Qt 4.8
Classes | Macros | Functions | Variables
qmemrotate.cpp File Reference
#include "private/qmemrotate_p.h"

Go to the source code of this file.

Classes

struct  qrgb_gl_rgba
 

Macros

#define QT_IMPL_MEMROTATE(srctype, desttype)
 
#define QT_IMPL_SIMPLE_MEMROTATE(srctype, desttype)
 

Functions

void qt_memrotate180_16 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
void qt_memrotate180_32 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate180_template (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
void qt_memrotate270_16 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
void qt_memrotate270_32 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_cachedRead (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_cachedWrite (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_packing (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_template (const SRC *src, int srcWidth, int srcHeight, int srcStride, DST *dest, int dstStride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_tiled (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_tiled_unpacked (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
void qt_memrotate90_16 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
void qt_memrotate90_32 (const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_cachedRead (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_cachedWrite (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
void Q_GUI_EXPORT qt_memrotate90_gl (const quint32 *src, int srcWidth, int srcHeight, int srcStride, quint32 *dest, int dstStride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_packing (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_template (const SRC *src, int srcWidth, int srcHeight, int srcStride, DST *dest, int dstStride)
 
template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint18, quint32 > (const quint32 *src, int srcWidth, int srcHeight, int srcStride, quint18 *dest, int dstStride)
 
template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint24, quint24 > (const quint24 *src, int srcWidth, int srcHeight, int srcStride, quint24 *dest, int dstStride)
 
template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint24, quint32 > (const quint32 *src, int srcWidth, int srcHeight, int srcStride, quint24 *dest, int dstStride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_tiled (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 
template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_tiled_unpacked (const SRC *src, int w, int h, int sstride, DST *dest, int dstride)
 

Variables

struct qrgb_gl_rgba Q_PACKED
 
MemRotateFunc qMemRotateFunctions [QImage::NImageFormats][3]
 
static const int tileSize = 32
 

Macro Definition Documentation

◆ QT_IMPL_MEMROTATE

#define QT_IMPL_MEMROTATE (   srctype,
  desttype 
)
Value:
void qt_memrotate90(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate90_template(src, w, h, sstride, dest, dstride); \
} \
void qt_memrotate180(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate180_template(src, w, h, sstride, dest, dstride); \
} \
void qt_memrotate270(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate270_template(src, w, h, sstride, dest, dstride); \
}
void Q_GUI_QWS_EXPORT qt_memrotate180(const quint32 *, int, int, int, quint32 *, int)
void Q_GUI_EXPORT qt_memrotate90(const quint32 *, int, int, int, quint32 *, int)
void Q_GUI_QWS_EXPORT qt_memrotate270(const quint32 *, int, int, int, quint32 *, int)

Definition at line 514 of file qmemrotate.cpp.

◆ QT_IMPL_SIMPLE_MEMROTATE

#define QT_IMPL_SIMPLE_MEMROTATE (   srctype,
  desttype 
)
Value:
void qt_memrotate90(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate90_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \
} \
void qt_memrotate180(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate180_template(src, w, h, sstride, dest, dstride); \
} \
void qt_memrotate270(const srctype *src, int w, int h, int sstride, \
desttype *dest, int dstride) \
{ \
qt_memrotate270_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \
}
void Q_GUI_QWS_EXPORT qt_memrotate180(const quint32 *, int, int, int, quint32 *, int)
void Q_GUI_EXPORT qt_memrotate90(const quint32 *, int, int, int, quint32 *, int)
void Q_GUI_QWS_EXPORT qt_memrotate270(const quint32 *, int, int, int, quint32 *, int)

Definition at line 531 of file qmemrotate.cpp.

Function Documentation

◆ qt_memrotate180_16()

void qt_memrotate180_16 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 602 of file qmemrotate.cpp.

603 {
604  qt_memrotate180((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);
605 }
void Q_GUI_QWS_EXPORT qt_memrotate180(const quint32 *, int, int, int, quint32 *, int)
unsigned short ushort
Definition: qglobal.h:995

◆ qt_memrotate180_32()

void qt_memrotate180_32 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 617 of file qmemrotate.cpp.

618 {
619  qt_memrotate180((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);
620 }
void Q_GUI_QWS_EXPORT qt_memrotate180(const quint32 *, int, int, int, quint32 *, int)
unsigned int uint
Definition: qglobal.h:996

◆ qt_memrotate180_template()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate180_template ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 409 of file qmemrotate.cpp.

412 {
413  const char *s = (const char*)(src) + (h - 1) * sstride;
414  for (int y = h - 1; y >= 0; --y) {
415  DST *d = reinterpret_cast<DST*>((char *)(dest) + (h - y - 1) * dstride);
416  src = reinterpret_cast<const SRC*>(s);
417  for (int x = w - 1; x >= 0; --x) {
418  d[w - x - 1] = qt_colorConvert<DST,SRC>(src[x], 0);
419  }
420  s -= sstride;
421  }
422 }
double d
Definition: qnumeric_p.h:62

◆ qt_memrotate270_16()

void qt_memrotate270_16 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 607 of file qmemrotate.cpp.

608 {
609  qt_memrotate270((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);
610 }
unsigned short ushort
Definition: qglobal.h:995
void Q_GUI_QWS_EXPORT qt_memrotate270(const quint32 *, int, int, int, quint32 *, int)

◆ qt_memrotate270_32()

void qt_memrotate270_32 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 622 of file qmemrotate.cpp.

623 {
624  qt_memrotate270((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);
625 }
unsigned int uint
Definition: qglobal.h:996
void Q_GUI_QWS_EXPORT qt_memrotate270(const quint32 *, int, int, int, quint32 *, int)

◆ qt_memrotate270_cachedRead()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_cachedRead ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 74 of file qmemrotate.cpp.

77 {
78  const char *s = reinterpret_cast<const char*>(src);
79  char *d = reinterpret_cast<char*>(dest);
80  s += (h - 1) * sstride;
81  for (int y = h - 1; y >= 0; --y) {
82  src = reinterpret_cast<const SRC*>(s);
83  for (int x = 0; x < w; ++x) {
84  DST *destline = reinterpret_cast<DST*>(d + x * dstride);
85  destline[h - y - 1] = qt_colorConvert<DST,SRC>(src[x], 0);
86  }
87  s -= sstride;
88  }
89 }
double d
Definition: qnumeric_p.h:62

◆ qt_memrotate270_cachedWrite()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_cachedWrite ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 108 of file qmemrotate.cpp.

111 {
112  for (int x = 0; x < w; ++x) {
113  DST *d = dest + x * dstride;
114  for (int y = h - 1; y >= 0; --y) {
115  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
116  }
117  }
118 }
double d
Definition: qnumeric_p.h:62

◆ qt_memrotate270_packing()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_packing ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 168 of file qmemrotate.cpp.

171 {
172  sstride /= sizeof(SRC);
173  dstride /= sizeof(DST);
174 
175  const int pack = sizeof(quint32) / sizeof(DST);
176  const int unaligned = int((long(dest) & (sizeof(quint32)-1))) / sizeof(DST);
177 
178  for (int x = 0; x < w; ++x) {
179  int y = h - 1;
180 
181  for (int i = 0; i < unaligned; ++i) {
182  dest[x * dstride + h - y - 1]
183  = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
184  --y;
185  }
186 
187  quint32 *d = reinterpret_cast<quint32*>(dest + x * dstride
188  + unaligned);
189  const int rest = (h - unaligned) % pack;
190  while (y > rest) {
191  quint32 c = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
192  for (int i = 1; i < pack; ++i) {
193  c |= qt_colorConvert<DST,SRC>(src[(y - i) * sstride + x], 0)
194  << (sizeof(int) * 8 / pack * i);
195  }
196  *d++ = c;
197  y -= pack;
198  }
199  while (y >= 0) {
200  dest[x * dstride + h - y - 1]
201  = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
202  --y;
203  }
204  }
205 }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
unsigned int quint32
Definition: qglobal.h:938

◆ qt_memrotate270_template()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_template ( const SRC *  src,
int  srcWidth,
int  srcHeight,
int  srcStride,
DST *  dest,
int  dstStride 
)
inline

Definition at line 425 of file qmemrotate.cpp.

428 {
429 #if QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDREAD
430  qt_memrotate270_cachedRead<DST,SRC>(src, srcWidth, srcHeight, srcStride,
431  dest, dstStride);
432 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDWRITE
433  qt_memrotate270_cachedWrite<DST,SRC>(src, srcWidth, srcHeight, srcStride,
434  dest, dstStride);
435 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_PACKING
436  qt_memrotate270_packing<DST,SRC>(src, srcWidth, srcHeight, srcStride,
437  dest, dstStride);
438 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_TILED
439  qt_memrotate270_tiled_unpacked<DST,SRC>(src, srcWidth, srcHeight,
440  srcStride,
441  dest, dstStride);
442 #endif
443 }

◆ qt_memrotate270_tiled()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_tiled ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 299 of file qmemrotate.cpp.

302 {
303  sstride /= sizeof(SRC);
304  dstride /= sizeof(DST);
305 
306  const int pack = sizeof(quint32) / sizeof(DST);
307  const int unaligned =
308  qMin(uint((long(dest) & (sizeof(quint32)-1)) / sizeof(DST)), uint(h));
309  const int restX = w % tileSize;
310  const int restY = (h - unaligned) % tileSize;
311  const int unoptimizedY = restY % pack;
312  const int numTilesX = w / tileSize + (restX > 0);
313  const int numTilesY = (h - unaligned) / tileSize + (restY >= pack);
314 
315  for (int tx = 0; tx < numTilesX; ++tx) {
316  const int startx = tx * tileSize;
317  const int stopx = qMin(startx + tileSize, w);
318 
319  if (unaligned) {
320  for (int x = startx; x < stopx; ++x) {
321  DST *d = dest + x * dstride;
322  for (int y = h - 1; y >= h - unaligned; --y) {
323  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
324  }
325  }
326  }
327 
328  for (int ty = 0; ty < numTilesY; ++ty) {
329  const int starty = h - 1 - unaligned - ty * tileSize;
330  const int stopy = qMax(starty - tileSize, unoptimizedY);
331 
332  for (int x = startx; x < stopx; ++x) {
333  quint32 *d = reinterpret_cast<quint32*>(dest + x * dstride
334  + h - 1 - starty);
335  for (int y = starty; y > stopy; y -= pack) {
336  quint32 c = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
337  for (int i = 1; i < pack; ++i) {
338  const int shift = (sizeof(int) * 8 / pack * i);
339  const DST color = qt_colorConvert<DST,SRC>(src[(y - i) * sstride + x], 0);
340  c |= color << shift;
341  }
342  *d++ = c;
343  }
344  }
345  }
346  if (unoptimizedY) {
347  const int starty = unoptimizedY - 1;
348  for (int x = startx; x < stopx; ++x) {
349  DST *d = dest + x * dstride + h - 1 - starty;
350  for (int y = starty; y >= 0; --y) {
351  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
352  }
353  }
354  }
355  }
356 }
double d
Definition: qnumeric_p.h:62
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
Definition: qbezier.cpp:289
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
unsigned int uint
Definition: qglobal.h:996
unsigned int quint32
Definition: qglobal.h:938
static const int tileSize
Definition: qmemrotate.cpp:47

◆ qt_memrotate270_tiled_unpacked()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate270_tiled_unpacked ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 359 of file qmemrotate.cpp.

362 {
363  const int numTilesX = (w + tileSize - 1) / tileSize;
364  const int numTilesY = (h + tileSize - 1) / tileSize;
365 
366  for (int tx = 0; tx < numTilesX; ++tx) {
367  const int startx = tx * tileSize;
368  const int stopx = qMin(startx + tileSize, w);
369 
370  for (int ty = 0; ty < numTilesY; ++ty) {
371  const int starty = h - 1 - ty * tileSize;
372  const int stopy = qMax(starty - tileSize, 0);
373 
374  for (int x = startx; x < stopx; ++x) {
375  DST *d = (DST*)((char*)dest + x * dstride) + h - 1 - starty;
376  const char *s = (const char*)(src + x) + starty * sstride;
377  for (int y = starty; y >= stopy; --y) {
378  *d++ = qt_colorConvert<DST,SRC>(*(const SRC*)s, 0);
379  s -= sstride;
380  }
381  }
382  }
383  }
384 }
double d
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static const int tileSize
Definition: qmemrotate.cpp:47

◆ qt_memrotate90_16()

void qt_memrotate90_16 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 597 of file qmemrotate.cpp.

598 {
599  qt_memrotate90((const ushort *)srcPixels, w, h, sbpl, (ushort *)destPixels, dbpl);
600 }
void Q_GUI_EXPORT qt_memrotate90(const quint32 *, int, int, int, quint32 *, int)
unsigned short ushort
Definition: qglobal.h:995

◆ qt_memrotate90_32()

void qt_memrotate90_32 ( const uchar srcPixels,
int  w,
int  h,
int  sbpl,
uchar destPixels,
int  dbpl 
)

Definition at line 612 of file qmemrotate.cpp.

613 {
614  qt_memrotate90((const uint *)srcPixels, w, h, sbpl, (uint *)destPixels, dbpl);
615 }
void Q_GUI_EXPORT qt_memrotate90(const quint32 *, int, int, int, quint32 *, int)
unsigned int uint
Definition: qglobal.h:996

◆ qt_memrotate90_cachedRead()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_cachedRead ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 57 of file qmemrotate.cpp.

60 {
61  const char *s = reinterpret_cast<const char*>(src);
62  char *d = reinterpret_cast<char*>(dest);
63  for (int y = 0; y < h; ++y) {
64  for (int x = w - 1; x >= 0; --x) {
65  DST *destline = reinterpret_cast<DST*>(d + (w - x - 1) * dstride);
66  destline[y] = qt_colorConvert<DST,SRC>(src[x], 0);
67  }
68  s += sstride;
69  src = reinterpret_cast<const SRC*>(s);
70  }
71 }
double d
Definition: qnumeric_p.h:62

◆ qt_memrotate90_cachedWrite()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_cachedWrite ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 94 of file qmemrotate.cpp.

97 {
98  for (int x = w - 1; x >= 0; --x) {
99  DST *d = dest + (w - x - 1) * dstride;
100  for (int y = 0; y < h; ++y) {
101  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
102  }
103  }
104 
105 }
double d
Definition: qnumeric_p.h:62

◆ qt_memrotate90_gl()

void Q_GUI_EXPORT qt_memrotate90_gl ( const quint32 src,
int  srcWidth,
int  srcHeight,
int  srcStride,
quint32 dest,
int  dstStride 
)

Definition at line 591 of file qmemrotate.cpp.

Referenced by nextMultiple(), and QGLPixmapBlurFilter::processGL().

593 {
594  qt_memrotate90_template(src, srcWidth, srcHeight, srcStride, reinterpret_cast<qrgb_gl_rgba *>(dest), dstStride);
595 }
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_template(const SRC *src, int srcWidth, int srcHeight, int srcStride, DST *dest, int dstStride)
Definition: qmemrotate.cpp:389

◆ qt_memrotate90_packing()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_packing ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 127 of file qmemrotate.cpp.

130 {
131  sstride /= sizeof(SRC);
132  dstride /= sizeof(DST);
133 
134  const int pack = sizeof(quint32) / sizeof(DST);
135  const int unaligned = int((long(dest) & (sizeof(quint32)-1))) / sizeof(DST);
136 
137  for (int x = w - 1; x >= 0; --x) {
138  int y = 0;
139 
140  for (int i = 0; i < unaligned; ++i) {
141  dest[(w - x - 1) * dstride + y]
142  = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
143  ++y;
144  }
145 
146  quint32 *d = reinterpret_cast<quint32*>(dest + (w - x - 1) * dstride
147  + unaligned);
148  const int rest = (h - unaligned) % pack;
149  while (y < h - rest) {
150  quint32 c = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
151  for (int i = 1; i < pack; ++i) {
152  c |= qt_colorConvert<DST,SRC>(src[(y + i) * sstride + x], 0)
153  << (sizeof(int) * 8 / pack * i);
154  }
155  *d++ = c;
156  y += pack;
157  }
158 
159  while (y < h) {
160  dest[(w - x - 1) * dstride + y]
161  = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
162  ++y;
163  }
164  }
165 }
double d
Definition: qnumeric_p.h:62
unsigned char c[8]
Definition: qnumeric_p.h:62
unsigned int quint32
Definition: qglobal.h:938

◆ qt_memrotate90_template()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_template ( const SRC *  src,
int  srcWidth,
int  srcHeight,
int  srcStride,
DST *  dest,
int  dstStride 
)
inline

Definition at line 389 of file qmemrotate.cpp.

Referenced by qt_memrotate90_gl().

392 {
393 #if QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDREAD
394  qt_memrotate90_cachedRead<DST,SRC>(src, srcWidth, srcHeight, srcStride,
395  dest, dstStride);
396 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDWRITE
397  qt_memrotate90_cachedWrite<DST,SRC>(src, srcWidth, srcHeight, srcStride,
398  dest, dstStride);
399 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_PACKING
400  qt_memrotate90_packing<DST,SRC>(src, srcWidth, srcHeight, srcStride,
401  dest, dstStride);
402 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_TILED
403  qt_memrotate90_tiled<DST,SRC>(src, srcWidth, srcHeight, srcStride,
404  dest, dstStride);
405 #endif
406 }

◆ qt_memrotate90_template< quint18, quint32 >()

template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint18, quint32 > ( const quint32 src,
int  srcWidth,
int  srcHeight,
int  srcStride,
quint18 dest,
int  dstStride 
)
inline

Definition at line 493 of file qmemrotate.cpp.

496 {
497 #if QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDREAD
498  qt_memrotate90_cachedRead<quint18,quint32>(src, srcWidth, srcHeight,
499  srcStride, dest, dstStride);
500 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDWRITE
501  qt_memrotate90_cachedWrite<quint18,quint32>(src, srcWidth, srcHeight,
502  srcStride, dest, dstStride);
503 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_PACKING
504  // packed algorithm not implemented
505  qt_memrotate90_cachedRead<quint18,quint32>(src, srcWidth, srcHeight,
506  srcStride, dest, dstStride);
507 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_TILED
508  // packed algorithm not implemented
509  qt_memrotate90_tiled_unpacked<quint18,quint32>(src, srcWidth, srcHeight,
510  srcStride, dest, dstStride);
511 #endif
512 }

◆ qt_memrotate90_template< quint24, quint24 >()

template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint24, quint24 > ( const quint24 src,
int  srcWidth,
int  srcHeight,
int  srcStride,
quint24 dest,
int  dstStride 
)
inline

Definition at line 447 of file qmemrotate.cpp.

450 {
451 #if QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDREAD
452  qt_memrotate90_cachedRead<quint24,quint24>(src, srcWidth, srcHeight,
453  srcStride, dest, dstStride);
454 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDWRITE
455  qt_memrotate90_cachedWrite<quint24,quint24>(src, srcWidth, srcHeight,
456  srcStride, dest, dstStride);
457 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_PACKING
458  // packed algorithm not implemented
459  qt_memrotate90_cachedRead<quint24,quint24>(src, srcWidth, srcHeight,
460  srcStride, dest, dstStride);
461 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_TILED
462  // packed algorithm not implemented
463  qt_memrotate90_tiled_unpacked<quint24,quint24>(src, srcWidth, srcHeight,
464  srcStride, dest, dstStride);
465 #endif
466 }

◆ qt_memrotate90_template< quint24, quint32 >()

template<>
Q_STATIC_TEMPLATE_SPECIALIZATION void qt_memrotate90_template< quint24, quint32 > ( const quint32 src,
int  srcWidth,
int  srcHeight,
int  srcStride,
quint24 dest,
int  dstStride 
)
inline

Definition at line 470 of file qmemrotate.cpp.

473 {
474 #if QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDREAD
475  qt_memrotate90_cachedRead<quint24,quint32>(src, srcWidth, srcHeight,
476  srcStride, dest, dstStride);
477 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_CACHEDWRITE
478  qt_memrotate90_cachedWrite<quint24,quint32>(src, srcWidth, srcHeight,
479  srcStride, dest, dstStride);
480 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_PACKING
481  // packed algorithm not implemented
482  qt_memrotate90_cachedRead<quint24,quint32>(src, srcWidth, srcHeight,
483  srcStride, dest, dstStride);
484 #elif QT_ROTATION_ALGORITHM == QT_ROTATION_TILED
485  // packed algorithm not implemented
486  qt_memrotate90_tiled_unpacked<quint24,quint32>(src, srcWidth, srcHeight,
487  srcStride, dest, dstStride);
488 #endif
489 }

◆ qt_memrotate90_tiled()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_tiled ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 211 of file qmemrotate.cpp.

214 {
215  sstride /= sizeof(SRC);
216  dstride /= sizeof(DST);
217 
218  const int pack = sizeof(quint32) / sizeof(DST);
219  const int unaligned =
220  qMin(uint((quintptr(dest) & (sizeof(quint32)-1)) / sizeof(DST)), uint(h));
221  const int restX = w % tileSize;
222  const int restY = (h - unaligned) % tileSize;
223  const int unoptimizedY = restY % pack;
224  const int numTilesX = w / tileSize + (restX > 0);
225  const int numTilesY = (h - unaligned) / tileSize + (restY >= pack);
226 
227  for (int tx = 0; tx < numTilesX; ++tx) {
228  const int startx = w - tx * tileSize - 1;
229  const int stopx = qMax(startx - tileSize, 0);
230 
231  if (unaligned) {
232  for (int x = startx; x >= stopx; --x) {
233  DST *d = dest + (w - x - 1) * dstride;
234  for (int y = 0; y < unaligned; ++y) {
235  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
236  }
237  }
238  }
239 
240  for (int ty = 0; ty < numTilesY; ++ty) {
241  const int starty = ty * tileSize + unaligned;
242  const int stopy = qMin(starty + tileSize, h - unoptimizedY);
243 
244  for (int x = startx; x >= stopx; --x) {
245  quint32 *d = reinterpret_cast<quint32*>(dest + (w - x - 1) * dstride + starty);
246  for (int y = starty; y < stopy; y += pack) {
247  quint32 c = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
248  for (int i = 1; i < pack; ++i) {
249  const int shift = (sizeof(int) * 8 / pack * i);
250  const DST color = qt_colorConvert<DST,SRC>(src[(y + i) * sstride + x], 0);
251  c |= color << shift;
252  }
253  *d++ = c;
254  }
255  }
256  }
257 
258  if (unoptimizedY) {
259  const int starty = h - unoptimizedY;
260  for (int x = startx; x >= stopx; --x) {
261  DST *d = dest + (w - x - 1) * dstride + starty;
262  for (int y = starty; y < h; ++y) {
263  *d++ = qt_colorConvert<DST,SRC>(src[y * sstride + x], 0);
264  }
265  }
266  }
267  }
268 }
double d
Definition: qnumeric_p.h:62
static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qreal threshold)
Definition: qbezier.cpp:289
QIntegerForSizeof< void * >::Unsigned quintptr
Definition: qglobal.h:986
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
unsigned int uint
Definition: qglobal.h:996
unsigned int quint32
Definition: qglobal.h:938
static const int tileSize
Definition: qmemrotate.cpp:47

◆ qt_memrotate90_tiled_unpacked()

template<class DST , class SRC >
Q_STATIC_TEMPLATE_FUNCTION void qt_memrotate90_tiled_unpacked ( const SRC *  src,
int  w,
int  h,
int  sstride,
DST *  dest,
int  dstride 
)
inline

Definition at line 271 of file qmemrotate.cpp.

274 {
275  const int numTilesX = (w + tileSize - 1) / tileSize;
276  const int numTilesY = (h + tileSize - 1) / tileSize;
277 
278  for (int tx = 0; tx < numTilesX; ++tx) {
279  const int startx = w - tx * tileSize - 1;
280  const int stopx = qMax(startx - tileSize, 0);
281 
282  for (int ty = 0; ty < numTilesY; ++ty) {
283  const int starty = ty * tileSize;
284  const int stopy = qMin(starty + tileSize, h);
285 
286  for (int x = startx; x >= stopx; --x) {
287  DST *d = (DST*)((char*)dest + (w - x - 1) * dstride) + starty;
288  const char *s = (const char*)(src + x) + starty * sstride;
289  for (int y = starty; y < stopy; ++y) {
290  *d++ = qt_colorConvert<DST,SRC>(*(const SRC*)(s), 0);
291  s += sstride;
292  }
293  }
294  }
295  }
296 }
double d
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static const int tileSize
Definition: qmemrotate.cpp:47

Variable Documentation

◆ Q_PACKED

struct qrgb_gl_rgba Q_PACKED

◆ qMemRotateFunctions

MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]
Initial value:
=
{
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },
{ qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
}
void qt_memrotate90_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:597
void qt_memrotate180_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:602
void qt_memrotate90_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:612
void qt_memrotate270_16(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:607
void qt_memrotate270_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:622
void qt_memrotate180_32(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl)
Definition: qmemrotate.cpp:617

Definition at line 627 of file qmemrotate.cpp.

Referenced by QRasterPaintEngine::drawImage(), and qInitDrawhelperAsm().

◆ tileSize

const int tileSize = 32
static