When drawing the decorator buttons lock the DrawingEngine, enable copying to

the front buffer, draw the bitmap, restore the copy to front buffer state and
unlock. This fixes that the updated button state was not actually copyied to
the front buffer (and therefore visible) when a window was inside an update
(disabling front buffer copying).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25954 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2008-06-14 20:51:20 +00:00
parent d7693ead7f
commit 6309b004c6
2 changed files with 20 additions and 8 deletions
+18 -8
View File
@@ -996,10 +996,7 @@ DefaultDecorator::_DrawClose(BRect rect)
fCloseBitmaps[index] = bitmap;
}
if (bitmap == NULL)
return;
fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect);
_DrawButtonBitmap(bitmap, rect);
}
@@ -1050,10 +1047,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
fZoomBitmaps[index] = bitmap;
}
if (bitmap == NULL)
return;
fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect);
_DrawButtonBitmap(bitmap, rect);
}
// _SetFocus
@@ -1093,6 +1087,22 @@ DefaultDecorator::_SetColors()
}
void
DefaultDecorator::_DrawButtonBitmap(ServerBitmap *bitmap, BRect rect)
{
if (bitmap == NULL)
return;
if (fDrawingEngine->LockParallelAccess()) {
bool copyToFrontEnabled = fDrawingEngine->CopyToFrontEnabled();
fDrawingEngine->SetCopyToFrontEnabled(true);
fDrawingEngine->DrawBitmap(bitmap, rect.OffsetToCopy(0, 0), rect);
fDrawingEngine->SetCopyToFrontEnabled(copyToFrontEnabled);
fDrawingEngine->UnlockParallelAccess();
}
}
/*!
\brief Draws a framed rectangle with a gradient.
\param down The rectangle should be drawn recessed or not
+2
View File
@@ -68,6 +68,8 @@ class DefaultDecorator: public Decorator {
virtual void _SetColors();
private:
void _DrawButtonBitmap(ServerBitmap *bitmap,
BRect rect);
void _DrawBlendedRect(DrawingEngine *engine,
BRect rect, bool down, bool focus);
void _GetButtonSizeAndOffset(const BRect& tabRect,