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:
parent
448641c5c1
commit
8f3f25cf63
|
@ -289,10 +289,7 @@ enum {
|
||||||
AS_LAYER_PRINT_ALIASING,
|
AS_LAYER_PRINT_ALIASING,
|
||||||
AS_LAYER_CLIP_TO_PICTURE,
|
AS_LAYER_CLIP_TO_PICTURE,
|
||||||
AS_LAYER_GET_CLIP_REGION,
|
AS_LAYER_GET_CLIP_REGION,
|
||||||
AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT,
|
AS_LAYER_DRAW_BITMAP,
|
||||||
AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT,
|
|
||||||
AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT,
|
|
||||||
AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT,
|
|
||||||
AS_LAYER_SET_EVENT_MASK,
|
AS_LAYER_SET_EVENT_MASK,
|
||||||
AS_LAYER_SET_MOUSE_EVENT_MASK,
|
AS_LAYER_SET_MOUSE_EVENT_MASK,
|
||||||
|
|
||||||
|
|
|
@ -2236,7 +2236,7 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
|
||||||
if (fOwner) {
|
if (fOwner) {
|
||||||
check_lock();
|
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<int32>(bitmap->get_server_token());
|
||||||
fOwner->fLink->Attach<BRect>(dstRect);
|
fOwner->fLink->Attach<BRect>(dstRect);
|
||||||
fOwner->fLink->Attach<BRect>(srcRect);
|
fOwner->fLink->Attach<BRect>(srcRect);
|
||||||
|
@ -2247,9 +2247,6 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
|
||||||
void
|
void
|
||||||
BView::DrawBitmapAsync(const BBitmap *bitmap, BRect dstRect)
|
BView::DrawBitmapAsync(const BBitmap *bitmap, BRect dstRect)
|
||||||
{
|
{
|
||||||
if (!bitmap || !dstRect.IsValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
DrawBitmapAsync(bitmap, bitmap->Bounds(), dstRect);
|
DrawBitmapAsync(bitmap, bitmap->Bounds(), dstRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2270,9 +2267,12 @@ BView::DrawBitmapAsync(const BBitmap *bitmap, BPoint where)
|
||||||
if (fOwner) {
|
if (fOwner) {
|
||||||
check_lock();
|
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<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
|
void
|
||||||
BView::DrawBitmap(const BBitmap *bitmap, BPoint where)
|
BView::DrawBitmap(const BBitmap *bitmap, BPoint where)
|
||||||
{
|
{
|
||||||
if (bitmap == NULL)
|
DrawBitmapAsync(bitmap, where);
|
||||||
return;
|
Sync();
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
|
BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
|
||||||
{
|
{
|
||||||
if (!bitmap || !dstRect.IsValid())
|
|
||||||
return;
|
|
||||||
|
|
||||||
DrawBitmap(bitmap, bitmap->Bounds(), dstRect);
|
DrawBitmap(bitmap, bitmap->Bounds(), dstRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2314,18 +2302,8 @@ BView::DrawBitmap(const BBitmap *bitmap, BRect dstRect)
|
||||||
void
|
void
|
||||||
BView::DrawBitmap(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
|
BView::DrawBitmap(const BBitmap *bitmap, BRect srcRect, BRect dstRect)
|
||||||
{
|
{
|
||||||
if ( !bitmap || !srcRect.IsValid() || !dstRect.IsValid())
|
DrawBitmapAsync(bitmap, srcRect, dstRect);
|
||||||
return;
|
Sync();
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1935,34 +1935,9 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
|
||||||
drawingEngine->FillRect(rect, fCurrentLayer->CurrentState());
|
drawingEngine->FillRect(rect, fCurrentLayer->CurrentState());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
case AS_LAYER_DRAW_BITMAP:
|
||||||
case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT:
|
|
||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_(A)SYNC_AT_POINT: ViewLayer name: %s\n", fTitle, fCurrentLayer->Name()));
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP: 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()));
|
|
||||||
int32 bitmapToken;
|
int32 bitmapToken;
|
||||||
BRect srcRect, dstRect;
|
BRect srcRect, dstRect;
|
||||||
|
|
||||||
|
@ -1977,7 +1952,6 @@ ServerWindow::_DispatchViewDrawingMessage(int32 code, BPrivate::LinkReceiver &li
|
||||||
drawingEngine->DrawBitmap(bitmap, srcRect, dstRect, fCurrentLayer->CurrentState());
|
drawingEngine->DrawBitmap(bitmap, srcRect, dstRect, fCurrentLayer->CurrentState());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: how should AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client?
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_STROKE_ARC:
|
case AS_STROKE_ARC:
|
||||||
|
@ -2248,8 +2222,7 @@ ServerWindow::_DispatchPictureMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
|
case AS_LAYER_DRAW_BITMAP:
|
||||||
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
|
|
||||||
{
|
{
|
||||||
int32 token;
|
int32 token;
|
||||||
link.Read<int32>(&token);
|
link.Read<int32>(&token);
|
||||||
|
|
Loading…
Reference in New Issue