summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper_p.h
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2016-02-08 15:02:17 +0100
committerBłażej Szczygieł <spaz16@wp.pl>2016-02-12 16:20:36 +0000
commit8dc55367ca3993f465f270ef79c2cb212d821d0c (patch)
treed9e83ceb9786575f2f5a7b826fd4ef3836039b33 /src/gui/painting/qdrawhelper_p.h
parent2ee75416169ba9cda8a021b119c4c217599d03b9 (diff)
QtGui: Avoid rgba64->rgba32 conversion on every pixel in gradient
Convert rgba64 color table to a new rgb32 color table only once. Use this cache when required. This patch can 2x speed up gradient painting using 32bit color format. Task-number: QTBUG-50930 Change-Id: I9212e01e397c2e0127cdf3070cc49880a2d8df88 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r--src/gui/painting/qdrawhelper_p.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 1ff19f4e04..ff98d186c5 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -268,7 +268,8 @@ struct QGradientData
#define GRADIENT_STOPTABLE_SIZE 1024
#define GRADIENT_STOPTABLE_SIZE_SHIFT 10
- QRgba64* colorTable; //[GRADIENT_STOPTABLE_SIZE];
+ const QRgba64 *colorTable64; //[GRADIENT_STOPTABLE_SIZE];
+ const QRgb *colorTable32; //[GRADIENT_STOPTABLE_SIZE];
uint alphaColor : 1;
};
@@ -376,13 +377,13 @@ static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
{
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
- return data->colorTable[qt_gradient_clamp(data, ipos)].toArgb32();
+ return data->colorTable32[qt_gradient_clamp(data, ipos)];
}
static inline const QRgba64& qt_gradient_pixel64(const QGradientData *data, qreal pos)
{
int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
- return data->colorTable[qt_gradient_clamp(data, ipos)];
+ return data->colorTable64[qt_gradient_clamp(data, ipos)];
}
static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
@@ -550,7 +551,7 @@ public:
delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
for (int i = 0; i < 4; ++i) \
- *buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable[index_vec.i[i]].toArgb32(); \
+ *buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable32[index_vec.i[i]]; \
}
#define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \