46 #include <private/qpainterpath_p.h> 47 #include <private/qfontengine_p.h> 48 #include <private/qstatictext_p.h> 135 #ifndef QT_NO_DEBUG_STREAM 187 for (
int i = 0; i < clipInfo.
size(); ++i) {
190 if (info.
matrix != q->state()->matrix) {
192 q->transformChanged();
219 if (transform != q->state()->matrix) {
220 q->state()->matrix = transform;
221 q->transformChanged();
261 QPainterPath::CurveToDataElement
336 QPainterPath::CurveToDataElement
391 qDebug() <<
"QPaintEngineEx::stroke()" << pen;
399 if (!
d->strokeHandler) {
413 d->stroker.setStrokeWidth(1);
415 d->stroker.setStrokeWidth(penWidth);
419 d->activeStroker = &
d->stroker;
421 d->activeStroker = 0;
425 d->activeStroker = &
d->dasher;
429 if (!
d->activeStroker) {
435 d->activeStroker->setClipRect(
d->exDeviceRect);
438 d->activeStroker->setClipRect(clipRect);
446 const qreal *lastPoint = points + (pointCount<<1);
448 d->strokeHandler->types.reset();
449 d->strokeHandler->pts.reset();
466 d->activeStroker->setCurveThresholdFromTransform(
state()->matrix);
467 d->activeStroker->begin(
d->strokeHandler);
469 while (points < lastPoint) {
472 d->activeStroker->moveTo(points[0], points[1]);
477 d->activeStroker->lineTo(points[0], points[1]);
482 d->activeStroker->cubicTo(points[0], points[1],
483 points[2], points[3],
484 points[4], points[5]);
494 d->activeStroker->lineTo(path.
points()[0], path.
points()[1]);
497 d->activeStroker->moveTo(points[0], points[1]);
499 while (points < lastPoint) {
500 d->activeStroker->lineTo(points[0], points[1]);
504 d->activeStroker->lineTo(path.
points()[0], path.
points()[1]);
506 d->activeStroker->end();
508 if (!
d->strokeHandler->types.size())
512 d->strokeHandler->types.size(),
513 d->strokeHandler->types.data(),
520 d->activeStroker->strokePath(painterPath,
d->strokeHandler,
QTransform());
522 d->activeStroker->setCurveThresholdFromTransform(
QTransform());
523 d->activeStroker->begin(
d->strokeHandler);
525 while (points < lastPoint) {
529 d->activeStroker->moveTo(pt.
x(), pt.
y());
536 d->activeStroker->lineTo(pt.
x(), pt.
y());
545 d->activeStroker->cubicTo(c1.
x(), c1.
y(), c2.
x(), c2.
y(), e.
x(), e.
y());
557 d->activeStroker->lineTo(pt.
x(), pt.
y());
562 d->activeStroker->moveTo(p.
x(), p.
y());
564 while (points < lastPoint) {
566 d->activeStroker->lineTo(p.
x(), p.
y());
570 d->activeStroker->lineTo(p.
x(), p.
y());
572 d->activeStroker->end();
576 d->strokeHandler->types.size(),
577 d->strokeHandler->types.data(),
588 fill(strokePath, brush);
626 if (rects.
size() <= 32) {
632 qreal x2 = i->x() + i->width();
633 qreal y2 = i->y() + i->height();
658 qreal x2 = i->x() + i->width();
659 qreal y2 = i->y() + i->height();
710 for (
int i=0; i<rectCount; ++i) {
711 const QRect &r = rects[i];
727 for (
int i=0; i<rectCount; ++i) {
728 const QRectF &r = rects[i];
751 xRadius = xRadius * rect.
width() /
qreal(200.);
755 xRadius =
qMin(xRadius, rect.
width() / 2);
761 x2 - (1 -
KAPPA) * xRadius, y1,
762 x2, y1 + (1 -
KAPPA) * yRadius,
765 x2, y2 - (1 -
KAPPA) * yRadius,
766 x2 - (1 -
KAPPA) * xRadius, y2,
769 x1 + (1 -
KAPPA) * xRadius, y2,
770 x1, y2 - (1 -
KAPPA) * yRadius,
773 x1, y1 + (1 -
KAPPA) * yRadius,
774 x1 + (1 -
KAPPA) * xRadius, y1,
786 int elementCount = lineCount << 1;
787 while (elementCount > 0) {
788 int count =
qMin(elementCount, 32);
791 int count2 = count<<1;
793 for (
int i=0; i<count2; i+=2) {
794 pts[i] = ((
int *) lines)[i+1];
795 pts[i+1] = ((
int *) lines)[i];
798 for (
int i=0; i<count2; ++i)
799 pts[i] = ((
int *) lines)[i];
812 int elementCount = lineCount << 1;
813 while (elementCount > 0) {
814 int count =
qMin(elementCount, 32);
859 while (pointCount > 0) {
860 int count =
qMin(pointCount, 16);
863 for (
int i=0; i<count; ++i) {
864 pts[++oset] = points[i].
x();
865 pts[++oset] = points[i].
y();
866 pts[++oset] = points[i].
x() + 1/
qreal(63.);
867 pts[++oset] = points[i].
y();
875 for (
int i=0; i<pointCount; ++i) {
876 qreal pts[] = { points[i].
x(), points[i].
y(), points[i].
x() + 1/
qreal(63.), points[i].
y() };
890 while (pointCount > 0) {
891 int count =
qMin(pointCount, 16);
894 for (
int i=0; i<count; ++i) {
895 pts[++oset] = points[i].
x();
896 pts[++oset] = points[i].
y();
897 pts[++oset] = points[i].
x() + 1/
qreal(63.);
898 pts[++oset] = points[i].
y();
906 for (
int i=0; i<pointCount; ++i) {
928 int count = pointCount<<1;
932 for (
int i=0; i<count; i+=2) {
933 pts[i] = ((
int *) points)[i+1];
934 pts[i+1] = ((
int *) points)[i];
937 for (
int i=0; i<count; ++i)
938 pts[i] = ((
int *) points)[i];
964 brush.setTransform(xform);
976 const QPixmap &pixmap, QPainter::PixmapFragmentHints )
984 for (
int i = 0; i < fragmentCount; ++i) {
986 transform.
translate(fragments[i].x, fragments[i].y);
987 transform.
rotate(fragments[i].rotation);
995 QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,
996 fragments[i].width, fragments[i].height);
1007 const QPixmap &pixmap, QPainter::PixmapFragmentHints )
1013 for (
int i = 0; i < fragmentCount; ++i)
1014 drawPixmap(targetRects[i], pixmap, sourceRects[i]);
1017 for (
int i = 0; i < fragmentCount; ++i)
1018 drawPixmap(targetRects[i], pixmap, sourceRect);
1052 QPointF p1(points[
id], points[
id+1]);
1053 QPointF p2(points[
id+2], points[
id+3]);
1054 QPointF p3(points[
id+4], points[
id+5]);
1094 bool changedHints =
false;
1100 changedHints =
true;
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
The QPainter class performs low-level painting on widgets and other paint devices.
The QDebug class provides an output stream for debugging information.
The QColor class provides colors based on RGB, HSV or CMYK values.
bool isEmpty() const
Returns true if either there are no elements in this path, or if the only element is a MoveToElement;...
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
QDataBuffer< QPainterPath::ElementType > types
qreal scaleY
the vertical scale of the target rectangle.
qreal y() const
Returns the y-coordinate of the rectangle's top edge.
qreal right() const
Returns the x-coordinate of the rectangle's right edge.
qreal width
the width of the source rectangle and is used to calculate the width of the target rectangle...
static mach_timebase_info_data_t info
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
QFontEngine * fontEngine() const
static void qpaintengineex_lineTo(qreal x, qreal y, void *data)
QSize size() const
Returns the size of the pixmap.
Qt::ClipOperation operation
virtual void drawPath(const QPainterPath &path)
The default implementation ignores the path and does nothing.
virtual void transformChanged()=0
The QLine class provides a two-dimensional vector using integer precision.
QPainter::RenderHints renderHints
void replayClipOperations()
Qt::BrushStyle qbrush_style(const QBrush &b)
QFixedPoint * glyphPositions
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QPaintEngineState * state
void setTransform(const QTransform &)
Sets matrix as an explicit transformation matrix on the current brush.
virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)=0
Reimplement this function to draw the part of the image specified by the sr rectangle in the given re...
void setCapStyle(Qt::PenCapStyle pcs)
Sets the pen's cap style to the given style.
Qt::PenStyle style() const
Returns the pen style.
StrokeHandler(int reserve)
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints)
Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
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...
The QPointF class defines a point in the plane using floating point precision.
qreal left() const
Returns the x-coordinate of the rectangle's left edge.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the vector...
bool hasClipOperations() const
static QPainterPath::ElementType qpaintengineex_rect4_types_32[]
QColor color() const
Returns the color of this pen's brush.
int width() const
Returns the width of the rectangle.
static QPainterPath::ElementType qpaintengineex_line_types_16[]
virtual uint flags() const
virtual void draw(const QVectorPath &path)
QRect boundingRect() const
Returns the bounding rectangle of this region.
void(* qvectorpath_cache_cleanup)(QPaintEngineEx *engine, void *data)
const QVectorPath & qtVectorPathForPath(const QPainterPath &path)
int height() const
Returns the height of the rectangle.
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
qreal opacity
the opacity of the target rectangle, where 0.0 is fully transparent and 1.0 is fully opaque...
QTransform transform() const
Returns the current transformation matrix for the brush.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
const QPainterPath::ElementType * elements() const
bool qpen_fast_equals(const QPen &a, const QPen &b)
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
qreal x() const
Returns the x-coordinate of this point.
virtual void fillRect(const QRectF &rect, const QBrush &brush)
The QLineF class provides a two-dimensional vector using floating point precision.
virtual void renderHintsChanged()=0
virtual bool supportsTransformations(qreal pixelSize, const QTransform &m) const
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
Q_CORE_EXPORT void qDebug(const char *,...)
QRectF controlPointRect() const
void setFillRule(Qt::FillRule fillRule)
Sets the fill rule of the painter path to the given fillRule.
virtual void stroke(const QVectorPath &path, const QPen &pen)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the vector.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
QPainterPathData * d_func() const
static float pixelSize(const QFontDef &request, int dpi)
virtual void updateState(const QPaintEngineState &state)
Reimplement this function to update the state of a paint engine.
QBrush qpen_brush(const QPen &p)
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Qt::PenJoinStyle joinStyle() const
Returns the pen's join style.
CacheEntry * lookupCacheData(QPaintEngineEx *engine) const
qreal height() const
Returns the height of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
static uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
CacheEntry * addCacheData(QPaintEngineEx *engine, void *data, qvectorpath_cache_cleanup cleanup) const
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
const QVectorPath & vectorPath()
qreal width() const
Returns the width of the rectangle.
QList< QPainterClipInfo > clipInfo
static void qpaintengineex_cubicTo(qreal c1x, qreal c1y, qreal c2x, qreal c2y, qreal ex, qreal ey, void *data)
The QRegion class specifies a clip region for a painter.
const T * ptr(const T &t)
virtual void setState(QPainterState *s)
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
const QPainterPath convertToPainterPath() const
QSize size() const
Returns the size of the image, i.
static void qpaintengineex_moveTo(qreal x, qreal y, void *data)
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 point...
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
virtual void opacityChanged()=0
virtual void drawLines(const QLine *lines, int lineCount)
The default implementation converts the first lineCount lines in lines to a QLineF and calls the floa...
qvectorpath_cache_cleanup cleanup
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
virtual void drawRoundedRect(const QRectF &rect, qreal xrad, qreal yrad, Qt::SizeMode mode)
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
int y() const
Returns the y-coordinate of the rectangle's top edge.
qreal x() const
Returns the x-coordinate of the rectangle's left edge.
This class is used in conjunction with the QPainter::drawPixmapFragments() function to specify how a ...
qreal scaleX
the horizontal scale of the target rectangle.
qreal miterLimit() const
Returns the miter limit of the pen.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QPoint class defines a point in the plane using integer precision.
virtual void drawStaticTextItem(QStaticTextItem *)
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
int size() const
Returns the number of items in the list.
const qreal * points() const
qreal widthF() const
Returns the pen width with floating point precision.
The QRect class defines a rectangle in the plane using integer precision.
bool hasImplicitClose() const
StrokeHandler * strokeHandler
QRect rect() const
Returns the pixmap's enclosing rectangle.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
virtual void fill(const QVectorPath &path, const QBrush &brush)=0
void cubicTo(const QPointF &ctrlPt1, const QPointF &ctrlPt2, const QPointF &endPt)
Adds a cubic Bezier curve between the current position and the given endPoint using the control point...
The QPixmap class is an off-screen image representation that can be used as a paint device...
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
qreal dashOffset() const
Returns the dash offset for the pen.
The QPaintEngineState class provides information about the active paint engine's current state...
int x() const
Returns the x coordinate of this point.
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLength, QPointF *curves, int *point_count)
Creates a number of curves for a given arc definition.
QDebug Q_GUI_EXPORT & operator<<(QDebug &s, const QVectorPath &path)
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
static QPainterPath::ElementType qpaintengineex_roundedrect_types[]
Qt::PenCapStyle capStyle() const
Returns the pen's cap style.
Qt::PenStyle qpen_style(const QPen &p)
qreal height
the height of the source rectangle and is used to calculate the height of the target rectangle...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
static QPainterPath::ElementType qpaintengineex_ellipse_types[]
QScopedPointer< QPainterPrivate > d_ptr
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0
virtual QPainterState * createState(QPainterState *orig) const