aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/VectorRenderer.h6
-rw-r--r--graphics/VectorRendererSpec.cpp17
-rw-r--r--graphics/VectorRendererSpec.h2
-rw-r--r--gui/ThemeEngine.cpp2
-rw-r--r--gui/ThemeParser.cpp5
-rw-r--r--gui/ThemeParser.h1
6 files changed, 23 insertions, 10 deletions
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index 3c042a3c40..2f609ea6db 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -80,6 +80,8 @@ struct DrawStep {
uint32 scale; /**< scale of all the coordinates in FIXED POINT with 16 bits mantissa */
+ bool autoscale; /**< scale alphaimage if present */
+
DrawingFunctionCallback drawingCall; /**< Pointer to drawing function */
Graphics::Surface *blitSrc;
Graphics::TransparentSurface *blitAlphaSrc;
@@ -428,7 +430,7 @@ public:
void drawCallback_ALPHABITMAP(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) {
uint16 x, y, w, h;
stepGetPositions(step, area, x, y, w, h);
- blitAlphaBitmap(step.blitAlphaSrc, Common::Rect(x, y, x + w, y + h)); //TODO
+ blitAlphaBitmap(step.blitAlphaSrc, Common::Rect(x, y, x + w, y + h), step.autoscale); //TODO
}
void drawCallback_CROSS(const Common::Rect &area, const DrawStep &step, const Common::Rect &clip) {
@@ -493,7 +495,7 @@ public:
virtual void blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) = 0;
virtual void blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) = 0;
- virtual void blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r) = 0;
+ virtual void blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale) = 0;
/**
* Draws a string into the screen. Wrapper for the Graphics::Font string drawing
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index e87397b349..1fdd0fc4eb 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -886,6 +886,17 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) {
template<typename PixelType>
void VectorRendererSpec<PixelType>::
+blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale) {
+ if (autoscale)
+ source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE,
+ nullptr, TS_ARGB(255, 255, 255, 255),
+ r.width(), r.height());
+ else
+ source->blit(*_activeSurface, r.left, r.top);
+}
+
+template<typename PixelType>
+void VectorRendererSpec<PixelType>::
blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) {
if (clipping.isEmpty() || clipping.contains(r)) {
blitKeyBitmap(source, r);
@@ -945,12 +956,6 @@ blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const
template<typename PixelType>
void VectorRendererSpec<PixelType>::
-blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r) {
- source->blit(*_activeSurface, r.left, r.top);
-}
-
-template<typename PixelType>
-void VectorRendererSpec<PixelType>::
applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) {
int pixels = _activeSurface->w * _activeSurface->h;
PixelType *ptr = (PixelType *)_activeSurface->getPixels();
diff --git a/graphics/VectorRendererSpec.h b/graphics/VectorRendererSpec.h
index 658c70948f..308fdc5c94 100644
--- a/graphics/VectorRendererSpec.h
+++ b/graphics/VectorRendererSpec.h
@@ -95,7 +95,7 @@ public:
void blitSubSurfaceClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping);
void blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r);
void blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping);
- void blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r);
+ void blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale);
void applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle);
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 26729b916f..545b9b5c56 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -334,7 +334,7 @@ void ThemeItemABitmap::drawSelf(bool draw, bool restore) {
_engine->restoreBackground(_area);
if (draw)
- _engine->renderer()->blitAlphaBitmap(_bitmap, _area);
+ _engine->renderer()->blitAlphaBitmap(_bitmap, _area, false);
_engine->addDirtyRect(_area);
}
diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp
index 8d917f29e0..ca8b2631a5 100644
--- a/gui/ThemeParser.cpp
+++ b/gui/ThemeParser.cpp
@@ -468,6 +468,11 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst
drawstep->blitAlphaSrc = _theme->getAlphaBitmap(stepNode->values["file"]);
+ if (stepNode->values.contains("autoscale") && stepNode->values["autoscale"] == "true")
+ drawstep->autoscale = true;
+ else
+ drawstep->autoscale = false;
+
if (!drawstep->blitAlphaSrc)
return parserError("The given filename hasn't been loaded into the GUI.");
}
diff --git a/gui/ThemeParser.h b/gui/ThemeParser.h
index 14305af80d..155731467f 100644
--- a/gui/ThemeParser.h
+++ b/gui/ThemeParser.h
@@ -146,6 +146,7 @@ protected:
XML_PROP(padding, false)
XML_PROP(orientation, false)
XML_PROP(file, false)
+ XML_PROP(autoscale, false)
KEY_END()
XML_KEY(text)