Qt 4.8
Public Functions | Public Variables | Private Functions | List of all members
QBlitterPaintEnginePrivate Class Reference
Inheritance diagram for QBlitterPaintEnginePrivate:
QRasterPaintEnginePrivate QPaintEngineExPrivate QPaintEnginePrivate

Public Functions

void clipAndDrawPixmap (const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
 
void fillRect (const QRectF &rect, const QColor &, bool alpha)
 
void lock ()
 
 QBlitterPaintEnginePrivate (QBlittablePixmapData *p)
 
void unlock ()
 
void updateBrushState (QPainterState *s)
 
void updateClipState (QPainterState *s)
 
void updateCompleteState (QPainterState *s)
 
void updateCompositionModeState (QPainterState *s)
 
void updateOpacityState (QPainterState *s)
 
void updatePenState (QPainterState *s)
 
void updateRenderHintsState (QPainterState *s)
 
void updateTransformState (QPainterState *s)
 
- Public Functions inherited from QRasterPaintEnginePrivate
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

CapabilitiesToStateMask caps
 
uint hasXForm
 
QBlittablePixmapDatapmData
 
- Public Variables inherited from QRasterPaintEnginePrivate
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
 

Private Functions

 Q_DECLARE_PUBLIC (QBlitterPaintEngine)
 

Detailed Description

Definition at line 240 of file qpaintengine_blitter.cpp.

Constructors and Destructors

◆ QBlitterPaintEnginePrivate()

QBlitterPaintEnginePrivate::QBlitterPaintEnginePrivate ( QBlittablePixmapData p)
inline

Definition at line 244 of file qpaintengine_blitter.cpp.

246  , pmData(p)
248  , hasXForm(false)
249 
250  {}
CapabilitiesToStateMask caps
Capabilities capabilities() const
Definition: qblittable.cpp:71
QBlittable * blittable() const

Functions

◆ clipAndDrawPixmap()

void QBlitterPaintEnginePrivate::clipAndDrawPixmap ( const QRectF clip,
const QRectF target,
const QPixmap pm,
const QRectF sr,
bool  opacity 
)

Definition at line 398 of file qpaintengine_blitter.cpp.

399 {
401  QRectF intersectedRect = clip.intersected(target);
402  if (intersectedRect.isEmpty())
403  return;
404  QRectF source = sr;
405  if (intersectedRect.size() != target.size()) {
406  if (sr.size() == target.size()) {
407  // no resize
408  qreal deltaTop = target.top() - intersectedRect.top();
409  qreal deltaLeft = target.left() - intersectedRect.left();
410  qreal deltaBottom = target.bottom() - intersectedRect.bottom();
411  qreal deltaRight = target.right() - intersectedRect.right();
412  source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
413  } else {
414  // resize case
415  qreal hFactor = sr.size().width() / target.size().width();
416  qreal vFactor = sr.size().height() / target.size().height();
417  qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor;
418  qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor;
419  qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor;
420  qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor;
421  source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
422  }
423  }
424  pmData->unmarkRasterOverlay(intersectedRect);
425  if (opacity)
426  pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity);
427  else
428  pmData->blittable()->drawPixmap(intersectedRect, pm, source);
429 }
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
double qreal
Definition: qglobal.h:1193
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
QRectF intersected(const QRectF &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:818
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect)=0
void adjust(qreal x1, qreal y1, qreal x2, qreal y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition: qrect.h:778
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
QBlittable * blittable() const
virtual void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity)
Definition: qblittable_p.h:87
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
void unmarkRasterOverlay(const QRectF &)

◆ fillRect()

void QBlitterPaintEnginePrivate::fillRect ( const QRectF rect,
const QColor color,
bool  alpha 
)

Definition at line 350 of file qpaintengine_blitter.cpp.

351 {
354  QRectF targetRect = rect;
355  if (hasXForm)
356  targetRect = q->state()->matrix.mapRect(rect);
357  const QClipData *clipData = clip();
358  if (clipData) {
359  if (clipData->hasRectClip) {
360  unlock();
361  if (alpha)
362  pmData->blittable()->alphaFillRect(targetRect & clipData->clipRect, color, q->state()->compositionMode());
363  else
364  pmData->blittable()->fillRect(targetRect & clipData->clipRect, color);
365  } else if (clipData->hasRegionClip) {
366  QVector<QRect> rects = clipData->clipRegion.rects();
367  for (int i = 0; i < rects.size(); ++i) {
368  QRect intersectRect = rects.at(i).intersected(targetRect.toRect());
369  if (!intersectRect.isEmpty()) {
370  unlock();
371  if (alpha)
372  pmData->blittable()->alphaFillRect(intersectRect, color, q->state()->compositionMode());
373  else
374  pmData->blittable()->fillRect(intersectRect, color);
375  }
376  }
377  }
378  } else {
379  if (targetRect.x() >= 0 && targetRect.y() >= 0
380  && targetRect.width() <= q->paintDevice()->width()
381  && targetRect.height() <= q->paintDevice()->height()) {
382  unlock();
383  if (alpha)
384  pmData->blittable()->alphaFillRect(targetRect, color, q->state()->compositionMode());
385  else
386  pmData->blittable()->fillRect(targetRect, color);
387  } else {
388  QRectF deviceRect(0, 0, q->paintDevice()->width(), q->paintDevice()->height());
389  unlock();
390  if (alpha)
391  pmData->blittable()->alphaFillRect(deviceRect & targetRect, color, q->state()->compositionMode());
392  else
393  pmData->blittable()->fillRect(deviceRect & targetRect, color);
394  }
395  }
396 }
virtual void fillRect(const QRectF &rect, const QColor &color)=0
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
#define Q_Q(Class)
Definition: qglobal.h:2483
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
virtual void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode)
Definition: qblittable_p.h:81
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
const QClipData * clip() const
QBlittable * blittable() const
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
void unmarkRasterOverlay(const QRectF &)

