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

#include <qpaintbuffer_p.h>

Inheritance diagram for QPaintBufferEngine:
QPaintEngineEx QPaintEngine

Public Functions

virtual void backgroundModeChanged ()
 
virtual bool begin (QPaintDevice *device)
 Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. More...
 
virtual void brushChanged ()
 
virtual void brushOriginChanged ()
 
virtual void clip (const QVectorPath &path, Qt::ClipOperation op)
 
virtual void clip (const QRect &rect, Qt::ClipOperation op)
 
virtual void clip (const QRegion &region, Qt::ClipOperation op)
 
virtual void clip (const QPainterPath &path, Qt::ClipOperation op)
 
virtual void clipEnabledChanged ()
 
virtual void compositionModeChanged ()
 
virtual QPainterStatecreateState (QPainterState *orig) const
 
virtual void draw (const QVectorPath &path)
 
virtual void drawEllipse (const QRectF &r)
 Reimplement this function to draw the largest ellipse that can be contained within rectangle rect. More...
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
virtual void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
 Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap. More...
 
virtual void drawImage (const QPointF &pos, const QImage &image)
 
virtual void drawLines (const QLine *lines, int lineCount)
 The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function. More...
 
virtual void drawLines (const QLineF *lines, int lineCount)
 The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine. More...
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
virtual void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)
 Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r. More...
 
virtual void drawPixmap (const QPointF &pos, const QPixmap &pm)
 
virtual void drawPoints (const QPointF *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPoints (const QPoint *points, int pointCount)
 Draws the first pointCount points in the buffer points. More...
 
virtual void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode. More...
 
virtual void drawRects (const QRect *rects, int rectCount)
 The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function. More...
 
virtual void drawRects (const QRectF *rects, int rectCount)
 Draws the first rectCount rectangles in the buffer rects. More...
 
virtual void drawStaticTextItem (QStaticTextItem *staticTextItem)
 
virtual void drawTextItem (const QPointF &pos, const QTextItem &ti)
 This function draws the text item textItem at position p. More...
 
virtual void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s)
 Reimplement this function to draw the pixmap in the given rect, starting at the given p. More...
 
virtual bool end ()
 Reimplement this function to finish painting on the current paint device. More...
 
virtual void fill (const QVectorPath &path, const QBrush &brush)
 
virtual void fillRect (const QRectF &rect, const QBrush &brush)
 
virtual void fillRect (const QRectF &rect, const QColor &color)
 
virtual uint flags () const
 
virtual void opacityChanged ()
 
virtual void penChanged ()
 
 QPaintBufferEngine (QPaintBufferPrivate *buffer)
 
virtual void renderHintsChanged ()
 
virtual void setState (QPainterState *s)
 
virtual void stroke (const QVectorPath &path, const QPen &pen)
 
virtual void transformChanged ()
 
virtual Type type () const
 Reimplement this function to return the paint engine Type. More...
 
- Public Functions inherited from QPaintEngineEx
virtual void beginNativePainting ()
 
