diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-28 22:18:29 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-28 22:18:29 (GMT) |
commit | 24e904b2ef438bafb24456f934ea93497f43f5c1 (patch) | |
tree | ff0d6918591b7ef96e0951dcdc70b34e9ec84b2f /src/gui | |
parent | 866813b6779a27e974c30d1023a5d734fa0318c9 (diff) | |
download | Qt-24e904b2ef438bafb24456f934ea93497f43f5c1.zip Qt-24e904b2ef438bafb24456f934ea93497f43f5c1.tar.gz Qt-24e904b2ef438bafb24456f934ea93497f43f5c1.tar.bz2 |
Further optimized fast scaling of ARGB8565 images onto RGB16 images.
This improves performance on embedded.
Reviewed-by: Samuel
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 10 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index f83ff7b..4bdaf0b 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -105,10 +105,10 @@ struct Blend_RGB16_on_RGB16_ConstAlpha { }; struct Blend_ARGB24_on_RGB16_SourceAlpha { - inline void write(quint16 *dst, qargb8565 src) { + inline void write(quint16 *dst, const qargb8565 &src) { const uint alpha = src.alpha(); if (alpha) { - quint16 s = qrgb565(src).rawValue(); + quint16 s = src.rawValue16(); if (alpha < 255) s += BYTE_MUL_RGB16(*dst, 255 - alpha); *dst = s; @@ -125,7 +125,7 @@ struct Blend_ARGB24_on_RGB16_SourceAndConstAlpha { src = src.byte_mul(src.alpha(m_alpha)); const uint alpha = src.alpha(); if (alpha) { - quint16 s = qrgb565(src).rawValue(); + quint16 s = src.rawValue16(); if (alpha < 255) s += BYTE_MUL_RGB16(*dst, 255 - alpha); *dst = s; diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 019402a..38fee8d 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -447,6 +447,7 @@ public: inline bool operator==(const qargb8565 &v) const; inline quint32 rawValue() const; + inline quint16 rawValue16() const; private: friend class qrgb565; @@ -463,7 +464,7 @@ public: inline explicit qrgb565(quint32p v); inline explicit qrgb565(quint32 v); - inline explicit qrgb565(qargb8565 v); + inline explicit qrgb565(const qargb8565 &v); inline operator quint32() const; inline operator quint16() const; @@ -569,6 +570,11 @@ quint32 qargb8565::rawValue() const return (data[2] << 16) | (data[1] << 8) | data[0]; } +quint16 qargb8565::rawValue16() const +{ + return (data[2] << 8) | data[1]; +} + qrgb565::qrgb565(quint32p v) { *this = qrgb565(quint32(v)); @@ -583,7 +589,7 @@ qrgb565::qrgb565(quint32 v) data = (r & 0xf800) | (g & 0x07e0)| (b & 0x001f); } -qrgb565::qrgb565(qargb8565 v) +qrgb565::qrgb565(const qargb8565 &v) { data = (v.data[2] << 8) | v.data[1]; } |