Qt 4.8
qpaintengine_blitter.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
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 Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "private/qpaintengine_blitter_p.h"
43 
44 #include "private/qblittable_p.h"
45 #include "private/qpaintengine_raster_p.h"
46 #include "private/qpainter_p.h"
47 #include "private/qapplication_p.h"
48 #include "private/qpixmap_blitter_p.h"
49 
50 #ifndef QT_NO_BLITTABLE
52 
53 #define STATE_XFORM_SCALE 0x00000001
54 #define STATE_XFORM_COMPLEX 0x00000002
55 
56 #define STATE_BRUSH_PATTERN 0x00000010
57 #define STATE_BRUSH_ALPHA 0x00000020
58 
59 #define STATE_PEN_ENABLED 0x00000100
60 
61 #define STATE_ANTIALIASING 0x00001000
62 #define STATE_ALPHA 0x00002000
63 #define STATE_BLENDING_COMPLEX 0x00004000
64 
65 #define STATE_CLIPSYS_COMPLEX 0x00010000
66 #define STATE_CLIP_COMPLEX 0x00020000
67 
68 
70 {
71 public:
72  CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
73  : m_capabilities(capabilities)
74  , fillRectMask(0)
75  , drawRectMask(0)
76  , drawPixmapMask(0)
80  {
81  if (capabilities & QBlittable::SolidRectCapability)
83  if (capabilities & QBlittable::SourcePixmapCapability)
85  if (capabilities & QBlittable::SourceOverPixmapCapability)
89  if (capabilities & QBlittable::AlphaFillRectCapability)
91  if (capabilities & QBlittable::OpacityPixmapCapability)
93  }
94 
95  inline bool canBlitterFillRect() const
96  {
98  }
99 
100  inline bool canBlitterAlphaFillRect() const
101  {
103  }
104 
105  inline bool canBlitterDrawRectMask() const
106  {
108  }
109 
110  bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
111  {
113  return false;
117  if (r.size() != sr.size())
119  else
121  }
123  return m_capabilities & QBlittable::SourcePixmapCapability;
124  }
125  return false;
126  }
127 
128  bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const
129  {
131  return false;
132 
134  }
135 
136  inline void updateState(uint mask, bool on) {
138  }
139 
140 private:
141 
142  static inline void updateStateBits(uint *state, uint mask, bool on)
143  {
144  *state = on ? (*state | mask) : (*state & ~mask);
145  }
146 
147  static inline bool checkStateAgainstMask(uint state, uint mask)
148  {
149  return !state || (state & mask && !(state & ~mask));
150  }
151 
155 
158 
160 
161  //Sub-pixel aliasing should not be sent to the blitter
165 
168  }
169 
173 
176 
178 
179  //Sub-pixel aliasing should not be sent to the blitter
183 
186  }
187 
191 
194 
196 
200 
203  }
204 
207  }
208 
212  }
213 
217 
220 
222 
226 
229  }
230 
231  QBlittable::Capabilities m_capabilities;
238 };
239 
241 {
243 public:
246  , pmData(p)
247  , caps(pmData->blittable()->capabilities())
248  , hasXForm(false)
249 
250  {}
251 
252  void lock();
253  void unlock();
254  void fillRect(const QRectF& rect, const QColor&, bool alpha);
255  void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity);
256 
257 
258  void updateCompleteState(QPainterState *s);
259  void updatePenState(QPainterState *s);
260  void updateBrushState(QPainterState *s);
261  void updateOpacityState(QPainterState *s);
262  void updateCompositionModeState(QPainterState *s);
263  void updateRenderHintsState(QPainterState *s);
264  void updateTransformState(QPainterState *s);
265  void updateClipState(QPainterState *s);
266 
270 };
271 
273 {
274  if (!pmData->blittable()->isLocked())
275  rasterBuffer->prepare(pmData->buffer());
276 }
277 
279 {
280  pmData->blittable()->unlock();
281 }
282 
283 // State tracking to make decisions
285 {
286  updatePenState(s);
287  updateBrushState(s);
288  updateOpacityState(s);
289  updateCompositionModeState(s);
290  updateRenderHintsState(s);
291  updateTransformState(s);
292  updateClipState(s);
293 }
294 
296 {
297  caps.updateState(STATE_PEN_ENABLED, qpen_style(s->pen) != Qt::NoPen);
298 }
299 
301 {
302  Qt::BrushStyle style = qbrush_style(s->brush);
303 
304  caps.updateState(STATE_BRUSH_PATTERN, style > Qt::SolidPattern);
305  caps.updateState(STATE_BRUSH_ALPHA,
306  qbrush_color(s->brush).alpha() < 255);
307 }
308 
310 {
311  bool translucent = s->opacity < 1;
312  caps.updateState(STATE_ALPHA, translucent);
313 }
314 
316 {
319 
320  caps.updateState(STATE_BLENDING_COMPLEX, nonTrivial);
321 }
322 
324 {
325  bool aa = s->renderHints & QPainter::Antialiasing;
326  caps.updateState(STATE_ANTIALIASING, aa);
327 }
328 
330 {
332 
333  // consider scaling operations with a negative factor as "complex" for now.
334  // as some blitters could handle axisymmetrical operations, we should improve blitter
335  // paint engine to handle them as a capability
336  caps.updateState(STATE_XFORM_COMPLEX, (type > QTransform::TxScale) ||
337  ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0))));
338  caps.updateState(STATE_XFORM_SCALE, type > QTransform::TxTranslate);
339 
340  hasXForm = type >= QTransform::TxTranslate;
341 }
342 
344 {
345  const QClipData *clipData = clip();
346  bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
347  caps.updateState(STATE_CLIP_COMPLEX, complexClip);
348 }
349 
350 void QBlitterPaintEnginePrivate::fillRect(const QRectF &rect, const QColor &color, bool alpha)
351 {
353  pmData->unmarkRasterOverlay(rect);
354  QRectF targetRect = rect;
355  if (hasXForm)
356  targetRect = q->state()->matrix.mapRect(rect);
357  const QClipData *clipData = clip();
358  if (clipData) {
359  if (clipData->hasRectClip) {
360  unlock();
361  if (alpha)
362  pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
363  else
364  pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
365  } else if (clipData->hasRegionClip) {
366  QVector<QRect> rects = clipData->clipRegion.rects();
367  for (int i = 0; i < rects.size(); ++i) {
368  QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
369  if (!intersectRect.isEmpty()) {
370  unlock();
371  if (alpha)
372  pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
373  else
374  pmData->blittable()->fillRect(intersectRect, color);
375  }
376  }
377  }
378  } else {
379  if (targetRect.x() >= 0 && targetRect.y() >= 0
380  && targetRect.width() <= q->paintDevice()->width()
381  && targetRect.height() <= q->paintDevice()->height()) {
382  unlock();
383  if (alpha)
384  pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
385  else
386  pmData->blittable()->fillRect(targetRect, color);
387  } else {
388  QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
389  unlock();
390  if (alpha)
391  pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
392  else
393  pmData->blittable()->fillRect(deviceRect & targetRect, color);
394  }
395  }
396 }
397 
398 void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
399 {
401  QRectF intersectedRect = clip.intersected(target);
402  if (intersectedRect.isEmpty())
403  return;
404  QRectF source = sr;
405  if (intersectedRect.size() != target.size()) {
406  if (sr.size() == target.size()) {
407  // no resize
408  qreal deltaTop = target.top() - intersectedRect.top();
409  qreal deltaLeft = target.left() - intersectedRect.left();
410  qreal deltaBottom = target.bottom() - intersectedRect.bottom();
411  qreal deltaRight = target.right() - intersectedRect.right();
412  source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
413  } else {
414  // resize case
415  qreal hFactor = sr.size().width() / target.size().width();
416  qreal vFactor = sr.size().height() / target.size().height();
417  qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor;
418  qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor;
419  qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor;
420  qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor;
421  source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
422  }
423  }
424  pmData->unmarkRasterOverlay(intersectedRect);
425  if (opacity)
426  pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity);
427  else
428  pmData->blittable()->drawPixmap(intersectedRect, pm, source);
429 }
430 
432  : QRasterPaintEngine(*(new QBlitterPaintEnginePrivate(p)), p->buffer())
433 {}
434 
435 // State tracking
437 {
439 
441  d->updatePenState(state());
442 }
443 
445 {
447 
449  d->updateBrushState(state());
450 }
451 
453 {
455 
457  d->updateOpacityState(state());
458 }
459 
461 {
463 
465  d->updateCompositionModeState(state());
466 }
467 
469 {
471 
473  d->updateRenderHintsState(state());
474 }
475 
477 {
479 
481  d->updateTransformState(state());
482 }
483 
485 {
488  d->updateClipState(state());
489 }
490 
492 {
493  bool ok = QRasterPaintEngine::begin(pdev);
494 #ifdef QT_BLITTER_RASTEROVERLAY
496  d->pmData->unmergeOverlay();
497 #endif
498  return ok;
499 }
500 
502 {
503 #ifdef QT_BLITTER_RASTEROVERLAY
505  d->pmData->mergeOverlay();
506 #endif
507 
508  return QRasterPaintEngine::end();
509 }
510 
512 {
514 
516  d->updateCompleteState(s);
517 }
518 
519 // Accelerated paths
520 void QBlitterPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
521 {
523  if (path.shape() == QVectorPath::RectangleHint) {
524  QRectF rect(((QPointF *) path.points())[0], ((QPointF *) path.points())[2]);
525  fillRect(rect, brush);
526  } else {
527  d->lock();
528  d->pmData->markRasterOverlay(path);
529  QRasterPaintEngine::fill(path, brush);
530  }
531 }
532 
533 void QBlitterPaintEngine::fillRect(const QRectF &rect, const QColor &color)
534 {
536  if (d->caps.canBlitterAlphaFillRect()) {
537  d->fillRect(rect, color, true);
538  } else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
539  d->fillRect(rect, color, false);
540  } else {
541  d->lock();
542  d->pmData->markRasterOverlay(rect);
543  QRasterPaintEngine::fillRect(rect, color);
544  }
545 }
546 
547 void QBlitterPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
548 {
549  if (rect.size().isEmpty())
550  return;
551 
553 
554  if (qbrush_style(brush) == Qt::SolidPattern
555  && d->caps.canBlitterAlphaFillRect()) {
556  d->fillRect(rect, qbrush_color(brush), true);
557  } else if (qbrush_style(brush) == Qt::SolidPattern
558  && qbrush_color(brush).alpha() == 0xff
559  && d->caps.canBlitterFillRect()) {
560  d->fillRect(rect, qbrush_color(brush), false);
561  } else if ((brush.style() == Qt::TexturePattern) &&
562  (brush.transform().type() <= QTransform::TxTranslate) &&
563  ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
564  (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
565  bool rectIsFilled = false;
566  QRectF transformedRect = state()->matrix.mapRect(rect);
567  qreal x = transformedRect.x();
568  qreal y = transformedRect.y();
569  QPixmap pm = brush.texture();
570  d->unlock();
571  int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width();
572  if (srcX < 0)
573  srcX = pm.width() + srcX;
574  const int startX = srcX;
575  int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height();
576  if (srcY < 0)
577  srcY = pm.height() + srcY;
578  while (!rectIsFilled) {
579  qreal blitWidth = (pm.width() ) - srcX;
580  qreal blitHeight = (pm.height() ) - srcY;
581  if (x + blitWidth > transformedRect.right())
582  blitWidth = transformedRect.right() -x;
583  if (y + blitHeight > transformedRect.bottom())
584  blitHeight = transformedRect.bottom() - y;
585  const QClipData *clipData = d->clip();
586  if (clipData->hasRectClip) {
587  QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect);
588  if (targetRect.isValid()) {
589  int tmpSrcX = srcX + (targetRect.x() - x);
590  int tmpSrcY = srcY + (targetRect.y() - y);
591  QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
592  d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
593  }
594  } else if (clipData->hasRegionClip) {
595  QVector<QRect> clipRects = clipData->clipRegion.rects();
596  QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
597  QRegion intersectedRects = clipData->clipRegion.intersected(unclippedTargetRect);
598 
599  for (int i = 0; i < intersectedRects.rects().size(); ++i) {
600  QRect targetRect = intersectedRects.rects().at(i);
601  if (!targetRect.isValid() || targetRect.isEmpty())
602  continue;
603  int tmpSrcX = srcX + (targetRect.x() - x);
604  int tmpSrcY = srcY + (targetRect.y() - y);
605  QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
606  d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
607  }
608  }
609  x+=blitWidth;
610  if (qFuzzyCompare(x, transformedRect.right())) {
611  x = transformedRect.x();
612  srcX = startX;
613  srcY = 0;
614  y += blitHeight;
615  if (qFuzzyCompare(y, transformedRect.bottom()))
616  rectIsFilled = true;
617  } else
618  srcX = 0;
619  }
620  } else {
621  d->lock();
622  d->pmData->markRasterOverlay(rect);
623  QRasterPaintEngine::fillRect(rect, brush);
624  }
625 
626 }
627 
628 void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
629 {
631  if (d->caps.canBlitterDrawRectMask()) {
632  for (int i=0; i<rectCount; ++i)
633  d->fillRect(rects[i], qbrush_color(state()->brush), false);
634  } else {
635  d->pmData->markRasterOverlay(rects, rectCount);
636  QRasterPaintEngine::drawRects(rects, rectCount);
637  }
638 }
639 
640 void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
641 {
643  if (d->caps.canBlitterDrawRectMask()) {
644  for (int i = 0; i < rectCount; ++i)
645  d->fillRect(rects[i], qbrush_color(state()->brush), false);
646  } else {
647  d->pmData->markRasterOverlay(rects, rectCount);
648  QRasterPaintEngine::drawRects(rects, rectCount);
649  }
650 }
651 
653 {
654  drawPixmap(QRectF(pos, pm.size()), pm, pm.rect());
655 }
656 
657 void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
658 {
660  bool canDrawOpacity;
661 
662  canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm);
663  if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) {
664 
665  d->unlock();
666  QRectF targetRect = r;
667  if (d->hasXForm)
668  targetRect = state()->matrix.mapRect(r);
669  const QClipData *clipData = d->clip();
670  if (clipData) {
671  if (clipData->hasRectClip) {
672  d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity);
673  } else if (clipData->hasRegionClip) {
674  QVector<QRect>rects = clipData->clipRegion.rects();
675  for (int i = 0; i<rects.size(); ++i)
676  d->clipAndDrawPixmap(rects.at(i), targetRect, pm, sr, canDrawOpacity);
677  }
678  } else {
679  QRectF deviceRect(0, 0, paintDevice()->width(), paintDevice()->height());
680  d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity);
681  }
682  }else {
683  d->lock();
684  d->pmData->markRasterOverlay(r);
686  }
687 }
688 
689 // Overriden methods to lock the graphics memory
690 void QBlitterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
691 {
693  d->lock();
694  d->pmData->markRasterOverlay(points, pointCount);
695  QRasterPaintEngine::drawPolygon(points, pointCount, mode);
696 }
697 
698 void QBlitterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
699 {
701  d->lock();
702  d->pmData->markRasterOverlay(points, pointCount);
703  QRasterPaintEngine::drawPolygon(points, pointCount, mode);
704 }
705 
707 {
709  d->lock();
710  d->pmData->markRasterOverlay(path);
711  QRasterPaintEngine::fillPath(path, fillData);
712 }
713 
714 void QBlitterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
715 {
717  d->lock();
718  d->pmData->markRasterOverlay(points, pointCount);
719  QRasterPaintEngine::fillPolygon(points, pointCount, mode);
720 }
721 
723 {
725  d->lock();
726  d->pmData->markRasterOverlay(r);
728 }
729 
730 void QBlitterPaintEngine::drawImage(const QPointF &pos, const QImage &image)
731 {
732  drawImage(QRectF(pos, image.size()), image, image.rect());
733 }
734 
735 void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
736  Qt::ImageConversionFlags flags)
737 {
739  d->lock();
740  d->pmData->markRasterOverlay(r);
741  QRasterPaintEngine::drawImage(r, pm, sr, flags);
742 }
743 
744 void QBlitterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
745 {
747  d->lock();
748  d->pmData->markRasterOverlay(r);
750 }
751 
753 {
755  d->lock();
756  d->pmData->markRasterOverlay(pos, ti);
758 }
759 
760 void QBlitterPaintEngine::drawPoints(const QPointF *points, int pointCount)
761 {
763  d->lock();
764  d->pmData->markRasterOverlay(points, pointCount);
765  QRasterPaintEngine::drawPoints(points, pointCount);
766 }
767 
768 void QBlitterPaintEngine::drawPoints(const QPoint *points, int pointCount)
769 {
771  d->lock();
772  d->pmData->markRasterOverlay(points, pointCount);
773  QRasterPaintEngine::drawPoints(points, pointCount);
774 }
775 
776 void QBlitterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
777 {
779  d->lock();
780  d->pmData->markRasterOverlay(path);
781  QRasterPaintEngine::stroke(path, pen);
782 }
783 
785 {
787  d->lock();
789 
790 #ifdef QT_BLITTER_RASTEROVERLAY
791 //#### d->pmData->markRasterOverlay(sti);
792  qWarning("not implemented: markRasterOverlay for QStaticTextItem");
793 #endif
794 }
795 
797 #endif //QT_NO_BLITTABLE
798 
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
double d
Definition: qnumeric_p.h:62
virtual void compositionModeChanged()
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:278
virtual void fill(const QVectorPath &path, const QBrush &brush)
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
BrushStyle
Definition: qnamespace.h:1162
QRegion intersected(const QRegion &r) const
Returns a region which is the intersection of this region and r.
Definition: qregion.h:112
void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
int type
Definition: qmetatype.cpp:239
double qreal
Definition: qglobal.h:1193
#define STATE_BRUSH_PATTERN
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
void updateTransformState(QPainterState *s)
#define STATE_ANTIALIASING
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns 0...
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
QRasterPaintEngineState * state()
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
QBlitterPaintEnginePrivate(QBlittablePixmapData *p)
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
void updateRenderHintsState(QPainterState *s)
qreal width() const
Returns the width.
Definition: qsize.h:284
void fillPath(const QPainterPath &path, QSpanData *fillData)
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal height() const
Returns the height.
Definition: qsize.h:287
void updateState(uint mask, bool on)
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
void drawEllipse(const QRectF &rect)
Reimplemented Function
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
bool begin(QPaintDevice *device)
Reimplemented Function
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
Reimplemented Function
void setState(QPainterState *s)
virtual uint flags() const
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
Reimplement this function to draw the pixmap in the given rect, starting at the given p...
#define STATE_BLENDING_COMPLEX
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
static bool checkStateAgainstMask(uint state, uint mask)
CapabilitiesToStateMask caps
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
void fillPath(const QPainterPath &path, QSpanData *fillData)
QTransform matrix
Definition: qpainter_p.h:161
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QRectF intersected(const QRectF &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:818
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
Definition: qimage.cpp:1603
#define STATE_CLIP_COMPLEX
TransformationType type() const
Returns the transformation type of this matrix.
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
#define STATE_PEN_ENABLED
#define Q_D(Class)
Definition: qglobal.h:2482
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
bool end()
Reimplemented Function
void drawRects(const QRect *rects, int rectCount)
Reimplemented Function
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual void renderHintsChanged()
void drawEllipse(const QRectF &rect)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
#define STATE_CLIPSYS_COMPLEX
void drawImage(const QPointF &p, const QImage &img)
void drawImage(const QPointF &p, const QImage &img)
virtual void fillRect(const QRectF &rect, const QBrush &brush)
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
TransformationType
Definition: qtransform.h:68
void updateBrushState(QPainterState *s)
void updateCompleteState(QPainterState *s)
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void drawPoints(const QPointF *points, int pointCount)
Reimplemented Function
void updateOpacityState(QPainterState *s)
void drawPixmap(const QPointF &p, const QPixmap &pm)
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
void drawStaticTextItem(QStaticTextItem *textItem)
Reimplemented Function
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
unsigned int uint
Definition: qglobal.h:996
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
ClassId classId() const
#define STATE_BRUSH_ALPHA
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
void fill(const QVectorPath &path, const QBrush &brush)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
void drawPixmap(const QPointF &p, const QPixmap &pm)
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
void setState(QPainterState *s)
#define STATE_XFORM_SCALE
void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
ushort alpha
Returns the alpha color component of this color.
Definition: qcolor.h:242
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
virtual void clipEnabledChanged()
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
QBlittable::Capabilities m_capabilities
void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:778
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
void updateCompositionModeState(QPainterState *s)
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
#define STATE_ALPHA
void fillRect(const QRectF &rect, const QBrush &brush)
Reimplemented Function
const qreal * points() const
virtual bool begin(QPaintDevice *pdev)
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
static QReadWriteLock lock
Definition: proxyconf.cpp:399
QPointF brushOrigin
Definition: qpainter_p.h:149
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QColor & qbrush_color(const QBrush &b)
Definition: qpainter_p.h:97
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const
QRect rect() const
Returns the pixmap&#39;s enclosing rectangle.
Definition: qpixmap.cpp:676
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void fillRect(const QRectF &rect, const QColor &, bool alpha)
void updatePenState(QPainterState *s)
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
Reimplemented Function
static void updateStateBits(uint *state, uint mask, bool on)
QBrush brush
Definition: qpainter_p.h:153
void drawTextItem(const QPointF &p, const QTextItem &textItem)
Reimplemented Function
void stroke(const QVectorPath &path, const QPen &pen)
void drawStaticTextItem(QStaticTextItem *)
void updateClipState(QPainterState *s)
virtual bool end()
Reimplement this function to finish painting on the current paint device.
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
void stroke(const QVectorPath &path, const QPen &pen)
The QTextItem class provides all the information required to draw text in a custom paint engine...
Definition: qpaintengine.h:68
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
bool hasAlphaChannel() const
Returns true if the pixmap has a format that respects the alpha channel, otherwise returns false...
Definition: qpixmap.cpp:1965
#define STATE_XFORM_COMPLEX
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
QBlitterPaintEngine(QBlittablePixmapData *p)
Hint shape() const
QPixmapData * pixmapData() const
Definition: qpixmap.cpp:2277
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const