From 0e4c846a39cdf5c8370106ba87b24ac7936818fd Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 15 Apr 2016 08:55:14 +0200 Subject: WAGE: Benefit from ManagedSurface methods --- engines/wage/design.cpp | 17 +++++------------ engines/wage/gui-console.cpp | 3 +-- engines/wage/macwindow.cpp | 2 +- engines/wage/menu.cpp | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) (limited to 'engines') diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index a697b89430..185c051eb6 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -99,8 +99,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, _surface = new Graphics::ManagedSurface; _surface->create(_bounds->width(), _bounds->height(), Graphics::PixelFormat::createFormatCLUT8()); - Common::Rect r(0, 0, _bounds->width(), _bounds->height()); - _surface->fillRect(r, kColorGreen); + _surface->clear(kColorGreen); needRender = true; } @@ -133,16 +132,10 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, if (_bounds->width() && _bounds->height()) { const int padding = 3; - for (int i = padding; i < _bounds->height() - 2 * padding; i++) { - const byte *src = (const byte *)_surface->getBasePtr(padding, i); - byte *dst = (byte *)surface->getBasePtr(x + padding, y+i); - for (int j = padding; j < _bounds->width() - 2 * padding; j++) { - if (*src != kColorGreen) - *dst = *src; - src++; - dst++; - } - } + Common::Rect from(padding, padding, _bounds->width() - 2 * padding, _bounds->height() - 2 * padding); + Common::Rect to(from); + to.moveTo(x, y); + surface->transBlitFrom(*_surface, from, to, kColorGreen); } } diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 3a3f189dce..5f9cfe5519 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -150,7 +150,6 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) { Common::Rect boundsR(kConWOverlap - kConOverscan, kConHOverlap - kConOverscan, r.width() + kConWOverlap + kConOverscan, r.height() + kConHOverlap + kConOverscan); - Common::Rect fullR(0, 0, surfW, surfH); if (_console.w != surfW || _console.h != surfH) { if (_console.w != surfW) @@ -163,7 +162,7 @@ void Gui::renderConsole(Graphics::ManagedSurface *g, Common::Rect &r) { } if (fullRedraw) - _console.fillRect(fullR, kColorWhite); + _console.clear(kColorWhite); const Graphics::Font *font = getConsoleFont(); diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index 7a080a38fa..dee80dee93 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -144,7 +144,7 @@ void MacWindow::drawBorder() { int height = _borderSurface.h; Graphics::ManagedSurface *g = &_borderSurface; - g->fillRect(_borderDims, kColorGreen2); + g->clear(kColorGreen2); drawBox(g, x, y, size, size); drawBox(g, x + width - size - 1, y, size, size); diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index 9bd43275b2..27cbf5e4f5 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -406,7 +406,7 @@ void Menu::renderSubmenu(MenuItem *menu) { ty = 0; accelX -= x; - _tempSurface.fillRect(Common::Rect(0, 0, _tempSurface.w, _tempSurface.h), kColorGreen); + _tempSurface.clear(kColorGreen); } _font->drawString(s, text, tx, ty, r->width(), color); -- cgit v1.2.3