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

#include <qpaintengine_raster_p.h>

Inheritance diagram for QRasterPaintEnginePrivate:
QPaintEngineExPrivate QPaintEnginePrivate QBlitterPaintEnginePrivate QDirectFBPaintEnginePrivate QVolatileImagePaintEnginePrivate

Public Functions

QTransform brushMatrix () const
 
bool canUseFastImageBlending (QPainter::CompositionMode mode, const QImage &image) const
 
const QClipDataclip () const
 
void drawImage (const QPointF &pt, const QImage &img, SrcOverBlendFunc func, const QRect &clip, int alpha, const QRect &sr=QRect())
 
ProcessSpans getBrushFunc (const QRect &rect, const QSpanData *data) const
 
ProcessSpans getBrushFunc (const QRectF &rect, const QSpanData *data) const
 
ProcessSpans getPenFunc (const QRectF &rect, const QSpanData *data) const
 
void initializeRasterizer (QSpanData *data)
 
bool isUnclipped (const QRect &rect, int penWidth) const
 
bool isUnclipped (const QRectF &rect, int penWidth) const
 
bool isUnclipped_normalized (const QRect &rect) const
 Returns true if the rectangle is completely within the current clip state of the paint engine. More...
 
void prepare (QCustomRasterPaintDevice *)
 
 QRasterPaintEnginePrivate ()
 
void rasterize (QT_FT_Outline *outline, ProcessSpans callback, QSpanData *spanData, QRasterBuffer *rasterBuffer)
 
void rasterize (QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer)
 
void rasterizeLine_dashed (QLineF line, qreal width, int *dashIndex, qreal *dashOffset, bool *inDash)
 
void recalculateFastImages ()
 
void systemStateChanged ()
 
void updateMatrixData (QSpanData *spanData, const QBrush &brush, const QTransform &brushMatrix)
 
- Public Functions inherited from QPaintEngineExPrivate
bool hasClipOperations () const
 
 QPaintEngineExPrivate ()
 
void replayClipOperations ()
 
 ~QPaintEngineExPrivate ()
 
- Public Functions inherited from QPaintEnginePrivate
void drawBoxTextItem (const QPointF &p, const QTextItemInt &ti)
 
 QPaintEnginePrivate ()
 
void setSystemTransform (const QTransform &xform)
 
void setSystemViewport (const QRegion &region)
 
void transformSystemClip ()
 
virtual ~QPaintEnginePrivate ()
 

Public Variables

QScopedPointer< QClipDatabaseClip
 
QStroker basicStroker
 
QDataBuffer< QLineFcachedLines
 
QScopedPointer< QDashStrokerdashStroker
 
QPaintDevicedevice
 
int deviceDepth
 
QRect deviceRect
 
QRect deviceRectUnclipped
 
QFontEngineGlyphCache::Type glyphCacheType
 
QScopedPointer< QT_FT_RastergrayRaster
 
HDC hdc
 
QSpanData image_filler
 
QSpanData image_filler_xform
 
uint isPlain45DegreeRotation: 1
 
uint mono_surface: 1
 
QScopedPointer< QOutlineMapperoutlineMapper
 
uint outlinemapper_xform_dirty: 1
 
QScopedPointer< QRasterBufferrasterBuffer
 
QScopedPointer< QRasterizerrasterizer
 
QSpanData solid_color_filler
 
- Public Variables inherited from QPaintEngineExPrivate
QStrokerOpsactiveStroker
 
QDashStroker dasher
 
QRect exDeviceRect
 
StrokeHandlerstrokeHandler
 
QStroker stroker
 
QPen strokerPen
 
- Public Variables inherited from QPaintEnginePrivate
QWidgetcurrentClipWidget
 
uint hasSystemTransform: 1
 
uint hasSystemViewport: 1
 
QPaintDevicepdev
 
QPaintEngineq_ptr
 
QRegion systemClip
 
QRect systemRect
 
QTransform systemTransform
 
QRegion systemViewport
 

Detailed Description

Definition at line 298 of file qpaintengine_raster_p.h.

Constructors and Destructors

◆ QRasterPaintEnginePrivate()

