GUI: Render ManagedSurface widget with transparency

This commit is contained in:
Eugene Sandulenko 2021-04-06 01:10:28 +02:00
parent a299f8b8f7
commit 7fe0073823
3 changed files with 17 additions and 1 deletions

View File

@ -1340,6 +1340,21 @@ void ThemeEngine::drawSurface(const Common::Point &p, const Graphics::Surface &s
addDirtyRect(dirtyRect);
}
void ThemeEngine::drawSurface(const Common::Point &p, const Graphics::ManagedSurface &surface, bool themeTrans) {
if (!ready())
return;
if (_layerToDraw == kDrawLayerBackground)
return;
_vectorRenderer->setClippingRect(_clip);
_vectorRenderer->blitManagedSurface(&surface, p);
Common::Rect dirtyRect = Common::Rect(p.x, p.y, p.x + surface.w, p.y + surface.h);
dirtyRect.clip(_clip);
addDirtyRect(dirtyRect);
}
void ThemeEngine::drawWidgetBackground(const Common::Rect &r, WidgetBackground background) {
if (!ready())
return;

View File

@ -459,6 +459,7 @@ public:
WidgetStateInfo buttonState, bool inButton, bool inDropdown, bool rtl = false);
void drawSurface(const Common::Point &p, const Graphics::Surface &surface, bool themeTrans = false);
void drawSurface(const Common::Point &p, const Graphics::ManagedSurface &surface, bool themeTrans = false);
void drawSlider(const Common::Rect &r, int width, WidgetStateInfo state = kStateEnabled, bool rtl = false);

View File

@ -907,7 +907,7 @@ void GraphicsWidget::setGfxFromTheme(const char *name) {
}
_gfx.free();
_gfx.create(_w, _h, g_gui.theme()->getPixelFormat());
_gfx.create(_w, _h, *svg->getPixelFormat());
svg->render(_gfx, _w, _h);
}