diff options
author | Eugene Sandulenko | 2014-05-11 22:40:35 +0300 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 94bc75ae464dc37d2a4dee0ac6fb69e75b265413 (patch) | |
tree | 64ea925f8b86cbde768ada1486cb6ef8172a2408 /graphics/VectorRendererSpec.cpp | |
parent | 75f9b099dc3e198c7a1750a6e26ac4945719492f (diff) | |
download | scummvm-rg350-94bc75ae464dc37d2a4dee0ac6fb69e75b265413.tar.gz scummvm-rg350-94bc75ae464dc37d2a4dee0ac6fb69e75b265413.tar.bz2 scummvm-rg350-94bc75ae464dc37d2a4dee0ac6fb69e75b265413.zip |
GUI: Implemented centering of dialog background
Diffstat (limited to 'graphics/VectorRendererSpec.cpp')
-rw-r--r-- | graphics/VectorRendererSpec.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 0b947e4a0f..8af6594fd4 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -887,7 +887,8 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { template<typename PixelType> void VectorRendererSpec<PixelType>:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale) { +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale, + Graphics::DrawStep::VectorAlignment xAlign, Graphics::DrawStep::VectorAlignment yAlign) { if (autoscale == GUI::ThemeEngine::kAutoScaleStretch) { source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), @@ -899,9 +900,16 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI if (ratio2 < ratio) ratio = ratio2; - source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, + int offx = 0, offy = 0; + if (xAlign == Graphics::DrawStep::kVectorAlignCenter) + offx = (r.width() - (int)(source->w * ratio)) >> 1; + + if (yAlign == Graphics::DrawStep::kVectorAlignCenter) + offy = (r.height() - (int)(source->h * ratio)) >> 1; + + source->blit(*_activeSurface, r.left + offx, r.top + offy, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), - (int)(source->w * ratio), (int)(source->h * ratio)); + (int)(source->w * ratio), (int)(source->h * ratio)); } else if (autoscale == GUI::ThemeEngine::kAutoScaleNinePatch) { Graphics::NinePatchBitmap nine(source, false); |