QRasterPaintEnginePrivate::QRasterPaintEnginePrivate ( )

Definition at line 249 of file qpaintengine_raster.cpp.

249  :
251  cachedLines(0)
252 {
253 }
QDataBuffer< QLineF > cachedLines

Functions

◆ brushMatrix()

QTransform QRasterPaintEnginePrivate::brushMatrix ( ) const
inline

Definition at line 319 of file qpaintengine_raster_p.h.

319  {
320  Q_Q(const QRasterPaintEngine);
321  const QRasterPaintEngineState *s = q->state();
322  QTransform m(s->matrix);
323  m.translate(s->brushOrigin.x(), s->brushOrigin.y());
324  return m;
325  }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
QTransform matrix
Definition: qpainter_p.h:161
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
#define Q_Q(Class)
Definition: qglobal.h:2483
QPointF brushOrigin
Definition: qpainter_p.h:149
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ canUseFastImageBlending()

bool QRasterPaintEnginePrivate::canUseFastImageBlending ( QPainter::CompositionMode  mode,
const QImage image 
) const

Definition at line 3881 of file qpaintengine_raster.cpp.

Referenced by brushMatrix(), and QRasterPaintEngine::drawImage().

3882 {
3883  Q_Q(const QRasterPaintEngine);
3884  const QRasterPaintEngineState *s = q->state();
3885 
3886  return s->flags.fast_images
3889  && !image.hasAlphaChannel()));
3890 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ clip()

const QClipData * QRasterPaintEnginePrivate::clip ( ) const
inline

Definition at line 557 of file qpaintengine_raster_p.h.

