* Implemented new BView drawing functions DrawBitmap[Async](

const BBitmap* bitmap, BRect bitmapRect, BRect viewRect, uint32 options).
  Only option so far is B_FILTER_BITMAP_BILINEAR.
* BView::DrawBitmap[Async](const BBitmap* bitmap, BRect viewRect) was accessing
  the bitmap pointer without checking it. Would therefore crash when passing
  NULL, unlike the other methods.
* The BPicture code already reserved room for the BBitmap flags, but did not
  store the actual flags and neiter use them for anything. Since the bitmap
  data is stored anyways, the bitmap creation flags do not matter. So I reused
  this for the new bitmap drawing options.
* Rewrote Bitmap.h and removed the B_BITMAP_SCALE_BILINEAR flag again.
* Tried to optimize Painter::_DrawBitmapBilinearCopy32() a little by giving
  the compiler better hints. There seems to be a marginal, possibly imagined
  speed increase < 0.05 ms. ;-)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2008-07-28 18:58:30 +00:00
parent 42ed4fd712
commit 162a7f5f8e
9 changed files with 228 additions and 163 deletions
+35 -7
View File
@@ -2356,7 +2356,8 @@ BView::ConstrainClippingRegion(BRegion* region)
void
BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect,
uint32 options)
{
if (bitmap == NULL || fOwner == NULL
|| !bitmapRect.IsValid() || !viewRect.IsValid())
@@ -2366,6 +2367,7 @@ BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
fOwner->fLink->StartMessage(AS_VIEW_DRAW_BITMAP);
fOwner->fLink->Attach<int32>(bitmap->_ServerToken());
fOwner->fLink->Attach<uint32>(options);
fOwner->fLink->Attach<BRect>(viewRect);
fOwner->fLink->Attach<BRect>(bitmapRect);
@@ -2374,16 +2376,19 @@ BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
void
BView::DrawBitmapAsync(const BBitmap* bitmap, BRect viewRect)
BView::DrawBitmapAsync(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
{
DrawBitmapAsync(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN), viewRect);
DrawBitmapAsync(bitmap, bitmapRect, viewRect, 0);
}
void
BView::DrawBitmapAsync(const BBitmap* bitmap)
BView::DrawBitmapAsync(const BBitmap* bitmap, BRect viewRect)
{
DrawBitmapAsync(bitmap, PenLocation());
if (bitmap && fOwner) {
DrawBitmapAsync(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN),
viewRect, 0);
}
}
@@ -2397,9 +2402,11 @@ BView::DrawBitmapAsync(const BBitmap* bitmap, BPoint where)
BRect bitmapRect = bitmap->Bounds().OffsetToCopy(B_ORIGIN);
BRect viewRect = bitmapRect.OffsetToCopy(where);
uint32 options = 0;
fOwner->fLink->StartMessage(AS_VIEW_DRAW_BITMAP);
fOwner->fLink->Attach<int32>(bitmap->_ServerToken());
fOwner->fLink->Attach<uint32>(options);
fOwner->fLink->Attach<BRect>(viewRect);
fOwner->fLink->Attach<BRect>(bitmapRect);
@@ -2407,11 +2414,29 @@ BView::DrawBitmapAsync(const BBitmap* bitmap, BPoint where)
}
void
BView::DrawBitmapAsync(const BBitmap* bitmap)
{
DrawBitmapAsync(bitmap, PenLocation());
}
void
BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect,
uint32 options)
{
if (fOwner) {
DrawBitmapAsync(bitmap, bitmapRect, viewRect, options);
Sync();
}
}
void
BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
{
if (fOwner) {
DrawBitmapAsync(bitmap, bitmapRect, viewRect);
DrawBitmapAsync(bitmap, bitmapRect, viewRect, 0);
Sync();
}
}
@@ -2420,7 +2445,10 @@ BView::DrawBitmap(const BBitmap* bitmap, BRect bitmapRect, BRect viewRect)
void
BView::DrawBitmap(const BBitmap* bitmap, BRect viewRect)
{
DrawBitmap(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN), viewRect);
if (bitmap && fOwner) {
DrawBitmap(bitmap, bitmap->Bounds().OffsetToCopy(B_ORIGIN), viewRect,
0);
}
}