From 065694dbb166d2fb113ba36b9340d91f9c71fdbe Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 6 Dec 2008 18:23:34 +0000 Subject: - Prevented direct reference to the back buffer in many cases (apart from a few, where it's modified directly) - Added skeleton code for dirty rectangle handling (still unfinished and non-working) - Added wrapper functions to access the back buffer, which add the appropriate dirty rectangles automatically svn-id: r35264 --- engines/saga/gfx.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'engines/saga/gfx.cpp') diff --git a/engines/saga/gfx.cpp b/engines/saga/gfx.cpp index 285a33b656..eac1d871ae 100644 --- a/engines/saga/gfx.cpp +++ b/engines/saga/gfx.cpp @@ -30,6 +30,7 @@ #include "saga/interface.h" #include "saga/rscfile.h" #include "saga/scene.h" +#include "saga/render.h" #include "common/system.h" #include "graphics/cursorman.h" @@ -561,4 +562,28 @@ bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_po return inside_flag; } +// This method adds a dirty rectangle automatically +void Gfx::drawFrame(const Common::Point &p1, const Common::Point &p2, int color) { + _backBuffer.drawFrame(p1, p2, color); + _vm->_render->addDirtyRect(Common::Rect(p1.x, p1.y, p2.x, p2.y)); +} + +// This method adds a dirty rectangle automatically +void Gfx::drawRect(const Common::Rect &destRect, int color) { + _backBuffer.drawRect(destRect, color); + _vm->_render->addDirtyRect(destRect); +} + +// This method adds a dirty rectangle automatically +void Gfx::fillRect(const Common::Rect &destRect, uint32 color) { + _backBuffer.fillRect(destRect, color); + _vm->_render->addDirtyRect(destRect); +} + +// This method adds a dirty rectangle automatically +void Gfx::drawRegion(const Common::Rect &destRect, const byte *sourceBuffer) { + _backBuffer.blit(destRect, sourceBuffer); + _vm->_render->addDirtyRect(destRect); +} + } // End of namespace Saga -- cgit v1.2.3