virtual void drawPixmapFragments (const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
 
virtual void drawPixmapFragments (const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
 
virtual void drawRoundedRect (const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
 
virtual void endNativePainting ()
 
virtual QPixmapFilterpixmapFilter (int, const QPixmapFilter *)
 
 QPaintEngineEx ()
 
QPainterStatestate ()
 
const QPainterStatestate () const
 
virtual bool supportsTransformations (qreal pixelSize, const QTransform &m) const
 
virtual void sync ()
 
virtual void updateState (const QPaintEngineState &state)
 Reimplement this function to update the state of a paint engine. More...
 
- Public Functions inherited from QPaintEngine
void clearDirty (DirtyFlags df)
 
virtual QPoint coordinateOffset () const
 Returns the offset from the painters origo to the engines origo. More...
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
virtual HDC getDC () const
 Empty default implementation. More...
 
bool hasFeature (PaintEngineFeatures feature) const
 Returns true if the paint engine supports the specified feature; otherwise returns false. More...
 
bool isActive () const
 Returns true if the paint engine is actively drawing; otherwise returns false. More...
 
bool isExtended () const
 Returns true if the paint engine is a QPaintEngineEx derivative. More...
 
QPaintDevicepaintDevice () const
 Returns the device that this engine is painting on, if painting is active; otherwise returns 0. More...
 
QPainterpainter () const
 Returns the paint engine's painter. More...
 
 QPaintEngine (PaintEngineFeatures features=0)
 Creates a paint engine with the featureset specified by caps. More...
 
virtual void releaseDC (HDC hdc) const
 Empty default implementation. More...
 
void setActive (bool newState)
 Sets the active state of the paint engine to state. More...
 
void setDirty (DirtyFlags df)
 
void setPaintDevice (QPaintDevice *device)
 
void setSystemClip (const QRegion &baseClip)
 Sets the system clip for this engine. More...
 
void setSystemRect (const QRect &rect)
 Sets the target rect for drawing within the backing store. More...
 
void syncState ()
 Updates all dirty states in this engine. More...
 
QRegion systemClip () const
 Returns the system clip. More...
 
QRect systemRect () const
 Retrieves the rect for drawing within the backing store. More...
 
bool testDirty (DirtyFlags df)
 
virtual ~QPaintEngine ()
 Destroys the paint engine. More...
 

Public Variables

QPaintBufferPrivatebuffer
 
int m_begin_detected: 1
 
QPainterStatem_created_state
 
int m_save_detected: 1
 
int m_stream_raw_text_items: 1
 
int m_unused: 29
 

Additional Inherited Members

- Public Types inherited from QPaintEngineEx
enum  Flags { DoNotEmulate = 0x01, IsEmulationEngine = 0x02 }
 
- Public Types inherited from QPaintEngine
enum  DirtyFlag {
  DirtyPen = 0x0001, DirtyBrush = 0x0002, DirtyBrushOrigin = 0x0004, DirtyFont = 0x0008,
  DirtyBackground = 0x0010, DirtyBackgroundMode = 0x0020, DirtyTransform = 0x0040, DirtyClipRegion = 0x0080,
  DirtyClipPath = 0x0100, DirtyHints = 0x0200, DirtyCompositionMode = 0x0400, DirtyClipEnabled = 0x0800,
  DirtyOpacity = 0x1000, AllDirty = 0xffff
}
 QPaintEngine::updateState(). More...
 
enum  PaintEngineFeature {
  PrimitiveTransform = 0x00000001, PatternTransform = 0x00000002, PixmapTransform = 0x00000004, PatternBrush = 0x00000008,
  LinearGradientFill = 0x00000010, RadialGradientFill = 0x00000020, ConicalGradientFill = 0x00000040, AlphaBlend = 0x00000080,
  PorterDuff = 0x00000100, PainterPaths = 0x00000200, Antialiasing = 0x00000400, BrushStroke = 0x00000800,
  ConstantOpacity = 0x00001000, MaskedBrush = 0x00002000, PerspectiveTransform = 0x00004000, BlendModes = 0x00008000,
  ObjectBoundingModeGradients = 0x00010000, RasterOpModes = 0x00020000, PaintOutsidePaintEvent = 0x20000000, AllFeatures = 0xffffffff
}
 This enum is used to describe the features or capabilities that the paint engine has. More...
 
enum  PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode }
 
enum  Type {
  X11, Windows, QuickDraw, CoreGraphics,
  MacPrinter, QWindowSystem, PostScript, OpenGL,
  Picture, SVG, Raster, Direct3D,
  Pdf, OpenVG, OpenGL2, PaintBuffer,
  Blitter, User = 50, MaxUser = 100
}
 
- Protected Functions inherited from QPaintEngineEx
 QPaintEngineEx (QPaintEngineExPrivate &data)
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 
- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

Definition at line 347 of file qpaintbuffer_p.h.

Constructors and Destructors

◆ QPaintBufferEngine()

QPaintBufferEngine::QPaintBufferEngine ( QPaintBufferPrivate buffer)

Definition at line 589 of file qpaintbuffer.cpp.

591  , buffer(b)
592  , m_begin_detected(false)
593  , m_save_detected(false)
594  , m_stream_raw_text_items(false)
595 {
596 }
QPaintBufferPrivate * buffer

Functions

◆ backgroundModeChanged()

void QPaintBufferEngine::backgroundModeChanged ( )
virtual

Definition at line 808 of file qpaintbuffer.cpp.

809 {
810 #ifdef QPAINTBUFFER_DEBUG_DRAW
811  qDebug() << "QPaintEngineBuffer: background mode changed" << state()->bgMode;
812 #endif
814  cmd->extra = state()->bgMode;
815 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)
Qt::BGMode bgMode
Definition: qpainter_p.h:171
QPainterState * state()

◆ begin()

bool QPaintBufferEngine::begin ( QPaintDevice pdev)
virtual

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev.

Return true if the initialization was successful; otherwise return false.

See also
end() isActive()

Implements QPaintEngine.

Definition at line 598 of file qpaintbuffer.cpp.

599 {
601  painter()->save();
602  d->systemStateChanged();
603  return true;
604 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void save()
Saves the current painter state (pushes the state onto a stack).
Definition: qpainter.cpp:1590
QPainter * painter() const
Returns the paint engine&#39;s painter.

◆ brushChanged()

void QPaintBufferEngine::brushChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 709 of file qpaintbuffer.cpp.

710 {
711  const QBrush &brush = state()->brush;
712 
713  if (!buffer->commands.isEmpty()
715 #ifdef QPAINTBUFFER_DEBUG_DRAW
716  qDebug() << "QPaintBufferEngine: brushChanged (compressed)" << state()->brush;
717 #endif
718  buffer->variants[buffer->commands.last().offset] = brush;
719  return;
720  }
721 
722 #ifdef QPAINTBUFFER_DEBUG_DRAW
723  qDebug() << "QPaintBufferEngine: brushChanged" << state()->brush;
724 #endif
726 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QVector< QPaintBufferCommand > commands
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
T & last()
Returns a reference to the last item in the vector.
Definition: qvector.h:262
QPaintBufferCommand * addCommand(Command command)
QBrush brush
Definition: qpainter_p.h:153
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
QPainterState * state()
QVector< QVariant > variants

◆ brushOriginChanged()

void QPaintBufferEngine::brushOriginChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 728 of file qpaintbuffer.cpp.

729 {
730 #ifdef QPAINTBUFFER_DEBUG_DRAW
731  qDebug() << "QPaintBufferEngine: brush origin changed" << state()->brushOrigin;
732 #endif
734 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPointF brushOrigin
Definition: qpainter_p.h:149
QPaintBufferCommand * addCommand(Command command)
QPainterState * state()

◆ clip() [1/4]

void QPaintBufferEngine::clip ( const QVectorPath path,
Qt::ClipOperation  op 
)
virtual

Implements QPaintEngineEx.

Definition at line 631 of file qpaintbuffer.cpp.

632 {
633 #ifdef QPAINTBUFFER_DEBUG_DRAW
634  qDebug() << "QPaintBufferEngine: clip vpath:" << path.elementCount() << "op:" << op;
635 #endif
636  QPaintBufferCommand *cmd =
638  cmd->extra = op;
639 }
int elementCount() const
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)

◆ clip() [2/4]

void QPaintBufferEngine::clip ( const QRect rect,
Qt::ClipOperation  op 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 641 of file qpaintbuffer.cpp.

642 {
643 #ifdef QPAINTBUFFER_DEBUG_DRAW
644  qDebug() << "QPaintBufferEngine: clip rect:" << rect << "op:" << op;
645 #endif
646  QPaintBufferCommand *cmd =
647  buffer->addCommand(QPaintBufferPrivate::Cmd_ClipRect, (int *) &rect, 4, 1);
648  cmd->extra = op;
649 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)

◆ clip() [3/4]

void QPaintBufferEngine::clip ( const QRegion region,
Qt::ClipOperation  op 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 651 of file qpaintbuffer.cpp.

652 {
653 #ifdef QPAINTBUFFER_DEBUG_DRAW
654  qDebug() << "QPaintBufferEngine: clip region br:" << region.boundingRect() << "op:" << op;
655 #endif
656  QPaintBufferCommand *cmd =
658  cmd->extra = op;
659 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)

◆ clip() [4/4]

void QPaintBufferEngine::clip ( const QPainterPath path,
Qt::ClipOperation  op 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 661 of file qpaintbuffer.cpp.

662 {
663  // ### TODO
664 // QPaintBufferCommand *cmd =
665 // buffer->addCommand(QPaintBufferPrivate::Cmd_ClipPath, QVariant(path));
666 // cmd->extra = op;
667  QPaintEngineEx::clip(path, op);
668 }
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0

◆ clipEnabledChanged()

void QPaintBufferEngine::clipEnabledChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 670 of file qpaintbuffer.cpp.

671 {
672 #ifdef QPAINTBUFFER_DEBUG_DRAW
673  qDebug() << "QPaintBufferEngine: clip enable change" << state()->clipEnabled;
674 #endif
675 
677 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
uint clipEnabled
Definition: qpainter_p.h:169
QPaintBufferCommand * addCommand(Command command)
QPainterState * state()

◆ compositionModeChanged()

void QPaintBufferEngine::compositionModeChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 744 of file qpaintbuffer.cpp.

745 {
746 #ifdef QPAINTBUFFER_DEBUG_DRAW
747  qDebug() << "QPaintBufferEngine: composition mode" << state()->composition_mode;
748 #endif
749  QPaintBufferCommand *cmd =
751  cmd->extra = state()->composition_mode;
752 }
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)
QPainterState * state()

◆ createState()

QPainterState * QPaintBufferEngine::createState ( QPainterState orig) const
virtual

Reimplemented from QPaintEngineEx.

Definition at line 613 of file qpaintbuffer.cpp.

614 {
615 #ifdef QPAINTBUFFER_DEBUG_DRAW
616  qDebug() << "QPaintBufferEngine: createState, orig=" << orig << ", current=" << state();
617 #endif
618 
621 
622  if (orig == 0) {
623  m_begin_detected = true;
624  return new QPainterState();
625  } else {
626  m_save_detected = true;
627  return new QPainterState(orig);
628  }
629 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT void qDebug(const char *,...)
QPainterState * state()

◆ draw()

void QPaintBufferEngine::draw ( const QVectorPath path)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 817 of file qpaintbuffer.cpp.

818 {
819 #ifdef QPAINTBUFFER_DEBUG_DRAW
820  qDebug() << "QPaintBufferEngine: draw vpath:" << path.elementCount();
821 #endif
822 
823  bool hasBrush = qbrush_style(state()->brush) != Qt::NoBrush;
824  bool hasPen = qpen_style(state()->pen) != Qt::NoPen
825  && qbrush_style(qpen_brush(state()->pen)) != Qt::NoBrush;
826 
827  if (hasPen || hasBrush)
829 #ifdef QPAINTBUFFER_DEBUG_DRAW
830  else
831  qDebug() << " - no pen or brush active, discarded...\n";
832 #endif
833 
834 // if (buffer->calculateBoundingRect) {
835 // QRealRect r = path.controlPointRect();
836 // buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
837 // }
838 }
int elementCount() const
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QBrush qpen_brush(const QPen &p)
Definition: qpainter_p.h:87
QPaintBufferCommand * addCommand(Command command)
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
QPainterState * state()

◆ drawEllipse() [1/2]

void QPaintBufferEngine::drawEllipse ( const QRectF rect)
virtual

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

The default implementation calls drawPolygon().

Reimplemented from QPaintEngineEx.

Definition at line 1042 of file qpaintbuffer.cpp.

1043 {
1044 #ifdef QPAINTBUFFER_DEBUG_DRAW
1045  qDebug() << "QPaintBufferEngine: drawEllipseF:" << r;
1046 #endif
1050 }
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
QPaintBufferCommand * addCommand(Command command)

◆ drawEllipse() [2/2]

void QPaintBufferEngine::drawEllipse ( const QRect r)
virtual

The default implementation of this function calls the floating point version of this function.

Reimplemented from QPaintEngineEx.

Definition at line 1052 of file qpaintbuffer.cpp.

1053 {
1054 #ifdef QPAINTBUFFER_DEBUG_DRAW
1055  qDebug() << "QPaintBufferEngine: drawEllipseI:" << r;
1056 #endif
1060 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
QPaintBufferCommand * addCommand(Command command)

◆ drawImage() [1/2]

void QPaintBufferEngine::drawImage ( const QRectF r,
const QImage pm,
const QRectF sr,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
)
virtual

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

Implements QPaintEngineEx.

Definition at line 1218 of file qpaintbuffer.cpp.

1220 {
1221 #ifdef QPAINTBUFFER_DEBUG_DRAW
1222  qDebug() << "QPaintBufferEngine: drawImage: src/dest rects " << r << sr;
1223 #endif
1224  QPaintBufferCommand *cmd =
1227  cmd->extra = buffer->addData((qreal *) &r, 4);
1228  buffer->addData((qreal *) &sr, 4);
1229  // ### flags...
1232 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)
static QImage qpaintbuffer_storable_image(const QImage &src)

◆ drawImage() [2/2]

void QPaintBufferEngine::drawImage ( const QPointF pos,
const QImage image 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 1234 of file qpaintbuffer.cpp.

1235 {
1236 #ifdef QPAINTBUFFER_DEBUG_DRAW
1237  qDebug() << "QPaintBufferEngine: drawImage: pos:" << pos;
1238 #endif
1239  QPaintBufferCommand *cmd =
1242  cmd->extra = buffer->addData((qreal *) &pos, 2);
1244  buffer->updateBoundingRect(QRectF(pos, image.size()));
1245 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
QPaintBufferCommand * addCommand(Command command)
static QImage qpaintbuffer_storable_image(const QImage &src)

◆ drawLines() [1/2]

void QPaintBufferEngine::drawLines ( const QLine lines,
int  lineCount 
)
virtual

The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from QPaintEngineEx.

Definition at line 958 of file qpaintbuffer.cpp.

959 {
960 #ifdef QPAINTBUFFER_DEBUG_DRAW
961  qDebug() << "QPaintBufferEngine: drawLinesI:" << lineCount;
962 #endif
963  QPaintBufferCommand *cmd =
964  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineI, (int *) lines, 4 * lineCount, lineCount);
965  cmd->extra = lineCount;
966 
968  int min_x = lines[0].p1().x();
969  int min_y = lines[0].p1().y();
970  int max_x = lines[0].p2().x();
971  int max_y = lines[0].p2().y();
972  if (min_x > max_x)
973  qSwap(min_x, max_x);
974  if (min_y > max_y)
975  qSwap(min_y, max_y);
976  for (int i=1; i < lineCount; ++i) {
977  int p1_x = lines[i].p1().x();
978  int p1_y = lines[i].p1().y();
979  int p2_x = lines[i].p2().x();
980  int p2_y = lines[i].p2().y();
981  if (p1_x > p2_x) {
982  min_x = qMin(p2_x, min_x);
983  max_x = qMax(p1_x, max_x);
984  } else {
985  min_x = qMin(p1_x, min_x);
986  max_x = qMax(p2_x, max_x);
987  }
988  if (p1_y > p2_y) {
989  min_y = qMin(p2_y, min_y);
990  max_y = qMax(p1_y, max_y);
991  } else {
992  min_y = qMin(p1_y, min_y);
993  max_y = qMax(p2_y, max_y);
994  }
995  }
996  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
997  }
998 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
QPaintBufferCommand * addCommand(Command command)

◆ drawLines() [2/2]

void QPaintBufferEngine::drawLines ( const QLineF lines,
int  lineCount 
)
virtual

The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngineEx.

Definition at line 1000 of file qpaintbuffer.cpp.

1001 {
1002 #ifdef QPAINTBUFFER_DEBUG_DRAW
1003  qDebug() << "QPaintBufferEngine: drawLinesF:" << lineCount;
1004 #endif
1005  QPaintBufferCommand *cmd =
1006  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawLineF, (qreal *) lines, 4 * lineCount, lineCount);
1007  cmd->extra = lineCount;
1008 
1010  qreal min_x = lines[0].p1().x();
1011  qreal min_y = lines[0].p1().y();
1012  qreal max_x = lines[0].p2().x();
1013  qreal max_y = lines[0].p2().y();
1014  if (min_x > max_x)
1015  qSwap(min_x, max_x);
1016  if (min_y > max_y)
1017  qSwap(min_y, max_y);
1018  for (int i=1; i < lineCount; ++i) {
1019  qreal p1_x = lines[i].p1().x();
1020  qreal p1_y = lines[i].p1().y();
1021  qreal p2_x = lines[i].p2().x();
1022  qreal p2_y = lines[i].p2().y();
1023  if (p1_x > p2_x) {
1024  min_x = qMin(p2_x, min_x);
1025  max_x = qMax(p1_x, max_x);
1026  } else {
1027  min_x = qMin(p1_x, min_x);
1028  max_x = qMax(p2_x, max_x);
1029  }
1030  if (p1_y > p2_y) {
1031  min_y = qMin(p2_y, min_y);
1032  max_y = qMax(p1_y, max_y);
1033  } else {
1034  min_y = qMin(p1_y, min_y);
1035  max_y = qMax(p2_y, max_y);
1036  }
1037  }
1038  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
1039  }
1040 }
double qreal
Definition: qglobal.h:1193
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
QPaintBufferCommand * addCommand(Command command)

◆ drawPath()

void QPaintBufferEngine::drawPath ( const QPainterPath path)
virtual

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngineEx.

Definition at line 1062 of file qpaintbuffer.cpp.

1063 {
1064 // #ifdef QPAINTBUFFER_DEBUG_DRAW
1065 // qDebug() << "QPaintBufferEngine: drawPath: element count:" << path.elementCount();
1066 // #endif
1067 // // ### Path -> QVariant
1068 // // buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPath, QVariant(path));
1070 
1071 // if (buffer->calculateBoundingRect)
1072 // buffer->updateBoundingRect(path.boundingRect());
1073 }
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.

◆ drawPixmap() [1/2]

void QPaintBufferEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
)
virtual

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implements QPaintEngineEx.

Definition at line 1187 of file qpaintbuffer.cpp.

1188 {
1189 #ifdef QPAINTBUFFER_DEBUG_DRAW
1190  qDebug() << "QPaintBufferEngine: drawPixmap: src/dest rects " << r << sr;
1191 #endif
1192  QPaintBufferCommand *cmd =
1194  cmd->extra = buffer->addData((qreal *) &r, 4);
1195  buffer->addData((qreal *) &sr, 4);
1198 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ drawPixmap() [2/2]

void QPaintBufferEngine::drawPixmap ( const QPointF pos,
const QPixmap pm 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 1200 of file qpaintbuffer.cpp.

1201 {
1202 #ifdef QPAINTBUFFER_DEBUG_DRAW
1203  qDebug() << "QPaintBufferEngine: drawPixmap: pos:" << pos;
1204 #endif
1205  QPaintBufferCommand *cmd =
1207  cmd->extra = buffer->addData((qreal *) &pos, 2);
1209  buffer->updateBoundingRect(QRectF(pos, pm.size()));
1210 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)

◆ drawPoints() [1/2]

void QPaintBufferEngine::drawPoints ( const QPointF points,
int  pointCount 
)
virtual

Draws the first pointCount points in the buffer points.

Reimplemented from QPaintEngineEx.

Definition at line 1099 of file qpaintbuffer.cpp.

1100 {
1101 #ifdef QPAINTBUFFER_DEBUG_DRAW
1102  qDebug() << "QPaintBufferEngine: drawPointsF: " << pointCount;
1103 #endif
1104  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsF, (qreal *) points, 2 * pointCount, pointCount);
1105 
1107  qreal min_x = points[0].x();
1108  qreal min_y = points[0].y();
1109  qreal max_x = points[0].x()+1;
1110  qreal max_y = points[0].y()+1;
1111  for (int i=1; i<pointCount; ++i) {
1112  qreal x = points[i].x();
1113  qreal y = points[i].y();
1114  min_x = qMin(min_x, x);
1115  min_y = qMin(min_y, y);
1116  max_x = qMax(max_x, x+1);
1117  max_y = qMax(max_y, y+1);
1118  }
1119  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
1120  }
1121 }
double qreal
Definition: qglobal.h:1193
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)

◆ drawPoints() [2/2]

void QPaintBufferEngine::drawPoints ( const QPoint points,
int  pointCount 
)
virtual

Draws the first pointCount points in the buffer points.

The default implementation converts the first pointCount QPoints in points to QPointFs and calls the floating point version of drawPoints.

Reimplemented from QPaintEngineEx.

Definition at line 1075 of file qpaintbuffer.cpp.

1076 {
1077 #ifdef QPAINTBUFFER_DEBUG_DRAW
1078  qDebug() << "QPaintBufferEngine: drawPointsI: " << pointCount;
1079 #endif
1080  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPointsI, (int *) points, 2 * pointCount, pointCount);
1081 
1083  int min_x = points[0].x();
1084  int min_y = points[0].y();
1085  int max_x = points[0].x()+1;
1086  int max_y = points[0].y()+1;
1087  for (int i=1; i<pointCount; ++i) {
1088  int x = points[i].x();
1089  int y = points[i].y();
1090  min_x = qMin(min_x, x);
1091  min_y = qMin(min_y, y);
1092  max_x = qMax(max_x, x+1);
1093  max_y = qMax(max_y, y+1);
1094  }
1095  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
1096  }
1097 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)

◆ drawPolygon() [1/2]

void QPaintBufferEngine::drawPolygon ( const QPointF points,
int  pointCount,
PolygonDrawMode  mode 
)
virtual

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented from QPaintEngineEx.

Definition at line 1155 of file qpaintbuffer.cpp.

1156 {
1157 #ifdef QPAINTBUFFER_DEBUG_DRAW
1158  qDebug() << "QPaintBufferEngine: drawPolygonF: size:" << count << ", mode:" << mode;
1159 #endif
1160  if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) {
1162  (qreal *) pts, 2 * count, count);
1163  cmd->extra = mode;
1164  } else if (mode == QPaintEngine::PolylineMode) {
1165  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineF, (qreal *) pts, 2 * count, count);
1166  } else {
1168  }
1169 
1171  qreal min_x = pts[0].x();
1172  qreal min_y = pts[0].y();
1173  qreal max_x = pts[0].x();
1174  qreal max_y = pts[0].y();
1175  for (int i=1; i<count; ++i) {
1176  qreal x = pts[i].x();
1177  qreal y = pts[i].y();
1178  min_x = qMin(min_x, x);
1179  min_y = qMin(min_y, y);
1180  max_x = qMax(max_x, x);
1181  max_y = qMax(max_y, y);
1182  }
1183  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
1184  }
1185 }
double qreal
Definition: qglobal.h:1193
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)

