summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2009-03-30 08:43:51 (GMT)
committerPaul Olav Tvete <paul.tvete@nokia.com>2009-08-21 08:36:19 (GMT)
commit499702455e21df61fc7a91d3b3c2b1ffaa0d4246 (patch)
treedb29024c267c1bc51959eaa86af008b0d560eece
parent1c3ba5fd9e16ef084a2e17380c4d635c87b2db26 (diff)
downloadQt-499702455e21df61fc7a91d3b3c2b1ffaa0d4246.zip
Qt-499702455e21df61fc7a91d3b3c2b1ffaa0d4246.tar.gz
Qt-499702455e21df61fc7a91d3b3c2b1ffaa0d4246.tar.bz2
Convert the screen cursor image to native premultiplied format
The default cursor on QWS is loaded as an 8bit QImage. Blitting that one is really slow so we better convert the image into a fast format before using it. Based on a patch by Lars. Reviewed-by: Tom
-rw-r--r--src/gui/embedded/qscreen_qws.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp
index 25550b0..7f3af17 100644
--- a/src/gui/embedded/qscreen_qws.cpp
+++ b/src/gui/embedded/qscreen_qws.cpp
@@ -181,7 +181,27 @@ void QScreenCursor::set(const QImage &image, int hotx, int hoty)
const QRect r = boundingRect();
hotspot = QPoint(hotx, hoty);
- cursor = image;
+ // These are in almost all cases the fastest formats to blend
+ QImage::Format f;
+ switch (qt_screen->depth()) {
+ case 12:
+ f = QImage::Format_ARGB4444_Premultiplied;
+ break;
+ case 15:
+ f = QImage::Format_ARGB8555_Premultiplied;
+ break;
+ case 16:
+ f = QImage::Format_ARGB8565_Premultiplied;
+ break;
+ case 18:
+ f = QImage::Format_ARGB6666_Premultiplied;
+ break;
+ default:
+ f = QImage::Format_ARGB32_Premultiplied;
+ }
+
+ cursor = image.convertToFormat(f);
+
size = image.size();
if (enable && !hwaccel)