* 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:
@@ -148,6 +148,7 @@ DefaultDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
_UpdateFont(settings);
|
_UpdateFont(settings);
|
||||||
|
_InvalidateBitmaps();
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
|
|
||||||
if (updateRegion != NULL) {
|
if (updateRegion != NULL) {
|
||||||
@@ -174,6 +175,7 @@ DefaultDecorator::SetLook(DesktopSettings& settings, window_look look,
|
|||||||
fLook = look;
|
fLook = look;
|
||||||
|
|
||||||
_UpdateFont(settings);
|
_UpdateFont(settings);
|
||||||
|
_InvalidateBitmaps();
|
||||||
_DoLayout();
|
_DoLayout();
|
||||||
|
|
||||||
if (updateRegion != NULL) {
|
if (updateRegion != NULL) {
|
||||||
@@ -887,7 +889,7 @@ DefaultDecorator::_DrawFrame(BRect invalid)
|
|||||||
gradient.SetEnd(bg.RightBottom());
|
gradient.SetEnd(bg.RightBottom());
|
||||||
gradient.AddColor(fFrameColors[1], 0);
|
gradient.AddColor(fFrameColors[1], 0);
|
||||||
gradient.AddColor(fFrameColors[2], 255);
|
gradient.AddColor(fFrameColors[2], 255);
|
||||||
|
|
||||||
fDrawingEngine->FillRect(bg, gradient);
|
fDrawingEngine->FillRect(bg, gradient);
|
||||||
|
|
||||||
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
|
fDrawingEngine->StrokeLine(BPoint(x - 15, y - 15),
|
||||||
@@ -1019,7 +1021,7 @@ DefaultDecorator::_DrawClose(BRect rect)
|
|||||||
rect.bottom));
|
rect.bottom));
|
||||||
|
|
||||||
int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2);
|
int32 index = (fButtonFocus ? 0 : 1) + (GetClose() ? 0 : 2);
|
||||||
ServerBitmap *bitmap = fCloseBitmaps[index];
|
ServerBitmap* bitmap = fCloseBitmaps[index];
|
||||||
if (bitmap == NULL) {
|
if (bitmap == NULL) {
|
||||||
bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus,
|
bitmap = _GetBitmapForButton(DEC_CLOSE, GetClose(), fButtonFocus,
|
||||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
||||||
@@ -1072,7 +1074,7 @@ DefaultDecorator::_DrawZoom(BRect rect)
|
|||||||
rect.bottom));
|
rect.bottom));
|
||||||
|
|
||||||
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
|
int32 index = (fButtonFocus ? 0 : 1) + (GetZoom() ? 0 : 2);
|
||||||
ServerBitmap *bitmap = fZoomBitmaps[index];
|
ServerBitmap* bitmap = fZoomBitmaps[index];
|
||||||
if (bitmap == NULL) {
|
if (bitmap == NULL) {
|
||||||
bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus,
|
bitmap = _GetBitmapForButton(DEC_ZOOM, GetZoom(), fButtonFocus,
|
||||||
rect.IntegerWidth(), rect.IntegerHeight(), this);
|
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
|
\param down The rectangle should be drawn recessed or not
|
||||||
*/
|
*/
|
||||||
void
|
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*
|
ServerBitmap*
|
||||||
DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
|
||||||
int32 width, int32 height, DefaultDecorator* object)
|
int32 width, int32 height, DefaultDecorator* object)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -79,6 +79,7 @@ private:
|
|||||||
float* offset, float* size,
|
float* offset, float* size,
|
||||||
float* inset) const;
|
float* inset) const;
|
||||||
void _LayoutTabItems(const BRect& tabRect);
|
void _LayoutTabItems(const BRect& tabRect);
|
||||||
|
void _InvalidateBitmaps();
|
||||||
|
|
||||||
static ServerBitmap* _GetBitmapForButton(int32 item, bool down,
|
static ServerBitmap* _GetBitmapForButton(int32 item, bool down,
|
||||||
bool focus, int32 width, int32 height,
|
bool focus, int32 width, int32 height,
|
||||||
@@ -102,8 +103,8 @@ private:
|
|||||||
rgb_color fNonFocusFrameColors[2];
|
rgb_color fNonFocusFrameColors[2];
|
||||||
|
|
||||||
bool fButtonFocus;
|
bool fButtonFocus;
|
||||||
ServerBitmap * fCloseBitmaps[4];
|
ServerBitmap* fCloseBitmaps[4];
|
||||||
ServerBitmap * fZoomBitmaps[4];
|
ServerBitmap* fZoomBitmaps[4];
|
||||||
|
|
||||||
// Individual rects for handling window frame
|
// Individual rects for handling window frame
|
||||||
// rendering the proper way
|
// rendering the proper way
|
||||||
|
|||||||
Reference in New Issue
Block a user