[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace
From: Enrico Ros <rosenric () dei ! unipd ! it>
Date: 2007-08-17 6:35:20
Message-ID: 1187332520.147663.30038.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 701053 by eros:
Faster background drawing. Speeds up a lot zooming operations and general compositing.
M +3 -1 libs/plasma/svg.cpp
M +20 -2 plasma/plasma/desktopview.cpp
M +7 -0 plasma/plasma/plasmaapp.cpp
--- trunk/KDE/kdebase/workspace/libs/plasma/svg.cpp #701052:701053
@@ -135,7 +135,9 @@
renderer->render(&renderPainter, elementId);
}
renderPainter.end();
- QPixmapCache::insert( id, p );
+ bool inserted = QPixmapCache::insert( id, p );
+ if (!inserted)
+ kDebug() << "pixmap cache is too small for inserting" << id << "of size" << s;
}
void createRenderer()
--- trunk/KDE/kdebase/workspace/plasma/plasma/desktopview.cpp #701052:701053
@@ -137,11 +137,29 @@
void DesktopView::drawBackground(QPainter * painter, const QRectF & rect)
{
+ // avoid expensive operations to the painter if there is nothing to paint
+ if (!m_background && !m_bitmapBackground)
+ return;
+
+ // draw the background untransformed (saves lots of per-pixel-math)
+ painter->save();
+ painter->resetTransform();
+ // blit the background (saves all the per-pixel-products that blending does)
+ painter->setCompositionMode(QPainter::CompositionMode_Source);
+
if (m_background) {
- m_background->paint(painter, rect);
+ // Plasma::Svg doesn't support drawing only part of the image (it only
+ // supports drawing the whole image to a rect), so we blit to 0,0-w,h
+ m_background->paint(painter, 0, 0);
} else if (m_bitmapBackground) {
- painter->drawPixmap(rect, *m_bitmapBackground, rect);
+ // for pixmaps we draw only the exposed part (untransformed since the
+ // bitmapBackground already has the size of the viewport)
+ QRect exposedRect = mapFromScene(rect).boundingRect();
+ painter->drawPixmap(exposedRect, *m_bitmapBackground, exposedRect);
}
+
+ // restore transformation and composition mode
+ painter->restore();
}
void DesktopView::resizeEvent(QResizeEvent* event)
--- trunk/KDE/kdebase/workspace/plasma/plasma/plasmaapp.cpp #701052:701053
@@ -26,6 +26,7 @@
#include "appadaptor.h"
#include <unistd.h>
+#include <QPixmapCache>
#include <QTimer>
#include <QtDBus/QtDBus>
@@ -72,6 +73,12 @@
setCrashHandler();
}
+ // enlarge application pixmap cache (TODO: make this dependand on system
+ // memory and screen resolution. 8MB is ok for caching the background up
+ // to 1600x1200 resolution)
+ if (QPixmapCache::cacheLimit() < 8192)
+ QPixmapCache::setCacheLimit(8192);
+
m_root = new RootWidget();
m_root->setAsDesktop(KCmdLineArgs::parsedArgs()->isSet("desktop"));
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic