summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qdrawhelper_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-12-13 14:22:31 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-03-07 14:30:01 +0000
commit9fb73a01dd860a8a8e80945d5591a081256b14e0 (patch)
tree8d3ee58e24b51ad9c8cbf1a37c1c045b0f29d7b7 /src/gui/painting/qdrawhelper_p.h
parent4020829ac8fc27f28e75db905aa307ef2af63bfe (diff)
Use simple scaling for downscaling less than 2x
The simple scaling that only samples every input pixel once, can be used with downscaling < 2x as well if we just handle the case where the input can't be in the intermediate buffer. At the same time the handling of the intermediate buffer has been moved out of simple scale helper functions so the code can be shared and the AVX2 optimizations also used for non-argb32pm formats. Change-Id: I98d225ef8d4f2978480d09110c959b556c563b57 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/painting/qdrawhelper_p.h')
-rw-r--r--src/gui/painting/qdrawhelper_p.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index ebf215a3eb..bf395ca595 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1191,6 +1191,22 @@ inline uint comp_func_Plus_one_pixel(uint d, const uint s)
#undef MIX
#undef AMIX
+// must be multiple of 4 for easier SIMD implementations
+static Q_CONSTEXPR int BufferSize = 2048;
+
+// A buffer of intermediate results used by simple bilinear scaling.
+struct IntermediateBuffer
+{
+ // The idea is first to do the interpolation between the row s1 and the row s2
+ // into this intermediate buffer, then later interpolate between two pixel of this buffer.
+ //
+ // buffer_rb is a buffer of red-blue component of the pixel, in the form 0x00RR00BB
+ // buffer_ag is the alpha-green component of the pixel, in the form 0x00AA00GG
+ // +1 for the last pixel to interpolate with, and +1 for rounding errors.
+ quint32 buffer_rb[BufferSize+2];
+ quint32 buffer_ag[BufferSize+2];
+};
+
struct QDitherInfo {
int x;
int y;