From 4474ccf8144563c4bacbb060c943c0f68e317cea Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 May 2014 00:52:56 +0300 Subject: GUI: Implemented alphabitmap autoscale --- graphics/VectorRenderer.h | 6 ++++-- graphics/VectorRendererSpec.cpp | 17 +++++++++++------ graphics/VectorRendererSpec.h | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'graphics') 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 @@ -884,6 +884,17 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { } } +template +void VectorRendererSpec:: +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 void VectorRendererSpec:: blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) { @@ -943,12 +954,6 @@ blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const } } -template -void VectorRendererSpec:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r) { - source->blit(*_activeSurface, r.left, r.top); -} - template void VectorRendererSpec:: applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { 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); -- cgit v1.2.3