diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2014-01-15 15:02:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-16 03:00:45 +0100 |
commit | 407eee51e6ce261b51ecacdcb9a4e2ff6364699a (patch) | |
tree | 2dcec72442f176422a7a2bb9f8bd8919c6157ea7 /src/gui/painting/qdrawhelper.cpp | |
parent | 93a895a41a55e286e8393c5f8566ce6332b49277 (diff) |
Optimize INV_PREMUL
Our inverse premultiply is rather unoptimized. It's major weakness is
using three divide operation which are the slowest integer operations.
This patch reduces the three divisions to just one but using an
approximation that is accurate for all uchar values.
The patch also adds a general short-cut for alpha==255.
Together these improvements makes it 2 to 16 times faster depending on
how many 0 and 255 alpha values are encountered.
Change-Id: I96d7098a1bc320793b0d0526637acd1fdb5a43eb
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 141688b826..8aef64c780 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -274,7 +274,7 @@ static const uint *QT_FASTCALL convertFromARGB32PM(uint *buffer, const uint *src if (!layout->premultiplied) { for (int i = 0; i < count; ++i) - buffer[i] = qAlpha(src[i]) == 255 ? src[i] : INV_PREMUL(src[i]); + buffer[i] = INV_PREMUL(src[i]); src = buffer; } for (int i = 0; i < count; ++i) { |