◆ drawPolygon() [2/2]

void QPaintBufferEngine::drawPolygon ( const QPoint points,
int  pointCount,
PolygonDrawMode  mode 
)
virtual

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note
At least one of the drawPolygon() functions must be reimplemented.

Reimplemented from QPaintEngineEx.

Definition at line 1123 of file qpaintbuffer.cpp.

1124 {
1125 #ifdef QPAINTBUFFER_DEBUG_DRAW
1126  qDebug() << "QPaintBufferEngine: drawPolygonI: size:" << count << ", mode:" << mode;
1127 #endif
1128  if (mode == QPaintEngine::OddEvenMode || mode == QPaintEngine::WindingMode) {
1130  (int *) pts, 2 * count, count);
1131  cmd->extra = mode;
1132  } else if (mode == QPaintEngine::PolylineMode) {
1133  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawPolylineI, (int *) pts, 2 * count, count);
1134  } else {
1135  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawConvexPolygonI, (int *) pts, 2 * count, count);
1136  }
1137 
1139  int min_x = pts[0].x();
1140  int min_y = pts[0].y();
1141  int max_x = pts[0].x();
1142  int max_y = pts[0].y();
1143  for (int i=1; i<count; ++i) {
1144  int x = pts[i].x();
1145  int y = pts[i].y();
1146  min_x = qMin(min_x, x);
1147  min_y = qMin(min_y, y);
1148  max_x = qMax(max_x, x);
1149  max_y = qMax(max_y, y);
1150  }
1151  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
1152  }
1153 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)

