From 928322314d82c9c7f549d6d9881025e30f5b9a8f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 5 Jan 2010 13:21:39 +0000 Subject: Removed duplicate code svn-id: r47024 --- engines/sci/graphics/gfx.cpp | 33 +++++++-------------------------- engines/sci/graphics/gfx.h | 4 ++-- 2 files changed, 9 insertions(+), 28 deletions(-) (limited to 'engines') diff --git a/engines/sci/graphics/gfx.cpp b/engines/sci/graphics/gfx.cpp index be4c7d357d..030d585407 100644 --- a/engines/sci/graphics/gfx.cpp +++ b/engines/sci/graphics/gfx.cpp @@ -332,21 +332,15 @@ void Gfx::drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredF void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight) { View *view = getView(viewId); Common::Rect rect; - Common::Rect clipRect; + if (view) { rect.left = leftPos; rect.top = topPos; rect.right = rect.left + view->getWidth(loopNo, celNo); rect.bottom = rect.top + view->getHeight(loopNo, celNo); - clipRect = rect; - clipRect.clip(_curPort->rect); - if (clipRect.isEmpty()) { // nothing to draw - return; - } - Common::Rect clipRectTranslated = clipRect; - OffsetRect(clipRectTranslated); - view->draw(rect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo, origHeight); + drawCel(view, loopNo, celNo, rect, priority, paletteNo, origHeight); + if (getSciVersion() >= SCI_VERSION_1_1) { if (!_screen->_picNotValidSci11) BitsShow(rect); @@ -358,26 +352,13 @@ void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftP } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) { - View *view = getView(viewId); - Common::Rect clipRect; - if (view) { - clipRect = celRect; - clipRect.clip(_curPort->rect); - if (clipRect.isEmpty()) { // nothing to draw - return; - } - - Common::Rect clipRectTranslated = clipRect; - OffsetRect(clipRectTranslated); - view->draw(celRect, clipRect, clipRectTranslated, loopNo, celNo, priority, paletteNo); - } +void Gfx::drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) { + drawCel(getView(viewId), loopNo, celNo, celRect, priority, paletteNo); } // This version of drawCel is not supposed to call BitsShow()! -void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo) { - Common::Rect clipRect; - clipRect = celRect; +void Gfx::drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight) { + Common::Rect clipRect = celRect; clipRect.clip(_curPort->rect); if (clipRect.isEmpty()) // nothing to draw return; diff --git a/engines/sci/graphics/gfx.h b/engines/sci/graphics/gfx.h index c6edd36ec8..4d9befd829 100644 --- a/engines/sci/graphics/gfx.h +++ b/engines/sci/graphics/gfx.h @@ -85,8 +85,8 @@ public: void drawPicture(GuiResourceId pictureId, int16 animationNr, bool mirroredFlag, bool addToFlag, GuiResourceId paletteId); void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, uint16 leftPos, uint16 topPos, byte priority, uint16 paletteNo, int16 origHeight = -1); - void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo); - void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo); + void drawCel(GuiResourceId viewId, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1); + void drawCel(View *view, LoopNo loopNo, CelNo celNo, Common::Rect celRect, byte priority, uint16 paletteNo, int16 origHeight = -1); uint16 onControl(uint16 screenMask, Common::Rect rect); -- cgit v1.2.3