Merged the four AS_LAYER_DRAW_BITMAP handlers into just one handler

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15842 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-01-04 12:15:58 +00:00
parent 448641c5c1
commit 8f3f25cf63
3 changed files with 14 additions and 66 deletions

View File

@ -289,10 +289,7 @@ enum {
AS_LAYER_PRINT_ALIASING,
AS_LAYER_CLIP_TO_PICTURE,
AS_LAYER_GET_CLIP_REGION,
AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT,
AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT,
AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT,
AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT,
AS_LAYER_DRAW_BITMAP,
AS_LAYER_SET_EVENT_MASK,
AS_LAYER_SET_MOUSE_EVENT_MASK,

View File

@ -2236,7 +2236,7 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
if (fOwner) {
check_lock();
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT);
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP);
fOwner->fLink->Attach<int32>(bitmap->get_server_token());
fOwner->fLink->Attach<BRect>(dstRect);
fOwner->fLink->Attach<BRect>(srcRect);
@ -2247,9 +2247,6 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
void
BView::DrawBitmapAsync(const BBitmap *bitmap, BRect dstRect)
{
if (!bitmap || !dstRect.IsValid())
return;
DrawBitmapAsync(bitmap, bitmap->Bounds(), dstRect);
}
@ -2270,9 +2267,12 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BPoint where)
if (fOwner) {
check_lock();
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT);
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP);
fOwner->fLink->Attach<int32>(bitmap->get_server_token());
fOwner->fLink->Attach<BPoint>(where);
BRect src = bitmap->Bounds();
BRect dst = src.OffsetToCopy(where);
fOwner->fLink->Attach<BRect>(dst);
fOwner->fLink->Attach<BRect>(src);
}
}
@ -2287,26 +2287,14 @@ BView::DrawBitmap(const BBitmap *bitmap)
void
BView::DrawBitmap(const BBitmap *bitmap, BPoint where)
{
if (bitmap == NULL)
return;
if (fOwner) {
check_lock();
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT);
fOwner->fLink->Attach<int32>(bitmap->get_server_token());
fOwner->fLink->Attach<BPoint>(where);
fOwner->fLink->Flush();
}
DrawBitmapAsync(bitmap, where);
Sync();
}
void
BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
{
if (!bitmap || !dstRect.IsValid())
return;
DrawBitmap(bitmap, bitmap->Bounds(), dstRect);
}
@ -2314,18 +2302,8 @@ BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
void
BView::DrawBitmap(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
{
if ( !bitmap || !srcRect.IsValid() || !dstRect.IsValid())
return;
if (fOwner) {
check_lock();
fOwner->fLink->StartMessage(AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT);
fOwner->fLink->Attach<int32>(bitmap->get_server_token());
fOwner->fLink->Attach<BRect>(dstRect);
fOwner->fLink->Attach<BRect>(srcRect);
fOwner->fLink->Flush();
}
DrawBitmapAsync(bitmap, srcRect, dstRect);
Sync();
}

View File

@ -1935,34 +1935,9 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
drawingEngine->FillRect(rect, fCurrentLayer->CurrentState());
break;
}
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT:
case AS_LAYER_DRAW_BITMAP:
{
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_(A)SYNC_AT_POINT: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
int32 bitmapToken;
BPoint point;
link.Read<int32>(&bitmapToken);
link.Read<BPoint>(&point);
ServerBitmap* bitmap = fServerApp->FindBitmap(bitmapToken);
if (bitmap) {
BRect src = bitmap->Bounds();
BRect dst = src.OffsetToCopy(point);
fCurrentLayer->ConvertToScreenForDrawing(&dst);
drawingEngine->DrawBitmap(bitmap, src, dst, fCurrentLayer->CurrentState());
}
// TODO: how should AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT sync with the client?
// It Doesn't have to. Sync means: force a sync of the view/link, so that
// the bitmap is already drawn when the "BView::DrawBitmap()" call returns.
// If this is ever possible.
break;
}
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
{
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_(A)SYNC_IN_RECT: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
int32 bitmapToken;
BRect srcRect, dstRect;
@ -1977,7 +1952,6 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
drawingEngine->DrawBitmap(bitmap, srcRect, dstRect, fCurrentLayer->CurrentState());
}
// TODO: how should AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client?
break;
}
case AS_STROKE_ARC:
@ -2248,8 +2222,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
break;
}
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
case AS_LAYER_DRAW_BITMAP:
{
int32 token;
link.Read<int32>(&token);