TWINE: use Rect::clip and renamed member
This commit is contained in:
parent
1cebbfdd51
commit
f95d6fd0ea
3 changed files with 7 additions and 23 deletions
|
@ -181,18 +181,16 @@ void Interface::drawFilledRect(const Common::Rect &rect, uint8 colorIndex) {
|
|||
}
|
||||
|
||||
void Interface::setClip(const Common::Rect &rect) {
|
||||
clip.left = MAX((int32)0, (int32)rect.left);
|
||||
clip.top = MAX((int32)0, (int32)rect.top);
|
||||
clip.right = MIN((int32)(_engine->width() - 1), (int32)rect.right);
|
||||
clip.bottom = MIN((int32)(_engine->height() - 1), (int32)rect.bottom);
|
||||
clip = rect;
|
||||
clip.clip(_engine->rect());
|
||||
}
|
||||
|
||||
void Interface::saveClip() {
|
||||
textWindowSave = clip;
|
||||
savedClip = clip;
|
||||
}
|
||||
|
||||
void Interface::loadClip() {
|
||||
clip = textWindowSave;
|
||||
clip = savedClip;
|
||||
}
|
||||
|
||||
void Interface::resetClip() {
|
||||
|
|
|
@ -38,7 +38,7 @@ class Interface {
|
|||
private:
|
||||
TwinEEngine *_engine;
|
||||
int32 checkClipping(int32 x, int32 y) const;
|
||||
Common::Rect textWindowSave;
|
||||
Common::Rect savedClip;
|
||||
|
||||
public:
|
||||
Interface(TwinEEngine *engine);
|
||||
|
|
|
@ -633,25 +633,11 @@ void Redraw::renderOverlays() {
|
|||
const int32 textHeight = 48;
|
||||
|
||||
renderRect.left = overlay->x - (textLength / 2);
|
||||
renderRect.top = overlay->y - 24;
|
||||
renderRect.top = overlay->y - (textHeight / 2);
|
||||
renderRect.right = overlay->x + (textLength / 2);
|
||||
renderRect.bottom = overlay->y + textHeight;
|
||||
|
||||
if (renderRect.left < 0) {
|
||||
renderRect.left = 0;
|
||||
}
|
||||
|
||||
if (renderRect.top < 0) {
|
||||
renderRect.top = 0;
|
||||
}
|
||||
|
||||
if (renderRect.right > (_engine->width() - 1)) {
|
||||
renderRect.right = (_engine->width() - 1);
|
||||
}
|
||||
|
||||
if (renderRect.bottom > (_engine->height() - 1)) {
|
||||
renderRect.bottom = (_engine->height() - 1);
|
||||
}
|
||||
renderRect.clip(_engine->rect());
|
||||
|
||||
_engine->_interface->setClip(renderRect);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue