summaryrefslogtreecommitdiff
path: root/metawatch/metawatchpaintengine.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-18 04:26:20 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-18 04:26:20 +0200
commitc42d5abff1f5f51facc169dd593725d819c4c868 (patch)
tree9aa8bdef88bf89561c7726948541a1ba3906b81e /metawatch/metawatchpaintengine.cpp
parentf225345d4de3b198a557fe3566f9630163e76d51 (diff)
downloadsowatch-c42d5abff1f5f51facc169dd593725d819c4c868.tar.gz
sowatch-c42d5abff1f5f51facc169dd593725d819c4c868.zip
separation into lib and plugins complete
Diffstat (limited to 'metawatch/metawatchpaintengine.cpp')
-rw-r--r--metawatch/metawatchpaintengine.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/metawatch/metawatchpaintengine.cpp b/metawatch/metawatchpaintengine.cpp
index 71ad452..58a7b9d 100644
--- a/metawatch/metawatchpaintengine.cpp
+++ b/metawatch/metawatchpaintengine.cpp
@@ -3,19 +3,37 @@
using namespace sowatch;
-MetaWatchPaintEngine::MetaWatchPaintEngine(MetaWatch* watch, QImage* image) :
- WatchPaintEngine(watch, image), _watch(watch),
- _imageRect(image->rect())
+MetaWatchPaintEngine::MetaWatchPaintEngine(MetaWatch* watch) :
+ WatchPaintEngine(watch), _watch(watch),
+ _imageRect(0, 0, MetaWatch::screenWidth, MetaWatch::screenHeight)
{
}
+bool MetaWatchPaintEngine::begin(QPaintDevice *pdev)
+{
+ _damaged = QRegion();
+ _watch = static_cast<MetaWatch*>(pdev);
+ _mode = _watch->paintTargetMode();
+
+ return _painter.begin(_watch->imageFor(_mode));
+}
+
+bool MetaWatchPaintEngine::end()
+{
+ bool ret = _painter.end();
+ if (ret) {
+ _watch->update(_mode, _damaged.rects().toList());
+ }
+ return ret;
+}
+
void MetaWatchPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
int i;
for (i = 0; i < rectCount; i++) {
const QRectF& r = rects[i];
if (_hasBrush && fillsEntireImage(r.toRect()) && (_isBrushBlack | _isBrushWhite)) {
- _watch->clear(_isBrushWhite);
+ _watch->clear(_mode, _isBrushBlack);
_damaged = QRegion();
continue;
}
@@ -38,7 +56,7 @@ void MetaWatchPaintEngine::drawRects(const QRect *rects, int rectCount)
for (i = 0; i < rectCount; i++) {
const QRect& r = rects[i];
if (_hasBrush && fillsEntireImage(r) && (_isBrushBlack | _isBrushWhite)) {
- _watch->clear(_isBrushWhite);
+ _watch->clear(_mode, _isBrushBlack);
_damaged = QRegion();
continue;
}