* default source BRect is now offset to B_ORIGIN because Bitmap bounds lefttop could be something else than (0,0). This caused some bugs in Haiku SoundRecorder app
i* thus the NOTE in Painter isn't valid anymore * in Painter::_DrawBimap() moved scale computation after potential changes to BRects * fix typo : right => bottom. This caused a bug in Haiku Mouse preferences app git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18017 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -2204,7 +2204,7 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
|
||||
void
|
||||
BView::DrawBitmapAsync(const BBitmap *bitmap, BRect dstRect)
|
||||
{
|
||||
DrawBitmapAsync(bitmap, bitmap->Bounds(), dstRect);
|
||||
DrawBitmapAsync(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN), dstRect);
|
||||
}
|
||||
|
||||
|
||||
@@ -2226,7 +2226,7 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BPoint where)
|
||||
|
||||
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP);
|
||||
fOwner->fLink->Attach<int32>(bitmap->_ServerToken());
|
||||
BRect src = bitmap->Bounds();
|
||||
BRect src = bitmap->Bounds().OffsetToCopy(B_ORIGIN);
|
||||
BRect dst = src.OffsetToCopy(where);
|
||||
fOwner->fLink->Attach<BRect>(dst);
|
||||
fOwner->fLink->Attach<BRect>(src);
|
||||
@@ -2256,7 +2256,7 @@ BView::DrawBitmap(const BBitmap *bitmap, BPoint where)
|
||||
void
|
||||
BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
|
||||
{
|
||||
DrawBitmap(bitmap, bitmap->Bounds(), dstRect);
|
||||
DrawBitmap(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN), dstRect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1328,19 +1328,9 @@ Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format,
|
||||
if (!fSubpixelPrecise)
|
||||
align_rect_to_pixels(&viewRect);
|
||||
|
||||
double xScale = (viewRect.Width() + 1) / (bitmapRect.Width() + 1);
|
||||
double yScale = (viewRect.Height() + 1) / (bitmapRect.Height() + 1);
|
||||
|
||||
if (xScale == 0.0 || yScale == 0.0)
|
||||
return;
|
||||
|
||||
// compensate for the lefttop offset the actualBitmapRect might have
|
||||
// NOTE: I have no clue why enabling the next call gives a wrong result!
|
||||
// According to the BeBook, bitmapRect is supposed to be in native
|
||||
// bitmap space! Disabling this call makes it look like the bitmap bounds are
|
||||
// assumed to have a left/top coord of 0,0 at all times. This is simply not true.
|
||||
// bitmapRect.OffsetBy(-actualBitmapRect.left, -actualBitmapRect.top);
|
||||
// actualBitmapRect has the right size, but put it at B_ORIGIN too
|
||||
// actualBitmapRect has the right size, but put it at B_ORIGIN
|
||||
// bitmapRect is already in good coordinates
|
||||
actualBitmapRect.OffsetBy(-actualBitmapRect.left, -actualBitmapRect.top);
|
||||
|
||||
// constrain rect to passed bitmap bounds
|
||||
@@ -1361,10 +1351,16 @@ Painter::_DrawBitmap(agg::rendering_buffer& srcBuffer, color_space format,
|
||||
bitmapRect.right = actualBitmapRect.right;
|
||||
}
|
||||
if (bitmapRect.bottom > actualBitmapRect.bottom) {
|
||||
float diff = bitmapRect.right - actualBitmapRect.bottom;
|
||||
float diff = bitmapRect.bottom - actualBitmapRect.bottom;
|
||||
viewRect.bottom -= diff;
|
||||
bitmapRect.bottom = actualBitmapRect.bottom;
|
||||
}
|
||||
|
||||
double xScale = (viewRect.Width() + 1) / (bitmapRect.Width() + 1);
|
||||
double yScale = (viewRect.Height() + 1) / (bitmapRect.Height() + 1);
|
||||
|
||||
if (xScale == 0.0 || yScale == 0.0)
|
||||
return;
|
||||
|
||||
double xOffset = viewRect.left - bitmapRect.left;
|
||||
double yOffset = viewRect.top - bitmapRect.top;
|
||||
|
||||
Reference in New Issue
Block a user