diff options
author | Eugene Sandulenko | 2006-05-18 21:48:47 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-05-18 21:48:47 +0000 |
commit | fac7a13cf5c2dd128f5f5b46f3d9c52a534a2322 (patch) | |
tree | 2a65c188dcb27e0b8d464931261f813d59986079 | |
parent | 2531fd58737b1e02b32f496ac891e5a96bf95828 (diff) | |
download | scummvm-rg350-fac7a13cf5c2dd128f5f5b46f3d9c52a534a2322.tar.gz scummvm-rg350-fac7a13cf5c2dd128f5f5b46f3d9c52a534a2322.tar.bz2 scummvm-rg350-fac7a13cf5c2dd128f5f5b46f3d9c52a534a2322.zip |
Proper rendering of slider widget.
svn-id: r22527
-rw-r--r-- | gui/ThemeNew.cpp | 49 | ||||
-rw-r--r-- | gui/theme.h | 3 | ||||
-rw-r--r-- | gui/themes/modern.ini | 18 |
3 files changed, 33 insertions, 37 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index f18030e8a8..b08dded3ce 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -512,11 +512,6 @@ void ThemeNew::drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidget Common::Rect r2; - if ((hints & THEME_HINT_SAVE_BACKGROUND) && !(hints & THEME_HINT_FIRST_DRAW) && !_forceRedraw) { - restoreBackground((hints & THEME_HINT_USE_SHADOW) ? r2 : r); - return; - } - kImageHandles corner, top, left, bkgd; kShadowStyles shadow; kColorHandles start, end; @@ -555,6 +550,11 @@ void ThemeNew::drawWidgetBackground(const Common::Rect &r, uint16 hints, kWidget break; } + if ((hints & THEME_HINT_SAVE_BACKGROUND) && !(hints & THEME_HINT_FIRST_DRAW) && !_forceRedraw) { + restoreBackground((hints & THEME_HINT_USE_SHADOW) ? r2 : r); + return; + } + if ((hints & THEME_HINT_USE_SHADOW)) { r2 = shadowRect(r, shadow); restoreBackground(r2); @@ -644,25 +644,26 @@ void ThemeNew::drawSurface(const Common::Rect &r, const Graphics::Surface &surfa addDirtyRect(r); } -void ThemeNew::drawSlider(const Common::Rect &r, int width, kState state) { +void ThemeNew::drawSlider(const Common::Rect &rr, int width, kState state) { if (!_initOk) return; - drawRectMasked(r, surface(kSliderBkgdCorner), surface(kSliderBkgdTop), surface(kSliderBkgdLeft), surface(kSliderBkgd), 256, - _colors[kSliderBackgroundStart], _colors[kSliderBackgroundEnd], _gradientFactors[kSliderBackground]); + Common::Rect r = rr; + + r.left++; + r.right++; + + drawWidgetBackground(r, THEME_HINT_USE_SHADOW, kWidgetBackgroundEditText, kStateEnabled); Common::Rect r2 = r; - r2.left = r.left + 2; - r2.top = r.top + 2; - r2.bottom = r.bottom - 2; + r2.left = r.left; + r2.top = r.top; + r2.bottom = r.bottom; r2.right = r2.left + width; - if (r2.right > r.right - 2) { - r2.right = r.right - 2; + if (r2.right > r.right) { + r2.right = r.right; } - // shadow - drawShadow(r2, surface(kSliderCorner), surface(kSliderTop), surface(kSliderLeft), surface(kSliderBkgd), kShadowSlider); - if (state == kStateHighlight) { drawRectMasked(r2, surface(kSliderCorner), surface(kSliderTop), surface(kSliderLeft), surface(kSliderBkgd), 256, _colors[kSliderHighStart], _colors[kSliderHighEnd], _gradientFactors[kSliderFactor]); @@ -1033,6 +1034,10 @@ Common::Rect ThemeNew::shadowRect(const Common::Rect &r, uint32 shadowStyle) { return Common::Rect(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 - 1, r.bottom + _shadowBottomHeight/2 - 1); break; + case kShadowEmboss: + return Common::Rect(r.left - 1, r.top - 1, r.right + 1, r.bottom + 1); + break; + default: return Common::Rect(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 + 1, r.bottom + _shadowBottomHeight/2 + 1); break; @@ -1070,17 +1075,9 @@ void ThemeNew::drawShadow(const Common::Rect &r, const Graphics::Surface *corner drawShadowRect(r3, r, corner, top, left, fill, kShadowTr4, skipLastRow); } break; - case kShadowSlider: { - Common::Rect r3(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2, r.bottom + _shadowBottomHeight/2); - Common::Rect r4(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right + _shadowRightWidth/2 - 1, r.bottom + _shadowBottomHeight/2 - 1); - - drawShadowRect(r3, r, corner, top, left, fill, kShadowTr2, skipLastRow); - drawShadowRect(r4, r, corner, top, left, fill, kShadowTr3, skipLastRow); - }; - case kShadowEmboss: { - Common::Rect r2(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right, r.bottom); - Common::Rect r4(r.left - _shadowLeftWidth/2+1, r.top - _shadowTopHeight/2+1, r.right + _shadowRightWidth/2, r.bottom + _shadowBottomHeight/2); + Common::Rect r2(r.left - 1, r.top - 1, r.right, r.bottom); + Common::Rect r4(r.left + 1, r.top + 1, r.right + 1, r.bottom + 1); drawShadowRect(r2, r, corner, top, left, fill, kShadowTr5, skipLastRow); drawShadowRect(r4, r, corner, top, left, fill, kShadowTr1, skipLastRow); diff --git a/gui/theme.h b/gui/theme.h index 314063cbd6..3873a9263b 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -338,8 +338,7 @@ private: kShadowFull = 0, kShadowSmall = 1, kShadowButton = 2, - kShadowSlider = 3, - kShadowEmboss = 4 + kShadowEmboss = 3 }; Common::Rect shadowRect(const Common::Rect &r, uint32 shadowStyle); diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini index d0486e3c3f..6aa96575e2 100644 --- a/gui/themes/modern.ini +++ b/gui/themes/modern.ini @@ -29,15 +29,15 @@ tab_top=widget_small_bkgd_top.bmp tab_left=widget_small_bkgd_left.bmp tab_bkgd=widget_small_bkgd.bmp -slider_bkgd_corner=widget_small_bkgd_corner.bmp -slider_bkgd_top=widget_small_bkgd_top.bmp -slider_bkgd_left=widget_small_bkgd_left.bmp -slider_bkgd_bkgd=widget_small_bkgd.bmp - -slider_corner=widget_bkgd_corner.bmp -slider_top=widget_bkgd_top.bmp -slider_left=widget_bkgd_left.bmp -slider_bkgd=widget_bkgd.bmp +slider_bkgd_corner=button_bkgd_corner.bmp +slider_bkgd_top=button_bkgd_top.bmp +slider_bkgd_left=button_bkgd_left.bmp +slider_bkgd_bkgd=button_bkgd.bmp + +slider_corner=button_bkgd_corner.bmp +slider_top=button_bkgd_top.bmp +slider_left=button_bkgd_left.bmp +slider_bkgd=button_bkgd.bmp scrollbar_bkgd_corner=widget_small_bkgd_corner.bmp scrollbar_bkgd_top=widget_small_bkgd_top.bmp |