aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorVicent Marti2008-07-20 21:47:28 +0000
committerVicent Marti2008-07-20 21:47:28 +0000
commit9aa07d206e679179f939e9beb0d441eb0c1a1fcb (patch)
treeda5ce6882b134d0d4a795dc42055a17515924a7a /graphics
parentb5081a02ec1d72e14ced116246545e1210b8b86f (diff)
downloadscummvm-rg350-9aa07d206e679179f939e9beb0d441eb0c1a1fcb.tar.gz
scummvm-rg350-9aa07d206e679179f939e9beb0d441eb0c1a1fcb.tar.bz2
scummvm-rg350-9aa07d206e679179f939e9beb0d441eb0c1a1fcb.zip
Rendering pipeline. Broken WIP.
svn-id: r33152
Diffstat (limited to 'graphics')
-rw-r--r--graphics/VectorRenderer.cpp8
-rw-r--r--graphics/VectorRenderer.h23
2 files changed, 14 insertions, 17 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index f2ce0e26b8..70bcc1b2c3 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -65,7 +65,7 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui
setGradientColors(step.gradColor1.r, step.gradColor1.g, step.gradColor1.b,
step.gradColor2.r, step.gradColor2.g, step.gradColor2.b);
- shadowEnable(step.shadow);
+ setShadowOffset(_disableShadows ? 0 : step.shadow);
setGradientFactor(step.factor);
setStrokeWidth(step.stroke);
setFillMode((FillMode)step.fillMode);
@@ -75,11 +75,13 @@ void VectorRenderer::drawStep(const Common::Rect &area, const DrawStep &step, ui
(this->*(step.drawingCall))(area, step);
}
-void VectorRenderer::textStep(const Common::String &text, const Common::Rect &area, const TextStep &step) {
+void VectorRenderer::textStep(const Common::String &text, const Common::Rect &area, const TextStep &step, GUI::Theme::TextAlign alignH) {
if (step.color.set)
setFgColor(step.color.r, step.color.g, step.color.b);
- drawString(step.font, text.c_str(), area, step.alignHorizontal, step.alignVertical);
+ drawString(step.font, text.c_str(), area,
+ !step.hasAlign ? alignH : step.alignHorizontal,
+ !step.hasAlign ? GUI::Theme::kTextAlignVTop : step.alignVertical);
}
/********************************************************************
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index e5fedd8ef5..c7ba0676b3 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -48,6 +48,7 @@ struct TextStep {
GUI::Theme::TextAlign alignHorizontal;
GUI::Theme::TextAlignVertical alignVertical;
+ bool hasAlign;
char *text;
const Graphics::Font *font;
};
@@ -105,7 +106,7 @@ VectorRenderer *createRenderer(int mode);
class VectorRenderer {
public:
VectorRenderer() : _shadowOffset(0), _fillMode(kFillDisabled),
- _activeSurface(NULL), _strokeWidth(1), _gradientFactor(1) {
+ _activeSurface(NULL), _strokeWidth(1), _gradientFactor(1), _disableShadows(false) {
}
@@ -317,26 +318,16 @@ public:
* Enables adding shadows to all drawn primitives.
* Shadows are drawn automatically under the shapes. The given offset
* controls their intensity and size (the higher the offset, the
- * bigger the shadows).
+ * bigger the shadows). If the offset is 0, no shadows are drawn.
*
* @param offset Shadow offset.
- * @see shadowDisable()
*/
- virtual void shadowEnable(int offset) {
+ virtual void setShadowOffset(int offset) {
if (offset >= 0)
_shadowOffset = offset;
}
/**
- * Disables adding shadows to all drawn primitives.
- *
- * @see shadowEnable()
- */
- virtual void shadowDisable() {
- _shadowOffset = 0;
- }
-
- /**
* Sets the multiplication factor of the active gradient.
*
* @see _gradientFactor
@@ -490,7 +481,7 @@ public:
* @param step Pointer to a DrawStep struct.
*/
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);
+ virtual void textStep(const Common::String &text, const Common::Rect &area, const TextStep &step, GUI::Theme::TextAlign alignH = GUI::Theme::kTextAlignLeft);
/**
* Copies the current surface to the system overlay
@@ -511,6 +502,9 @@ public:
virtual uint32 buildColor(uint8 r, uint8 g, uint8 b) = 0;
virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV) = 0;
+
+ virtual void disableShadows() { _disableShadows = true; }
+ virtual void enableShadows() { _disableShadows = false; }
protected:
Surface *_activeSurface; /** Pointer to the surface currently being drawn */
@@ -518,6 +512,7 @@ protected:
FillMode _fillMode; /** Defines in which way (if any) are filled the drawn shapes */
int _shadowOffset; /** offset for drawn shadows */
+ bool _disableShadows; /** Disables temporarily shadow drawing for overlayed images. */
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 */