From 057b01951a92cc17e6c7a5121d2bd866841c4f75 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 25 Sep 2013 19:47:39 +0200 Subject: WINTERMUTE: Add displayTiled function to replace repeatLastDraw This avoids queueing many tickets for a UITiledImage, replacing them by a single tiled ticket. --- engines/wintermute/ui/ui_tiled_image.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'engines/wintermute/ui/ui_tiled_image.cpp') diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index de4b86a6dd..7c28c139f4 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -75,8 +75,6 @@ bool UITiledImage::display(int x, int y, int width, int height) { int nuColumns = (width - (_middleLeft.right - _middleLeft.left) - (_middleRight.right - _middleRight.left)) / tileWidth; int nuRows = (height - (_upMiddle.bottom - _upMiddle.top) - (_downMiddle.bottom - _downMiddle.top)) / tileHeight; - int col, row; - _gameRef->_renderer->startSpriteBatch(); // top left/right @@ -88,27 +86,24 @@ bool UITiledImage::display(int x, int y, int width, int height) { _image->_surface->displayTrans(x + (_upLeft.right - _upLeft.left) + nuColumns * tileWidth, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downRight); // left/right - int yyy = y + (_upMiddle.bottom - _upMiddle.top); - for (row = 0; row < nuRows; row++) { - _image->_surface->displayTrans(x, yyy, _middleLeft); - _image->_surface->displayTrans(x + (_middleLeft.right - _middleLeft.left) + nuColumns * tileWidth, yyy, _middleRight); - yyy += tileWidth; + if (nuRows > 0) { + int yyy = y + (_upMiddle.bottom - _upMiddle.top); + _image->_surface->displayTiled(x, yyy, _middleLeft, 1, nuRows); + _image->_surface->displayTiled(x + (_middleLeft.right - _middleLeft.left) + nuColumns * tileWidth, yyy, _middleRight, 1, nuRows); } // top/bottom - int xxx = x + (_upLeft.right - _upLeft.left); - for (col = 0; col < nuColumns; col++) { - _image->_surface->displayTrans(xxx, y, _upMiddle); - _image->_surface->displayTrans(xxx, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downMiddle); - xxx += tileWidth; + if (nuColumns > 0) { + int xxx = x + (_upLeft.right - _upLeft.left); + _image->_surface->displayTiled(xxx, y, _upMiddle, nuColumns, 1); + _image->_surface->displayTiled(xxx, y + (_upMiddle.bottom - _upMiddle.top) + nuRows * tileHeight, _downMiddle, nuColumns, 1); } // tiles if (nuRows > 0 && nuColumns > 0) { - yyy = y + (_upMiddle.bottom - _upMiddle.top); - xxx = x + (_upLeft.right - _upLeft.left); - _image->_surface->displayTrans(xxx, yyy, _middleMiddle); - _image->_surface->repeatLastDisplayOp(tileWidth, tileWidth, nuColumns, nuRows); + int yyy = y + (_upMiddle.bottom - _upMiddle.top); + int xxx = x + (_upLeft.right - _upLeft.left); + _image->_surface->displayTiled(xxx, yyy, _middleMiddle, nuColumns, nuRows); } _gameRef->_renderer->endSpriteBatch(); -- cgit v1.2.3