Qt 4.8
Public Functions | Protected Variables | List of all members
QPainterReplayer Class Reference

#include <qpaintbuffer_p.h>

Inheritance diagram for QPainterReplayer:
QPaintEngineExReplayer

Public Functions

virtual void process (const QPaintBufferCommand &cmd)
 
void processCommands (const QPaintBuffer &buffer, QPainter *painter, int begin, int end)
 
 QPainterReplayer ()
 
void setupTransform (QPainter *painter)
 
virtual ~QPainterReplayer ()
 

Protected Variables

QPaintBufferPrivated
 
QTransform m_world_matrix
 
QPainterpainter
 

Detailed Description

Definition at line 319 of file qpaintbuffer_p.h.

Constructors and Destructors

◆ QPainterReplayer()

QPainterReplayer::QPainterReplayer ( )
inline

Definition at line 322 of file qpaintbuffer_p.h.

322 { }

◆ ~QPainterReplayer()

virtual QPainterReplayer::~QPainterReplayer ( )
inlinevirtual

Definition at line 324 of file qpaintbuffer_p.h.

324 { }

Functions

◆ process()

void QPainterReplayer::process ( const QPaintBufferCommand cmd)
virtual

Reimplemented in QPaintEngineExReplayer.

Definition at line 1403 of file qpaintbuffer.cpp.

Referenced by QPaintEngineExReplayer::process().

