diff options
author | Neil <nyamatongwe@gmail.com> | 2022-03-24 10:02:30 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2022-03-24 10:02:30 +1100 |
commit | 1deaab0fb9d38b6a6f3d1efc5363396299ed5168 (patch) | |
tree | c4fefcc670ae3f461e11417a966a6bcd0e0cc57c /qt | |
parent | 4e58da1aacb709d84ad4160d53ab35c459b33b90 (diff) | |
download | scintilla-mirror-1deaab0fb9d38b6a6f3d1efc5363396299ed5168.tar.gz |
Use drawTiledPixmap instead of explicit tiling code.
This removes limitation of only supporting 8x8 patterns and should be faster.
Diffstat (limited to 'qt')
-rw-r--r-- | qt/ScintillaEditBase/PlatQt.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/qt/ScintillaEditBase/PlatQt.cpp b/qt/ScintillaEditBase/PlatQt.cpp index c6163a742..b2a298f03 100644 --- a/qt/ScintillaEditBase/PlatQt.cpp +++ b/qt/ScintillaEditBase/PlatQt.cpp @@ -339,19 +339,8 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { // Tile pattern over rectangle SurfaceImpl *surface = dynamic_cast<SurfaceImpl *>(&surfacePattern); - // Currently assumes 8x8 pattern - int widthPat = 8; - int heightPat = 8; - for (int xTile = rc.left; xTile < rc.right; xTile += widthPat) { - int widthx = (xTile + widthPat > rc.right) ? rc.right - xTile : widthPat; - for (int yTile = rc.top; yTile < rc.bottom; yTile += heightPat) { - int heighty = (yTile + heightPat > rc.bottom) ? rc.bottom - yTile : heightPat; - QRect source(0, 0, widthx, heighty); - QRect target(xTile, yTile, widthx, heighty); - QPixmap *pixmap = static_cast<QPixmap *>(surface->GetPaintDevice()); - GetPainter()->drawPixmap(target, *pixmap, source); - } - } + const QPixmap *pixmap = static_cast<QPixmap *>(surface->GetPaintDevice()); + GetPainter()->drawTiledPixmap(QRectFromPRect(rc), *pixmap); } void SurfaceImpl::RoundedRectangle(PRectangle rc, FillStroke fillStroke) |