Fix performance regression in mirroring QBitmap

The recent split of qimage.cpp meant mirror_horizonal_bitmap had
to access the bitflip array using a function call. The function call
was placed in the inner loop, but should have been moved out of the loop
as it can not be inlined.

Change-Id: Id771b2fb7e6c2bfa59670ee96a857a529da13c0b
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
This commit is contained in:
Allan Sandfeld Jensen 2014-01-27 18:22:53 +01:00 committed by The Qt Project
parent b709d07c34
commit 433ea5eb0c

View File

@ -2729,12 +2729,13 @@ inline void mirrored_helper_loop_inplace(int w, int h, int dxi, int dxs, int dyi
inline void mirror_horizonal_bitmap(int w, int h, int dxs, uchar* data, int bpl, bool monolsb) inline void mirror_horizonal_bitmap(int w, int h, int dxs, uchar* data, int bpl, bool monolsb)
{ {
int shift = w % 8; int shift = w % 8;
const uchar* bitflip = qt_get_bitflip_array();
for (int y = h-1; y >= 0; y--) { for (int y = h-1; y >= 0; y--) {
quint8* a0 = (quint8*)(data + y*bpl); quint8* a0 = (quint8*)(data + y*bpl);
// Swap bytes // Swap bytes
quint8* a = a0+dxs; quint8* a = a0+dxs;
while (a >= a0) { while (a >= a0) {
*a = qt_get_bitflip_array()[*a]; *a = bitflip[*a];
a--; a--;
} }
// Shift bits if unaligned // Shift bits if unaligned