1404 {
1405  switch (cmd.id) {
1407 #ifdef QPAINTBUFFER_DEBUG_DRAW
1408  qDebug() << " -> Cmd_Save";
1409 #endif
1410  painter->save();
1411  break; }
1412 
1414 #ifdef QPAINTBUFFER_DEBUG_DRAW
1415  qDebug() << " -> Cmd_Restore";
1416 #endif
1417  painter->restore();
1418  break; }
1419 
1421  QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.offset));
1422 #ifdef QPAINTBUFFER_DEBUG_DRAW
1423  qDebug() << " -> Cmd_SetPen: " << pen;
1424 #endif
1425  painter->setPen(pen);
1426  break; }
1427 
1429  QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.offset));
1430 #ifdef QPAINTBUFFER_DEBUG_DRAW
1431  qDebug() << " -> Cmd_SetBrush: " << brush;
1432 #endif
1433  painter->setBrush(brush);
1434  break; }
1435 
1437 #ifdef QPAINTBUFFER_DEBUG_DRAW
1438  qDebug() << " -> Cmd_SetBrushOrigin: " << d->variants.at(cmd.offset).toPointF();
1439 #endif
1441  break; }
1442 
1445 #ifdef QPAINTBUFFER_DEBUG_DRAW
1446  qDebug() << " -> Cmd_SetTransform, offset: " << cmd.offset << xform;
1447 #endif
1449  break; }
1450 
1452  QPointF delta(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
1453 #ifdef QPAINTBUFFER_DEBUG_DRAW
1454  qDebug() << " -> Cmd_Translate, offset: " << cmd.offset << delta;
1455 #endif
1456  painter->translate(delta.x(), delta.y());
1457  return;
1458  }
1459 
1462 #ifdef QPAINTBUFFER_DEBUG_DRAW
1463  qDebug() << " -> Cmd_SetCompositionMode, mode: " << mode;
1464 #endif
1465  painter->setCompositionMode(mode);
1466  break; }
1467 
1469 #ifdef QPAINTBUFFER_DEBUG_DRAW
1470  qDebug() << " -> Cmd_SetRenderHints, hints: " << cmd.extra;
1471 #endif
1472  QPainter::RenderHints ph = painter->renderHints();
1473  QPainter::RenderHints nh = (QPainter::RenderHints) cmd.extra;
1474  QPainter::RenderHints xored = ph ^ nh;
1475  if (xored & QPainter::Antialiasing)
1476  painter->setRenderHint(QPainter::Antialiasing, nh & QPainter::Antialiasing);
1478  painter->setRenderHint(QPainter::HighQualityAntialiasing, nh & QPainter::HighQualityAntialiasing);
1479  if (xored & QPainter::TextAntialiasing)
1480  painter->setRenderHint(QPainter::TextAntialiasing, nh & QPainter::TextAntialiasing);
1481  if (xored & QPainter::SmoothPixmapTransform)
1482  painter->setRenderHint(QPainter::SmoothPixmapTransform, nh & QPainter::SmoothPixmapTransform);
1483  if (xored & QPainter::NonCosmeticDefaultPen)
1484  painter->setRenderHint(QPainter::NonCosmeticDefaultPen, nh & QPainter::NonCosmeticDefaultPen);
1485  break; }
1486 
1488 #ifdef QPAINTBUFFER_DEBUG_DRAW
1489  qDebug() << " -> Cmd_SetOpacity: " << d->variants.at(cmd.offset).toDouble();
1490 #endif
1492  break; }
1493 
1495 #ifdef QPAINTBUFFER_DEBUG_DRAW
1496  qDebug() << " -> Cmd_SetBackgroundMode: " << cmd.extra;
1497 #endif
1499  break; }
1500 
1502 #ifdef QPAINTBUFFER_DEBUG_DRAW
1503  qDebug() << " -> Cmd_DrawVectorPath: size: " << cmd.size
1504 // << ", hints:" << d->ints[cmd.offset2+cmd.size]
1505  << "pts/elms:" << cmd.offset << cmd.offset2;
1506 #endif
1507  QVectorPathCmd path(d, cmd);
1508  painter->drawPath(path().convertToPainterPath());
1509  break; }
1510 
1512  QPen pen = qvariant_cast<QPen>(d->variants.at(cmd.extra));
1513 #ifdef QPAINTBUFFER_DEBUG_DRAW
1514  qDebug() << " -> Cmd_StrokeVectorPath: size: " << cmd.size
1515 // << ", hints:" << d->ints[cmd.offset2+cmd.size]
1516  << "pts/elms:" << cmd.offset << cmd.offset2;
1517 #endif
1518  QVectorPathCmd path(d, cmd);
1519  painter->strokePath(path().convertToPainterPath(), pen);
1520  break; }
1521 
1523  QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
1524 #ifdef QPAINTBUFFER_DEBUG_DRAW
1525  qDebug() << " -> Cmd_FillVectorPath: size: " << cmd.size
1526 // << ", hints:" << d->ints[cmd.offset2+cmd.size]
1527  << "pts/elms:" << cmd.offset << cmd.offset2 << brush;
1528 #endif
1529  QVectorPathCmd path(d, cmd);
1530  painter->fillPath(path().convertToPainterPath(), brush);
1531  break; }
1532 
1534 #ifdef QPAINTBUFFER_DEBUG_DRAW
1535  qDebug() << " -> Cmd_DrawPolygonF, offset: " << cmd.offset << " size: " << cmd.size
1536  << " mode: " << cmd.extra
1537  << d->floats.at(cmd.offset)
1538  << d->floats.at(cmd.offset+1);
1539 #endif
1542  painter->drawPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size, fill);
1543  break; }
1544 
1546 #ifdef QPAINTBUFFER_DEBUG_DRAW
1547  qDebug() << " -> Cmd_DrawPolygonI, offset: " << cmd.offset << " size: " << cmd.size
1548  << " mode: " << cmd.extra
1549  << d->ints.at(cmd.offset)
1550  << d->ints.at(cmd.offset+1);
1551 #endif
1554  painter->drawPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size, fill);
1555  break; }
1556 
1558 #ifdef QPAINTBUFFER_DEBUG_DRAW
1559  qDebug() << " -> Cmd_DrawPolylineF, offset: " << cmd.offset << " size: " << cmd.size;
1560 #endif
1561  painter->drawPolyline((QPointF *) (d->floats.constData() + cmd.offset), cmd.size);
1562  break; }
1563 
1565 #ifdef QPAINTBUFFER_DEBUG_DRAW
1566  qDebug() << " -> Cmd_DrawPolylineI, offset: " << cmd.offset << " size: " << cmd.size;
1567 #endif
1568  painter->drawPolyline((QPoint *) (d->ints.constData() + cmd.offset), cmd.size);
1569  break; }
1570 
1572 #ifdef QPAINTBUFFER_DEBUG_DRAW
1573  qDebug() << " -> Cmd_DrawConvexPolygonF, offset: " << cmd.offset << " size: " << cmd.size;
1574 #endif
1575  painter->drawConvexPolygon((QPointF *) (d->floats.constData() + cmd.offset), cmd.size);
1576  break; }
1577 
1579 #ifdef QPAINTBUFFER_DEBUG_DRAW
1580  qDebug() << " -> Cmd_DrawConvexPolygonI, offset: " << cmd.offset << " size: " << cmd.size;
1581 #endif
1582  painter->drawConvexPolygon((QPoint *) (d->ints.constData() + cmd.offset), cmd.size);
1583  break; }
1584 
1586 #ifdef QPAINTBUFFER_DEBUG_DRAW
1587  qDebug() << " -> Cmd_DrawEllipseF, offset: " << cmd.offset;
1588 #endif
1589  painter->drawEllipse(*(QRectF *)(d->floats.constData() + cmd.offset));
1590  break; }
1591 
1593 #ifdef QPAINTBUFFER_DEBUG_DRAW
1594  qDebug() << " -> Cmd_DrawEllipseI, offset: " << cmd.offset;
1595 #endif
1596  painter->drawEllipse(*(QRect *)(d->ints.constData() + cmd.offset));
1597  break; }
1598 
1600 #ifdef QPAINTBUFFER_DEBUG_DRAW
1601  qDebug() << " -> Cmd_DrawLineF, offset: " << cmd.offset << " size: " << cmd.size;
1602 #endif
1603  painter->drawLines((QLineF *)(d->floats.constData() + cmd.offset), cmd.size);
1604  break; }
1605 
1607 #ifdef QPAINTBUFFER_DEBUG_DRAW
1608  qDebug() << " -> Cmd_DrawLineI, offset: " << cmd.offset << " size: " << cmd.size;
1609 #endif
1610  painter->drawLines((QLine *)(d->ints.constData() + cmd.offset), cmd.size);
1611  break; }
1612 
1614 #ifdef QPAINTBUFFER_DEBUG_DRAW
1615  qDebug() << " -> Cmd_DrawPointsF, offset: " << cmd.offset << " size: " << cmd.size;
1616 #endif
1617  painter->drawPoints((QPointF *)(d->floats.constData() + cmd.offset), cmd.size);
1618  break; }
1619 
1621 #ifdef QPAINTBUFFER_DEBUG_DRAW
1622  qDebug() << " -> Cmd_DrawPointsI, offset: " << cmd.offset << " size: " << cmd.size;
1623 #endif
1624  painter->drawPoints((QPoint *)(d->ints.constData() + cmd.offset), cmd.size);
1625  break; }
1626 
1628  QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
1629  QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
1630  d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
1631 
1632  QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5),
1633  d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7));
1634 #ifdef QPAINTBUFFER_DEBUG_DRAW
1635  qDebug() << " -> Cmd_DrawPixmapRect:" << r << sr;
1636 #endif
1637  painter->drawPixmap(r, pm, sr);
1638  break; }
1639 
1641  QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
1642  QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
1643 #ifdef QPAINTBUFFER_DEBUG_DRAW
1644  qDebug() << " -> Cmd_DrawPixmapPos:" << pos;
1645 #endif
1646  painter->drawPixmap(pos, pm);
1647  break; }
1648 
1650  QPixmap pm(d->variants.at(cmd.offset).value<QPixmap>());
1651  QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
1652  d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
1653 
1654  QPointF offset(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5));
1655 #ifdef QPAINTBUFFER_DEBUG_DRAW
1656  qDebug() << " -> Cmd_DrawTiledPixmap:" << r << offset;
1657 #endif
1658  painter->drawTiledPixmap(r, pm, offset);
1659  break; }
1660 
1662  QImage image(d->variants.at(cmd.offset).value<QImage>());
1663  QRectF r(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1),
1664  d->floats.at(cmd.extra+2), d->floats.at(cmd.extra+3));
1665  QRectF sr(d->floats.at(cmd.extra+4), d->floats.at(cmd.extra+5),
1666  d->floats.at(cmd.extra+6), d->floats.at(cmd.extra+7));
1667 #ifdef QPAINTBUFFER_DEBUG_DRAW
1668  qDebug() << " -> Cmd_DrawImageRect:" << r << sr;
1669 #endif
1670  painter->drawImage(r, image, sr);
1671  break; }
1672 
1674  QImage image(d->variants.at(cmd.offset).value<QImage>());
1675  QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
1676 #ifdef QPAINTBUFFER_DEBUG_DRAW
1677  qDebug() << " -> Cmd_DrawImagePos:" << pos;
1678 #endif
1679  painter->drawImage(pos, image);
1680  break; }
1681 
1683 #ifdef QPAINTBUFFER_DEBUG_DRAW
1684  qDebug() << " -> Cmd_DrawRectF, offset: " << cmd.offset;
1685 #endif
1686  painter->drawRects((QRectF *)(d->floats.constData() + cmd.offset), cmd.size);
1687  break; }
1688 
1690 #ifdef QPAINTBUFFER_DEBUG_DRAW
1691  qDebug() << " -> Cmd_DrawRectI, offset: " << cmd.offset;
1692 #endif
1693  painter->drawRects((QRect *)(d->ints.constData() + cmd.offset), cmd.size);
1694  break; }
1695 
1697  QBrush brush = qvariant_cast<QBrush>(d->variants.at(cmd.extra));
1698  QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
1699 #ifdef QPAINTBUFFER_DEBUG_DRAW
1700  qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " brush: " << brush;
1701 #endif
1702  painter->fillRect(*rect, brush);
1703  break; }
1704 
1706  QColor color = qvariant_cast<QColor>(d->variants.at(cmd.extra));
1707  QRectF *rect = (QRectF *)(d->floats.constData() + cmd.offset);
1708 #ifdef QPAINTBUFFER_DEBUG_DRAW
1709  qDebug() << " -> Cmd_FillRectBrush, offset: " << cmd.offset << " rect: " << *rect << " color: " << color;
1710 #endif
1711  painter->fillRect(*rect, color);
1712  break; }
1713 
1715  bool clipEnabled = d->variants.at(cmd.offset).toBool();
1716 #ifdef QPAINTBUFFER_DEBUG_DRAW
1717  qDebug() << " -> Cmd_SetClipEnabled:" << clipEnabled;
1718 #endif
1719  painter->setClipping(clipEnabled);
1720  break; }
1721 
1723  QVectorPathCmd path(d, cmd);
1724 #ifdef QPAINTBUFFER_DEBUG_DRAW
1725  qDebug() << " -> Cmd_ClipVectorPath:" << path().elementCount();
1726 #endif
1727  painter->setClipPath(path().convertToPainterPath(), Qt::ClipOperation(cmd.extra));
1728  break; }
1729 
1730 
1732  QRect rect(QPoint(d->ints.at(cmd.offset), d->ints.at(cmd.offset + 1)),
1733  QPoint(d->ints.at(cmd.offset + 2), d->ints.at(cmd.offset + 3)));
1734 #ifdef QPAINTBUFFER_DEBUG_DRAW
1735  qDebug() << " -> Cmd_ClipRect:" << rect << cmd.extra;
1736 #endif
1738  break; }
1739 
1741  QRegion region(d->variants.at(cmd.offset).value<QRegion>());
1742 #ifdef QPAINTBUFFER_DEBUG_DRAW
1743  qDebug() << " -> Cmd_ClipRegion:" << region.boundingRect() << cmd.extra;
1744 #endif
1746  break; }
1747 
1748 #if !defined(QT_NO_RAWFONT)
1750 
1751  QVariantList variants(d->variants.at(cmd.offset).value<QVariantList>());
1752 
1753  QFont font = variants.at(0).value<QFont>();
1754 
1755  QVector<quint32> glyphIndexes;
1757 
1758  for (int i=0; i<(variants.size() - 1) / 2; ++i) {
1759  glyphIndexes.append(variants.at(i*2 + 1).toUInt());
1760  positions.append(variants.at(i*2 + 2).toPointF());
1761  }
1762 
1763  painter->setFont(font);
1764 
1765  QRawFont rawFont;
1766  QRawFontPrivate *rawFontD = QRawFontPrivate::get(rawFont);
1767  QFontPrivate *fontD = QFontPrivate::get(font);
1769  rawFontD->fontEngine->ref.ref();
1770 
1771  QGlyphRun glyphs;
1772  glyphs.setRawFont(rawFont);
1773  glyphs.setGlyphIndexes(glyphIndexes);
1774  glyphs.setPositions(positions);
1775 
1776  painter->drawGlyphRun(QPointF(), glyphs);
1777  break;
1778  }
1779 #endif
1780 
1782  QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
1783  QList<QVariant> variants(d->variants.at(cmd.offset).value<QList<QVariant> >());
1784 
1785  QFont font(variants.at(0).value<QFont>());
1786  QString text(variants.at(1).value<QString>());
1787 
1788  painter->setFont(font);
1789  painter->drawText(pos, text);
1790  break; }
1791 
1793  QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1));
1794  QTextItemIntCopy *tiCopy = reinterpret_cast<QTextItemIntCopy *>(qvariant_cast<void *>(d->variants.at(cmd.offset)));
1795  QTextItemInt &ti = (*tiCopy)();
1796  QString text(ti.text());
1797 
1798  QFont font(ti.font());
1799  font.setUnderline(false);
1800  font.setStrikeOut(false);
1801  font.setOverline(false);
1802 
1803  const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
1804  qreal justificationWidth = 0;
1805  if (si.justified)
1806  justificationWidth = si.width.toReal();
1807  qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY());
1808 
1809 #ifdef QPAINTBUFFER_DEBUG_DRAW
1810  qDebug() << " -> Cmd_DrawTextItem:" << pos << " " << text << " " << scaleFactor;
1811 #endif
1812 
1813  if (scaleFactor != 1.0) {
1814  QFont fnt(font);
1815  QFakeDevice fake;
1816  fake.setDpiX(qRound(scaleFactor*qt_defaultDpiX()));
1817  fake.setDpiY(qRound(scaleFactor*qt_defaultDpiY()));
1818  font = QFont(fnt, &fake);
1819  }
1820 
1822  QSizeF size(1, 1);
1823  if (justificationWidth > 0) {
1824  size.setWidth(justificationWidth);
1825  flags |= Qt::TextJustificationForced;
1826  flags |= Qt::AlignJustify;
1827  }
1828 
1829  QFontMetrics fm(font);
1830  QPointF pt(pos.x(), pos.y() - fm.ascent());
1831  qt_format_text(font, QRectF(pt, size), flags, /*opt*/0,
1832  text, /*brect=*/0, /*tabstops=*/0, /*...*/0, /*tabarraylen=*/0, painter);
1833  break; }
1835  QRegion systemClip(d->variants.at(cmd.offset).value<QRegion>());
1836 
1837 #ifdef QPAINTBUFFER_DEBUG_DRAW
1838  qDebug() << " -> Cmd_SystemStateChanged:" << systemClip;
1839 #endif
1840 
1841  painter->paintEngine()->setSystemClip(systemClip);
1843  break; }
1844  }
1845 }
QAtomicInt ref
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Definition: qpainter.cpp:9547
void setBackgroundMode(Qt::BGMode mode)
Sets the background mode of the painter to the given mode.
Definition: qpainter.cpp:3998
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
Definition: qpainter.cpp:3502
double qreal
Definition: qglobal.h:1193
The QFontMetrics class provides font metrics information.
Definition: qfontmetrics.h:65
QPointF toPointF() const
Returns the variant as a QPointF if the variant has type() Point or PointF ; otherwise returns a null...
Definition: qvariant.cpp:2509
CompositionMode
Defines the modes supported for digital image compositing.
Definition: qpainter.h:138
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen&#39;s color.
Definition: qpainter.cpp:3816
void setUnderline(bool)
If enable is true, sets underline on; otherwise sets underline off.
Definition: qfont.cpp:1331
Q_GUI_EXPORT int qt_defaultDpiY()
Definition: qfont.cpp:201
void setDpiY(int dpi)
Definition: qpicture.cpp:460
void setPositions(const QVector< QPointF > &positions)
Sets the positions of the edge of the baseline for each glyph in this set of glyph indexes to positio...
Definition: qglyphrun.cpp:244
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
Definition: qpainter.cpp:2801
Q_GUI_EXPORT int qt_defaultDpiX()
Definition: qfont.cpp:162
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
FillRule
Definition: qnamespace.h:1485
void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString &str, QRectF *brect, int tabstops, int *tabarray, int tabarraylen, QPainter *painter)
Definition: qpainter.cpp:8458
static QRawFontPrivate * get(const QRawFont &font)
Definition: qrawfont_p.h:109
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
Definition: qvariant.cpp:2691
static QFontPrivate * get(const QFont &font)
Definition: qfont_p.h:202
bool ref()
Atomically increments the value of this QAtomicInt.
The QString class provides a Unicode character string.
Definition: qstring.h:83
QString text() const
Returns the text that should be drawn.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
void setBrushOrigin(int x, int y)
Sets the brush&#39;s origin to point (x, y).
Definition: qpainter.h:825
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
Q_CORE_EXPORT void qDebug(const char *,...)
QVector< int > ints
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
Definition: qpainter.cpp:6231
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
Definition: qpainter.cpp:7620
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
Definition: qpainter.cpp:3641
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
Definition: qpainter.cpp:4464
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
Definition: qpainter.cpp:4873
void fillPath(const QPainterPath &path, const QBrush &brush)
Fills the given path using the given brush.
Definition: qpainter.cpp:3456
void drawConvexPolygon(const QPointF *points, int pointCount)
Draws the convex polygon defined by the first pointCount points in the array points using the current...
Definition: qpainter.cpp:5484
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Definition: qcssparser.cpp:329
void setStrikeOut(bool)
If enable is true, sets strikeout on; otherwise sets strikeout off.
Definition: qfont.cpp:1378
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
Internal QTextItem.
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun)
Draws the specified glyphs at the given position.
Definition: qpainter.cpp:6064
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
Definition: qpainter.cpp:1991
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
Definition: qpainter.cpp:5205
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QGlyphRun class provides direct access to the internal glyphs in a font.
Definition: qglyphrun.h:59
void setSystemClip(const QRegion &baseClip)
Sets the system clip for this engine.
void strokePath(const QPainterPath &path, const QPen &pen)
Draws the outline (strokes) the path path with the pen specified by pen.
Definition: qpainter.cpp:3413
QPaintBufferPrivate * d
virtual void systemStateChanged()
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QFontEngine * engineForScript(int script) const
Definition: qfont.cpp:294
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
Draws a tiled pixmap, inside the given rectangle with its origin at the given position.
Definition: qpainter.cpp:7146
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
QScopedPointer< QPaintEnginePrivate > d_ptr
Definition: qpaintengine.h:246
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
Definition: qpainter.cpp:2917
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
Definition: qpainter.cpp:2422
The QRawFont class provides access to a single physical instance of a font.
Definition: qrawfont.h:63
void setClipping(bool enable)
Enables clipping if enable is true, or disables clipping if enable is false.
Definition: qpainter.cpp:2517
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
void setOverline(bool)
If enable is true, sets overline on; otherwise sets overline off.
Definition: qfont.cpp:1354
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QExplicitlySharedDataPointer< QFontPrivate > d
Definition: qfont.h:343
void setBrush(const QBrush &brush)
Sets the painter&#39;s brush to the given brush.
Definition: qpainter.cpp:4171
void setPen(const QColor &color)
Sets the painter&#39;s pen to have style Qt::SolidLine, width 0 and the specified color.
Definition: qpainter.cpp:4047
if(void) toggleToolbarShown
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
qreal toReal() const
Definition: qfixed_p.h:77
T qvariant_cast(const QVariant &)
Definition: qvariant.h:571
double toDouble(bool *ok=0) const
Returns the variant as a double if the variant has type() Double , QMetaType::Float ...
Definition: qvariant.cpp:2710
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Definition: qpainter.cpp:5936
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
Definition: qpainter.cpp:5619
QFontEngine * fontEngine
Definition: qrawfont_p.h:111
void setFont(const QFont &f)
Sets the painter&#39;s font to the given font.
Definition: qpainter.cpp:4288
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
Definition: qpainter.cpp:7675
QPainter * painter
void setClipPath(const QPainterPath &path, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip path for the painter to the given path, with the clip operation...
Definition: qpainter.cpp:3365
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
void setOpacity(qreal opacity)
Sets the opacity of the painter to opacity.
Definition: qpainter.cpp:2139
T value() const
Returns the stored value converted to the template type T.
Definition: qvariant.h:332
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
Definition: qpainter.cpp:5055
QTransform m_world_matrix
QFont font() const
Returns the font that should be used to draw the text.
BGMode
Definition: qnamespace.h:588
QVector< QVariant > variants
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
void setDpiX(int dpi)
Definition: qpicture.cpp:459
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
Definition: qpainter.cpp:7420
#define text
Definition: qobjectdefs.h:80
void setGlyphIndexes(const QVector< quint32 > &glyphIndexes)
Set the glyph indexes for this QGlyphRun object to glyphIndexes.
Definition: qglyphrun.cpp:217
QVector< qreal > floats
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
void setRawFont(const QRawFont &rawFont)
Sets the font specified by rawFont to be the font used to look up the glyph indexes.
Definition: qglyphrun.cpp:191
ClipOperation
Definition: qnamespace.h:1495
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
Definition: qpainter.cpp:3311

◆ processCommands()

void QPainterReplayer::processCommands ( const QPaintBuffer buffer,
QPainter painter,
int  begin,
int  end 
)

Definition at line 1381 of file qpaintbuffer.cpp.

Referenced by QPaintBuffer::processCommands().

1382 {
1383  d = buffer.d_ptr;
1384  painter = p;
1385 
1386  for (int cmdIndex = begin; cmdIndex < end; ++cmdIndex) {
1387  const QPaintBufferCommand &cmd = d->commands.at(cmdIndex);
1388  process(cmd);
1389  }
1390 }
QPaintBufferPrivate * d_ptr
virtual void process(const QPaintBufferCommand &cmd)
QVector< QPaintBufferCommand > commands
QPaintBufferPrivate * d
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
static const KeyPair *const end

◆ setupTransform()

void QPainterReplayer::setupTransform ( QPainter painter)

Definition at line 1372 of file qpaintbuffer.cpp.

1373 {
1374  painter = _painter;
1375  m_world_matrix = painter->transform();
1377  qreal(painter->device()->logicalDpiY()) / qreal(qt_defaultDpiY()));
1378  painter->setTransform(m_world_matrix);
1379 }
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
Definition: qpainter.cpp:9547
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
double qreal
Definition: qglobal.h:1193
const QTransform & transform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9558
int logicalDpiY() const
Definition: qpaintdevice.h:96
Q_GUI_EXPORT int qt_defaultDpiY()
Definition: qfont.cpp:201
Q_GUI_EXPORT int qt_defaultDpiX()
Definition: qfont.cpp:162
int logicalDpiX() const
Definition: qpaintdevice.h:95
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
QTransform m_world_matrix

Properties

◆ d

QPaintBufferPrivate* QPainterReplayer::d
protected

Definition at line 331 of file qpaintbuffer_p.h.

◆ m_world_matrix

QTransform QPainterReplayer::m_world_matrix
protected

Definition at line 332 of file qpaintbuffer_p.h.

◆ painter

QPainter* QPainterReplayer::painter
protected

Definition at line 334 of file qpaintbuffer_p.h.


The documentation for this class was generated from the following files: