Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpaintengine_blitter.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "private/qpaintengine_blitter_p.h"
5
6#include "private/qblittable_p.h"
7#include "private/qpaintengine_raster_p.h"
8#include "private/qpainter_p.h"
9#include "private/qpixmap_blitter_p.h"
10
11#ifndef QT_NO_BLITTABLE
13
14#define STATE_XFORM_SCALE 0x00000001
15#define STATE_XFORM_COMPLEX 0x00000002
16
17#define STATE_BRUSH_PATTERN 0x00000010
18#define STATE_BRUSH_ALPHA 0x00000020
19
20#define STATE_PEN_ENABLED 0x00000100
21
22#define STATE_ANTIALIASING 0x00001000
23#define STATE_ALPHA 0x00002000
24#define STATE_BLENDING_COMPLEX 0x00004000
25
26#define STATE_CLIPSYS_COMPLEX 0x00010000
27#define STATE_CLIP_COMPLEX 0x00020000
28
29
31{
32public:
33 CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
34 : m_capabilities(capabilities)
35 , fillRectMask(0)
36 , drawRectMask(0)
37 , drawPixmapMask(0)
38 , alphaFillRectMask(0)
39 , opacityPixmapMask(0)
40 , capabillitiesState(0)
41 {
42 if (capabilities & QBlittable::SolidRectCapability)
43 setFillRectMask();
44 if (capabilities & QBlittable::SourcePixmapCapability)
45 setSourcePixmapMask();
47 setSourceOverPixmapMask();
49 setSourceOverScaledPixmapMask();
50 if (capabilities & QBlittable::AlphaFillRectCapability)
51 setAlphaFillRectMask();
52 if (capabilities & QBlittable::OpacityPixmapCapability)
53 setOpacityPixmapMask();
54 }
55
56 inline bool canBlitterFillRect() const
57 {
58 return checkStateAgainstMask(capabillitiesState, fillRectMask);
59 }
60
61 inline bool canBlitterAlphaFillRect() const
62 {
63 return checkStateAgainstMask(capabillitiesState, alphaFillRectMask);
64 }
65
66 inline bool canBlitterDrawRectMask() const
67 {
68 return checkStateAgainstMask(capabillitiesState, drawRectMask);
69 }
70
71 bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
72 {
74 return false;
75 if (checkStateAgainstMask(capabillitiesState, drawPixmapMask)) {
76 if (m_capabilities & (QBlittable::SourceOverPixmapCapability
78 if (r.size() != sr.size())
80 else
81 return m_capabilities & QBlittable::SourceOverPixmapCapability;
82 }
83 if ((m_capabilities & QBlittable::SourcePixmapCapability) && r.size() == sr.size() && !pm.hasAlphaChannel())
84 return m_capabilities & QBlittable::SourcePixmapCapability;
85 }
86 return false;
87 }
88
90 {
92 return false;
93
94 return checkStateAgainstMask(capabillitiesState, opacityPixmapMask);
95 }
96
97 bool canBlitterDrawCachedGlyphs(const QTransform &transform, QFontEngine::GlyphFormat requestedGlyphFormat, bool complexClip) const
98 {
99 if (transform.type() > QTransform::TxScale)
100 return false;
101 if (!(m_capabilities & QBlittable::DrawScaledCachedGlyphsCapability))
102 return false;
103 if (requestedGlyphFormat == QFontEngine::Format_ARGB && !(m_capabilities & QBlittable::SubPixelGlyphsCapability))
104 return false;
105 if (complexClip && !(m_capabilities & QBlittable::ComplexClipCapability))
106 return false;
107 return true;
108 }
109
110 inline void updateState(uint mask, bool on) {
111 updateStateBits(&capabillitiesState, mask, on);
112 }
113
114private:
115
116 static inline void updateStateBits(uint *state, uint mask, bool on)
117 {
118 *state = on ? (*state | mask) : (*state & ~mask);
119 }
120
121 static inline bool checkStateAgainstMask(uint state, uint mask)
122 {
123 return !state || (state & mask && !(state & ~mask));
124 }
125
126 void setFillRectMask() {
127 updateStateBits(&fillRectMask, STATE_XFORM_SCALE, false);
128 updateStateBits(&fillRectMask, STATE_XFORM_COMPLEX, false);
129
130 updateStateBits(&fillRectMask, STATE_BRUSH_PATTERN, false);
131 updateStateBits(&fillRectMask, STATE_BRUSH_ALPHA, false);
132
133 updateStateBits(&fillRectMask, STATE_PEN_ENABLED, true);
134
135 //Sub-pixel aliasing should not be sent to the blitter
136 updateStateBits(&fillRectMask, STATE_ANTIALIASING, true);
137 updateStateBits(&fillRectMask, STATE_ALPHA, false);
138 updateStateBits(&fillRectMask, STATE_BLENDING_COMPLEX, false);
139
140 updateStateBits(&fillRectMask, STATE_CLIPSYS_COMPLEX, false);
141 updateStateBits(&fillRectMask, STATE_CLIP_COMPLEX, false);
142 }
143
144 void setAlphaFillRectMask() {
145 updateStateBits(&alphaFillRectMask, STATE_XFORM_SCALE, false);
146 updateStateBits(&alphaFillRectMask, STATE_XFORM_COMPLEX, false);
147
148 updateStateBits(&alphaFillRectMask, STATE_BRUSH_PATTERN, false);
149 updateStateBits(&alphaFillRectMask, STATE_BRUSH_ALPHA, true);
150
151 updateStateBits(&alphaFillRectMask, STATE_PEN_ENABLED, true);
152
153 //Sub-pixel aliasing should not be sent to the blitter
154 updateStateBits(&alphaFillRectMask, STATE_ANTIALIASING, true);
155 updateStateBits(&alphaFillRectMask, STATE_ALPHA, false);
156 updateStateBits(&alphaFillRectMask, STATE_BLENDING_COMPLEX, false);
157
158 updateStateBits(&alphaFillRectMask, STATE_CLIPSYS_COMPLEX, false);
159 updateStateBits(&alphaFillRectMask, STATE_CLIP_COMPLEX, false);
160 }
161
162 void setSourcePixmapMask() {
163 updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, false);
164 updateStateBits(&drawPixmapMask, STATE_XFORM_COMPLEX, false);
165
166 updateStateBits(&drawPixmapMask, STATE_BRUSH_PATTERN, true);
167 updateStateBits(&drawPixmapMask, STATE_BRUSH_ALPHA, false);
168
169 updateStateBits(&drawPixmapMask, STATE_PEN_ENABLED, true);
170
171 updateStateBits(&drawPixmapMask, STATE_ANTIALIASING, true);
172 updateStateBits(&drawPixmapMask, STATE_ALPHA, false);
173 updateStateBits(&drawPixmapMask, STATE_BLENDING_COMPLEX, false);
174
175 updateStateBits(&drawPixmapMask, STATE_CLIPSYS_COMPLEX, false);
176 updateStateBits(&drawPixmapMask, STATE_CLIP_COMPLEX, false);
177 }
178
179 void setSourceOverPixmapMask() {
180 setSourcePixmapMask();
181 }
182
183 void setSourceOverScaledPixmapMask() {
184 setSourceOverPixmapMask();
185 updateStateBits(&drawPixmapMask, STATE_XFORM_SCALE, true);
186 }
187
188 void setOpacityPixmapMask() {
189 updateStateBits(&opacityPixmapMask, STATE_XFORM_SCALE, true);
190 updateStateBits(&opacityPixmapMask, STATE_XFORM_COMPLEX, false);
191
192 updateStateBits(&opacityPixmapMask, STATE_BRUSH_PATTERN, true);
193 updateStateBits(&opacityPixmapMask, STATE_BRUSH_ALPHA, true);
194
195 updateStateBits(&opacityPixmapMask, STATE_PEN_ENABLED, true);
196
197 updateStateBits(&opacityPixmapMask, STATE_ANTIALIASING, true);
198 updateStateBits(&opacityPixmapMask, STATE_ALPHA, true);
199 updateStateBits(&opacityPixmapMask, STATE_BLENDING_COMPLEX, false);
200
201 updateStateBits(&opacityPixmapMask, STATE_CLIPSYS_COMPLEX, false);
202 updateStateBits(&opacityPixmapMask, STATE_CLIP_COMPLEX, false);
203 }
204
205 QBlittable::Capabilities m_capabilities;
206 uint fillRectMask;
207 uint drawRectMask;
208 uint drawPixmapMask;
209 uint alphaFillRectMask;
210 uint opacityPixmapMask;
211 uint capabillitiesState;
212};
213
215{
216 Q_DECLARE_PUBLIC(QBlitterPaintEngine)
217public:
220 , pmData(p)
221 , caps(pmData->blittable()->capabilities())
222 , hasXForm(false)
223
224 {}
225
226 void lock();
227 void unlock();
228 void fillRect(const QRectF &rect, const QColor &color, bool alpha);
229 void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity);
230
231
240
244};
245
246
252
257
258// State tracking to make decisions
269
274
283
285{
286 bool translucent = s->opacity < 1;
287 caps.updateState(STATE_ALPHA, translucent);
288}
289
291{
292 bool nonTrivial = s->composition_mode != QPainter::CompositionMode_SourceOver
293 && s->composition_mode != QPainter::CompositionMode_Source;
294
296}
297
303
305{
306 QTransform::TransformationType type = s->matrix.type();
307
308 // consider scaling operations with a negative factor as "complex" for now.
309 // as some blitters could handle axisymmetrical operations, we should improve blitter
310 // paint engine to handle them as a capability
312 ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0))));
314
316}
317
319{
320 const QClipData *clipData = clip();
321 bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
322 caps.updateState(STATE_CLIP_COMPLEX, complexClip);
323}
324
326{
329 QRectF targetRect = rect;
330 if (hasXForm)
331 targetRect = q->state()->matrix.mapRect(rect);
332 const QClipData *clipData = clip();
333 if (clipData) {
334 if (clipData->hasRectClip) {
335 unlock();
336 if (alpha)
337 pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
338 else
339 pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
340 } else if (clipData->hasRegionClip) {
341 for (const QRect &rect : clipData->clipRegion) {
342 QRect intersectRect = rect.intersected(targetRect.toRect());
343 if (!intersectRect.isEmpty()) {
344 unlock();
345 if (alpha)
346 pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
347 else
348 pmData->blittable()->fillRect(intersectRect, color);
349 }
350 }
351 }
352 } else {
353 if (targetRect.x() >= 0 && targetRect.y() >= 0
354 && targetRect.width() <= q->paintDevice()->width()
355 && targetRect.height() <= q->paintDevice()->height()) {
356 unlock();
357 if (alpha)
358 pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
359 else
360 pmData->blittable()->fillRect(targetRect, color);
361 } else {
362 QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
363 unlock();
364 if (alpha)
365 pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
366 else
367 pmData->blittable()->fillRect(deviceRect & targetRect, color);
368 }
369 }
370}
371
373 const QRectF &target,
374 const QPixmap &pm,
375 const QRectF &sr,
376 bool opacity)
377{
379 QRectF intersectedRect = clip.intersected(target);
380 if (intersectedRect.isEmpty())
381 return;
382 QRectF source = sr;
383 if (intersectedRect.size() != target.size()) {
384 if (sr.size() == target.size()) {
385 // no resize
386 qreal deltaTop = target.top() - intersectedRect.top();
387 qreal deltaLeft = target.left() - intersectedRect.left();
388 qreal deltaBottom = target.bottom() - intersectedRect.bottom();
389 qreal deltaRight = target.right() - intersectedRect.right();
390 source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
391 } else {
392 // resize case
393 qreal hFactor = sr.size().width() / target.size().width();
394 qreal vFactor = sr.size().height() / target.size().height();
395 qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor;
396 qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor;
397 qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor;
398 qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor;
399 source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
400 }
401 }
402 pmData->unmarkRasterOverlay(intersectedRect);
403 if (opacity)
404 pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity);
405 else
406 pmData->blittable()->drawPixmap(intersectedRect, pm, source);
407}
408
412
413// State tracking
415{
417
419 d->updatePenState(state());
420}
421
423{
425
427 d->updateBrushState(state());
428}
429
431{
433
435 d->updateOpacityState(state());
436}
437
439{
441
443 d->updateCompositionModeState(state());
444}
445
447{
449
451 d->updateRenderHintsState(state());
452}
453
455{
457
459 d->updateTransformState(state());
460}
461
468
470{
472 bool ok = QRasterPaintEngine::begin(pdev);
473#ifdef QT_BLITTER_RASTEROVERLAY
474 d->pmData->unmergeOverlay();
475#endif
476 d->pdev = pdev;
477 return ok;
478}
479
481{
482#ifdef QT_BLITTER_RASTEROVERLAY
484 d->pmData->mergeOverlay();
485#endif
486
488}
489
491{
493
495 d->updateCompleteState(s);
496}
497
498// Accelerated paths
500{
502 if (path.shape() == QVectorPath::RectangleHint) {
503 QRectF rect(((const QPointF *) path.points())[0], ((const QPointF *) path.points())[2]);
505 } else {
506 d->lock();
507 d->pmData->markRasterOverlay(path);
509 }
510}
511
513{
515 if (d->caps.canBlitterAlphaFillRect()) {
516 d->fillRect(rect, color, true);
517 } else if (d->caps.canBlitterFillRect() && color.alpha() == 0xff) {
518 d->fillRect(rect, color, false);
519 } else {
520 d->lock();
521 d->pmData->markRasterOverlay(rect);
523 }
524}
525
527{
528 if (rect.size().isEmpty())
529 return;
530
532
534 && d->caps.canBlitterAlphaFillRect()) {
535 d->fillRect(rect, qbrush_color(brush), true);
536 } else if (qbrush_style(brush) == Qt::SolidPattern
537 && qbrush_color(brush).alpha() == 0xff
538 && d->caps.canBlitterFillRect()) {
539 d->fillRect(rect, qbrush_color(brush), false);
540 } else if ((brush.style() == Qt::TexturePattern) &&
541 (brush.transform().type() <= QTransform::TxTranslate) &&
542 ((d->caps.canBlitterDrawPixmapOpacity(brush.texture())) ||
543 (d->caps.canBlitterDrawPixmap(rect, brush.texture(), rect)))) {
544 bool rectIsFilled = false;
545 QRectF transformedRect = state()->matrix.mapRect(rect);
546 qreal x = transformedRect.x();
547 qreal y = transformedRect.y();
548 QPixmap pm = brush.texture();
549 d->unlock();
550 int srcX = int(rect.x() - state()->brushOrigin.x() - brush.transform().dx()) % pm.width();
551 if (srcX < 0)
552 srcX = pm.width() + srcX;
553 const int startX = srcX;
554 int srcY = int(rect.y() - state()->brushOrigin.y() - brush.transform().dy()) % pm.height();
555 if (srcY < 0)
556 srcY = pm.height() + srcY;
557 while (!rectIsFilled) {
558 qreal blitWidth = (pm.width() ) - srcX;
559 qreal blitHeight = (pm.height() ) - srcY;
560 if (x + blitWidth > transformedRect.right())
561 blitWidth = transformedRect.right() -x;
562 if (y + blitHeight > transformedRect.bottom())
563 blitHeight = transformedRect.bottom() - y;
564 const QClipData *clipData = d->clip();
565 if (clipData->hasRectClip) {
566 QRect targetRect = QRect(x, y, blitWidth, blitHeight).intersected(clipData->clipRect);
567 if (targetRect.isValid()) {
568 int tmpSrcX = srcX + (targetRect.x() - x);
569 int tmpSrcY = srcY + (targetRect.y() - y);
570 QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
571 d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
572 }
573 } else if (clipData->hasRegionClip) {
574 QRect unclippedTargetRect(x, y, blitWidth, blitHeight);
575 const QRegion targetRegion = clipData->clipRegion.intersected(unclippedTargetRect);
576 for (const QRect &targetRect : targetRegion) {
577 if (!targetRect.isValid() || targetRect.isEmpty())
578 continue;
579 int tmpSrcX = srcX + (targetRect.x() - x);
580 int tmpSrcY = srcY + (targetRect.y() - y);
581 QRect srcRect(tmpSrcX, tmpSrcY, targetRect.width(), targetRect.height());
582 d->pmData->blittable()->drawPixmap(targetRect, pm, srcRect);
583 }
584 }
585 x+=blitWidth;
586 if (qFuzzyCompare(x, transformedRect.right())) {
587 x = transformedRect.x();
588 srcX = startX;
589 srcY = 0;
590 y += blitHeight;
591 if (qFuzzyCompare(y, transformedRect.bottom()))
592 rectIsFilled = true;
593 } else
594 srcX = 0;
595 }
596 } else {
597 d->lock();
598 d->pmData->markRasterOverlay(rect);
600 }
601
602}
603
604void QBlitterPaintEngine::drawRects(const QRect *rects, int rectCount)
605{
607 if (d->caps.canBlitterDrawRectMask()) {
608 for (int i=0; i<rectCount; ++i)
609 d->fillRect(rects[i], qbrush_color(state()->brush), false);
610 } else {
611 d->pmData->markRasterOverlay(rects, rectCount);
612 QRasterPaintEngine::drawRects(rects, rectCount);
613 }
614}
615
616void QBlitterPaintEngine::drawRects(const QRectF *rects, int rectCount)
617{
619 if (d->caps.canBlitterDrawRectMask()) {
620 for (int i = 0; i < rectCount; ++i)
621 d->fillRect(rects[i], qbrush_color(state()->brush), false);
622 } else {
623 d->pmData->markRasterOverlay(rects, rectCount);
624 QRasterPaintEngine::drawRects(rects, rectCount);
625 }
626}
627
629{
630 drawPixmap(QRectF(pos, pm.size()), pm, pm.rect());
631}
632
633void QBlitterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
634{
636 bool canDrawOpacity;
637
638 canDrawOpacity = d->caps.canBlitterDrawPixmapOpacity(pm);
639 if (canDrawOpacity || (d->caps.canBlitterDrawPixmap(r, pm, sr))) {
640
641 d->unlock();
642 QRectF targetRect = r;
643 if (d->hasXForm)
644 targetRect = state()->matrix.mapRect(r);
645 const QClipData *clipData = d->clip();
646 if (clipData) {
647 if (clipData->hasRectClip) {
648 d->clipAndDrawPixmap(clipData->clipRect, targetRect, pm, sr, canDrawOpacity);
649 } else if (clipData->hasRegionClip) {
650 for (const QRect &rect : clipData->clipRegion)
651 d->clipAndDrawPixmap(rect, targetRect, pm, sr, canDrawOpacity);
652 }
653 } else {
655 d->clipAndDrawPixmap(deviceRect, targetRect, pm, sr, canDrawOpacity);
656 }
657 }else {
658 d->lock();
659 d->pmData->markRasterOverlay(r);
661 }
662}
663
664// Overridden methods to lock the graphics memory
666{
668 d->lock();
669 d->pmData->markRasterOverlay(points, pointCount);
671}
672
674{
676 d->lock();
677 d->pmData->markRasterOverlay(points, pointCount);
679}
680
682{
684 d->lock();
685 d->pmData->markRasterOverlay(path);
687}
688
690{
692 d->lock();
693 d->pmData->markRasterOverlay(points, pointCount);
695}
696
698{
700 d->lock();
701 d->pmData->markRasterOverlay(r);
703}
704
706{
707 drawImage(QRectF(pos, image.size()), image, image.rect());
708}
709
710void QBlitterPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
711 Qt::ImageConversionFlags flags)
712{
714 d->lock();
715 d->pmData->markRasterOverlay(r);
717}
718
720{
722 d->lock();
723 d->pmData->markRasterOverlay(r);
725}
726
728{
730 d->lock();
731 d->pmData->markRasterOverlay(pos, ti);
733}
734
736{
738 d->lock();
739 d->pmData->markRasterOverlay(points, pointCount);
741}
742
744{
746 d->lock();
747 d->pmData->markRasterOverlay(points, pointCount);
749}
750
752{
754 d->lock();
755 d->pmData->markRasterOverlay(path);
757}
758
760{
762 d->lock();
764
765#ifdef QT_BLITTER_RASTEROVERLAY
766//#### d->pmData->markRasterOverlay(sti);
767 qWarning("not implemented: markRasterOverlay for QStaticTextItem");
768#endif
769}
770
772{
774 QFontEngine::GlyphFormat glyphFormat = d->glyphCacheFormat;
775 if (fontEngine->glyphFormat != QFontEngine::Format_None)
776 glyphFormat = fontEngine->glyphFormat;
777
778 const QClipData *clipData = d->clip();
779 const bool complexClip = clipData && !clipData->hasRectClip;
780
781 const QPainterState *s = state();
782 if (d->caps.canBlitterDrawCachedGlyphs(s->transform(), glyphFormat, complexClip)) {
783 d->unlock();
784 const bool result = d->pmData->blittable()->drawCachedGlyphs(s, glyphFormat, numGlyphs, glyphs, positions, fontEngine);
785 // Lock again as the raster paint engine might draw decorations now.
786 d->lock();
787 return result;
788 } else {
789 return QRasterPaintEngine::drawCachedGlyphs(numGlyphs, glyphs, positions, fontEngine);
790 }
791}
792
794#endif //QT_NO_BLITTABLE
795
CapabilitiesToStateMask(QBlittable::Capabilities capabilities)
bool canBlitterDrawCachedGlyphs(const QTransform &transform, QFontEngine::GlyphFormat requestedGlyphFormat, bool complexClip) const
void updateState(uint mask, bool on)
bool canBlitterDrawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) const
bool canBlitterDrawPixmapOpacity(const QPixmap &pm) const
QBlittable * blittable() const
void unmarkRasterOverlay(const QRectF &)
QImage * buffer() override
virtual void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity)
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect)=0
virtual void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode)
virtual void fillRect(const QRectF &rect, const QColor &color)=0
@ SourceOverPixmapCapability
@ DrawScaledCachedGlyphsCapability
@ SourcePixmapCapability
@ OpacityPixmapCapability
@ ComplexClipCapability
@ SubPixelGlyphsCapability
@ SolidRectCapability
@ AlphaFillRectCapability
@ SourceOverScaledPixmapCapability
bool isLocked() const
void unlock()
void updateOpacityState(QPainterState *s)
void updateBrushState(QPainterState *s)
void clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
QBlitterPaintEnginePrivate(QBlittablePlatformPixmap *p)
QBlittablePlatformPixmap * pmData
void fillRect(const QRectF &rect, const QColor &color, bool alpha)
void updateCompositionModeState(QPainterState *s)
void updateTransformState(QPainterState *s)
void updatePenState(QPainterState *s)
void updateRenderHintsState(QPainterState *s)
void updateClipState(QPainterState *s)
void updateCompleteState(QPainterState *s)
void drawStaticTextItem(QStaticTextItem *) override
void fill(const QVectorPath &path, const QBrush &brush) override
void stroke(const QVectorPath &path, const QPen &pen) override
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
void fillPath(const QPainterPath &path, QSpanData *fillData) override
virtual bool begin(QPaintDevice *pdev) override
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void drawImage(const QPointF &p, const QImage &img) override
bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine) override
void setState(QPainterState *s) override
virtual void penChanged() override
void drawRects(const QRect *rects, int rectCount) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
virtual bool end() override
Reimplement this function to finish painting on the current paint device.
virtual void opacityChanged() override
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
Reimplement this virtual function to draw the polygon defined by the pointCount first points in point...
void drawPoints(const QPointF *points, int pointCount) override
Draws the first pointCount points in the buffer points.
void drawEllipse(const QRectF &rect) override
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.
void drawTextItem(const QPointF &p, const QTextItem &textItem) override
This function draws the text item textItem at position p.
virtual void compositionModeChanged() override
void fillRect(const QRectF &rect, const QBrush &brush) override
virtual void clipEnabledChanged() override
virtual void transformChanged() override
void drawPixmap(const QPointF &p, const QPixmap &pm) override
virtual void renderHintsChanged() override
virtual void brushChanged() override
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
int alpha() const noexcept
Returns the alpha color component of this color.
Definition qcolor.cpp:1466
GlyphFormat glyphFormat
\inmodule QtGui
Definition qimage.h:37
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
QPaintDevice * paintDevice() const
Returns the device that this engine is painting on, if painting is active; otherwise returns \nullptr...
\inmodule QtGui
QTransform matrix
Definition qpainter_p.h:130
@ Antialiasing
Definition qpainter.h:52
@ CompositionMode_SourceOver
Definition qpainter.h:98
@ CompositionMode_Source
Definition qpainter.h:101
\inmodule QtGui
Definition qpen.h:28
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
int height() const
Returns the height of the pixmap.
Definition qpixmap.cpp:480
QSize size() const
Returns the size of the pixmap.
Definition qpixmap.cpp:493
int width() const
Returns the width of the pixmap.
Definition qpixmap.cpp:468
QPlatformPixmap * handle() const
Definition qpixmap.cpp:1506
QRect rect() const
Returns the pixmap's enclosing rectangle.
Definition qpixmap.cpp:505
bool hasAlphaChannel() const
ClassId classId() const
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
QImage::Format prepare(QImage *image)
const QClipData * clip() const
QScopedPointer< QRasterBuffer > rasterBuffer
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
void compositionModeChanged() override
void drawStaticTextItem(QStaticTextItem *textItem) override
\reimp
void fill(const QVectorPath &path, const QBrush &brush) override
void transformChanged() override
void setState(QPainterState *s) override
void drawEllipse(const QRectF &rect) override
\reimp
virtual bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
void renderHintsChanged() override
void drawPoints(const QPointF *points, int pointCount) override
\reimp
QRasterPaintEngineState * state()
const QClipData * clipData() const
virtual void fillPath(const QPainterPath &path, QSpanData *fillData)
bool end() override
\reimp
void stroke(const QVectorPath &path, const QPen &pen) override
void drawTextItem(const QPointF &p, const QTextItem &textItem) override
\reimp
void opacityChanged() override
void drawPixmap(const QPointF &p, const QPixmap &pm) override
void drawImage(const QPointF &p, const QImage &img) override
bool begin(QPaintDevice *device) override
\reimp
void clipEnabledChanged() override
void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) override
\reimp
void drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) override
\reimp
void fillRect(const QRectF &rect, const QBrush &brush) override
\reimp
virtual void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
void drawRects(const QRect *rects, int rectCount) override
\reimp
\inmodule QtCore\reentrant
Definition qrect.h:484
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
Definition qrect.h:661
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:500
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:497
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
Definition qrect.h:735
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:498
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:499
\inmodule QtCore\reentrant
Definition qrect.h:30
QRect intersected(const QRect &other) const noexcept
Definition qrect.h:415
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
QRegion intersected(const QRegion &r) const
\inmodule QtGui
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
QRect mapRect(const QRect &) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
TransformationType
\value TxNone \value TxTranslate \value TxScale \value TxRotate \value TxShear \value TxProject
Definition qtransform.h:22
rect
[4]
else opt state
[0]
Combined button and popup list for selecting options.
@ NoPen
BrushStyle
@ SolidPattern
@ TexturePattern
Definition brush.cpp:5
Definition image.cpp:4
static const QCssKnownValue positions[NumKnownPositionModes - 1]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
#define qWarning
Definition qlogging.h:166
GLint GLint GLint GLint GLint x
[0]
GLenum mode
GLint GLsizei GLsizei height
GLboolean r
[2]
GLenum GLint GLint GLint srcY
GLenum const void GLbitfield GLsizei numGlyphs
GLenum GLuint buffer
GLint GLsizei width
GLenum GLint GLint srcX
GLuint color
[2]
GLenum type
GLenum target
GLbitfield flags
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLint y
GLsizei GLsizei GLchar * source
GLuint GLenum GLenum transform
GLfixed GLfixed GLint GLint GLfixed points
GLdouble s
[6]
Definition qopenglext.h:235
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei const GLchar *const * path
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLfloat GLfloat GLfloat alpha
Definition qopenglext.h:418
#define STATE_BRUSH_ALPHA
#define STATE_ANTIALIASING
#define STATE_ALPHA
#define STATE_BLENDING_COMPLEX
#define STATE_XFORM_SCALE
#define STATE_BRUSH_PATTERN
#define STATE_CLIP_COMPLEX
#define STATE_XFORM_COMPLEX
#define STATE_CLIPSYS_COMPLEX
#define STATE_PEN_ENABLED
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition qpainter_p.h:63
Qt::PenStyle qpen_style(const QPen &p)
Definition qpainter_p.h:56
const QColor & qbrush_color(const QBrush &b)
Definition qpainter_p.h:64
unsigned int glyph_t
unsigned int uint
Definition qtypes.h:34
double qreal
Definition qtypes.h:187