diff options
author | Vicent Marti | 2008-08-02 22:11:57 +0000 |
---|---|---|
committer | Vicent Marti | 2008-08-02 22:11:57 +0000 |
commit | a3f85956ff851321495404030146c5f60bf1018d (patch) | |
tree | b853d0be8fe37eb365d3fb72b0654bc052b7cfa1 /graphics/VectorRenderer.cpp | |
parent | 03ffc30bdce0a62ce3cd3bcbd439d0f70e4dadf5 (diff) | |
download | scummvm-rg350-a3f85956ff851321495404030146c5f60bf1018d.tar.gz scummvm-rg350-a3f85956ff851321495404030146c5f60bf1018d.tar.bz2 scummvm-rg350-a3f85956ff851321495404030146c5f60bf1018d.zip |
Added basic support for inner shadows.
Made sliders look pretty much like the current GUI.
svn-id: r33548
Diffstat (limited to 'graphics/VectorRenderer.cpp')
-rw-r--r-- | graphics/VectorRenderer.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 3bd3b86cf8..db9b774857 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -75,6 +75,7 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui step.gradColor2.r, step.gradColor2.g, step.gradColor2.b); setShadowOffset(_disableShadows ? 0 : step.shadow); + setInnerShadowOffset(_disableShadows ? 0 : step.innerShadow); setGradientFactor(step.factor); setStrokeWidth(step.stroke); setFillMode((FillMode)step.fillMode); @@ -511,6 +512,9 @@ drawRoundedSquare(int x, int y, int r, int w, int h) { } break; } + + if (Base::_innerShadowOffset) + drawRoundedSquareInnerShadow(x, y, r, w, h, Base::_innerShadowOffset); } template<typename PixelType, typename PixelFormat> @@ -1154,6 +1158,62 @@ drawRoundedSquareShadow(int x1, int y1, int r, int w, int h, int blur) { } } +template<typename PixelType, typename PixelFormat> +void VectorRendererSpec<PixelType, PixelFormat>:: +drawRoundedSquareInnerShadow(int x1, int y1, int r, int w, int h, int blur) { + int x, y; + int p = Base::surfacePitch(), px, py; + int sw = 0, sp = 0; + + uint32 rsq = (r * r) << 16; + uint32 T = 0, oldT; + uint8 a1, a2; + + PixelType color = RGBToColor<PixelFormat>(63, 60, 17); + + PixelType *ptr_tl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + r); + PixelType *ptr_tr = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w - r, y1 + r); + PixelType *ptr_bl = (PixelType *)Base::_activeSurface->getBasePtr(x1 + r, y1 + h - r); + PixelType *ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1); + + int short_h = h - 2 * r; + + while (sw++ < blur) { + colorFill(ptr_fill + sp + r, ptr_fill + w + 1 + sp - r, color); + sp += p; + + x = r - (sw - 1); y = 0; T = 0; + px = p * x; py = 0; + + while (x > y++) { + __WU_ALGORITHM(); + + a1 = a1 * 3 / 4; + a2 = a2 * 3 / 4; + + blendPixelPtr(ptr_tr + (y) - (px - p), color, a2); + blendPixelPtr(ptr_tr + (x - 1) - (py), color, a2); + blendPixelPtr(ptr_tl - (x - 1) - (py), color, a2); + blendPixelPtr(ptr_tl - (y) - (px - p), color, a2); + blendPixelPtr(ptr_bl - (y) + (px - p), color, a2); + blendPixelPtr(ptr_bl - (x - 1) + (py), color, a2); + + blendPixelPtr(ptr_tr + (y) - (px), color, a1); + blendPixelPtr(ptr_tr + (x) - (py), color, a1); + blendPixelPtr(ptr_tl - (x) - (py), color, a1); + blendPixelPtr(ptr_tl - (y) - (px), color, a1); + blendPixelPtr(ptr_bl - (y) + (px), color, a1); + blendPixelPtr(ptr_bl - (x) + (py), color, a1); + } + } + + ptr_fill += p * r; + while (short_h-- >= 0) { + colorFill(ptr_fill, ptr_fill + blur, color); + ptr_fill += p; + } +} + /******************************************************************** * ANTIALIASED PRIMITIVES drawing algorithms - VectorRendererAA @@ -1255,7 +1315,7 @@ drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, Vecto colorFill(ptr_fill, ptr_fill + Base::_strokeWidth, color); colorFill(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color); ptr_fill += p; - } + } } else { x = r; y = 0; T = 0; px = p * x; py = 0; |