diff options
author | Eugene Sandulenko | 2014-05-07 13:12:59 +0300 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 38114eb760f842eb3145c9d1af62366cf2fab8ca (patch) | |
tree | 2e28e23339ebd0184a3e8a3807906ddc00c95fe2 | |
parent | ec7312ac13ce19f64b2b453b43e2c37235dcbe7a (diff) | |
download | scummvm-rg350-38114eb760f842eb3145c9d1af62366cf2fab8ca.tar.gz scummvm-rg350-38114eb760f842eb3145c9d1af62366cf2fab8ca.tar.bz2 scummvm-rg350-38114eb760f842eb3145c9d1af62366cf2fab8ca.zip |
GUI: Plug NinePatch bitmaps into parser
-rw-r--r-- | graphics/VectorRenderer.h | 3 | ||||
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 4 | ||||
-rw-r--r-- | gui/ThemeParser.cpp | 9 |
3 files changed, 12 insertions, 4 deletions
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index fb19fa3156..0a83dc5d49 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -71,7 +71,8 @@ struct DrawStep { enum AutoScaleMode { kAutoScaleNone = 0, kAutoScaleStretch = 1, - kAutoScaleFit = 2 + kAutoScaleFit = 2, + kAutoScaleNinePatch = 3 }; VectorAlignment xAlign; diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 68b77d20ee..f3e496af70 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -26,6 +26,7 @@ #include "graphics/surface.h" #include "graphics/transparent_surface.h" +#include "graphics/nine_patch.h" #include "graphics/colormasks.h" #include "gui/ThemeEngine.h" @@ -902,6 +903,9 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Gra nullptr, TS_ARGB(255, 255, 255, 255), (int)(source->w * ratio), (int)(source->h * ratio)); + } else if (autoscale == Graphics::DrawStep::kAutoScaleNinePatch) { + Graphics::NinePatchBitmap nine(source, false); + nine.blit(*_activeSurface, r.left, r.top, r.width(), r.height()); } else { source->blit(*_activeSurface, r.left, r.top); } diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 226281122f..d4701c49f6 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -469,12 +469,15 @@ bool ThemeParser::parseDrawStep(ParserNode *stepNode, Graphics::DrawStep *drawst drawstep->blitAlphaSrc = _theme->getAlphaBitmap(stepNode->values["file"]); if (stepNode->values.contains("autoscale")) - if (stepNode->values["autoscale"] == "true" || stepNode->values["autoscale"] == "stretch") + if (stepNode->values["autoscale"] == "true" || stepNode->values["autoscale"] == "stretch") { drawstep->autoscale = Graphics::DrawStep::kAutoScaleStretch; - else if (stepNode->values["autoscale"] == "fit") + } else if (stepNode->values["autoscale"] == "fit") { drawstep->autoscale = Graphics::DrawStep::kAutoScaleFit; - else + } else if (stepNode->values["autoscale"] == "9patch") { + drawstep->autoscale = Graphics::DrawStep::kAutoScaleNinePatch; + } else { drawstep->autoscale = Graphics::DrawStep::kAutoScaleNone; + } if (!drawstep->blitAlphaSrc) return parserError("The given filename hasn't been loaded into the GUI."); |