diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2011-09-26 02:36:09 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2011-09-26 02:36:09 +0200 |
commit | 0822b88738e00625efd27ccca9119885272924d2 (patch) | |
tree | f379817602cc23dd829c0aa4751b6b5edc348923 /libsowatch/watchpaintengine.cpp | |
parent | cf5d24b94d96b722c6d76c2225293a56a50d3c2b (diff) | |
download | sowatch-0822b88738e00625efd27ccca9119885272924d2.tar.gz sowatch-0822b88738e00625efd27ccca9119885272924d2.zip |
fixing bugs found during use ;)
Diffstat (limited to 'libsowatch/watchpaintengine.cpp')
-rw-r--r-- | libsowatch/watchpaintengine.cpp | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/libsowatch/watchpaintengine.cpp b/libsowatch/watchpaintengine.cpp index 6c509cb..90ad8bf 100644 --- a/libsowatch/watchpaintengine.cpp +++ b/libsowatch/watchpaintengine.cpp @@ -1,19 +1,40 @@ #include <QtCore/QDebug> #include <math.h> -#include "watch.h" #include "watchpaintengine.h" using namespace sowatch; -WatchPaintEngine::WatchPaintEngine(Watch* watch) +WatchPaintEngine::WatchPaintEngine() : QPaintEngine(QPaintEngine::AllFeatures), - _watch(watch), _painter(), - _hasPen(false), _hasBrush(false), _clipEnabled(false) + _painter() { } +WatchPaintEngine::~WatchPaintEngine() +{ + +} + +bool WatchPaintEngine::begin(QPaintDevice *pdev) +{ + _damaged = QRegion(); + _area = QRect(0, 0, pdev->width(), pdev->height()); + _hasPen = false; + _penWidth = 0.0; + _hasBrush = false; + _clipEnabled = false; + _clipRegion = _area; + + return _painter.begin(pdev); +} + +bool WatchPaintEngine::end() +{ + return _painter.end(); +} + void WatchPaintEngine::damageMappedRect(const QRect &r) { if (_clipEnabled) { @@ -57,7 +78,7 @@ void WatchPaintEngine::updateClipRegion(const QRegion& region, Qt::ClipOperation switch(op) { case Qt::NoClip: _clipEnabled = false; - _clipRegion = QRegion(0, 0, _watch->width(), _watch->height()); + _clipRegion = _area; break; case Qt::ReplaceClip: _clipEnabled = true; |