diff options
author | Eugene Sandulenko | 2017-08-03 19:26:28 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-08-04 21:54:20 +0200 |
commit | 676b6082ab0bcbaf2a5303c7471f87c9cfe847dd (patch) | |
tree | 8dad85da469e6d35853b7ab8bd0cd00e082b05c0 /graphics | |
parent | 71aadb5645a8d19ec015b372f5331dbb6440a719 (diff) | |
download | scummvm-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')
-rw-r--r-- | graphics/macgui/mactext.h | 2 | ||||
-rw-r--r-- | graphics/macgui/mactextwindow.cpp | 26 |
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 |