◆ lock()

void QBlitterPaintEnginePrivate::lock ( )
inline

Definition at line 272 of file qpaintengine_blitter.cpp.

273 {
274  if (!pmData->blittable()->isLocked())
276 }
QScopedPointer< QRasterBuffer > rasterBuffer
QImage::Format prepare(QImage *image)
QBlittable * blittable() const
bool isLocked() const
Definition: qblittable.cpp:83

◆ Q_DECLARE_PUBLIC()

QBlitterPaintEnginePrivate::Q_DECLARE_PUBLIC ( QBlitterPaintEngine  )
private

◆ unlock()

void QBlitterPaintEnginePrivate::unlock ( )
inline

Definition at line 278 of file qpaintengine_blitter.cpp.

279 {
280  pmData->blittable()->unlock();
281 }
void unlock()
Definition: qblittable.cpp:100
QBlittable * blittable() const

◆ updateBrushState()

void QBlitterPaintEnginePrivate::updateBrushState ( QPainterState s)

Definition at line 300 of file qpaintengine_blitter.cpp.

301 {
302  Qt::BrushStyle style = qbrush_style(s->brush);
303 
306  qbrush_color(s->brush).alpha() < 255);
307 }
BrushStyle
Definition: qnamespace.h:1162
#define STATE_BRUSH_PATTERN
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
void updateState(uint mask, bool on)
CapabilitiesToStateMask caps
#define STATE_BRUSH_ALPHA
ushort alpha
Returns the alpha color component of this color.
Definition: qcolor.h:242
const QColor & qbrush_color(const QBrush &b)
Definition: qpainter_p.h:97
QBrush brush
Definition: qpainter_p.h:153

◆ updateClipState()

void QBlitterPaintEnginePrivate::updateClipState ( QPainterState s)

Definition at line 343 of file qpaintengine_blitter.cpp.

344 {
345  const QClipData *clipData = clip();
346  bool complexClip = clipData && !(clipData->hasRectClip || clipData->hasRegionClip);
347  caps.updateState(STATE_CLIP_COMPLEX, complexClip);
348 }
void updateState(uint mask, bool on)
CapabilitiesToStateMask caps
#define STATE_CLIP_COMPLEX
const QClipData * clip() const

◆ updateCompleteState()

void QBlitterPaintEnginePrivate::updateCompleteState ( QPainterState s)

Definition at line 284 of file qpaintengine_blitter.cpp.

285 {
286  updatePenState(s);
287  updateBrushState(s);
292  updateClipState(s);
293 }
void updateTransformState(QPainterState *s)
void updateRenderHintsState(QPainterState *s)
void updateBrushState(QPainterState *s)
void updateOpacityState(QPainterState *s)
void updateCompositionModeState(QPainterState *s)
void updatePenState(QPainterState *s)
void updateClipState(QPainterState *s)

◆ updateCompositionModeState()

void QBlitterPaintEnginePrivate::updateCompositionModeState ( QPainterState s)

Definition at line 315 of file qpaintengine_blitter.cpp.

316 {
319 
321 }
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
void updateState(uint mask, bool on)
#define STATE_BLENDING_COMPLEX
CapabilitiesToStateMask caps

◆ updateOpacityState()

void QBlitterPaintEnginePrivate::updateOpacityState ( QPainterState s)

Definition at line 309 of file qpaintengine_blitter.cpp.

310 {
311  bool translucent = s->opacity < 1;
312  caps.updateState(STATE_ALPHA, translucent);
313 }
void updateState(uint mask, bool on)
CapabilitiesToStateMask caps
#define STATE_ALPHA

◆ updatePenState()

void QBlitterPaintEnginePrivate::updatePenState ( QPainterState s)

Definition at line 295 of file qpaintengine_blitter.cpp.

296 {
298 }
void updateState(uint mask, bool on)
CapabilitiesToStateMask caps
#define STATE_PEN_ENABLED
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89

◆ updateRenderHintsState()

void QBlitterPaintEnginePrivate::updateRenderHintsState ( QPainterState s)

Definition at line 323 of file qpaintengine_blitter.cpp.

324 {
325  bool aa = s->renderHints & QPainter::Antialiasing;
327 }
#define STATE_ANTIALIASING
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
void updateState(uint mask, bool on)
CapabilitiesToStateMask caps

◆ updateTransformState()

void QBlitterPaintEnginePrivate::updateTransformState ( QPainterState s)

Definition at line 329 of file qpaintengine_blitter.cpp.

330 {
332 
333  // consider scaling operations with a negative factor as "complex" for now.
334  // as some blitters could handle axisymmetrical operations, we should improve blitter
335  // paint engine to handle them as a capability
337  ((type == QTransform::TxScale) && ((s->matrix.m11() < 0.0) || (s->matrix.m22() < 0.0))));
339 
341 }
int type
Definition: qmetatype.cpp:239
void updateState(uint mask, bool on)
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
CapabilitiesToStateMask caps
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
TransformationType
Definition: qtransform.h:68
#define STATE_XFORM_SCALE
#define STATE_XFORM_COMPLEX
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237

Properties

◆ caps

CapabilitiesToStateMask QBlitterPaintEnginePrivate::caps

Definition at line 268 of file qpaintengine_blitter.cpp.

◆ hasXForm

uint QBlitterPaintEnginePrivate::hasXForm

Definition at line 269 of file qpaintengine_blitter.cpp.

◆ pmData

QBlittablePixmapData* QBlitterPaintEnginePrivate::pmData

Definition at line 267 of file qpaintengine_blitter.cpp.


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