aboutsummaryrefslogtreecommitdiff
path: root/graphics/VectorRendererSpec.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2014-05-05 21:36:16 +0300
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commitec7312ac13ce19f64b2b453b43e2c37235dcbe7a (patch)
tree8be300bb5049397d5d70732ed0be46dea2f269bc /graphics/VectorRendererSpec.cpp
parent4474ccf8144563c4bacbb060c943c0f68e317cea (diff)
downloadscummvm-rg350-ec7312ac13ce19f64b2b453b43e2c37235dcbe7a.tar.gz
scummvm-rg350-ec7312ac13ce19f64b2b453b43e2c37235dcbe7a.tar.bz2
scummvm-rg350-ec7312ac13ce19f64b2b453b43e2c37235dcbe7a.zip
GUI: Implemented more modes to autoscale
Diffstat (limited to 'graphics/VectorRendererSpec.cpp')
-rw-r--r--graphics/VectorRendererSpec.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp
index 1fdd0fc4eb..68b77d20ee 100644
--- a/graphics/VectorRendererSpec.cpp
+++ b/graphics/VectorRendererSpec.cpp
@@ -886,13 +886,25 @@ 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)
+blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Graphics::DrawStep::AutoScaleMode autoscale) {
+ if (autoscale == Graphics::DrawStep::kAutoScaleStretch) {
source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE,
nullptr, TS_ARGB(255, 255, 255, 255),
r.width(), r.height());
- else
+ } else if (autoscale == Graphics::DrawStep::kAutoScaleFit) {
+ double ratio = (double)r.width() / source->w;
+ double ratio2 = (double)r.height() / source->h;
+
+ if (ratio2 < ratio)
+ ratio = ratio2;
+
+ source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE,
+ nullptr, TS_ARGB(255, 255, 255, 255),
+ (int)(source->w * ratio), (int)(source->h * ratio));
+
+ } else {
source->blit(*_activeSurface, r.left, r.top);
+ }
}
template<typename PixelType>