◆ drawRects() [1/2]

void QPaintBufferEngine::drawRects ( const QRect rects,
int  rectCount 
)
virtual

The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from QPaintEngineEx.

Definition at line 892 of file qpaintbuffer.cpp.

893 {
894 #ifdef QPAINTBUFFER_DEBUG_DRAW
895  qDebug() << "QPaintBufferEngine: drawRectsI:" << rectCount;
896 #endif
897  QPaintBufferCommand *cmd =
898  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectI, (int *) rects, 4 * rectCount, rectCount);
899  cmd->extra = rectCount;
900 
902  if (rectCount == 1) {
903  buffer->updateBoundingRect(rects[0]);
904  } else {
905  int min_x = rects[0].left();
906  int min_y = rects[0].top();
907  int max_x = rects[0].left() + rects[0].width();
908  int max_y = rects[0].top() + rects[0].height();
909  for (int i=1; i< rectCount; ++i) {
910  if (rects[i].left() < min_x)
911  min_x = rects[i].left();
912  if (rects[i].top() < min_y)
913  min_y = rects[i].top();
914  if (rects[i].right() > max_x)
915  max_x = rects[i].left() + rects[i].width();
916  if (rects[i].bottom() > max_y)
917  max_y = rects[i].top() + rects[i].height();
918 
919  }
920  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
921  }
922  }
923 }
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ drawRects() [2/2]

