aboutsummaryrefslogtreecommitdiff
path: root/graphics/macgui/mactextwindow.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2017-08-03 19:26:28 +0200
committerEugene Sandulenko2017-08-04 21:54:20 +0200
commit676b6082ab0bcbaf2a5303c7471f87c9cfe847dd (patch)
tree8dad85da469e6d35853b7ab8bd0cd00e082b05c0 /graphics/macgui/mactextwindow.cpp
parent71aadb5645a8d19ec015b372f5331dbb6440a719 (diff)
downloadscummvm-rg350-676b6082ab0bcbaf2a5303c7471f87c9cfe847dd.tar.gz
scummvm-rg350-676b6082ab0bcbaf2a5303c7471f87c9cfe847dd.tar.bz2
scummvm-rg350-676b6082ab0bcbaf2a5303c7471f87c9cfe847dd.zip
GRAPHICS: GUI: Mark beginning and end column of selection in MacTextWindow
Diffstat (limited to 'graphics/macgui/mactextwindow.cpp')
-rw-r--r--graphics/macgui/mactextwindow.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 2194fddf36..7873ea2a6c 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -164,6 +164,9 @@ void MacTextWindow::drawSelection() {
SWAP(s.startCol, s.endCol);
}
+ int lastLineHeight = _mactext->getLineHeight(s.endRow);
+ s.endY += lastLineHeight;
+
int start = s.startY - _scrollPos;
start = MAX(0, start);
@@ -177,10 +180,29 @@ void MacTextWindow::drawSelection() {
end = MIN((int)getInnerDimensions().height(), end);
+ int numLines = 0;
+ int x1, x2;
+
for (int y = start; y < end; y++) {
- byte *ptr = (byte *)_composeSurface.getBasePtr(kConWOverlap - 2, kConWOverlap - 2 + y);
+ if (!numLines) {
+ x1 = 0;
+ x2 = getInnerDimensions().width();
+
+ if (y + _scrollPos == s.startY && s.startX > 0) {
+ numLines = _mactext->getLineHeight(s.startRow);
+ x1 = s.startX;
+ }
+ if (y + _scrollPos == s.endY - lastLineHeight) {
+ numLines = _mactext->getLineHeight(s.endRow);
+ x2 = s.endX;
+ }
+ } else {
+ numLines--;
+ }
+
+ byte *ptr = (byte *)_composeSurface.getBasePtr(x1 + kConWOverlap - 2, y + kConWOverlap - 2);
- for (int x = 0; x < getInnerDimensions().width(); x++, ptr++)
+ for (int x = x1; x < x2; x++, ptr++)
if (*ptr == kColorBlack)
*ptr = kColorWhite;
else