From 499702455e21df61fc7a91d3b3c2b1ffaa0d4246 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Mon, 30 Mar 2009 10:43:51 +0200 Subject: 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 --- src/gui/embedded/qscreen_qws.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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) -- cgit v0.12