void QPaintBufferEngine::drawRects ( const QRectF rects,
int  rectCount 
)
virtual

Draws the first rectCount rectangles in the buffer rects.

The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngineEx.

Definition at line 925 of file qpaintbuffer.cpp.

926 {
927 #ifdef QPAINTBUFFER_DEBUG_DRAW
928  qDebug() << "QPaintBufferEngine: drawRectsF:" << rectCount;
929 #endif
930  QPaintBufferCommand *cmd =
931  buffer->addCommand(QPaintBufferPrivate::Cmd_DrawRectF, (qreal *) rects, 4 * rectCount, rectCount);
932  cmd->extra = rectCount;
933 
935  if (rectCount == 1) {
936  buffer->updateBoundingRect(rects[0]);
937  } else {
938  qreal min_x = rects[0].left();
939  qreal min_y = rects[0].top();
940  qreal max_x = rects[0].right();
941  qreal max_y = rects[0].bottom();
942  for (int i=1; i< rectCount; ++i) {
943  if (rects[i].left() < min_x)
944  min_x = rects[i].left();
945  if (rects[i].top() < min_y)
946  min_y = rects[i].top();
947  if (rects[i].right() > max_x)
948  max_x = rects[i].right();
949  if (rects[i].bottom() > max_y)
950  max_y = rects[i].bottom();
951 
952  }
953  buffer->updateBoundingRect(QRectF(min_x, min_y, max_x - min_x, max_y - min_y));
954  }
955  }
956 }
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
QPaintBufferCommand * addCommand(Command command)
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ drawStaticTextItem()

