diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2010-04-09 09:24:43 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2010-04-09 11:31:20 (GMT) |
commit | 6a9e6f4780f5fc3aaf34f93c85de575f81c91e48 (patch) | |
tree | c2f49a8938ca7f5a53f5700c235d97d893b80b7b /src/gui/painting/qdrawhelper.cpp | |
parent | 0d1be2406cb58a51ef5a7271fbf5e191fe50ab91 (diff) | |
download | Qt-6a9e6f4780f5fc3aaf34f93c85de575f81c91e48.zip Qt-6a9e6f4780f5fc3aaf34f93c85de575f81c91e48.tar.gz Qt-6a9e6f4780f5fc3aaf34f93c85de575f81c91e48.tar.bz2 |
Speedup fetchTransformedBilinear in the fast_matrix case
3% faster on a trace from the qml samegame.
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/painting/qdrawhelper.cpp')
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 917b910..6561419 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -70,8 +70,10 @@ static uint gccBug(uint value) constants and structures */ -static const int fixed_scale = 1 << 16; -static const int half_point = 1 << 15; +enum { + fixed_scale = 1 << 16, + half_point = 1 << 15 +}; static const int buffer_size = 2048; struct LinearGradientValues @@ -695,11 +697,6 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * int y1 = (fy >> 16); int y2 = y1 + 1; - int distx = ((fx - (x1 << 16)) >> 8); - int disty = ((fy - (y1 << 16)) >> 8); - int idistx = 256 - distx; - int idisty = 256 - disty; - if (blendType == BlendTransformedBilinearTiled) { x1 %= image_width; x2 %= image_width; @@ -730,6 +727,11 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * uint bl = fetch(s2, x1, data->texture.colorTable); uint br = fetch(s2, x2, data->texture.colorTable); + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + int idistx = 256 - distx; + int idisty = 256 - disty; + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); |