QtBase  v6.3.1
qdrawhelper_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtGui module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39 
40 #ifndef QDRAWHELPER_P_H
41 #define QDRAWHELPER_P_H
42 
43 //
44 // W A R N I N G
45 // -------------
46 //
47 // This file is not part of the Qt API. It exists purely as an
48 // implementation detail. This header file may change from version to
49 // version without notice, or even be removed.
50 //
51 // We mean it.
52 //
53 
54 #include <QtGui/private/qtguiglobal_p.h>
55 #include "QtCore/qmath.h"
56 #include "QtGui/qcolor.h"
57 #include "QtGui/qpainter.h"
58 #include "QtGui/qimage.h"
59 #include "QtGui/qrgba64.h"
60 #ifndef QT_FT_BEGIN_HEADER
61 #define QT_FT_BEGIN_HEADER
62 #define QT_FT_END_HEADER
63 #endif
64 #include "private/qpixellayout_p.h"
65 #include "private/qrasterdefs_p.h"
66 #include <private/qsimd_p.h>
67 
68 #include <QtCore/qsharedpointer.h>
69 
71 
72 #if defined(Q_CC_GNU)
73 # define Q_DECL_RESTRICT __restrict__
74 # if defined(Q_PROCESSOR_X86_32) && defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
75 # define Q_DECL_VECTORCALL __attribute__((sseregparm,regparm(3)))
76 # else
77 # define Q_DECL_VECTORCALL
78 # endif
79 #elif defined(Q_CC_MSVC)
80 # define Q_DECL_RESTRICT __restrict
81 # define Q_DECL_VECTORCALL __vectorcall
82 #else
83 # define Q_DECL_RESTRICT
84 # define Q_DECL_VECTORCALL
85 #endif
86 
87 static const uint AMASK = 0xff000000;
88 static const uint RMASK = 0x00ff0000;
89 static const uint GMASK = 0x0000ff00;
90 static const uint BMASK = 0x000000ff;
91 
92 /*******************************************************************************
93  * QSpan
94  *
95  * duplicate definition of FT_Span
96  */
97 typedef QT_FT_Span QSpan;
98 
99 struct QSolidData;
100 struct QTextureData;
101 struct QGradientData;
102 struct QLinearGradientData;
103 struct QRadialGradientData;
104 struct QConicalGradientData;
105 struct QSpanData;
106 class QGradient;
107 class QRasterBuffer;
108 class QClipData;
110 
111 template<typename F> class QRgbaFloat;
113 
115 typedef void (*BitmapBlitFunc)(QRasterBuffer *rasterBuffer,
116  int x, int y, const QRgba64 &color,
117  const uchar *bitmap,
118  int mapWidth, int mapHeight, int mapStride);
119 
120 typedef void (*AlphamapBlitFunc)(QRasterBuffer *rasterBuffer,
121  int x, int y, const QRgba64 &color,
122  const uchar *bitmap,
123  int mapWidth, int mapHeight, int mapStride,
124  const QClipData *clip, bool useGammaCorrection);
125 
126 typedef void (*AlphaRGBBlitFunc)(QRasterBuffer *rasterBuffer,
127  int x, int y, const QRgba64 &color,
128  const uint *rgbmask,
129  int mapWidth, int mapHeight, int mapStride,
130  const QClipData *clip, bool useGammaCorrection);
131 
132 typedef void (*RectFillFunc)(QRasterBuffer *rasterBuffer,
133  int x, int y, int width, int height,
134  const QRgba64 &color);
135 
136 typedef void (*SrcOverBlendFunc)(uchar *destPixels, int dbpl,
137  const uchar *src, int spbl,
138  int w, int h,
139  int const_alpha);
140 
141 typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl,
142  const uchar *src, int spbl, int srch,
143  const QRectF &targetRect,
144  const QRectF &sourceRect,
145  const QRect &clipRect,
146  int const_alpha);
147 
148 typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl,
149  const uchar *src, int spbl,
150  const QRectF &targetRect,
151  const QRectF &sourceRect,
152  const QRect &clipRect,
153  const QTransform &targetRectTransform,
154  int const_alpha);
155 
156 struct DrawHelper {
162 };
163 
167 
169 
170 struct quint24 {
171  quint24() = default;
173  {
174  data[0] = uchar(value >> 16);
175  data[1] = uchar(value >> 8);
176  data[2] = uchar(value);
177  }
178  operator uint() const
179  {
180  return data[2] | (data[1] << 8) | (data[0] << 16);
181  }
182 
184 };
185 
186 void qBlendGradient(int count, const QSpan *spans, void *userData);
187 void qBlendTexture(int count, const QSpan *spans, void *userData);
188 #ifdef __SSE2__
191 #else
192 extern void qt_memfill64(quint64 *dest, quint64 value, qsizetype count);
193 extern void qt_memfill32(quint32 *dest, quint32 value, qsizetype count);
194 #endif
195 extern void qt_memfill24(quint24 *dest, quint24 value, qsizetype count);
196 extern void qt_memfill16(quint16 *dest, quint16 value, qsizetype count);
197 
198 typedef void (QT_FASTCALL *CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha);
199 typedef void (QT_FASTCALL *CompositionFunction64)(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha);
200 typedef void (QT_FASTCALL *CompositionFunctionFP)(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha);
201 typedef void (QT_FASTCALL *CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha);
202 typedef void (QT_FASTCALL *CompositionFunctionSolid64)(QRgba64 *dest, int length, QRgba64 color, uint const_alpha);
203 typedef void (QT_FASTCALL *CompositionFunctionSolidFP)(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha);
204 
206 {
211 };
212 
214 {
221  bool extended;
222 };
223 
224 struct Operator;
225 typedef uint* (QT_FASTCALL *DestFetchProc)(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
226 typedef QRgba64* (QT_FASTCALL *DestFetchProc64)(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
227 typedef QRgbaFloat32* (QT_FASTCALL *DestFetchProcFP)(QRgbaFloat32 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length);
228 typedef void (QT_FASTCALL *DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length);
229 typedef void (QT_FASTCALL *DestStoreProc64)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length);
230 typedef void (QT_FASTCALL *DestStoreProcFP)(QRasterBuffer *rasterBuffer, int x, int y, const QRgbaFloat32 *buffer, int length);
231 typedef const uint* (QT_FASTCALL *SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
232 typedef const QRgba64* (QT_FASTCALL *SourceFetchProc64)(QRgba64 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
233 typedef const QRgbaFloat32* (QT_FASTCALL *SourceFetchProcFP)(QRgbaFloat32 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length);
234 
235 struct Operator
236 {
243 
249 
255 
256  union {
259  };
260 };
261 
262 class QRasterPaintEngine;
263 
265 {
266  struct {
270  struct {
271  qreal x;
272  qreal y;
273  } end;
274 };
275 
277 {
278  struct {
283  struct {
284  qreal x;
285  qreal y;
286  qreal radius;
287  } focal;
288 };
289 
291 {
292  struct {
297 };
298 
300 {
302 
303  union {
307  };
308 
309 #define GRADIENT_STOPTABLE_SIZE 1024
310 #define GRADIENT_STOPTABLE_SIZE_SHIFT 10
311 
312 #if QT_CONFIG(raster_64bit) || QT_CONFIG(raster_fp)
313  const QRgba64 *colorTable64; //[GRADIENT_STOPTABLE_SIZE];
314 #endif
315  const QRgb *colorTable32; //[GRADIENT_STOPTABLE_SIZE];
316 
318 };
319 
321 {
322  const uchar *imageData;
323  const uchar *scanLine(int y) const { return imageData + y*bytesPerLine; }
324 
325  int width;
326  int height;
327  // clip rect
328  int x1;
329  int y1;
330  int x2;
331  int y2;
335  bool hasAlpha;
336  enum Type {
339  Pattern
340  };
343 };
344 
345 struct QSpanData
346 {
348  ~QSpanData() { delete tempImage; }
349 
357  qreal m11, m12, m13, m21, m22, m23, m33, dx, dy; // inverse xform matrix
358  const QClipData *clip;
359  enum Type {
365  Texture
366  } type : 8;
367  signed int txop : 8;
369  bool bilinear;
372  union {
375  };
376  class Pinnable {
377  protected:
379  }; // QSharedPointer<const void> is not supported
381 
382 
383  void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
384  void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode);
385  void setupMatrix(const QTransform &matrix, int bilinear);
386  void initTexture(const QImage *image, int alpha, QTextureData::Type = QTextureData::Plain, const QRect &sourceRect = QRect());
387  void adjustSpanMethods();
388 };
389 
390 static inline uint qt_gradient_clamp(const QGradientData *data, int ipos)
391 {
392  if (ipos < 0 || ipos >= GRADIENT_STOPTABLE_SIZE) {
393  if (data->spread == QGradient::RepeatSpread) {
394  ipos = ipos % GRADIENT_STOPTABLE_SIZE;
395  ipos = ipos < 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos;
396  } else if (data->spread == QGradient::ReflectSpread) {
397  const int limit = GRADIENT_STOPTABLE_SIZE * 2;
398  ipos = ipos % limit;
399  ipos = ipos < 0 ? limit + ipos : ipos;
400  ipos = ipos >= GRADIENT_STOPTABLE_SIZE ? limit - 1 - ipos : ipos;
401  } else {
402  if (ipos < 0)
403  ipos = 0;
404  else if (ipos >= GRADIENT_STOPTABLE_SIZE)
405  ipos = GRADIENT_STOPTABLE_SIZE-1;
406  }
407  }
408 
409  Q_ASSERT(ipos >= 0);
411 
412  return ipos;
413 }
414 
415 static inline uint qt_gradient_pixel(const QGradientData *data, qreal pos)
416 {
417  int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
418  return data->colorTable32[qt_gradient_clamp(data, ipos)];
419 }
420 
421 #if QT_CONFIG(raster_64bit)
422 static inline const QRgba64& qt_gradient_pixel64(const QGradientData *data, qreal pos)
423 {
424  int ipos = int(pos * (GRADIENT_STOPTABLE_SIZE - 1) + qreal(0.5));
425  return data->colorTable64[qt_gradient_clamp(data, ipos)];
426 }
427 #endif
428 
429 static inline qreal qRadialDeterminant(qreal a, qreal b, qreal c)
430 {
431  return (b * b) - (4 * a * c);
432 }
433 
434 template <class RadialFetchFunc, typename BlendType> static
435 const BlendType * QT_FASTCALL qt_fetch_radial_gradient_template(BlendType *buffer, const Operator *op,
436  const QSpanData *data, int y, int x, int length)
437 {
438  // avoid division by zero
439  if (qFuzzyIsNull(op->radial.a)) {
440  RadialFetchFunc::memfill(buffer, RadialFetchFunc::null(), length);
441  return buffer;
442  }
443 
444  const BlendType *b = buffer;
445  qreal rx = data->m21 * (y + qreal(0.5))
446  + data->dx + data->m11 * (x + qreal(0.5));
447  qreal ry = data->m22 * (y + qreal(0.5))
448  + data->dy + data->m12 * (x + qreal(0.5));
449  bool affine = !data->m13 && !data->m23;
450 
451  BlendType *end = buffer + length;
452  if (affine) {
453  rx -= data->gradient.radial.focal.x;
454  ry -= data->gradient.radial.focal.y;
455 
456  qreal inv_a = 1 / qreal(2 * op->radial.a);
457 
458  const qreal delta_rx = data->m11;
459  const qreal delta_ry = data->m12;
460 
461  qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + rx * op->radial.dx + ry * op->radial.dy);
462  qreal delta_b = 2*(delta_rx * op->radial.dx + delta_ry * op->radial.dy);
463  const qreal b_delta_b = 2 * b * delta_b;
464  const qreal delta_b_delta_b = 2 * delta_b * delta_b;
465 
466  const qreal bb = b * b;
467  const qreal delta_bb = delta_b * delta_b;
468 
469  b *= inv_a;
470  delta_b *= inv_a;
471 
472  const qreal rxrxryry = rx * rx + ry * ry;
473  const qreal delta_rxrxryry = delta_rx * delta_rx + delta_ry * delta_ry;
474  const qreal rx_plus_ry = 2*(rx * delta_rx + ry * delta_ry);
475  const qreal delta_rx_plus_ry = 2 * delta_rxrxryry;
476 
477  inv_a *= inv_a;
478 
479  qreal det = (bb - 4 * op->radial.a * (op->radial.sqrfr - rxrxryry)) * inv_a;
480  qreal delta_det = (b_delta_b + delta_bb + 4 * op->radial.a * (rx_plus_ry + delta_rxrxryry)) * inv_a;
481  const qreal delta_delta_det = (delta_b_delta_b + 4 * op->radial.a * delta_rx_plus_ry) * inv_a;
482 
483  RadialFetchFunc::fetch(buffer, end, op, data, det, delta_det, delta_delta_det, b, delta_b);
484  } else {
485  qreal rw = data->m23 * (y + qreal(0.5))
486  + data->m33 + data->m13 * (x + qreal(0.5));
487 
488  while (buffer < end) {
489  if (rw == 0) {
490  *buffer = RadialFetchFunc::null();
491  } else {
492  qreal invRw = 1 / rw;
493  qreal gx = rx * invRw - data->gradient.radial.focal.x;
494  qreal gy = ry * invRw - data->gradient.radial.focal.y;
495  qreal b = 2*(op->radial.dr*data->gradient.radial.focal.radius + gx*op->radial.dx + gy*op->radial.dy);
496  qreal det = qRadialDeterminant(op->radial.a, b, op->radial.sqrfr - (gx*gx + gy*gy));
497 
498  BlendType result = RadialFetchFunc::null();
499  if (det >= 0) {
500  qreal detSqrt = qSqrt(det);
501 
502  qreal s0 = (-b - detSqrt) * op->radial.inv2a;
503  qreal s1 = (-b + detSqrt) * op->radial.inv2a;
504 
505  qreal s = qMax(s0, s1);
506 
507  if (data->gradient.radial.focal.radius + op->radial.dr * s >= 0)
508  result = RadialFetchFunc::fetchSingle(data->gradient, s);
509  }
510 
511  *buffer = result;
512  }
513 
514  rx += data->m11;
515  ry += data->m12;
516  rw += data->m13;
517 
518  ++buffer;
519  }
520  }
521 
522  return b;
523 }
524 
525 template <class Simd>
527 {
528 public:
529  static uint null() { return 0; }
530  static uint fetchSingle(const QGradientData& gradient, qreal v)
531  {
532  return qt_gradient_pixel(&gradient, v);
533  }
534  static void memfill(uint *buffer, uint fill, int length)
535  {
537  }
538  static void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det,
539  qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
540  {
541  typename Simd::Vect_buffer_f det_vec;
542  typename Simd::Vect_buffer_f delta_det4_vec;
543  typename Simd::Vect_buffer_f b_vec;
544 
545  for (int i = 0; i < 4; ++i) {
546  det_vec.f[i] = det;
547  delta_det4_vec.f[i] = 4 * delta_det;
548  b_vec.f[i] = b;
549 
550  det += delta_det;
551  delta_det += delta_delta_det;
552  b += delta_b;
553  }
554 
555  const typename Simd::Float32x4 v_delta_delta_det16 = Simd::v_dup(16 * delta_delta_det);
556  const typename Simd::Float32x4 v_delta_delta_det6 = Simd::v_dup(6 * delta_delta_det);
557  const typename Simd::Float32x4 v_delta_b4 = Simd::v_dup(4 * delta_b);
558 
559  const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius);
560  const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr);
561 
562 #if defined(__ARM_NEON__)
563  // NEON doesn't have SIMD sqrt, but uses rsqrt instead that can't be taken of 0.
564  const typename Simd::Float32x4 v_min = Simd::v_dup(std::numeric_limits<float>::epsilon());
565 #else
566  const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f);
567 #endif
568  const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1));
569  const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f);
570 
571  const typename Simd::Int32x4 v_repeat_mask = Simd::v_dup(~(uint(0xffffff) << GRADIENT_STOPTABLE_SIZE_SHIFT));
572  const typename Simd::Int32x4 v_reflect_mask = Simd::v_dup(~(uint(0xffffff) << (GRADIENT_STOPTABLE_SIZE_SHIFT+1)));
573 
574  const typename Simd::Int32x4 v_reflect_limit = Simd::v_dup(2 * GRADIENT_STOPTABLE_SIZE - 1);
575 
576  const int extended_mask = op->radial.extended ? 0x0 : ~0x0;
577 
578 #define FETCH_RADIAL_LOOP_PROLOGUE \
579  while (buffer < end) { \
580  typename Simd::Vect_buffer_i v_buffer_mask; \
581  v_buffer_mask.v = Simd::v_greaterOrEqual(det_vec.v, v_min); \
582  const typename Simd::Float32x4 v_index_local = Simd::v_sub(Simd::v_sqrt(Simd::v_max(v_min, det_vec.v)), b_vec.v); \
583  const typename Simd::Float32x4 v_index = Simd::v_add(Simd::v_mul(v_index_local, v_max), v_half); \
584  v_buffer_mask.v = Simd::v_and(v_buffer_mask.v, Simd::v_greaterOrEqual(Simd::v_add(v_r0, Simd::v_mul(v_dr, v_index_local)), v_min)); \
585  typename Simd::Vect_buffer_i index_vec;
586 #define FETCH_RADIAL_LOOP_CLAMP_REPEAT \
587  index_vec.v = Simd::v_and(v_repeat_mask, Simd::v_toInt(v_index));
588 #define FETCH_RADIAL_LOOP_CLAMP_REFLECT \
589  const typename Simd::Int32x4 v_index_i = Simd::v_and(v_reflect_mask, Simd::v_toInt(v_index)); \
590  const typename Simd::Int32x4 v_index_i_inv = Simd::v_sub(v_reflect_limit, v_index_i); \
591  index_vec.v = Simd::v_min_16(v_index_i, v_index_i_inv);
592 #define FETCH_RADIAL_LOOP_CLAMP_PAD \
593  index_vec.v = Simd::v_toInt(Simd::v_min(v_max, Simd::v_max(v_min, v_index)));
594 #define FETCH_RADIAL_LOOP_EPILOGUE \
595  det_vec.v = Simd::v_add(Simd::v_add(det_vec.v, delta_det4_vec.v), v_delta_delta_det6); \
596  delta_det4_vec.v = Simd::v_add(delta_det4_vec.v, v_delta_delta_det16); \
597  b_vec.v = Simd::v_add(b_vec.v, v_delta_b4); \
598  for (int i = 0; i < 4; ++i) \
599  *buffer++ = (extended_mask | v_buffer_mask.i[i]) & data->gradient.colorTable32[index_vec.i[i]]; \
600  }
601 
602 #define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP) \
603  FETCH_RADIAL_LOOP_PROLOGUE \
604  FETCH_RADIAL_LOOP_CLAMP \
605  FETCH_RADIAL_LOOP_EPILOGUE
606 
607  switch (data->gradient.spread) {
610  break;
613  break;
616  break;
617  default:
618  Q_UNREACHABLE();
619  }
620  }
621 };
622 
623 static inline uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b) {
624  uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
625  t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
626  t &= 0xff00ff;
627 
628  x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
629  x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
630  x &= 0xff00ff00;
631  x |= t;
632  return x;
633 }
634 
635 #if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
636 
637 static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
638  quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
639  t += (((quint64(y)) | ((quint64(y)) << 24)) & 0x00ff00ff00ff00ff) * b;
640  t >>= 8;
641  t &= 0x00ff00ff00ff00ff;
642  return (uint(t)) | (uint(t >> 24));
643 }
644 
645 static inline uint BYTE_MUL(uint x, uint a) {
646  quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a;
647  t = (t + ((t >> 8) & 0xff00ff00ff00ff) + 0x80008000800080) >> 8;
648  t &= 0x00ff00ff00ff00ff;
649  return (uint(t)) | (uint(t >> 24));
650 }
651 
652 #else // 32-bit versions
653 
654 static inline uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) {
655  uint t = (x & 0xff00ff) * a + (y & 0xff00ff) * b;
656  t >>= 8;
657  t &= 0xff00ff;
658 
659  x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b;
660  x &= 0xff00ff00;
661  x |= t;
662  return x;
663 }
664 
665 static inline uint BYTE_MUL(uint x, uint a) {
666  uint t = (x & 0xff00ff) * a;
667  t = (t + ((t >> 8) & 0xff00ff) + 0x800080) >> 8;
668  t &= 0xff00ff;
669 
670  x = ((x >> 8) & 0xff00ff) * a;
671  x = (x + ((x >> 8) & 0xff00ff) + 0x800080);
672  x &= 0xff00ff00;
673  x |= t;
674  return x;
675 }
676 #endif
677 
678 static inline void blend_pixel(quint32 &dst, const quint32 src)
679 {
680  if (src >= 0xff000000)
681  dst = src;
682  else if (src != 0)
683  dst = src + BYTE_MUL(dst, qAlpha(~src));
684 }
685 
686 static inline void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
687 {
688  if (const_alpha == 255)
689  return blend_pixel(dst, src);
690  if (src != 0) {
691  const quint32 s = BYTE_MUL(src, const_alpha);
692  dst = s + BYTE_MUL(dst, qAlpha(~s));
693  }
694 }
695 
696 #if defined(__SSE2__)
697 static inline uint Q_DECL_VECTORCALL interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
698 {
699  // First interpolate top and bottom pixels in parallel.
700  vt = _mm_unpacklo_epi8(vt, _mm_setzero_si128());
701  vb = _mm_unpacklo_epi8(vb, _mm_setzero_si128());
702  vt = _mm_mullo_epi16(vt, _mm_set1_epi16(256 - disty));
703  vb = _mm_mullo_epi16(vb, _mm_set1_epi16(disty));
704  __m128i vlr = _mm_add_epi16(vt, vb);
705  vlr = _mm_srli_epi16(vlr, 8);
706  // vlr now contains the result of the first two interpolate calls vlr = unpacked((xright << 64) | xleft)
707 
708  // Now the last interpolate between left and right..
709  const __m128i vidistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(256 - distx), _MM_SHUFFLE(0, 0, 0, 0));
710  const __m128i vdistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(distx), _MM_SHUFFLE(0, 0, 0, 0));
711  const __m128i vmulx = _mm_unpacklo_epi16(vidistx, vdistx);
712  vlr = _mm_unpacklo_epi16(vlr, _mm_srli_si128(vlr, 8));
713  // vlr now contains the colors of left and right interleaved { la, ra, lr, rr, lg, rg, lb, rb }
714  vlr = _mm_madd_epi16(vlr, vmulx); // Multiply and horizontal add.
715  vlr = _mm_srli_epi32(vlr, 8);
716  vlr = _mm_packs_epi32(vlr, vlr);
717  vlr = _mm_packus_epi16(vlr, vlr);
718  return _mm_cvtsi128_si32(vlr);
719 }
720 
721 static inline uint interpolate_4_pixels(uint tl, uint tr, uint bl, uint br, uint distx, uint disty)
722 {
723  __m128i vt = _mm_unpacklo_epi32(_mm_cvtsi32_si128(tl), _mm_cvtsi32_si128(tr));
724  __m128i vb = _mm_unpacklo_epi32(_mm_cvtsi32_si128(bl), _mm_cvtsi32_si128(br));
725  return interpolate_4_pixels_sse2(vt, vb, distx, disty);
726 }
727 
728 static inline uint interpolate_4_pixels(const uint t[], const uint b[], uint distx, uint disty)
729 {
730  __m128i vt = _mm_loadl_epi64((const __m128i*)t);
731  __m128i vb = _mm_loadl_epi64((const __m128i*)b);
732  return interpolate_4_pixels_sse2(vt, vb, distx, disty);
733 }
734 
735 static constexpr inline bool hasFastInterpolate4() { return true; }
736 
737 #elif defined(__ARM_NEON__)
738 static inline uint interpolate_4_pixels_neon(uint32x2_t vt32, uint32x2_t vb32, uint distx, uint disty)
739 {
740  uint16x8_t vt16 = vmovl_u8(vreinterpret_u8_u32(vt32));
741  uint16x8_t vb16 = vmovl_u8(vreinterpret_u8_u32(vb32));
742  vt16 = vmulq_n_u16(vt16, 256 - disty);
743  vt16 = vmlaq_n_u16(vt16, vb16, disty);
744  vt16 = vshrq_n_u16(vt16, 8);
745  uint16x4_t vl16 = vget_low_u16(vt16);
746  uint16x4_t vr16 = vget_high_u16(vt16);
747  vl16 = vmul_n_u16(vl16, 256 - distx);
748  vl16 = vmla_n_u16(vl16, vr16, distx);
749  vl16 = vshr_n_u16(vl16, 8);
750  uint8x8_t vr = vmovn_u16(vcombine_u16(vl16, vl16));
751  return vget_lane_u32(vreinterpret_u32_u8(vr), 0);
752 }
753 
754 static inline uint interpolate_4_pixels(uint tl, uint tr, uint bl, uint br, uint distx, uint disty)
755 {
756  uint32x2_t vt32 = vmov_n_u32(tl);
757  uint32x2_t vb32 = vmov_n_u32(bl);
758  vt32 = vset_lane_u32(tr, vt32, 1);
759  vb32 = vset_lane_u32(br, vb32, 1);
760  return interpolate_4_pixels_neon(vt32, vb32, distx, disty);
761 }
762 
763 static inline uint interpolate_4_pixels(const uint t[], const uint b[], uint distx, uint disty)
764 {
765  uint32x2_t vt32 = vld1_u32(t);
766  uint32x2_t vb32 = vld1_u32(b);
767  return interpolate_4_pixels_neon(vt32, vb32, distx, disty);
768 }
769 
770 static constexpr inline bool hasFastInterpolate4() { return true; }
771 
772 #else
773 static inline uint interpolate_4_pixels(uint tl, uint tr, uint bl, uint br, uint distx, uint disty)
774 {
775  uint idistx = 256 - distx;
776  uint idisty = 256 - disty;
777  uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
778  uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
779  return INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
780 }
781 
782 static inline uint interpolate_4_pixels(const uint t[], const uint b[], uint distx, uint disty)
783 {
784  return interpolate_4_pixels(t[0], t[1], b[0], b[1], distx, disty);
785 }
786 
787 static constexpr inline bool hasFastInterpolate4() { return false; }
788 
789 #endif
790 
791 static inline QRgba64 multiplyAlpha256(QRgba64 rgba64, uint alpha256)
792 {
793  return QRgba64::fromRgba64((rgba64.red() * alpha256) >> 8,
794  (rgba64.green() * alpha256) >> 8,
795  (rgba64.blue() * alpha256) >> 8,
796  (rgba64.alpha() * alpha256) >> 8);
797 }
798 static inline QRgba64 interpolate256(QRgba64 x, uint alpha1, QRgba64 y, uint alpha2)
799 {
800  return QRgba64::fromRgba64(multiplyAlpha256(x, alpha1) + multiplyAlpha256(y, alpha2));
801 }
802 
803 #ifdef __SSE2__
804 static inline QRgba64 interpolate_4_pixels_rgb64(const QRgba64 t[], const QRgba64 b[], uint distx, uint disty)
805 {
806  __m128i vt = _mm_loadu_si128((const __m128i*)t);
807  if (disty) {
808  __m128i vb = _mm_loadu_si128((const __m128i*)b);
809  vt = _mm_mulhi_epu16(vt, _mm_set1_epi16(0x10000 - disty));
810  vb = _mm_mulhi_epu16(vb, _mm_set1_epi16(disty));
811  vt = _mm_add_epi16(vt, vb);
812  }
813  if (distx) {
814  const __m128i vdistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(distx), _MM_SHUFFLE(0, 0, 0, 0));
815  const __m128i vidistx = _mm_shufflelo_epi16(_mm_cvtsi32_si128(0x10000 - distx), _MM_SHUFFLE(0, 0, 0, 0));
816  vt = _mm_mulhi_epu16(vt, _mm_unpacklo_epi64(vidistx, vdistx));
817  vt = _mm_add_epi16(vt, _mm_srli_si128(vt, 8));
818  }
819 #ifdef Q_PROCESSOR_X86_64
820  return QRgba64::fromRgba64(_mm_cvtsi128_si64(vt));
821 #else
822  QRgba64 out;
823  _mm_storel_epi64((__m128i*)&out, vt);
824  return out;
825 #endif // Q_PROCESSOR_X86_64
826 }
827 #elif defined(__ARM_NEON__)
828 static inline QRgba64 interpolate_4_pixels_rgb64(const QRgba64 t[], const QRgba64 b[], uint distx, uint disty)
829 {
830  uint64x1x2_t vt = vld2_u64(reinterpret_cast<const uint64_t *>(t));
831  if (disty) {
832  uint64x1x2_t vb = vld2_u64(reinterpret_cast<const uint64_t *>(b));
833  uint32x4_t vt0 = vmull_n_u16(vreinterpret_u16_u64(vt.val[0]), 0x10000 - disty);
834  uint32x4_t vt1 = vmull_n_u16(vreinterpret_u16_u64(vt.val[1]), 0x10000 - disty);
835  vt0 = vmlal_n_u16(vt0, vreinterpret_u16_u64(vb.val[0]), disty);
836  vt1 = vmlal_n_u16(vt1, vreinterpret_u16_u64(vb.val[1]), disty);
837  vt.val[0] = vreinterpret_u64_u16(vshrn_n_u32(vt0, 16));
838  vt.val[1] = vreinterpret_u64_u16(vshrn_n_u32(vt1, 16));
839  }
840  if (distx) {
841  uint32x4_t vt0 = vmull_n_u16(vreinterpret_u16_u64(vt.val[0]), 0x10000 - distx);
842  vt0 = vmlal_n_u16(vt0, vreinterpret_u16_u64(vt.val[1]), distx);
843  vt.val[0] = vreinterpret_u64_u16(vshrn_n_u32(vt0, 16));
844  }
845  QRgba64 out;
846  vst1_u64(reinterpret_cast<uint64_t *>(&out), vt.val[0]);
847  return out;
848 }
849 #else
850 static inline QRgba64 interpolate_4_pixels_rgb64(const QRgba64 t[], const QRgba64 b[], uint distx, uint disty)
851 {
852  const uint dx = distx>>8;
853  const uint dy = disty>>8;
854  const uint idx = 256 - dx;
855  const uint idy = 256 - dy;
856  QRgba64 xtop = interpolate256(t[0], idx, t[1], dx);
857  QRgba64 xbot = interpolate256(b[0], idx, b[1], dx);
858  return interpolate256(xtop, idy, xbot, dy);
859 }
860 #endif // __SSE2__
861 
862 #if QT_CONFIG(raster_fp)
863 static inline QRgbaFloat32 multiplyAlpha_rgba32f(QRgbaFloat32 c, float a)
864 {
865  return QRgbaFloat32 { c.r * a, c.g * a, c.b * a, c.a * a };
866 }
867 
868 static inline QRgbaFloat32 interpolate_rgba32f(QRgbaFloat32 x, float alpha1, QRgbaFloat32 y, float alpha2)
869 {
870  x = multiplyAlpha_rgba32f(x, alpha1);
871  y = multiplyAlpha_rgba32f(y, alpha2);
872  return QRgbaFloat32 { x.r + y.r, x.g + y.g, x.b + y.b, x.a + y.a };
873 }
874 #ifdef __SSE2__
875 static inline __m128 Q_DECL_VECTORCALL interpolate_rgba32f(__m128 x, __m128 alpha1, __m128 y, __m128 alpha2)
876 {
877  return _mm_add_ps(_mm_mul_ps(x, alpha1), _mm_mul_ps(y, alpha2));
878 }
879 #endif
880 
881 static inline QRgbaFloat32 interpolate_4_pixels_rgba32f(const QRgbaFloat32 t[], const QRgbaFloat32 b[], uint distx, uint disty)
882 {
883  constexpr float f = 1.0f / 65536.0f;
884  const float dx = distx * f;
885  const float dy = disty * f;
886  const float idx = 1.0f - dx;
887  const float idy = 1.0f - dy;
888 #ifdef __SSE2__
889  const __m128 vtl = _mm_load_ps((const float *)&t[0]);
890  const __m128 vtr = _mm_load_ps((const float *)&t[1]);
891  const __m128 vbl = _mm_load_ps((const float *)&b[0]);
892  const __m128 vbr = _mm_load_ps((const float *)&b[1]);
893 
894  const __m128 vdx = _mm_set1_ps(dx);
895  const __m128 vidx = _mm_set1_ps(idx);
896  __m128 vt = interpolate_rgba32f(vtl, vidx, vtr, vdx);
897  __m128 vb = interpolate_rgba32f(vbl, vidx, vbr, vdx);
898  const __m128 vdy = _mm_set1_ps(dy);
899  const __m128 vidy = _mm_set1_ps(idy);
900  vt = interpolate_rgba32f(vt, vidy, vb, vdy);
902  _mm_store_ps((float*)&res, vt);
903  return res;
904 #else
905  QRgbaFloat32 xtop = interpolate_rgba32f(t[0], idx, t[1], dx);
906  QRgbaFloat32 xbot = interpolate_rgba32f(b[0], idx, b[1], dx);
907  xtop = interpolate_rgba32f(xtop, idy, xbot, dy);
908  return xtop;
909 #endif
910 }
911 #endif // QT_CONFIG(raster_fp)
912 
913 static inline uint BYTE_MUL_RGB16(uint x, uint a) {
914  a += 1;
915  uint t = (((x & 0x07e0)*a) >> 8) & 0x07e0;
916  t |= (((x & 0xf81f)*(a>>2)) >> 6) & 0xf81f;
917  return t;
918 }
919 
920 static inline uint BYTE_MUL_RGB16_32(uint x, uint a) {
921  uint t = (((x & 0xf81f07e0) >> 5)*a) & 0xf81f07e0;
922  t |= (((x & 0x07e0f81f)*a) >> 5) & 0x07e0f81f;
923  return t;
924 }
925 
926 // qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers
927 static constexpr inline int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
928 static constexpr inline uint qt_div_257_floor(uint x) { return (x - (x >> 8)) >> 8; }
929 static constexpr inline uint qt_div_257(uint x) { return qt_div_257_floor(x + 128); }
930 static constexpr inline uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
931 
932 template <class T> inline void qt_memfill_template(T *dest, T color, qsizetype count)
933 {
934  if (!count)
935  return;
936 
937  qsizetype n = (count + 7) / 8;
938  switch (count & 0x07)
939  {
940  case 0: do { *dest++ = color; Q_FALLTHROUGH();
941  case 7: *dest++ = color; Q_FALLTHROUGH();
942  case 6: *dest++ = color; Q_FALLTHROUGH();
943  case 5: *dest++ = color; Q_FALLTHROUGH();
944  case 4: *dest++ = color; Q_FALLTHROUGH();
945  case 3: *dest++ = color; Q_FALLTHROUGH();
946  case 2: *dest++ = color; Q_FALLTHROUGH();
947  case 1: *dest++ = color;
948  } while (--n > 0);
949  }
950 }
951 
952 template <class T> inline void qt_memfill(T *dest, T value, qsizetype count)
953 {
955 }
956 
957 template<> inline void qt_memfill(quint64 *dest, quint64 color, qsizetype count)
958 {
959  qt_memfill64(dest, color, count);
960 }
961 
962 template<> inline void qt_memfill(quint32 *dest, quint32 color, qsizetype count)
963 {
964  qt_memfill32(dest, color, count);
965 }
966 
967 template<> inline void qt_memfill(quint24 *dest, quint24 color, qsizetype count)
968 {
969  qt_memfill24(dest, color, count);
970 }
971 
972 template<> inline void qt_memfill(quint16 *dest, quint16 color, qsizetype count)
973 {
974  qt_memfill16(dest, color, count);
975 }
976 
977 template<> inline void qt_memfill(quint8 *dest, quint8 color, qsizetype count)
978 {
979  memset(dest, color, count);
980 }
981 
982 template <class T> static
983 inline void qt_rectfill(T *dest, T value,
984  int x, int y, int width, int height, qsizetype stride)
985 {
986  char *d = reinterpret_cast<char*>(dest + x) + y * stride;
987  if (uint(stride) == (width * sizeof(T))) {
988  qt_memfill(reinterpret_cast<T*>(d), value, qsizetype(width) * height);
989  } else {
990  for (int j = 0; j < height; ++j) {
991  dest = reinterpret_cast<T*>(d);
992  qt_memfill(dest, value, width);
993  d += stride;
994  }
995  }
996 }
997 
999 {
1000  return (((c) >> 3) & 0x001f)
1001  | (((c) >> 5) & 0x07e0)
1002  | (((c) >> 8) & 0xf800);
1003 }
1004 
1006 {
1007  return 0xff000000
1008  | ((((c) << 3) & 0xf8) | (((c) >> 2) & 0x7))
1009  | ((((c) << 5) & 0xfc00) | (((c) >> 1) & 0x300))
1010  | ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000));
1011 }
1012 
1013 const uint qt_bayer_matrix[16][16] = {
1014  { 0x1, 0xc0, 0x30, 0xf0, 0xc, 0xcc, 0x3c, 0xfc,
1015  0x3, 0xc3, 0x33, 0xf3, 0xf, 0xcf, 0x3f, 0xff},
1016  { 0x80, 0x40, 0xb0, 0x70, 0x8c, 0x4c, 0xbc, 0x7c,
1017  0x83, 0x43, 0xb3, 0x73, 0x8f, 0x4f, 0xbf, 0x7f},
1018  { 0x20, 0xe0, 0x10, 0xd0, 0x2c, 0xec, 0x1c, 0xdc,
1019  0x23, 0xe3, 0x13, 0xd3, 0x2f, 0xef, 0x1f, 0xdf},
1020  { 0xa0, 0x60, 0x90, 0x50, 0xac, 0x6c, 0x9c, 0x5c,
1021  0xa3, 0x63, 0x93, 0x53, 0xaf, 0x6f, 0x9f, 0x5f},
1022  { 0x8, 0xc8, 0x38, 0xf8, 0x4, 0xc4, 0x34, 0xf4,
1023  0xb, 0xcb, 0x3b, 0xfb, 0x7, 0xc7, 0x37, 0xf7},
1024  { 0x88, 0x48, 0xb8, 0x78, 0x84, 0x44, 0xb4, 0x74,
1025  0x8b, 0x4b, 0xbb, 0x7b, 0x87, 0x47, 0xb7, 0x77},
1026  { 0x28, 0xe8, 0x18, 0xd8, 0x24, 0xe4, 0x14, 0xd4,
1027  0x2b, 0xeb, 0x1b, 0xdb, 0x27, 0xe7, 0x17, 0xd7},
1028  { 0xa8, 0x68, 0x98, 0x58, 0xa4, 0x64, 0x94, 0x54,
1029  0xab, 0x6b, 0x9b, 0x5b, 0xa7, 0x67, 0x97, 0x57},
1030  { 0x2, 0xc2, 0x32, 0xf2, 0xe, 0xce, 0x3e, 0xfe,
1031  0x1, 0xc1, 0x31, 0xf1, 0xd, 0xcd, 0x3d, 0xfd},
1032  { 0x82, 0x42, 0xb2, 0x72, 0x8e, 0x4e, 0xbe, 0x7e,
1033  0x81, 0x41, 0xb1, 0x71, 0x8d, 0x4d, 0xbd, 0x7d},
1034  { 0x22, 0xe2, 0x12, 0xd2, 0x2e, 0xee, 0x1e, 0xde,
1035  0x21, 0xe1, 0x11, 0xd1, 0x2d, 0xed, 0x1d, 0xdd},
1036  { 0xa2, 0x62, 0x92, 0x52, 0xae, 0x6e, 0x9e, 0x5e,
1037  0xa1, 0x61, 0x91, 0x51, 0xad, 0x6d, 0x9d, 0x5d},
1038  { 0xa, 0xca, 0x3a, 0xfa, 0x6, 0xc6, 0x36, 0xf6,
1039  0x9, 0xc9, 0x39, 0xf9, 0x5, 0xc5, 0x35, 0xf5},
1040  { 0x8a, 0x4a, 0xba, 0x7a, 0x86, 0x46, 0xb6, 0x76,
1041  0x89, 0x49, 0xb9, 0x79, 0x85, 0x45, 0xb5, 0x75},
1042  { 0x2a, 0xea, 0x1a, 0xda, 0x26, 0xe6, 0x16, 0xd6,
1043  0x29, 0xe9, 0x19, 0xd9, 0x25, 0xe5, 0x15, 0xd5},
1044  { 0xaa, 0x6a, 0x9a, 0x5a, 0xa6, 0x66, 0x96, 0x56,
1045  0xa9, 0x69, 0x99, 0x59, 0xa5, 0x65, 0x95, 0x55}
1046 };
1047 
1048 #define ARGB_COMBINE_ALPHA(argb, alpha) \
1049  ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff)
1050 
1051 
1052 #if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
1053 #define AMIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
1054 #define MIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
1055 #else // 32 bits
1056 // The mask for alpha can overflow over 32 bits
1057 #define AMIX(mask) quint32(qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
1058 #define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
1059 #endif
1060 
1061 inline uint comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
1062 {
1063  const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
1064  return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
1065 }
1066 
1068 {
1069  const uint result = uint(AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
1070  return result;
1071 }
1072 
1073 #undef MIX
1074 #undef AMIX
1075 
1076 // must be multiple of 4 for easier SIMD implementations
1077 static constexpr int BufferSize = 2048;
1078 
1079 // A buffer of intermediate results used by simple bilinear scaling.
1081 {
1082  // The idea is first to do the interpolation between the row s1 and the row s2
1083  // into this intermediate buffer, then later interpolate between two pixel of this buffer.
1084  //
1085  // buffer_rb is a buffer of red-blue component of the pixel, in the form 0x00RR00BB
1086  // buffer_ag is the alpha-green component of the pixel, in the form 0x00AA00GG
1087  // +1 for the last pixel to interpolate with, and +1 for rounding errors.
1090 };
1091 
1093 
1094 #endif // QDRAWHELPER_P_H
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
#define value
[5]
FT_UInt idx
Definition: cffcmap.c:135
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:66
int qAlpha(QRgb rgba)
Definition: qrgb.h:63
QRgb
Definition: qrgb.h:49
The QGradient class is used in combination with QBrush to specify gradient fills.
Definition: qbrush.h:171
@ ReflectSpread
Definition: qbrush.h:184
@ RepeatSpread
Definition: qbrush.h:185
@ PadSpread
Definition: qbrush.h:183
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:73
Format
Definition: qimage.h:77
@ NImageFormats
Definition: qimage.h:115
CompositionMode
Definition: qpainter.h:132
static void memfill(uint *buffer, uint fill, int length)
static void fetch(uint *buffer, uint *end, const Operator *op, const QSpanData *data, qreal det, qreal delta_det, qreal delta_delta_det, qreal b, qreal delta_b)
static uint fetchSingle(const QGradientData &gradient, qreal v)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
The QRectF class defines a finite rectangle in the plane using floating point precision.
Definition: qrect.h:511
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:59
constexpr quint16 red() const
Definition: qrgba64.h:106
constexpr quint16 alpha() const
Definition: qrgba64.h:109
constexpr quint16 green() const
Definition: qrgba64.h:107
constexpr static QRgba64 fromRgba64(quint64 c)
Definition: qrgba64.h:72
constexpr quint16 blue() const
Definition: qrgba64.h:108
The QSharedPointer class holds a strong reference to a shared pointer.
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:56
#define T(x)
Definition: main.cpp:42
float rx
QRhiRenderBuffer * rb
Definition: brush.cpp:52
Definition: image.cpp:51
set set set set set set set macro pixldst1 op
void
Definition: png.h:1080
#define Q_FALLTHROUGH()
#define Q_UNREACHABLE()
void qt_memfill24(quint24 *dest, quint24 value, qsizetype count)
void(QT_FASTCALL * CompositionFunction64)(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha)
void(* RectFillFunc)(QRasterBuffer *rasterBuffer, int x, int y, int width, int height, const QRgba64 &color)
void qBlendTexture(int count, const QSpan *spans, void *userData)
DrawHelper qDrawHelper[QImage::NImageFormats]
void qt_memfill(T *dest, T value, qsizetype count)
uint comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
#define FETCH_RADIAL_LOOP_CLAMP_PAD
void(QT_FASTCALL * CompositionFunctionSolid)(uint *dest, int length, uint color, uint const_alpha)
#define Q_DECL_RESTRICT
Definition: qdrawhelper_p.h:83
void(QT_FASTCALL * CompositionFunction)(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
#define FETCH_RADIAL_LOOP_CLAMP_REPEAT
void qBlendGradient(int count, const QSpan *spans, void *userData)
QRgba64 *(QT_FASTCALL * DestFetchProc64)(QRgba64 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
const uint *(QT_FASTCALL * SourceFetchProc)(uint *buffer, const Operator *o, const QSpanData *data, int y, int x, int length)
void(* SrcOverBlendFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, int w, int h, int const_alpha)
void(QT_FASTCALL * DestStoreProcFP)(QRasterBuffer *rasterBuffer, int x, int y, const QRgbaFloat32 *buffer, int length)
void qt_memfill16(quint16 *dest, quint16 value, qsizetype count)
ushort qConvertRgb32To16(uint c)
#define FETCH_RADIAL_LOOP_CLAMP_REFLECT
void(QT_FASTCALL * DestStoreProc)(QRasterBuffer *rasterBuffer, int x, int y, const uint *buffer, int length)
SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]
QT_FT_SpanFunc ProcessSpans
QRgbaFloat< float > QRgbaFloat32
void(* BitmapBlitFunc)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *bitmap, int mapWidth, int mapHeight, int mapStride)
#define FETCH_RADIAL_LOOP(FETCH_RADIAL_LOOP_CLAMP)
const QRgba64 *(QT_FASTCALL * SourceFetchProc64)(QRgba64 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length)
void qt_memfill32(quint32 *dest, quint32 value, qsizetype count)
SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]
void(QT_FASTCALL * CompositionFunctionFP)(QRgbaFloat32 *Q_DECL_RESTRICT dest, const QRgbaFloat32 *Q_DECL_RESTRICT src, int length, uint const_alpha)
void(* AlphamapBlitFunc)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *bitmap, int mapWidth, int mapHeight, int mapStride, const QClipData *clip, bool useGammaCorrection)
void(QT_FASTCALL * CompositionFunctionSolid64)(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
#define AMIX(mask)
uint comp_func_Plus_one_pixel(uint d, const uint s)
#define MIX(mask)
#define GRADIENT_STOPTABLE_SIZE_SHIFT
QRgbaFloat32 *(QT_FASTCALL * DestFetchProcFP)(QRgbaFloat32 *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
const QRgbaFloat32 *(QT_FASTCALL * SourceFetchProcFP)(QRgbaFloat32 *buffer, const Operator *o, const QSpanData *data, int y, int x, int length)
void(QT_FASTCALL * CompositionFunctionSolidFP)(QRgbaFloat32 *dest, int length, QRgbaFloat32 color, uint const_alpha)
void(* AlphaRGBBlitFunc)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uint *rgbmask, int mapWidth, int mapHeight, int mapStride, const QClipData *clip, bool useGammaCorrection)
#define GRADIENT_STOPTABLE_SIZE
uint *QT_FASTCALL * DestFetchProc(uint *buffer, QRasterBuffer *rasterBuffer, int x, int y, int length)
void(QT_FASTCALL * DestStoreProc64)(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 *buffer, int length)
const uint qt_bayer_matrix[16][16]
QRgb qConvertRgb16To32(uint c)
void(* SrcOverScaleFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clipRect, int const_alpha)
void qt_memfill_template(T *dest, T color, qsizetype count)
SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]
void qt_memfill64(quint64 *dest, quint64 value, qsizetype count)
void(* SrcOverTransformFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clipRect, const QTransform &targetRectTransform, int const_alpha)
#define Q_DECL_VECTORCALL
Definition: qdrawhelper_p.h:84
EGLOutputLayerEXT EGLint EGLAttrib value
bool qFuzzyIsNull(qfloat16 f) noexcept
Definition: qfloat16.h:249
unsigned int quint32
Definition: qglobal.h:288
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
Definition: qglobal.h:332
unsigned short quint16
Definition: qglobal.h:286
QT_END_INCLUDE_NAMESPACE typedef double qreal
Definition: qglobal.h:341
unsigned long long quint64
Definition: qglobal.h:299
ptrdiff_t qsizetype
Definition: qglobal.h:308
unsigned int uint
Definition: qglobal.h:334
unsigned short ushort
Definition: qglobal.h:333
unsigned char quint8
Definition: qglobal.h:284
auto qSqrt(T v)
Definition: qmath.h:132
GLenum GLuint GLenum GLsizei length
Definition: qopengl.h:270
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLuint end
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
GLenum GLenum GLsizei count
GLfloat GLfloat f
GLenum src
const void GLsizei GLsizei stride
GLenum GLuint buffer
GLint GLsizei width
GLuint color
[2]
GLenum GLenum dst
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfloat n
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
GLuint res
Definition: qopenglext.h:8867
const GLubyte * c
Definition: qopenglext.h:12701
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
Definition: qopenglext.h:5182
GLint limit
Definition: qopenglext.h:9975
GLuint GLenum matrix
Definition: qopenglext.h:11564
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
GLdouble s
[6]
Definition: qopenglext.h:235
GLfloat GLfloat GLfloat alpha
Definition: qopenglext.h:418
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
void(* QT_FT_SpanFunc)(int count, const QT_FT_Span *spans, void *worker)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition: qrgb.h:49
#define tr(X)
const int BufferSize
Definition: semaphores.cpp:59
QTextStream out(stdout)
[7]
QObject::connect nullptr
ba fill(true)
p ry()++
QPointer< QVBoxLayout > vbl
RectFillFunc fillRect
AlphaRGBBlitFunc alphaRGBBlit
ProcessSpans blendColor
AlphamapBlitFunc alphamapBlit
BitmapBlitFunc bitmapBlit
quint32 buffer_ag[BufferSize+2]
quint32 buffer_rb[BufferSize+2]
LinearGradientValues linear
CompositionFunction64 func64
DestStoreProcFP destStoreFP
CompositionFunctionSolidFP funcSolidFP
CompositionFunctionSolid funcSolid
DestStoreProc64 destStore64
SourceFetchProcFP srcFetchFP
DestStoreProc destStore
SourceFetchProc64 srcFetch64
QPainter::CompositionMode mode
CompositionFunction func
CompositionFunctionFP funcFP
DestFetchProcFP destFetchFP
DestFetchProc64 destFetch64
RadialGradientValues radial
SourceFetchProc srcFetch
CompositionFunctionSolid64 funcSolid64
DestFetchProc destFetch
struct QConicalGradientData::@537 center
QRadialGradientData radial
const QRgb * colorTable32
QLinearGradientData linear
QGradient::Spread spread
QConicalGradientData conical
struct QLinearGradientData::@534 end
struct QLinearGradientData::@533 origin
struct QRadialGradientData::@536 focal
struct QRadialGradientData::@535 center
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
uint fast_matrix
AlphaRGBBlitFunc alphaRGBBlit
QRasterBuffer * rasterBuffer
void initTexture(const QImage *image, int alpha, QTextureData::Type=QTextureData::Plain, const QRect &sourceRect=QRect())
BitmapBlitFunc bitmapBlit
QImage * tempImage
QRgba64 solidColor
enum QSpanData::Type type
QTextureData texture
signed int txop
RectFillFunc fillRect
ProcessSpans unclipped_blend
ProcessSpans blend
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
QGradientData gradient
const QClipData * clip
AlphamapBlitFunc alphamapBlit
QSharedPointer< const Pinnable > cachedGradient
void setupMatrix(const QTransform &matrix, int bilinear)
const uchar * scanLine(int y) const
QImage::Format format
const uchar * imageData
const QList< QRgb > * colorTable
qsizetype bytesPerLine
Definition: main.cpp:38
Definition: moc.h:48
quint24()=default
quint24(uint value)
const qreal epsilon
Definition: tst_qline.cpp:63