summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyle_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qstyle_p.h')
-rw-r--r--src/widgets/styles/qstyle_p.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index 66cd7eed10..85e8e54b16 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -72,6 +72,15 @@ public:
QStyle *proxyStyle;
};
+inline QImage styleCacheImage(const QSize &size)
+{
+ return QImage(size, QImage::Format_ARGB32_Premultiplied);
+}
+
+inline QPixmap styleCachePixmap(const QSize &size)
+{
+ return QPixmap(size);
+}
#define BEGIN_STYLE_PIXMAPCACHE(a) \
QRect rect = option->rect; \
@@ -80,13 +89,14 @@ public:
QPainter *p = painter; \
QString unique = QStyleHelper::uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = txType <= QTransform::TxTranslate; \
+ bool doPixmapCache = (txType <= QTransform::TxTranslate) \
+ || (painter->deviceTransform().type() == QTransform::TxScale); \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
if (doPixmapCache) { \
rect.setRect(0, 0, option->rect.width(), option->rect.height()); \
- imageCache = QImage(option->rect.size(), QImage::Format_ARGB32_Premultiplied); \
+ imageCache = styleCacheImage(option->rect.size()); \
imageCache.fill(0); \
p = new QPainter(&imageCache); \
}