aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/macgui/mactext.h2
-rw-r--r--graphics/macgui/mactextwindow.cpp26
2 files changed, 25 insertions, 3 deletions
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index ffc8c8dc71..7cbf40e8bc 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -109,6 +109,7 @@ public:
void removeLastLine();
int getLineCount() { return _textLines.size(); }
int getTextHeight() { return _textMaxHeight; }
+ int getLineHeight(int line);
void render();
Graphics::ManagedSurface *getSurface() { return _surface; }
@@ -121,7 +122,6 @@ private:
void recalcDims();
void reallocSurface();
int getLineWidth(int line, bool enforce = false);
- int getLineHeight(int line);
private:
MacWindowManager *_wm;
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