WAGE: Benefit from ManagedSurface methods

This commit is contained in:
Eugene Sandulenko 2016-04-15 08:55:14 +02:00
parent 00399d27db
commit 0e4c846a39
4 changed files with 8 additions and 16 deletions

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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);

View File

@ -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);