Referenced by QRasterPaintEngine::alphaPenBlt(), QRasterPaintEngine::clip(), QRasterPaintEngine::clipBoundingRect(), QRasterPaintEngine::clipType(), QRasterPaintEngine::drawImage(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QRasterPaintEngine::drawTiledPixmap(), QRasterPaintEngine::fillRect(), qrasterpaintengine_dirty_clip(), QDirectFBPaintEnginePrivate::updateClip(), and updateMatrixData().

557  {
558  Q_Q(const QRasterPaintEngine);
559  if (q->state() && q->state()->clip && q->state()->clip->enabled)
560  return q->state()->clip;
561  return baseClip.data();
562 }
QScopedPointer< QClipData > baseClip
T * data() const
Returns the value of the pointer referenced by this object.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawImage()

void QRasterPaintEnginePrivate::drawImage ( const QPointF pt,
const QImage img,
SrcOverBlendFunc  func,
const QRect clip,
int  alpha,
const QRect sr = QRect() 
)

Definition at line 995 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::drawImage().

1001 {
1002  if (alpha == 0 || !clip.isValid())
1003  return;
1004 
1005  Q_ASSERT(img.depth() >= 8);
1006 
1007  int srcBPL = img.bytesPerLine();
1008  const uchar *srcBits = img.bits();
1009  int srcSize = img.depth() >> 3; // This is the part that is incompatible with lower than 8-bit..
1010  int iw = img.width();
1011  int ih = img.height();
1012 
1013  if (!sr.isEmpty()) {
1014  iw = sr.width();
1015  ih = sr.height();
1016  // Adjust the image according to the source offset...
1017  srcBits += ((sr.y() * srcBPL) + sr.x() * srcSize);
1018  }
1019 
1020  // adapt the x parameters
1021  int x = qRound(pt.x());
1022  int cx1 = clip.x();
1023  int cx2 = clip.x() + clip.width();
1024  if (x < cx1) {
1025  int d = cx1 - x;
1026  srcBits += srcSize * d;
1027  iw -= d;
1028  x = cx1;
1029  }
1030  if (x + iw > cx2) {
1031  int d = x + iw - cx2;
1032  iw -= d;
1033  }
1034  if (iw <= 0)
1035  return;
1036 
1037  // adapt the y paremeters...
1038  int cy1 = clip.y();
1039  int cy2 = clip.y() + clip.height();
1040  int y = qRound(pt.y());
1041  if (y < cy1) {
1042  int d = cy1 - y;
1043  srcBits += srcBPL * d;
1044  ih -= d;
1045  y = cy1;
1046  }
1047  if (y + ih > cy2) {
1048  int d = y + ih - cy2;
1049  ih -= d;
1050  }
1051  if (ih <= 0)
1052  return;
1053 
1054  // call the blend function...
1055  int dstSize = rasterBuffer->bytesPerPixel();
1056  int dstBPL = rasterBuffer->bytesPerLine();
1057  func(rasterBuffer->buffer() + x * dstSize + y * dstBPL, dstBPL,
1058  srcBits, srcBPL,
1059  iw, ih,
1060  alpha);
1061 }
double d
Definition: qnumeric_p.h:62
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
QScopedPointer< QRasterBuffer > rasterBuffer
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int bytesPerLine() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
unsigned char uchar
Definition: qglobal.h:994
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
int bytesPerPixel() const
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
uchar * buffer() const
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
Definition: qrect.h:237
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ getBrushFunc() [1/2]

ProcessSpans QRasterPaintEnginePrivate::getBrushFunc ( const QRect rect,
const QSpanData data 
) const
inline

Definition at line 3042 of file qpaintengine_raster.cpp.

Referenced by brushMatrix(), QRasterPaintEngine::drawEllipse(), QRasterPaintEngine::drawPolygon(), QRasterPaintEngine::fill(), QRasterPaintEngine::fillPath(), and QRasterPaintEngine::fillPolygon().

3044 {
3045  return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;
3046 }
ProcessSpans blend
bool isUnclipped(const QRect &rect, int penWidth) const
ProcessSpans unclipped_blend

◆ getBrushFunc() [2/2]

ProcessSpans QRasterPaintEnginePrivate::getBrushFunc ( const QRectF rect,
const QSpanData data 
) const
inline

Definition at line 3049 of file qpaintengine_raster.cpp.

3051 {
3052  return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;
3053 }
ProcessSpans blend
bool isUnclipped(const QRect &rect, int penWidth) const
ProcessSpans unclipped_blend

◆ getPenFunc()

ProcessSpans QRasterPaintEnginePrivate::getPenFunc ( const QRectF rect,
const QSpanData data 
) const
inline

Definition at line 3056 of file qpaintengine_raster.cpp.

Referenced by brushMatrix(), and QRasterPaintEngine::drawEllipse().

3058 {
3059  Q_Q(const QRasterPaintEngine);
3060  const QRasterPaintEngineState *s = q->state();
3061 
3062  if (!s->flags.fast_pen && s->matrix.type() > QTransform::TxTranslate)
3063  return data->blend;
3064  const int penWidth = s->flags.fast_pen ? 1 : qCeil(s->lastPen.widthF());
3065  return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
3066 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
int qCeil(qreal v)
Definition: qmath.h:63
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_Q(Class)
Definition: qglobal.h:2483
ProcessSpans blend
bool isUnclipped(const QRect &rect, int penWidth) const
qreal widthF() const
Returns the pen width with floating point precision.
Definition: qpen.cpp:645
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
ProcessSpans unclipped_blend

◆ initializeRasterizer()

void QRasterPaintEnginePrivate::initializeRasterizer ( QSpanData data)

Definition at line 3722 of file qpaintengine_raster.cpp.

Referenced by brushMatrix(), QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawRects(), QRasterPaintEngine::drawTiledPixmap(), QRasterPaintEngine::fill(), QRasterPaintEngine::fillPath(), QRasterPaintEngine::fillRect(), and QRasterPaintEngine::stroke().

3723 {
3725  QRasterPaintEngineState *s = q->state();
3726 
3728 
3729  QRect clipRect(deviceRect);
3730  ProcessSpans blend;
3731  // ### get from optimized rectbased QClipData
3732 
3733  const QClipData *c = clip();
3734  if (c) {
3735  const QRect r(QPoint(c->xmin, c->ymin),
3736  QSize(c->xmax - c->xmin, c->ymax - c->ymin));
3737  clipRect = clipRect.intersected(r);
3738  blend = data->blend;
3739  } else {
3740  blend = data->unclipped_blend;
3741  }
3742 
3743  rasterizer->setClipRect(clipRect);
3744  rasterizer->initialize(blend, data);
3745 }
void initialize(ProcessSpans blend, void *data)
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
unsigned char c[8]
Definition: qnumeric_p.h:62
QT_FT_SpanFunc ProcessSpans
void setAntialiased(bool antialiased)
#define Q_Q(Class)
Definition: qglobal.h:2483
ProcessSpans blend
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QClipData * clip() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setClipRect(const QRect &clipRect)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
ProcessSpans unclipped_blend
QScopedPointer< QRasterizer > rasterizer

◆ isUnclipped() [1/2]

bool QRasterPaintEnginePrivate::isUnclipped ( const QRect rect,
int  penWidth 
) const

Definition at line 2995 of file qpaintengine_raster.cpp.

Referenced by brushMatrix().

2997 {
2998  Q_Q(const QRasterPaintEngine);
2999  const QRasterPaintEngineState *s = q->state();
3000  const QClipData *cl = clip();
3001  if (!cl) {
3002  QRect r = rect.normalized();
3003  // inline contains() for performance (we know the rects are normalized)
3004  const QRect &r1 = deviceRect;
3005  return (r.left() >= r1.left() && r.right() <= r1.right()
3006  && r.top() >= r1.top() && r.bottom() <= r1.bottom());
3007  }
3008 
3009 
3010  // currently all painting functions that call this function clip to deviceRect internally
3011  if (cl->hasRectClip && cl->clipRect == deviceRect)
3012  return true;
3013 
3014  if (s->flags.antialiased)
3015  ++penWidth;
3016 
3017  QRect r = rect.normalized();
3018  if (penWidth > 0) {
3019  r.setX(r.x() - penWidth);
3020  r.setY(r.y() - penWidth);
3021  r.setWidth(r.width() + 2 * penWidth);
3022  r.setHeight(r.height() + 2 * penWidth);
3023  }
3024 
3025  if (cl->hasRectClip) {
3026  // inline contains() for performance (we know the rects are normalized)
3027  const QRect &r1 = cl->clipRect;
3028  return (r.left() >= r1.left() && r.right() <= r1.right()
3029  && r.top() >= r1.top() && r.bottom() <= r1.bottom());
3030  } else {
3031  return qt_region_strictContains(cl->clipRegion, r);
3032  }
3033 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:322
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
void setY(int y)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:285
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
#define Q_Q(Class)
Definition: qglobal.h:2483
void setX(int x)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:282
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
Q_GUI_EXPORT bool qt_region_strictContains(const QRegion &region, const QRect &rect)
Returns true if rect is guaranteed to be fully contained in region.
Definition: qregion.cpp:4380
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QClipData * clip() const
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ isUnclipped() [2/2]

bool QRasterPaintEnginePrivate::isUnclipped ( const QRectF rect,
int  penWidth 
) const
inline

Definition at line 3035 of file qpaintengine_raster.cpp.

3037 {
3038  return isUnclipped(rect.normalized().toAlignedRect(), penWidth);
3039 }
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
bool isUnclipped(const QRect &rect, int penWidth) const
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822

◆ isUnclipped_normalized()

bool QRasterPaintEnginePrivate::isUnclipped_normalized ( const QRect rect) const

Returns true if the rectangle is completely within the current clip state of the paint engine.

Definition at line 2970 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::alphaPenBlt(), brushMatrix(), and fillRect_normalized().

2971 {
2972  const QClipData *cl = clip();
2973  if (!cl) {
2974  // inline contains() for performance (we know the rects are normalized)
2975  const QRect &r1 = deviceRect;
2976  return (r.left() >= r1.left() && r.right() <= r1.right()
2977  && r.top() >= r1.top() && r.bottom() <= r1.bottom());
2978  }
2979 
2980 
2981  if (cl->hasRectClip) {
2982  // currently all painting functions clips to deviceRect internally
2983  if (cl->clipRect == deviceRect)
2984  return true;
2985 
2986  // inline contains() for performance (we know the rects are normalized)
2987  const QRect &r1 = cl->clipRect;
2988  return (r.left() >= r1.left() && r.right() <= r1.right()
2989  && r.top() >= r1.top() && r.bottom() <= r1.bottom());
2990  } else {
2991  return qt_region_strictContains(cl->clipRegion, r);
2992  }
2993 }
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
Q_GUI_EXPORT bool qt_region_strictContains(const QRegion &region, const QRect &rect)
Returns true if rect is guaranteed to be fully contained in region.
Definition: qregion.cpp:4380
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QClipData * clip() const

◆ prepare()

void QRasterPaintEnginePrivate::prepare ( QCustomRasterPaintDevice device)

Definition at line 989 of file qpaintengine_raster.cpp.

Referenced by brushMatrix(), and QDirectFBPaintEnginePrivate::lock().

990 {
991  rasterBuffer->prepare(device);
992 }
QScopedPointer< QRasterBuffer > rasterBuffer
QImage::Format prepare(QImage *image)

◆ rasterize() [1/2]

void QRasterPaintEnginePrivate::rasterize ( QT_FT_Outline outline,
ProcessSpans  callback,
QSpanData spanData,
QRasterBuffer rasterBuffer 
)

Definition at line 3747 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::clip(), QRasterPaintEngine::drawPolygon(), QRasterPaintEngine::fill(), QRasterPaintEngine::fillPath(), and QRasterPaintEngine::fillPolygon().

3750 {
3751  if (!callback || !outline)
3752  return;
3753 
3755  QRasterPaintEngineState *s = q->state();
3756 
3757  if (!s->flags.antialiased) {
3758  initializeRasterizer(spanData);
3759 
3760  const Qt::FillRule fillRule = outline->flags == QT_FT_OUTLINE_NONE
3761  ? Qt::WindingFill
3762  : Qt::OddEvenFill;
3763 
3764  rasterizer->rasterize(outline, fillRule);
3765  return;
3766  }
3767 
3768  rasterize(outline, callback, (void *)spanData, rasterBuffer);
3769 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
static void callback(AuServer *, AuEventHandlerRec *, AuEvent *e, AuPointer p)
Definition: qsound_x11.cpp:170
void rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
FillRule
Definition: qnamespace.h:1485
#define Q_Q(Class)
Definition: qglobal.h:2483
void initializeRasterizer(QSpanData *data)
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, QSpanData *spanData, QRasterBuffer *rasterBuffer)
#define QT_FT_OUTLINE_NONE
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
QScopedPointer< QRasterizer > rasterizer

◆ rasterize() [2/2]

void QRasterPaintEnginePrivate::rasterize ( QT_FT_Outline outline,
ProcessSpans  callback,
void *  userData,
QRasterBuffer rasterBuffer 
)

Definition at line 3780 of file qpaintengine_raster.cpp.

3783 {
3784  if (!callback || !outline)
3785  return;
3786 
3788  QRasterPaintEngineState *s = q->state();
3789 
3790  if (!s->flags.antialiased) {
3793  rasterizer->initialize(callback, userData);
3794 
3795  const Qt::FillRule fillRule = outline->flags == QT_FT_OUTLINE_NONE
3796  ? Qt::WindingFill
3797  : Qt::OddEvenFill;
3798 
3799  rasterizer->rasterize(outline, fillRule);
3800  return;
3801  }
3802 
3803  // Initial size for raster pool is MINIMUM_POOL_SIZE so as to
3804  // minimize memory reallocations. However if initial size for
3805  // raster pool is changed for lower value, reallocations will
3806  // occur normally.
3807  int rasterPoolSize = MINIMUM_POOL_SIZE;
3808  uchar rasterPoolOnStack[MINIMUM_POOL_SIZE + 0xf];
3809  uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf);
3810  uchar *rasterPoolOnHeap = 0;
3811 
3812  qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
3813 
3814  void *data = userData;
3815 
3816  QT_FT_BBox clip_box = { deviceRect.x(),
3817  deviceRect.y(),
3818  deviceRect.x() + deviceRect.width(),
3819  deviceRect.y() + deviceRect.height() };
3820 
3821  QT_FT_Raster_Params rasterParams;
3822  rasterParams.target = 0;
3823  rasterParams.source = outline;
3824  rasterParams.flags = QT_FT_RASTER_FLAG_CLIP;
3825  rasterParams.gray_spans = 0;
3826  rasterParams.black_spans = 0;
3827  rasterParams.bit_test = 0;
3828  rasterParams.bit_set = 0;
3829  rasterParams.user = data;
3830  rasterParams.clip_box = clip_box;
3831 
3832  bool done = false;
3833  int error;
3834 
3835  int rendered_spans = 0;
3836 
3837  while (!done) {
3838 
3840  rasterParams.gray_spans = callback;
3841  rasterParams.skip_spans = rendered_spans;
3842  error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams);
3843 
3844  // Out of memory, reallocate some more and try again...
3845  if (error == -6) { // ErrRaster_OutOfMemory from qgrayraster.c
3846  rasterPoolSize *= 2;
3847  if (rasterPoolSize > 1024 * 1024) {
3848  qWarning("QPainter: Rasterization of primitive failed");
3849  break;
3850  }
3851 
3852  rendered_spans += q_gray_rendered_spans(*grayRaster.data());
3853 
3854  free(rasterPoolOnHeap);
3855  rasterPoolOnHeap = (uchar *)malloc(rasterPoolSize + 0xf);
3856 
3857  Q_CHECK_PTR(rasterPoolOnHeap); // note: we just freed the old rasterPoolBase. I hope it's not fatal.
3858 
3859  rasterPoolBase = alignAddress(rasterPoolOnHeap, 0xf);
3860 
3863  qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
3864  } else {
3865  done = true;
3866  }
3867  }
3868 
3869  free(rasterPoolOnHeap);
3870 }
void initialize(ProcessSpans blend, void *data)
const QT_FT_Raster_Funcs qt_ft_grays_raster
Definition: qgrayraster.c:1931
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
static void callback(AuServer *, AuEventHandlerRec *, AuEvent *e, AuPointer p)
Definition: qsound_x11.cpp:170
QT_FT_Raster_DoneFunc raster_done
int q_gray_rendered_spans(QT_FT_Raster raster)
static uchar * alignAddress(uchar *address, quintptr alignmentMask)
void rasterize(const QT_FT_Outline *outline, Qt::FillRule fillRule)
#define error(msg)
QT_FT_SpanFunc gray_spans
FillRule
Definition: qnamespace.h:1485
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
#define QT_FT_RASTER_FLAG_CLIP
QT_FT_Raster_BitSet_Func bit_set
void setAntialiased(bool antialiased)
#define Q_Q(Class)
Definition: qglobal.h:2483
unsigned char uchar
Definition: qglobal.h:994
#define QT_FT_RASTER_FLAG_DIRECT
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
QT_FT_SpanFunc black_spans
QT_FT_Bitmap * target
#define Q_CHECK_PTR(p)
Definition: qglobal.h:1853
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
#define QT_FT_OUTLINE_NONE
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
QScopedPointer< QT_FT_Raster > grayRaster
#define MINIMUM_POOL_SIZE
Definition: qgrayraster_p.h:94
QT_FT_Raster_BitTest_Func bit_test
QT_FT_Raster_RenderFunc raster_render
void setClipRect(const QRect &clipRect)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
QT_FT_Raster_ResetFunc raster_reset
QT_FT_Raster_NewFunc raster_new
QScopedPointer< QRasterizer > rasterizer
#define QT_FT_RASTER_FLAG_AA

◆ rasterizeLine_dashed()

void QRasterPaintEnginePrivate::rasterizeLine_dashed ( QLineF  line,
qreal  width,
int *  dashIndex,
qreal dashOffset,
bool *  inDash 
)

Definition at line 3275 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::stroke().

3280 {
3282  QRasterPaintEngineState *s = q->state();
3283 
3284  const QPen &pen = s->lastPen;
3285  const bool squareCap = (pen.capStyle() == Qt::SquareCap);
3286  const QVector<qreal> pattern = pen.dashPattern();
3287 
3288  qreal patternLength = 0;
3289  for (int i = 0; i < pattern.size(); ++i)
3290  patternLength += pattern.at(i);
3291 
3292  if (patternLength <= 0)
3293  return;
3294 
3295  qreal length = line.length();
3296  Q_ASSERT(length > 0);
3297  while (length > 0) {
3298  const bool rasterize = *inDash;
3299  qreal dash = (pattern.at(*dashIndex) - *dashOffset) * width;
3300  QLineF l = line;
3301 
3302  if (dash >= length) {
3303  dash = length;
3304  *dashOffset += dash / width;
3305  length = 0;
3306  } else {
3307  *dashOffset = 0;
3308  *inDash = !(*inDash);
3309  if (++*dashIndex >= pattern.size())
3310  *dashIndex = 0;
3311  length -= dash;
3312  l.setLength(dash);
3313  line.setP1(l.p2());
3314  }
3315 
3316  if (rasterize && dash > 0)
3317  rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap);
3318  }
3319 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
void setP1(const QPointF &p1)
Sets the starting point of this line to p1.
Definition: qline.h:381
double qreal
Definition: qglobal.h:1193
qreal length() const
Returns the length of the line.
Definition: qline.cpp:698
QPointF p1() const
Returns the line&#39;s start point.
Definition: qline.h:314
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QPen class defines how a QPainter should draw lines and outlines of shapes.
Definition: qpen.h:64
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
Definition: qpen.cpp:466
#define Q_Q(Class)
Definition: qglobal.h:2483
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
void rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap=false)
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, QSpanData *spanData, QRasterBuffer *rasterBuffer)
void setLength(qreal len)
Sets the length of the line to the given length.
Definition: qline.h:360
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QPointF p2() const
Returns the line&#39;s end point.
Definition: qline.h:319
QFactoryLoader * l
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Qt::PenCapStyle capStyle() const
Returns the pen&#39;s cap style.
Definition: qpen.cpp:706
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QScopedPointer< QRasterizer > rasterizer

