summaryrefslogtreecommitdiff
path: root/liveview/liveviewpaintengine.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-14 02:27:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-14 02:27:30 +0200
commit8acbca729c2bca966c0e4b91701654532af2f55c (patch)
tree45a063db9dd4abec7a34240dfd62cdc513ac8eab /liveview/liveviewpaintengine.cpp
parent9e3eff1c3a2b7105fecf6d0d7f052eb9943fbada (diff)
downloadsowatch-8acbca729c2bca966c0e4b91701654532af2f55c.tar.gz
sowatch-8acbca729c2bca966c0e4b91701654532af2f55c.zip
add tiling support to liveview
Diffstat (limited to 'liveview/liveviewpaintengine.cpp')
-rw-r--r--liveview/liveviewpaintengine.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/liveview/liveviewpaintengine.cpp b/liveview/liveviewpaintengine.cpp
index 9f7ffec..2370477 100644
--- a/liveview/liveviewpaintengine.cpp
+++ b/liveview/liveviewpaintengine.cpp
@@ -21,9 +21,17 @@ bool LiveViewPaintEngine::end()
bool ret = WatchPaintEngine::end();
if (ret) {
QRect rect = _damaged.boundingRect();
- if (!rect.isEmpty()) {
- QImage sub_image = _watch->image()->copy(rect);
- _watch->renderImage(rect.x(), rect.y(), sub_image);
+
+ const int tile_size = 64;
+ // Have to make tiles
+ for (int x = rect.left(); x < rect.right(); x += tile_size) {
+ for (int y = rect.top(); y < rect.bottom(); y += tile_size) {
+ QRect tile(x, y,
+ qMin(x + tile_size, rect.right()),
+ qMin(y + tile_size, rect.bottom()));
+ QImage sub_image = _watch->image()->copy(tile);
+ _watch->renderImage(tile.x(), tile.y(), sub_image);
+ }
}
}
return ret;
@@ -35,7 +43,7 @@ void LiveViewPaintEngine::drawRects(const QRectF *rects, int rectCount)
for (i = 0; i < rectCount; i++) {
const QRectF& r = rects[i];
if (_hasBrush && fillsEntireImage(r.toRect()) && _isBrushBlack) {
- //_watch->clear();
+ _watch->clear();
_damaged = QRegion();
continue;
}
@@ -58,7 +66,7 @@ void LiveViewPaintEngine::drawRects(const QRect *rects, int rectCount)
for (i = 0; i < rectCount; i++) {
const QRect& r = rects[i];
if (_hasBrush && fillsEntireImage(r) && _isBrushBlack) {
- //_watch->clear();
+ _watch->clear();
_damaged = QRegion();
continue;
}