8#include "private/qpaintengine_alpha_p.h"
10#include "private/qpainter_p.h"
11#include "private/qpicture_p.h"
12#include "private/qfont_p.h"
13#include "QtGui/qpicture.h"
32 d->m_continueCall =
true;
40 d->m_alphaPen =
false;
41 d->m_alphaBrush =
false;
42 d->m_alphaOpacity =
false;
43 d->m_hasalpha =
false;
44 d->m_advancedPen =
false;
45 d->m_advancedBrush =
false;
46 d->m_complexTransform =
false;
47 d->m_emulateProjectiveTransforms =
false;
64 d->m_continueCall =
true;
88 d->m_advancedPen =
false;
89 d->m_alphaPen =
false;
92 d->m_alphaPen = !
d->m_pen.brush().isOpaque();
97 d->m_continueCall =
true;
100 d->m_continueCall =
false;
108 d->m_advancedBrush =
false;
109 d->m_alphaBrush =
false;
117 d->m_hasalpha =
d->m_alphaOpacity ||
d->m_alphaBrush ||
d->m_alphaPen;
119 if (
d->m_picengine) {
121 d->m_picpainter->setPen(
p->pen());
122 d->m_picpainter->setBrush(
p->brush());
123 d->m_picpainter->setBrushOrigin(
p->brushOrigin());
124 d->m_picpainter->setFont(
p->font());
125 d->m_picpainter->setOpacity(
p->opacity());
126 d->m_picpainter->setTransform(
p->combinedTransform());
127 d->m_picengine->updateState(
state);
137 if (
d->m_pass == 0) {
138 d->m_continueCall =
false;
139 if (
d->canSeeTroughBackground(
d->m_hasalpha,
tr) ||
d->m_advancedPen ||
d->m_advancedBrush
140 ||
d->m_emulateProjectiveTransforms)
148 d->m_picengine->drawPath(
path);
150 d->m_continueCall = !
d->fullyContained(
tr);
160 for (
int i = 0;
i < pointCount; ++
i)
164 path.addPolygon(poly);
167 if (
d->m_pass == 0) {
168 d->m_continueCall =
false;
169 if (
d->canSeeTroughBackground(
d->m_hasalpha,
tr) ||
d->m_advancedPen ||
d->m_advancedBrush
170 ||
d->m_emulateProjectiveTransforms)
178 d->m_picengine->drawPolygon(
points, pointCount,
mode);
180 d->m_continueCall = !
d->fullyContained(
tr);
189 if (
d->m_pass == 0) {
190 d->m_continueCall =
false;
191 if (
d->canSeeTroughBackground(pm.
hasAlpha() ||
d->m_alphaOpacity,
tr) ||
d->m_complexTransform || pm.
isQBitmap()) {
198 d->m_picengine->drawPixmap(
r, pm, sr);
201 d->m_continueCall = !
d->fullyContained(
tr);
210 tr =
d->m_transform.mapRect(
tr);
212 if (
d->m_pass == 0) {
213 d->m_continueCall =
false;
214 if (
d->canSeeTroughBackground(
d->m_alphaPen ||
d->m_alphaOpacity,
tr) ||
d->m_advancedPen) {
220 if (
d->m_picengine) {
221 d->m_picengine->drawTextItem(
p, textItem);
224 d->m_continueCall = !
d->fullyContained(
tr);
232 QRectF brect =
d->m_transform.mapRect(
r);
234 if (
d->m_pass == 0) {
235 d->m_continueCall =
false;
236 if (
d->canSeeTroughBackground(
pixmap.hasAlpha() ||
d->m_alphaOpacity, brect) ||
d->m_complexTransform ||
pixmap.isQBitmap()) {
237 d->addAlphaRect(brect);
240 d->addDirtyRect(brect);
243 d->m_picengine->drawTiledPixmap(
r,
pixmap,
s);
245 d->m_continueCall = !
d->fullyContained(brect);
258 return d->m_continueCall;
267 d->m_picpainter->end();
270 d->m_alphargn =
d->m_alphargn.intersected(
QRect(0, 0,
d->m_pdev->width(),
d->m_pdev->height()));
273 if (
d->m_alphargn.rectCount() > 10) {
274 QRect br =
d->m_alphargn.boundingRect();
278 const auto oldAlphaRegion =
d->m_cliprgn =
d->m_alphargn;
300 for (
const auto &
rect : oldAlphaRegion)
301 d->drawAlphaImage(
rect);
316 d->m_pic->d_ptr->in_memory_only =
true;
318 d->m_picengine =
d->m_picpainter->paintEngine();
323 d->m_picpainter->setPen(
painter()->pen());
325 d->m_picpainter->setBrushOrigin(
painter()->brushOrigin());
327 d->m_picpainter->setOpacity(
painter()->opacity());
328 d->m_picpainter->setTransform(
painter()->combinedTransform());
329 d->m_picengine->syncState();
341 delete d->m_picpainter;
344 d->m_picpainter =
nullptr;
346 d->m_picengine =
nullptr;
354 m_numberOfCachedRects(0),
358 m_alphaOpacity(
false),
359 m_advancedPen(
false),
360 m_advancedBrush(
false),
361 m_complexTransform(
false)
403 if (somethingInRectHasAlpha) {
432 int incx = int(
rect.width() / divw);
433 int incy = int(
rect.height() / divh);
435 for (
int y=0;
y<divh; ++
y) {
436 int ypos = int((incy *
y) +
rect.y());
437 int height = int((
y == (divh - 1)) ? (
rect.height() - (incy *
y)) : incy) + 1;
439 for (
int x=0;
x<divw; ++
x) {
440 int xpos = int((incx *
x) +
rect.x());
441 int width = int((
x == (divw - 1)) ? (
rect.width() - (incx *
x)) : incx) + 1;
445 img.fill(0xffffffff);
455 q->painter()->drawImage(
r,
img);
470 p->setBrushOrigin(0,0);
477 p->setViewTransformEnabled(
false);
480 p->setClipping(
false);
int m_numberOfCachedRects
void drawAlphaImage(const QRectF &rect)
void resetState(QPainter *p)
QRectF addPenWidth(const QPainterPath &path)
void addAlphaRect(const QRectF &rect)
QAlphaPaintEnginePrivate()
bool fullyContained(const QRectF &rect) const
QList< QRect > m_dirtyRects
~QAlphaPaintEnginePrivate()
bool canSeeTroughBackground(bool somethingInRectHasAlpha, const QRectF &rect) const
QRegion alphaClipping() const
void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.
QAlphaPaintEngine(QAlphaPaintEnginePrivate &data, PaintEngineFeatures devcaps={ })
bool continueCall() const
bool end() override
Reimplement this function to finish painting on the current paint device.
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 drawTextItem(const QPointF &p, const QTextItem &textItem) override
This function draws the text item textItem at position p.
bool begin(QPaintDevice *pdev) override
Reimplement this function to initialise your paint engine when painting is to start on the paint devi...
void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override
Reimplement this function to draw the pixmap in the given rect, starting at the given p.
void updateState(const QPaintEngineState &state) override
Reimplement this function to update the state of a paint engine.
void drawPath(const QPainterPath &path) override
The default implementation ignores the path and does nothing.
void flushAndInit(bool init=true)
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Qt::BrushStyle style() const
Returns the brush style.
qsizetype size() const noexcept
const_pointer constData() const noexcept
void reserve(qsizetype size)
void append(parameter_type t)
The QPaintEngineState class provides information about the active paint engine's current state....
QTransform transform() const
QPainter * painter() const
Returns a pointer to the painter currently updating the paint engine.
QBrush brush() const
Returns the brush in the current paint engine state.
QPen pen() const
Returns the pen in the current paint engine state.
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
PolygonDrawMode
\value OddEvenMode The polygon should be drawn using OddEven fill rule.
QPainter * painter() const
Returns the paint engine's painter.
@ ObjectBoundingModeGradients
QPaintEngineState * state
PaintEngineFeatures gccaps
The QPainterPathStroker class is used to generate fillable outlines for a given painter path.
void setCapStyle(Qt::PenCapStyle style)
Sets the cap style of the generated outlines to style.
void setWidth(qreal width)
Sets the width of the generated outline painter path to width.
QPainterPath createStroke(const QPainterPath &path) const
Generates a new path that is a fillable area representing the outline of the given path.
void setJoinStyle(Qt::PenJoinStyle style)
Sets the join style of the generated outlines to style.
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
The QPainter class performs low-level painting on widgets and other paint devices.
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
void drawPicture(const QPointF &p, const QPicture &picture)
Replays the given picture at the given point.
void setTransform(const QTransform &transform, bool combine=false)
qreal widthF() const
Returns the pen width with floating point precision.
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
Qt::PenStyle style() const
Returns the pen style.
The QPicture class is a paint device that records and replays QPainter commands.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
\inmodule QtCore\reentrant
The QPolygonF class provides a list of points using floating point precision.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
The QRegion class specifies a clip region for a painter.
void setRects(const QRect *rect, int num)
Sets the region using the array of rectangles specified by rects and number.
bool intersects(const QRegion &r) const
QRegion intersected(const QRegion &r) const
qreal descent() const
Corresponds to the \l{QFontMetrics::descent()}{descent} of the piece of text that is drawn.
qreal ascent() const
Corresponds to the \l{QFontMetrics::ascent()}{ascent} of the piece of text that is drawn.
qreal width() const
Specifies the total width of the text to be drawn.
Combined button and popup list for selecting options.
Q_GUI_EXPORT int qt_defaultDpiX()
Q_GUI_EXPORT int qt_defaultDpiY()
static QT_BEGIN_NAMESPACE const int tileSize
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
GLenum GLenum GLuint GLint GLint GLint yscale
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLuint GLint GLint xscale
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLfixed GLfixed GLint GLint GLfixed points
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
static QT_BEGIN_NAMESPACE void init(QTextBoundaryFinder::BoundaryType type, QStringView str, QCharAttributes *attributes)