[Scummvm-cvs-logs] SF.net SVN: scummvm: [32506] scummvm/branches/gsoc2008-gui/graphics
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Mon Jun 2 23:38:29 CEST 2008
Revision: 32506
http://scummvm.svn.sourceforge.net/scummvm/?rev=32506&view=rev
Author: Tanoku
Date: 2008-06-02 14:38:28 -0700 (Mon, 02 Jun 2008)
Log Message:
-----------
Beveled squares for Classic GUI imitation
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-06-02 21:36:45 UTC (rev 32505)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-06-02 21:38:28 UTC (rev 32506)
@@ -431,6 +431,44 @@
}
}
+/** 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>::
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-06-02 21:36:45 UTC (rev 32505)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-06-02 21:38:28 UTC (rev 32506)
@@ -146,6 +146,7 @@
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 @@
*/
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 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list