[Scummvm-cvs-logs] SF.net SVN: scummvm:[33088] scummvm/branches/gsoc2008-gui
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Thu Jul 17 10:36:18 CEST 2008
Revision: 33088
http://scummvm.svn.sourceforge.net/scummvm/?rev=33088&view=rev
Author: Tanoku
Date: 2008-07-17 08:36:16 +0000 (Thu, 17 Jul 2008)
Log Message:
-----------
Finished tabs drawing.
Added support for dynamic parameters in the Vector Renderer.
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-07-17 07:13:41 UTC (rev 33087)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-07-17 08:36:16 UTC (rev 33088)
@@ -53,7 +53,7 @@
/********************************************************************
* DRAWSTEP handling functions
********************************************************************/
-void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step) {
+void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, uint32 extra) {
if (step.bgColor.set)
setBgColor(step.bgColor.r, step.bgColor.g, step.bgColor.b);
@@ -69,8 +69,10 @@
setGradientFactor(step.factor);
setStrokeWidth(step.stroke);
setFillMode((FillMode)step.fillMode);
+
+ _dynamicData = extra;
- (this->*(step.drawingCall))(area, step);
+ (this->*(step.drawingCall))(area, step);
}
void VectorRenderer::textStep(const Common::String &text, const Common::Rect &area, const TextStep &step) {
@@ -405,7 +407,7 @@
case kFillBackground:
drawTabAlg(x, y, w, h, r, (Base::_fillMode == kFillBackground) ? _bgColor : _fgColor, Base::_fillMode);
if (Base::_strokeWidth)
- drawTabAlg(x, y, w, h, r, _fgColor, kFillDisabled);
+ drawTabAlg(x, y, w, h, r, _fgColor, kFillDisabled, (Base::_dynamicData >> 16), (Base::_dynamicData & 0xFFFF));
break;
case kFillForeground:
@@ -472,7 +474,7 @@
/** TAB ALGORITHM - NON AA */
template<typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType, PixelFormat>::
-drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m) {
+drawTabAlg(int x1, int y1, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m, int baseLeft, int baseRight) {
int f, ddF_x, ddF_y;
int x, y, px, py;
int pitch = Base::surfacePitch();
@@ -507,10 +509,6 @@
*(ptr_tl - (y) - (px)) = color;
if (Base::_strokeWidth > 1) {
- *(ptr_tr + (y) - (px)) = color;
- *(ptr_tr + (x - 1) - (py)) = color;
- *(ptr_tl - (x - 1) - (py)) = color;
- *(ptr_tl - (y) - (px)) = color;
*(ptr_tr + (y) - (px - pitch)) = color;
*(ptr_tr + (x) - (py)) = color;
*(ptr_tl - (x) - (py)) = color;
@@ -521,10 +519,28 @@
ptr_fill += pitch * real_radius;
while (short_h--) {
- colorFill(ptr_fill, ptr_fill + Base::_strokeWidth, color);
- colorFill(ptr_fill + w - Base::_strokeWidth + 1, ptr_fill + w + 1, color);
+ colorFill(ptr_fill, ptr_fill + Base::_strokeWidth - 1, color);
+ colorFill(ptr_fill + w - Base::_strokeWidth + 2, ptr_fill + w, color);
ptr_fill += pitch;
}
+
+ if (baseLeft) {
+ sw = 0;
+ ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1, y1 + h);
+ while (sw++ < Base::_strokeWidth) {
+ colorFill(ptr_fill - baseLeft, ptr_fill, color);
+ ptr_fill += pitch;
+ }
+ }
+
+ if (baseRight) {
+ sw = 0;
+ ptr_fill = (PixelType *)Base::_activeSurface->getBasePtr(x1 + w, y1 + h);
+ while (sw++ < Base::_strokeWidth) {
+ colorFill(ptr_fill, ptr_fill + baseRight, color);
+ ptr_fill += pitch;
+ }
+ }
} else {
__BE_RESET();
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-17 07:13:41 UTC (rev 33087)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-17 08:36:16 UTC (rev 33088)
@@ -78,7 +78,7 @@
uint8 shadow, stroke, factor, radius; /** Misc options... */
uint8 fillMode; /** active fill mode */
- uint8 extraData; /** Generic parameter for extra options (orientation/bevel) */
+ uint32 extraData; /** Generic parameter for extra options (orientation/bevel) */
uint32 scale; /** scale of all the coordinates in FIXED POINT with 16 bits mantissa */
@@ -489,7 +489,7 @@
* @param area Zone to paint on
* @param step Pointer to a DrawStep struct.
*/
- virtual void drawStep(const Common::Rect &area, const DrawStep &step);
+ virtual void drawStep(const Common::Rect &area, const DrawStep &step, uint32 extra = 0);
virtual void textStep(const Common::String &text, const Common::Rect &area, const TextStep &step);
/**
@@ -519,6 +519,7 @@
int _shadowOffset; /** offset for drawn shadows */
int _strokeWidth; /** Width of the stroke of all drawn shapes */
+ uint32 _dynamicData; /** Dynamic data from the GUI Theme that modifies the drawing of the current shape */
int _gradientFactor; /** Multiplication factor of the active gradient */
int _gradientBytes[3]; /** Color bytes of the active gradient, used to speed up calculation */
@@ -763,7 +764,7 @@
virtual void drawTriangleVertAlg(int x, int y, int w, int h, bool inverted, PixelType color, FillMode fill_m);
virtual void drawTriangleFast(int x, int y, int size, 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);
- virtual void drawTabAlg(int x, int y, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m);
+ virtual void drawTabAlg(int x, int y, int w, int h, int r, PixelType color, VectorRenderer::FillMode fill_m, int baseLeft = 0, int baseRight = 0);
/**
* SHADOW DRAWING ALGORITHMS
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp 2008-07-17 07:13:41 UTC (rev 33087)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeDefaultXML.cpp 2008-07-17 08:36:16 UTC (rev 33088)
@@ -62,13 +62,13 @@
"</drawdata>"
"<drawdata id = 'tab_active' cache = false>"
- "<text vertical_align = 'center' horizontal_align = 'center' color = '255, 255, 255' />"
- "<drawstep func = 'tab' radius = '8' stroke = '2' fill = 'gradient' gradient_start = '206, 121, 99' gradient_end = '173, 40, 8' shadow = 3 />"
+ "<text vertical_align = 'center' horizontal_align = 'center' color = '0, 0, 0' />"
+ "<drawstep func = 'tab' radius = '4' stroke = '2' fill = 'gradient' gradient_end = '255, 231, 140' gradient_start = '255, 243, 206' shadow = 3 />"
"</drawdata>"
"<drawdata id = 'tab_inactive' cache = false>"
- "<text vertical_align = 'center' horizontal_align = 'center' color = '255, 255, 255' />"
- "<drawstep func = 'tab' radius = '8' stroke = '0' fill = 'foreground' fg_color = '206, 121, 99' shadow = 3 />"
+ "<text vertical_align = 'center' horizontal_align = 'center' color = '128, 128, 128' />"
+ "<drawstep func = 'tab' radius = '4' stroke = '0' fill = 'foreground' fg_color = '206, 121, 99' shadow = 3 />"
"</drawdata>"
"<drawdata id = 'slider_empty' cache = false>"
@@ -93,7 +93,7 @@
"</drawdata>"
"<drawdata id = 'default_bg' cache = false>"
- "<drawstep func = 'roundedsq' radius = 12 stroke = 4 fg_color = '206, 121, 99' fill = 'gradient' gradient_start = '255, 231, 140' gradient_end = '255, 243, 206' shadow = 3 />"
+ "<drawstep func = 'roundedsq' radius = 12 stroke = 2 fg_color = '255, 255, 255' fill = 'gradient' gradient_start = '255, 231, 140' gradient_end = '255, 243, 206' shadow = 3 />"
"</drawdata>"
"<drawdata id = 'button_idle' cache = false>"
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-17 07:13:41 UTC (rev 33087)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-17 08:36:16 UTC (rev 33088)
@@ -290,7 +290,7 @@
_vectorRenderer->blitSurface(_widgets[type]->_surfaceCache, r);
}
-void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r) {
+void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r, uint32 dynamicData) {
if (_widgets[type] == 0)
return;
@@ -299,7 +299,7 @@
} else {
for (Common::List<Graphics::DrawStep>::const_iterator step = _widgets[type]->_steps.begin();
step != _widgets[type]->_steps.end(); ++step)
- _vectorRenderer->drawStep(r, *step);
+ _vectorRenderer->drawStep(r, *step, dynamicData);
}
}
@@ -473,7 +473,9 @@
if (active >= 0) {
Common::Rect tabRect(r.left + active * (tabWidth + tabOffset), r.top, r.left + active * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight);
- drawDD(kDDTabActive, tabRect);
+ const uint16 tabLeft = active * (tabWidth + tabOffset);
+ const uint16 tabRight = r.right - tabRect.right;
+ drawDD(kDDTabActive, tabRect, (tabLeft << 16) | (tabRight & 0xFFFF));
drawDDText(kDDTabActive, tabRect, tabs[active]);
}
}
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-17 07:13:41 UTC (rev 33087)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-17 08:36:16 UTC (rev 33088)
@@ -261,7 +261,7 @@
bool isWidgetCached(DrawData type, const Common::Rect &r);
void drawCached(DrawData type, const Common::Rect &r);
- inline void drawDD(DrawData type, const Common::Rect &r);
+ inline void drawDD(DrawData type, const Common::Rect &r, uint32 dynamicData = 0);
inline void drawDDText(DrawData type, const Common::Rect &r, const Common::String &text);
inline void debugWidgetPosition(const char *name, const Common::Rect &r);
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