◆ recalculateFastImages()

void QRasterPaintEnginePrivate::recalculateFastImages ( )

Definition at line 3872 of file qpaintengine_raster.cpp.

Referenced by brushMatrix().

3873 {
3875  QRasterPaintEngineState *s = q->state();
3876 
3878  && s->matrix.type() <= QTransform::TxShear;
3879 }
QPaintEngine::DirtyFlags state() const
Returns a combination of flags identifying the set of properties that need to be updated when updatin...
Definition: qpaintengine.h:292
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ systemStateChanged()

void QRasterPaintEnginePrivate::systemStateChanged ( )
virtual

Reimplemented from QPaintEnginePrivate.

Reimplemented in QDirectFBPaintEnginePrivate.

Definition at line 1064 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEnginePrivate::systemStateChanged().

1065 {
1066  deviceRectUnclipped = QRect(0, 0,
1069 
1070  if (!systemClip.isEmpty()) {
1071  QRegion clippedDeviceRgn = systemClip & deviceRectUnclipped;
1072  deviceRect = clippedDeviceRgn.boundingRect();
1073  baseClip->setClipRegion(clippedDeviceRgn);
1074  } else {
1077  }
1078 #ifdef QT_DEBUG_DRAW
1079  qDebug() << "systemStateChanged" << this << "deviceRect" << deviceRect << deviceRectUnclipped << systemClip;
1080 #endif
1081 
1083 
1085  q->state()->strokeFlags |= QPaintEngine::DirtyClipRegion;
1086  q->state()->fillFlags |= QPaintEngine::DirtyClipRegion;
1087  q->state()->pixmapFlags |= QPaintEngine::DirtyClipRegion;
1088 }
void setClipRegion(const QRegion &region)
QScopedPointer< QClipData > baseClip
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int height() const
Definition: qpaintdevice.h:92
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
void setClipRect(const QRect &rect)
#define Q_Q(Class)
Definition: qglobal.h:2483
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Definition: qpaintdevice.h:91
const int QT_RASTER_COORD_LIMIT
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ updateMatrixData()

void QRasterPaintEnginePrivate::updateMatrixData ( QSpanData spanData,
const QBrush brush,
const QTransform brushMatrix 
)

Definition at line 1090 of file qpaintengine_raster.cpp.

1091 {
1092  if (b.d->style == Qt::NoBrush || b.d->style == Qt::SolidPattern)
1093  return;
1094 
1096  bool bilinear = q->state()->flags.bilinear;
1097 
1098  if (b.d->transform.type() > QTransform::TxNone) { // FALCON: optimize
1099  spanData->setupMatrix(b.transform() * m, bilinear);
1100  } else {
1101  if (m.type() <= QTransform::TxTranslate) {
1102  // specialize setupMatrix for translation matrices
1103  // to avoid needless matrix inversion
1104  spanData->m11 = 1;
1105  spanData->m12 = 0;
1106  spanData->m13 = 0;
1107  spanData->m21 = 0;
1108  spanData->m22 = 1;
1109  spanData->m23 = 0;
1110  spanData->m33 = 1;
1111  spanData->dx = -m.dx();
1112  spanData->dy = -m.dy();
1113  spanData->txop = m.type();
1114  spanData->bilinear = bilinear;
1115  spanData->fast_matrix = qAbs(m.dx()) < 1e4 && qAbs(m.dy()) < 1e4;
1116  spanData->adjustSpanMethods();
1117  } else {
1118  spanData->setupMatrix(m, bilinear);
1119  }
1120  }
1121 }
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_Q(Class)
Definition: qglobal.h:2483
void setupMatrix(const QTransform &matrix, int bilinear)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

Properties

◆ baseClip

QScopedPointer<QClipData> QRasterPaintEnginePrivate::baseClip

Definition at line 371 of file qpaintengine_raster_p.h.

Referenced by QRasterPaintEngine::clip().

◆ basicStroker

QStroker QRasterPaintEnginePrivate::basicStroker

Definition at line 358 of file qpaintengine_raster_p.h.

◆ cachedLines

QDataBuffer<QLineF> QRasterPaintEnginePrivate::cachedLines

Definition at line 363 of file qpaintengine_raster_p.h.

◆ dashStroker

QScopedPointer<QDashStroker> QRasterPaintEnginePrivate::dashStroker

Definition at line 359 of file qpaintengine_raster_p.h.

◆ device

QPaintDevice* QRasterPaintEnginePrivate::device

Definition at line 345 of file qpaintengine_raster_p.h.

Referenced by rasterFallbacksMask().

◆ deviceDepth

int QRasterPaintEnginePrivate::deviceDepth

Definition at line 373 of file qpaintengine_raster_p.h.

Referenced by QRasterPaintEngine::alphaPenBlt().

◆ deviceRect

QRect QRasterPaintEnginePrivate::deviceRect

◆ deviceRectUnclipped

QRect QRasterPaintEnginePrivate::deviceRectUnclipped

◆ glyphCacheType

QFontEngineGlyphCache::Type QRasterPaintEnginePrivate::glyphCacheType

◆ grayRaster

QScopedPointer<QT_FT_Raster> QRasterPaintEnginePrivate::grayRaster

Definition at line 361 of file qpaintengine_raster_p.h.

◆ hdc

HDC QRasterPaintEnginePrivate::hdc

◆ image_filler

QSpanData QRasterPaintEnginePrivate::image_filler

◆ image_filler_xform

QSpanData QRasterPaintEnginePrivate::image_filler_xform

◆ isPlain45DegreeRotation

uint QRasterPaintEnginePrivate::isPlain45DegreeRotation

Definition at line 379 of file qpaintengine_raster_p.h.

◆ mono_surface

uint QRasterPaintEnginePrivate::mono_surface

Definition at line 375 of file qpaintengine_raster_p.h.

◆ outlineMapper

QScopedPointer<QOutlineMapper> QRasterPaintEnginePrivate::outlineMapper

◆ outlinemapper_xform_dirty

uint QRasterPaintEnginePrivate::outlinemapper_xform_dirty

Definition at line 376 of file qpaintengine_raster_p.h.

◆ rasterBuffer

QScopedPointer<QRasterBuffer> QRasterPaintEnginePrivate::rasterBuffer

◆ rasterizer

QScopedPointer<QRasterizer> QRasterPaintEnginePrivate::rasterizer

◆ solid_color_filler

QSpanData QRasterPaintEnginePrivate::solid_color_filler

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