void QPaintBufferEngine::drawStaticTextItem ( QStaticTextItem staticTextItem)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 1260 of file qpaintbuffer.cpp.

1261 {
1262  QVariantList variants;
1263 
1264  variants << QVariant(staticTextItem->font);
1265  for (int i=0; i<staticTextItem->numGlyphs; ++i) {
1266  variants.append(staticTextItem->glyphs[i]);
1267  variants.append(staticTextItem->glyphPositions[i].toPointF());
1268  }
1269 
1271 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
QFixedPoint * glyphPositions
QPaintBufferPrivate * buffer
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
QPointF toPointF() const
Definition: qfixed_p.h:194
QPaintBufferCommand * addCommand(Command command)
glyph_t * glyphs

◆ drawTextItem()

void QPaintBufferEngine::drawTextItem ( const QPointF p,
const QTextItem textItem 
)
virtual

This function draws the text item textItem at position p.

The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Reimplemented from QPaintEngine.

Definition at line 1273 of file qpaintbuffer.cpp.

1274 {
1275 #ifdef QPAINTBUFFER_DEBUG_DRAW
1276  qDebug() << "QPaintBufferEngine: drawTextItem: pos:" << pos << ti.text();
1277 #endif
1279  QPaintBufferCommand *cmd = buffer->addCommand(QPaintBufferPrivate::Cmd_DrawTextItem, QVariant::fromValue<void *>(new QTextItemIntCopy(ti)));
1280 
1281  QFont font(ti.font());
1282  font.setUnderline(false);
1283  font.setStrikeOut(false);
1284  font.setOverline(false);
1285 
1286  const QTextItemInt &si = static_cast<const QTextItemInt &>(ti);
1287  qreal justificationWidth = 0;
1288  if (si.justified)
1289  justificationWidth = si.width.toReal();
1290  int renderFlags = ti.renderFlags();
1291  qreal scaleFactor = font.d->dpi/qreal(qt_defaultDpiY());
1292 
1293  buffer->addData(QVariant(font));
1294  cmd->extra = buffer->addData((qreal *) &pos, 2);
1295  buffer->addData((qreal *) &justificationWidth, 1);
1296  buffer->addData((qreal *) &scaleFactor, 1);
1297  cmd->offset2 = buffer->addData((int *) &renderFlags, 1);
1298  } else {
1299  QList<QVariant> variants;
1300  variants << QVariant(ti.font()) << QVariant(ti.text());
1302  cmd->extra = buffer->addData((qreal *) &pos, 2);
1303  }
1304 
1306  buffer->updateBoundingRect(QRectF(pos, QSize(ti.width(), ti.ascent() + ti.descent() + 1)));
1307 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
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
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Internal QTextItem.
The QFont class specifies a font used for drawing text.
Definition: qfont.h:64
qreal toReal() const
Definition: qfixed_p.h:77
QPaintBufferCommand * addCommand(Command command)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ drawTiledPixmap()

void QPaintBufferEngine::drawTiledPixmap ( const QRectF rect,
const QPixmap pixmap,
const QPointF p 
)
virtual

Reimplement this function to draw the pixmap in the given rect, starting at the given p.

The pixmap will be drawn repeatedly until the rect is filled.

Reimplemented from QPaintEngineEx.

Definition at line 1247 of file qpaintbuffer.cpp.

1248 {
1249 #ifdef QPAINTBUFFER_DEBUG_DRAW
1250  qDebug() << "QPaintBufferEngine: drawTiledPixmap: src rect/offset:" << r << s;
1251 #endif
1252  QPaintBufferCommand *cmd =
1254  cmd->extra = buffer->addData((qreal *) &r, 4);
1255  buffer->addData((qreal *) &s, 2);
1258 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ end()

bool QPaintBufferEngine::end ( )
virtual

Reimplement this function to finish painting on the current paint device.

Return true if painting was finished successfully; otherwise return false.

See also
begin() isActive()

Implements QPaintEngine.

Definition at line 606 of file qpaintbuffer.cpp.

Referenced by QPainterReplayer::processCommands().

607 {
608  painter()->restore();
609  m_created_state = 0;
610  return true;
611 }
void restore()
Restores the current painter state (pops a saved state off the stack).
Definition: qpainter.cpp:1620
QPainter * painter() const
Returns the paint engine&#39;s painter.
QPainterState * m_created_state

◆ fill()

void QPaintBufferEngine::fill ( const QVectorPath path,
const QBrush brush 
)
virtual

Implements QPaintEngineEx.

Definition at line 840 of file qpaintbuffer.cpp.

Referenced by QPainterReplayer::process().

841 {
842 #ifdef QPAINTBUFFER_DEBUG_DRAW
843  qDebug() << "QPaintBufferEngine: fill vpath:" << path.elementCount() << brush;
844 #endif
845  QPaintBufferCommand *cmd =
847  cmd->extra = buffer->addData(QVariant(brush));
848 // if (buffer->calculateBoundingRect) {
849 // QRealRect r = path.controlPointRect();
850 // buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
851 // }
852 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
int elementCount() const
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ fillRect() [1/2]

void QPaintBufferEngine::fillRect ( const QRectF rect,
const QBrush brush 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 868 of file qpaintbuffer.cpp.

869 {
870 #ifdef QPAINTBUFFER_DEBUG_DRAW
871  qDebug() << "QPaintBufferEngine: fillRect brush:" << rect << brush;
872 #endif
873  QPaintBufferCommand *cmd =
875  cmd->extra = buffer->addData(brush);
877  buffer->updateBoundingRect(rect);
878 }
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ fillRect() [2/2]

void QPaintBufferEngine::fillRect ( const QRectF rect,
const QColor color 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 880 of file qpaintbuffer.cpp.

881 {
882 #ifdef QPAINTBUFFER_DEBUG_DRAW
883  qDebug() << "QPaintBufferEngine: fillRect color:" << rect << color;
884 #endif
885  QPaintBufferCommand *cmd =
887  cmd->extra = buffer->addData(color);
889  buffer->updateBoundingRect(rect);
890 }
double qreal
Definition: qglobal.h:1193
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
void updateBoundingRect(const QRectF &rect)
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ flags()

virtual uint QPaintBufferEngine::flags ( ) const
inlinevirtual

Reimplemented from QPaintEngineEx.

Definition at line 412 of file qpaintbuffer_p.h.

Referenced by QPainterReplayer::process().

◆ opacityChanged()

void QPaintBufferEngine::opacityChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 736 of file qpaintbuffer.cpp.

737 {
738 #ifdef QPAINTBUFFER_DEBUG_DRAW
739  qDebug() << "QPaintBufferEngine: opacity changed" << state()->opacity;
740 #endif
742 }
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)
QPainterState * state()

◆ penChanged()

void QPaintBufferEngine::penChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 679 of file qpaintbuffer.cpp.

680 {
681  const QPen &pen = state()->pen;
682 
683  if (!buffer->commands.isEmpty()
685 #ifdef QPAINTBUFFER_DEBUG_DRAW
686  qDebug() << "QPaintBufferEngine: penChanged (compressed)" << state()->pen;
687 #endif
689  return;
690  }
691 
693  if (pen.style() == Qt::NoPen) {
695  } else {
696  qreal penWidth = (pen.widthF() == 0) ? 1 : pen.widthF();
697  QPointF transformedWidth(penWidth, penWidth);
698  if (!pen.isCosmetic())
699  transformedWidth = painter()->transform().map(transformedWidth);
700  buffer->penWidthAdjustment = transformedWidth.x() / 2.0;
701  }
702  }
703 #ifdef QPAINTBUFFER_DEBUG_DRAW
704  qDebug() << "QPaintBufferEngine: penChanged" << state()->pen;
705 #endif
707 }
double qreal
Definition: qglobal.h:1193
const QTransform & transform() const
Returns the world transformation matrix.
Definition: qpainter.cpp:9558
Qt::PenStyle style() const
Returns the pen style.
Definition: qpen.cpp:428
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPainter * painter() const
Returns the paint engine&#39;s painter.
QVector< QPaintBufferCommand > commands
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Definition: qpen.cpp:840
QPoint map(const QPoint &p) const
Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate sys...
T & last()
Returns a reference to the last item in the vector.
Definition: qvector.h:262
qreal widthF() const
Returns the pen width with floating point precision.
Definition: qpen.cpp:645
QPaintBufferCommand * addCommand(Command command)
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
QPainterState * state()
QVector< QVariant > variants

◆ renderHintsChanged()

void QPaintBufferEngine::renderHintsChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 754 of file qpaintbuffer.cpp.

755 {
756 #ifdef QPAINTBUFFER_DEBUG_DRAW
757  qDebug() << "QPaintBufferEngine: render hints changed" << state()->renderHints;
758 #endif
759  QPaintBufferCommand *cmd =
761  cmd->extra = state()->renderHints;
762 }
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
QPaintBufferCommand * addCommand(Command command)
QPainterState * state()

◆ setState()

void QPaintBufferEngine::setState ( QPainterState s)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 1310 of file qpaintbuffer.cpp.

1311 {
1313  if (m_begin_detected) {
1314 #ifdef QPAINTBUFFER_DEBUG_DRAW
1315  qDebug() << "QPaintBufferEngine: setState: begin, ignoring.";
1316 #endif
1317  m_begin_detected = false;
1318  } else if (m_save_detected) {
1319 #ifdef QPAINTBUFFER_DEBUG_DRAW
1320  qDebug() << "QPaintBufferEngine: setState: save.";
1321 #endif
1322  m_save_detected = false;
1324  } else {
1325 #ifdef QPAINTBUFFER_DEBUG_DRAW
1326  qDebug() << "QPaintBufferEngine: setState: restore.";
1327 #endif
1329  }
1330 
1331  d->last = s->matrix;
1332 
1334 }
double d
Definition: qnumeric_p.h:62
QTransform matrix
Definition: qpainter_p.h:161
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
virtual void setState(QPainterState *s)
QPaintBufferCommand * addCommand(Command command)

◆ stroke()

void QPaintBufferEngine::stroke ( const QVectorPath path,
const QPen pen 
)
virtual

Reimplemented from QPaintEngineEx.

Definition at line 854 of file qpaintbuffer.cpp.

855 {
856 #ifdef QPAINTBUFFER_DEBUG_DRAW
857  qDebug() << "QPaintBufferEngine: stroke vpath:" << path.elementCount() << pen;
858 #endif
859  QPaintBufferCommand *cmd =
861  cmd->extra = buffer->addData(QVariant(pen));
862 // if (buffer->calculateBoundingRect) {
863 // QRealRect r = path.controlPointRect();
864 // buffer->updateBoundingRect(QRectF(r.x1, r.y1, r.x2 - r.x1, r.y2 - r.y1));
865 // }
866 }
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
int elementCount() const
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
int addData(const int *data, int count)
QPaintBufferCommand * addCommand(Command command)

◆ transformChanged()

void QPaintBufferEngine::transformChanged ( )
virtual

Implements QPaintEngineEx.

Definition at line 764 of file qpaintbuffer.cpp.

765 {
767  const QTransform &transform = state()->matrix;
768 
769  QTransform delta;
770 
771  bool invertible = false;
772  if (transform.type() <= QTransform::TxScale && transform.type() == d->last.type())
773  delta = transform * d->last.inverted(&invertible);
774 
775  d->last = transform;
776 
777  if (invertible && delta.type() == QTransform::TxNone)
778  return;
779 
780  if (invertible && delta.type() == QTransform::TxTranslate) {
781 #ifdef QPAINTBUFFER_DEBUG_DRAW
782  qDebug() << "QPaintBufferEngine: transformChanged (translate only) " << state()->matrix;
783 #endif
784  QPaintBufferCommand *cmd =
786 
787  qreal data[] = { delta.dx(), delta.dy() };
788  cmd->extra = buffer->addData((qreal *) data, 2);
789  return;
790  }
791 
792  // ### accumulate, like in QBrush case...
793  if (!buffer->commands.isEmpty()
795 #ifdef QPAINTBUFFER_DEBUG_DRAW
796  qDebug() << "QPaintBufferEngine: transformChanged (compressing) " << state()->matrix;
797 #endif
799  return;
800  }
801 
802 #ifdef QPAINTBUFFER_DEBUG_DRAW
803  qDebug() << "QPaintBufferEngine: transformChanged:" << state()->matrix;
804 #endif
806 }
double d
Definition: qnumeric_p.h:62
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
double qreal
Definition: qglobal.h:1193
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
QPaintBufferPrivate * buffer
int addData(const int *data, int count)
QVector< QPaintBufferCommand > commands
static const char * data(const QByteArray &arr)
T & last()
Returns a reference to the last item in the vector.
Definition: qvector.h:262
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
QPaintBufferCommand * addCommand(Command command)
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
QPainterState * state()
QVector< QVariant > variants
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ type()

virtual Type QPaintBufferEngine::type ( ) const
inlinevirtual

Reimplement this function to return the paint engine Type.

Implements QPaintEngine.

Definition at line 356 of file qpaintbuffer_p.h.

Properties

◆ buffer

QPaintBufferPrivate* QPaintBufferEngine::buffer

◆ m_begin_detected

int QPaintBufferEngine::m_begin_detected
mutable

Definition at line 416 of file qpaintbuffer_p.h.

Referenced by createState(), and setState().

◆ m_created_state

QPainterState* QPaintBufferEngine::m_created_state
mutable

Definition at line 421 of file qpaintbuffer_p.h.

Referenced by end().

◆ m_save_detected

int QPaintBufferEngine::m_save_detected
mutable

Definition at line 417 of file qpaintbuffer_p.h.

Referenced by createState(), and setState().

◆ m_stream_raw_text_items

int QPaintBufferEngine::m_stream_raw_text_items
mutable

Definition at line 418 of file qpaintbuffer_p.h.

Referenced by drawTextItem().

◆ m_unused

int QPaintBufferEngine::m_unused
mutable

Definition at line 419 of file qpaintbuffer_p.h.


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