diff options
author | johndoe123 | 2013-04-17 12:41:49 +0200 |
---|---|---|
committer | johndoe123 | 2013-04-17 12:41:49 +0200 |
commit | 0a0b2f397b95e6e219f2ac8c5b79bbe6300ef432 (patch) | |
tree | 4351e3a630eb9dc4e684d5147e1c1499fbf0e98e /engines/sword25/gfx/panel.cpp | |
parent | 6548104b96be211b1c93412a05802cc821b1d2e0 (diff) | |
download | scummvm-rg350-0a0b2f397b95e6e219f2ac8c5b79bbe6300ef432.tar.gz scummvm-rg350-0a0b2f397b95e6e219f2ac8c5b79bbe6300ef432.tar.bz2 scummvm-rg350-0a0b2f397b95e6e219f2ac8c5b79bbe6300ef432.zip |
SWORD25: Optimize graphics drawing code
Diffstat (limited to 'engines/sword25/gfx/panel.cpp')
-rw-r--r-- | engines/sword25/gfx/panel.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp index 6d5b2a623d..931b9cdbe7 100644 --- a/engines/sword25/gfx/panel.cpp +++ b/engines/sword25/gfx/panel.cpp @@ -36,6 +36,8 @@ #include "sword25/gfx/graphicengine.h" #include "sword25/gfx/image/image.h" +#include "sword25/gfx/renderobjectmanager.h" + namespace Sword25 { Panel::Panel(RenderObjectPtr<RenderObject> parentPtr, int width, int height, uint color) : @@ -67,7 +69,7 @@ Panel::Panel(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parent Panel::~Panel() { } -bool Panel::doRender() { +bool Panel::doRender(RectangleList *updateRects) { // Falls der Alphawert 0 ist, ist das Panel komplett durchsichtig und es muss nichts gezeichnet werden. if (_color >> 24 == 0) return true; @@ -75,7 +77,15 @@ bool Panel::doRender() { GraphicEngine *gfxPtr = Kernel::getInstance()->getGfx(); assert(gfxPtr); - return gfxPtr->fill(&_bbox, _color); + for (RectangleList::iterator it = updateRects->begin(); it != updateRects->end(); ++it) { + const Common::Rect &clipRect = *it; + if (_bbox.intersects(clipRect)) { + Common::Rect intersectionRect = _bbox.findIntersectingRect(clipRect); + gfxPtr->fill(&intersectionRect, _color); + } + } + + return true; } bool Panel::persist(OutputPersistenceBlock &writer) { |