diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-17 02:29:28 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-17 02:29:28 +0200 |
commit | 9c44782c5eab5635ca6adf4717409bf2ffb6c694 (patch) | |
tree | 99f774bccb6e964864168b346155bbd5a52bf3b2 /libsowatch/graphicswatchlet.cpp | |
parent | f9ac9d207025fb8d40d1be753cde78beb77aa202 (diff) | |
download | sowatch-9c44782c5eab5635ca6adf4717409bf2ffb6c694.tar.gz sowatch-9c44782c5eab5635ca6adf4717409bf2ffb6c694.zip |
new nekowatchlet and minor graphics/performance changes
Diffstat (limited to 'libsowatch/graphicswatchlet.cpp')
-rw-r--r-- | libsowatch/graphicswatchlet.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/libsowatch/graphicswatchlet.cpp b/libsowatch/graphicswatchlet.cpp index 2d58ff6..08441b0 100644 --- a/libsowatch/graphicswatchlet.cpp +++ b/libsowatch/graphicswatchlet.cpp @@ -7,8 +7,10 @@ using namespace sowatch; -GraphicsWatchlet::GraphicsWatchlet(WatchServer* server, const QString& id) : - Watchlet(server, id), _scene(0), _frameTimer(), _damaged() +GraphicsWatchlet::GraphicsWatchlet(WatchServer* server, const QString& id) + : Watchlet(server, id), + _scene(0), _frameTimer(), + _fullUpdateMode(false), _damaged() { _frameTimer.setSingleShot(true); connect(&_frameTimer, SIGNAL(timeout()), SLOT(frameTimeout())); @@ -35,6 +37,16 @@ void GraphicsWatchlet::setScene(QGraphicsScene *scene) } } +bool GraphicsWatchlet::fullUpdateMode() const +{ + return _fullUpdateMode; +} + +void GraphicsWatchlet::setFullUpdateMode(bool fullUpdateMode) +{ + _fullUpdateMode = fullUpdateMode; +} + QRectF GraphicsWatchlet::sceneRect() const { if (_scene) { @@ -56,12 +68,16 @@ QRect GraphicsWatchlet::viewportRect() const void GraphicsWatchlet::sceneChanged(const QList<QRectF> &rects) { + // Only consider scene updates if the watchlet is active if (_active) { - // Only consider scene updates if the watchlet is active QRect viewport = viewportRect(); - foreach(const QRectF& frect, rects) { - QRect rect = frect.toAlignedRect() & viewport; - _damaged += rect; + if (_fullUpdateMode) { + _damaged += viewport; + } else { + foreach(const QRectF& frect, rects) { + QRect rect = frect.toAlignedRect() & viewport; + _damaged += rect; + } } // Start frame timer if we got new data |