summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorJens Bache-Wiig <jbache@trolltech.com>2010-06-02 10:58:17 (GMT)
committerJens Bache-Wiig <jbache@trolltech.com>2010-06-02 11:19:30 (GMT)
commit7644a925dab5400280228cd2f7381030368c6913 (patch)
tree8a75c4740c62a507de70a363cb6b0919601a926e /src/gui/painting
parent417f3a4ece9403d1eb37ce0ecdf74cf670bdd0ff (diff)
downloadQt-7644a925dab5400280228cd2f7381030368c6913.zip
Qt-7644a925dab5400280228cd2f7381030368c6913.tar.gz
Qt-7644a925dab5400280228cd2f7381030368c6913.tar.bz2
More Pixmap cache key optimizations
Reviewed-by: ogoffart
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbrush.cpp7
-rw-r--r--src/gui/painting/qdrawutil.cpp5
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp7
-rw-r--r--src/gui/painting/qpainter.cpp8
4 files changed, 19 insertions, 8 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index b468b11..d3061d8 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -48,6 +48,7 @@
#include "qline.h"
#include "qdebug.h"
#include <QtCore/qcoreapplication.h>
+#include "private/qstylehelper_p.h"
QT_BEGIN_NAMESPACE
@@ -96,9 +97,11 @@ const uchar *qt_patternForBrush(int brushStyle, bool invert)
QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
{
+
QPixmap pm;
- QString key = QLatin1String("$qt-brush$") + QString::number(brushStyle)
- + QString::number((int)invert);
+ QString key = QLatin1Literal("$qt-brush$")
+ % HexString<uint>(brushStyle)
+ % QLatin1Char(invert ? '1' : '0');
if (!QPixmapCache::find(key, pm)) {
pm = QBitmap::fromData(QSize(8, 8), qt_patternForBrush(brushStyle, invert),
QImage::Format_MonoLSB);
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 3ce95ef..11ea6d5 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -48,6 +48,7 @@
#include <private/qpaintengineex_p.h>
#include <qvarlengtharray.h>
#include <qmath.h>
+#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
@@ -1018,7 +1019,9 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs,
;
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
} else { // color pixmap, no mask
- QString k = QString::fromLatin1("$qt-drawitem-%1").arg(pm.cacheKey());
+ QString k = QLatin1Literal("$qt-drawitem")
+ % HexString<qint64>(pm.cacheKey());
+
if (!QPixmapCache::find(k, pm)) {
pm = pm.createHeuristicMask();
pm.setMask((QBitmap&)pm);
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index aef8b80..b8ad9b3 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -79,6 +79,8 @@
#include <private/qtessellator_p.h>
#endif
+#include <private/qstylehelper_p.h>
+
QT_BEGIN_NAMESPACE
extern Drawable qt_x11Handle(const QPaintDevice *pd);
@@ -224,7 +226,10 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = {
static QPixmap qt_patternForAlpha(uchar alpha, int screen)
{
QPixmap pm;
- QString key = QLatin1String("$qt-alpha-brush$") + QString::number(alpha) + QString::number(screen);
+ QString key = QLatin1Literal("$qt-alpha-brush$")
+ % HexString<uchar>(alpha)
+ % HexString<int>(screen);
+
if (!QPixmapCache::find(key, pm)) {
// #### why not use a mono image here????
QImage pattern(DITHER_SIZE, DITHER_SIZE, QImage::Format_ARGB32);
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index e460b7b..97f754d 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -72,6 +72,7 @@
#include <private/qmath_p.h>
#include <qstatictext.h>
#include <private/qstatictext_p.h>
+#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
@@ -6245,10 +6246,9 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
{
const qreal radiusBase = qMax(qreal(1), maxRadius);
- QString key = QLatin1String("WaveUnderline-");
- key += pen.color().name();
- key += QLatin1Char('-');
- key += QString::number(radiusBase);
+ QString key = QLatin1Literal("WaveUnderline-")
+ % pen.color().name()
+ % HexString<qreal>(radiusBase);
QPixmap pixmap;
if (QPixmapCache::find(key, pixmap))