* The cached button bitmaps were not invalidated on font or look change, causing

incorrect buttons to be shown.
* Fixed coding style violations.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32472 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-08-17 17:09:38 +00:00
parent b53a9cf25c
commit dacf06e665
2 changed files with 20 additions and 8 deletions

View File

@ -148,6 +148,7 @@ DefaultDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
}
_UpdateFont(settings);
_InvalidateBitmaps();
_DoLayout();
if (updateRegion != NULL) {
@ -174,6 +175,7 @@ DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
fLook = look;
_UpdateFont(settings);
_InvalidateBitmaps();
_DoLayout();
if (updateRegion != NULL) {
@ -887,7 +889,7 @@ DefaultDecorator::_DrawFrame(BRect invalid)
gradient.SetEnd(bg.RightBottom());
gradient.AddColor(fFrameColors[1], 0);
gradient.AddColor(fFrameColors[2], 255);
fDrawingEngine->FillRect(bg, gradient);
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
@ -1019,7 +1021,7 @@ DefaultDecorator::_DrawClose(BRect rect)
rect.bottom));
int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2);
ServerBitmap *bitmap = fCloseBitmaps[index];
ServerBitmap* bitmap = fCloseBitmaps[index];
if (bitmap == NULL) {
bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus,
rect.IntegerWidth(), rect.IntegerHeight(), this);
@ -1072,7 +1074,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
rect.bottom));
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
ServerBitmap *bitmap = fZoomBitmaps[index];
ServerBitmap* bitmap = fZoomBitmaps[index];
if (bitmap == NULL) {
bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus,
rect.IntegerWidth(), rect.IntegerHeight(), this);
@ -1153,8 +1155,7 @@ DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect)
}
/*!
\brief Draws a framed rectangle with a gradient.
/*! \brief Draws a framed rectangle with a gradient.
\param down The rectangle should be drawn recessed or not
*/
void
@ -1259,6 +1260,16 @@ DefaultDecorator::_LayoutTabItems(const BRect& tabRect)
}
void
DefaultDecorator::_InvalidateBitmaps()
{
for (int32 index = 0; index < 4; index++) {
fCloseBitmaps[index] = NULL;
fZoomBitmaps[index] = NULL;
}
}
ServerBitmap*
DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
int32 width, int32 height, DefaultDecorator* object)

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2008, Haiku.
* Copyright 2001-2009, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -79,6 +79,7 @@ private:
float* offset, float* size,
float* inset) const;
void _LayoutTabItems(const BRect& tabRect);
void _InvalidateBitmaps();
static ServerBitmap* _GetBitmapForButton(int32 item, bool down,
bool focus, int32 width, int32 height,
@ -102,8 +103,8 @@ private:
rgb_color fNonFocusFrameColors[2];
bool fButtonFocus;
ServerBitmap * fCloseBitmaps[4];
ServerBitmap * fZoomBitmaps[4];
ServerBitmap* fCloseBitmaps[4];
ServerBitmap* fZoomBitmaps[4];
// Individual rects for handling window frame
// rendering the proper way