aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Marti2008-06-02 21:38:28 +0000
committerVicent Marti2008-06-02 21:38:28 +0000
commit934f4fd17f92804b2b1bf1244e8e8ac162de0e4a (patch)
tree0793b8100efe233fee19361f7c336831e9cba203
parent5d2d18421386021eb7754684edf908e02276add5 (diff)
downloadscummvm-rg350-934f4fd17f92804b2b1bf1244e8e8ac162de0e4a.tar.gz
scummvm-rg350-934f4fd17f92804b2b1bf1244e8e8ac162de0e4a.tar.bz2
scummvm-rg350-934f4fd17f92804b2b1bf1244e8e8ac162de0e4a.zip
Beveled squares for Classic GUI imitation
svn-id: r32506
-rw-r--r--graphics/VectorRenderer.cpp38
-rw-r--r--graphics/VectorRenderer.h6
2 files changed, 44 insertions, 0 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index b9d44a224e..43046bafdf 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -431,6 +431,44 @@ drawSquareAlg(int x, int y, int w, int h, PixelType color, VectorRenderer::FillM
}
}
+/** SQUARE ALGORITHM **/
+template<typename PixelType, typename PixelFormat>
+void VectorRendererSpec<PixelType, PixelFormat>::
+drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color) {
+ PixelType *ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y);
+ int pitch = Base::surfacePitch();
+ int i, j;
+
+ i = bevel;
+ while (i--) {
+ colorFill(ptr_left, ptr_left + w, top_color);
+ ptr_left += pitch;
+ }
+
+ i = h - bevel;
+ ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y + bevel);
+ while (i--) {
+ colorFill(ptr_left, ptr_left + bevel, top_color);
+ ptr_left += pitch;
+ }
+
+ i = bevel;
+ ptr_left = (PixelType *)_activeSurface->getBasePtr(x, y + h - bevel);
+ while (i--) {
+ colorFill(ptr_left + i, ptr_left + w, bottom_color);
+ ptr_left += pitch;
+ }
+
+ i = h - bevel;
+ j = bevel;
+ ptr_left = (PixelType *)_activeSurface->getBasePtr(x + w - bevel, y);
+ while (i--) {
+ colorFill(ptr_left + j, ptr_left + bevel, bottom_color);
+ if (j > 0) j--;
+ ptr_left += pitch;
+ }
+}
+
/** GENERIC LINE ALGORITHM **/
template<typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType,PixelFormat>::
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index b6c72425d7..ed000a9215 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -146,6 +146,7 @@ public:
virtual void drawRoundedSquare(int x, int y, int r, int w, int h) = 0;
virtual void drawTriangle(int x, int y, int base, int height, TriangleOrientation orient) = 0;
+ virtual void drawBeveledSquare(int x, int y, int w, int h, int bevel) = 0;
/**
* Gets the pixel pitch for the current drawing surface.
@@ -373,6 +374,10 @@ public:
*/
void drawTriangle(int x, int y, int base, int height, TriangleOrientation orient);
+ void drawBeveledSquare(int x, int y, int w, int h, int bevel) {
+ drawBevelSquareAlg(x, y, w, h, bevel, _fgColor, _bgColor);
+ }
+
/**
* @see VectorRenderer::setFgColor()
*/
@@ -513,6 +518,7 @@ protected:
virtual void drawRoundedSquareAlg(int x1, int y1, int r, int w, int h, PixelType color, FillMode fill_m);
virtual void drawSquareAlg(int x, int y, int w, int h, PixelType color, FillMode fill_m);
virtual void drawTriangleVertAlg(int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m);
+ virtual void drawBevelSquareAlg(int x, int y, int w, int h, int bevel, PixelType top_color, PixelType bottom_color);
/**
* SHADOW DRAWING ALGORITHMS