diff options
author | Einar Johan Trøan Sømåen | 2012-07-23 01:28:42 +0200 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-07-23 01:30:11 +0200 |
commit | d1f7730ec25b409f3651167640dd48b7dd8046be (patch) | |
tree | 09acde0f33697153c91bd4f3044f5ef1dc29e830 /engines | |
parent | 93864d4e39f6335684bee9d8dc291ce9af32ca7b (diff) | |
download | scummvm-rg350-d1f7730ec25b409f3651167640dd48b7dd8046be.tar.gz scummvm-rg350-d1f7730ec25b409f3651167640dd48b7dd8046be.tar.bz2 scummvm-rg350-d1f7730ec25b409f3651167640dd48b7dd8046be.zip |
WINTERMUTE: Encapsulate BaseRenderer::_rectList and replace it by Common::Array
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wintermute/ad/ad_entity.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/base/base_sub_frame.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/base/gfx/base_renderer.h | 10 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_button.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_edit.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/ui/ui_window.cpp | 2 |
7 files changed, 19 insertions, 13 deletions
diff --git a/engines/wintermute/ad/ad_entity.cpp b/engines/wintermute/ad/ad_entity.cpp index 2a281d0fcb..91ba066d6a 100644 --- a/engines/wintermute/ad/ad_entity.cpp +++ b/engines/wintermute/ad/ad_entity.cpp @@ -502,7 +502,7 @@ bool AdEntity::display() { if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) Reg = false;
if (_region && (Reg || _editorAlwaysRegister)) {
- _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY));
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY));
}
displaySpriteAttachments(true);
diff --git a/engines/wintermute/base/base_sub_frame.cpp b/engines/wintermute/base/base_sub_frame.cpp index d6a8c2490f..05b7d21dfe 100644 --- a/engines/wintermute/base/base_sub_frame.cpp +++ b/engines/wintermute/base/base_sub_frame.cpp @@ -209,9 +209,9 @@ bool BaseSubFrame::draw(int x, int y, BaseObject *registerOwner, float zoomX, fl if (registerOwner != NULL && !_decoration) {
if (zoomX == 100 && zoomY == 100) {
- _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + _rect.left, y - _hotspotY + _rect.top, _rect.right - _rect.left, _rect.bottom - _rect.top, zoomX, zoomY, precise));
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, x - _hotspotX + _rect.left, y - _hotspotY + _rect.top, _rect.right - _rect.left, _rect.bottom - _rect.top, zoomX, zoomY, precise));
} else {
- _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + _rect.left) * (zoomX / 100)), (int)(y - (_hotspotY + _rect.top) * (zoomY / 100)), (int)((_rect.right - _rect.left) * (zoomX / 100)), (int)((_rect.bottom - _rect.top) * (zoomY / 100)), zoomX, zoomY, precise));
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, registerOwner, this, (int)(x - (_hotspotX + _rect.left) * (zoomX / 100)), (int)(y - (_hotspotY + _rect.top) * (zoomY / 100)), (int)((_rect.right - _rect.left) * (zoomX / 100)), (int)((_rect.bottom - _rect.top) * (zoomY / 100)), zoomX, zoomY, precise));
}
}
if (_gameRef->_suspendedRendering) return STATUS_OK;
diff --git a/engines/wintermute/base/gfx/base_renderer.cpp b/engines/wintermute/base/gfx/base_renderer.cpp index c46115d70a..63c23169b7 100644 --- a/engines/wintermute/base/gfx/base_renderer.cpp +++ b/engines/wintermute/base/gfx/base_renderer.cpp @@ -72,7 +72,7 @@ BaseObject *BaseRenderer::getObjectAt(int x, int y) { point.x = x;
point.y = y;
- for (int i = _rectList.getSize() - 1; i >= 0; i--) {
+ for (int i = _rectList.size() - 1; i >= 0; i--) {
if (BasePlatform::ptInRect(&_rectList[i]->_rect, point)) {
if (_rectList[i]->_precise) {
// frame
@@ -106,10 +106,10 @@ BaseObject *BaseRenderer::getObjectAt(int x, int y) { //////////////////////////////////////////////////////////////////////////
void BaseRenderer::deleteRectList() {
- for (int i = 0; i < _rectList.getSize(); i++) {
+ for (int i = 0; i < _rectList.size(); i++) {
delete _rectList[i];
}
- _rectList.removeAll();
+ _rectList.clear();
}
@@ -254,4 +254,8 @@ bool BaseRenderer::pointInViewport(Point32 *p) { return true;
}
+void BaseRenderer::addRectToList(BaseActiveRect *rect) {
+ _rectList.push_back(rect);
+}
+
} // end of namespace WinterMute
diff --git a/engines/wintermute/base/gfx/base_renderer.h b/engines/wintermute/base/gfx/base_renderer.h index 118cda0ec6..32dced0878 100644 --- a/engines/wintermute/base/gfx/base_renderer.h +++ b/engines/wintermute/base/gfx/base_renderer.h @@ -29,10 +29,10 @@ #ifndef WINTERMUTE_BRENDERER_H
#define WINTERMUTE_BRENDERER_H
-
-#include "engines/wintermute/coll_templ.h"
+#include "engines/wintermute/math/rect32.h"
#include "engines/wintermute/base/base.h"
#include "common/rect.h"
+#include "common/array.h"
namespace WinterMute {
@@ -117,8 +117,10 @@ public: int _bPP;
int _height;
int _width;
-
- BaseArray<BaseActiveRect *, BaseActiveRect *> _rectList;
+
+ void addRectToList(BaseActiveRect *rect);
+private:
+ Common::Array<BaseActiveRect *> _rectList;
};
BaseRenderer *makeOSystemRenderer(BaseGame *inGame); // Implemented in BRenderSDL.cpp
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 2c4f6d5e4e..21a60ef922 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -637,7 +637,7 @@ bool UIButton::display(int offsetX, int offsetY) { font->drawText((byte *)_text, offsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), offsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
}
- if (!_pixelPerfect || !_image) _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ if (!_pixelPerfect || !_image) _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
// reset unused sprites
if (_image && _image != image) _image->reset();
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 8c277e7c87..df3bd85bb8 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -672,7 +672,7 @@ bool UIEdit::display(int offsetX, int offsetY) { }
- _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
_gameRef->_textEncoding = OrigEncoding;
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 7e6986508b..1f7dc0bee9 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -190,7 +190,7 @@ bool UIWindow::display(int offsetX, int offsetY) { }
if (!_transparent && !image)
- _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
+ _gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
for (int i = 0; i < _widgets.getSize(); i++) {
_widgets[i]->display(_posX + offsetX, _posY + offsetY);
|