Qt 4.8
Public Types | Public Functions | Protected Functions | Private Functions | Friends | Related Functions | List of all members
QRasterPaintEngine Class Reference

The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded Linux. More...

#include <qpaintengine_raster_p.h>

Inheritance diagram for QRasterPaintEngine:
QPaintEngineEx QPaintEngine QBlitterPaintEngine QDirectFBPaintEngine QOnScreenRasterPaintEngine QVolatileImagePaintEngine

Public Types

enum  ClipType { RectClip, ComplexClip }
 
- 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
}
 

Public Functions

void alphaPenBlt (const void *src, int bpl, int depth, int rx, int ry, int w, int h)
 
bool begin (QPaintDevice *device)
 Reimplemented Function More...
 
void brushChanged ()
 
void brushOriginChanged ()
 
void clip (const QVectorPath &path, Qt::ClipOperation op)
 
void clip (const QRect &rect, Qt::ClipOperation op)
 
void clip (const QRegion &region, Qt::ClipOperation op)
 
QRect clipBoundingRect () const
 Returns the bounding rect of the currently set clip. More...
 
void clipEnabledChanged ()
 
ClipType clipType () const
 Returns the type of the clip currently set. More...
 
void compositionModeChanged ()
 
QPoint coordinateOffset () const
 
QPainterStatecreateState (QPainterState *orig) const
 
virtual void drawBufferSpan (const uint *buffer, int bufsize, int x, int y, int length, uint const_alpha)
 Draws the given buffer. More...
 
virtual void drawColorSpans (const QSpan *spans, int count, uint color)
 Draws the given color spans with the specified color. More...
 
void drawEllipse (const QRectF &rect)
 Reimplemented Function More...
 
void drawImage (const QPointF &p, const QImage &img)
 
void drawImage (const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags falgs=Qt::AutoColor)
 Reimplemented Function More...
 
void drawLines (const QLine *line, int lineCount)
 Reimplemented Function More...
 
void drawLines (const QLineF *line, int lineCount)
 Reimplemented Function More...
 
void drawPixmap (const QPointF &p, const QPixmap &pm)
 
void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)
 Reimplemented Function More...
 
void drawPoints (const QPointF *points, int pointCount)
 Reimplemented Function More...
 
void drawPoints (const QPoint *points, int pointCount)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Draws the first pointCount points in the buffer points. More...
 
void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
 Reimplemented Function More...
 
void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
 Reimplemented Function More...
 
void drawRects (const QRect *rects, int rectCount)
 Reimplemented Function More...
 
void drawRects (const QRectF *rects, int rectCount)
 Reimplemented Function More...
 
void drawStaticTextItem (QStaticTextItem *textItem)
 Reimplemented Function More...
 
void drawTextItem (const QPointF &p, const QTextItem &textItem)
 Reimplemented Function More...
 
void drawTiledPixmap (const QRectF &r, const QPixmap &pm, const QPointF &sr)
 Reimplemented Function More...
 
bool end ()
 Reimplemented Function More...
 
void fill (const QVectorPath &path, const QBrush &brush)
 
void fillPath (const QPainterPath &path, QSpanData *fillData)
 
void fillPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
 
void fillRect (const QRectF &rect, const QBrush &brush)
 Reimplemented Function More...
 
void fillRect (const QRectF &rect, const QColor &color)
 Reimplemented Function More...
 
CGContextRef getCGContext () const
 
HDC getDC () const
 
void opacityChanged ()
 
void penChanged ()
 
 QRasterPaintEngine (QPaintDevice *device)
 Creates a raster based paint engine for operating on the given device, with the complete set of QPaintEngine::PaintEngineFeature {paint engine features and capabilities}. More...
 
void releaseBuffer ()
 
void releaseDC (HDC hdc) const
 
void renderHintsChanged ()
 
void saveBuffer (const QString &s) const
 
void setCGContext (CGContextRef ref)
 
void setDC (HDC hdc)
 
void setState (QPainterState *s)
 
QSize size () const
 
QRasterPaintEngineStatestate ()
 
const QRasterPaintEngineStatestate () const
 
void stroke (const QVectorPath &path, const QPen &pen)
 
bool supportsTransformations (const QFontEngine *fontEngine) const
 
bool supportsTransformations (qreal pixelSize, const QTransform &m) const
 
void transformChanged ()
 
Type type () const
 Reimplemented Function More...
 
void updateBrush (const QBrush &brush)
 
void updateMatrix (const QTransform &matrix)
 
void updatePen (const QPen &pen)
 
 ~QRasterPaintEngine ()
 Destroys this paint engine. More...
 
- Public Functions inherited from QPaintEngineEx
virtual void beginNativePainting ()
 
virtual void clip (const QPainterPath &path, Qt::ClipOperation op)
 
virtual void draw (const QVectorPath &path)
 
virtual void drawEllipse (const QRect &r)
 The default implementation of this function calls the floating point version of this function. More...
 
virtual void drawPath (const QPainterPath &path)
 The default implementation ignores the path and does nothing. More...
 
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 uint flags () const
 
virtual QPixmapFilterpixmapFilter (int, const QPixmapFilter *)
 
 QPaintEngineEx ()
 
QPainterStatestate ()
 
const QPainterStatestate () 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)
 
void fix_neg_rect (int *x, int *y, int *w, int *h)
 
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...
 
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...
 

Protected Functions

 QRasterPaintEngine (QRasterPaintEnginePrivate &d, QPaintDevice *)
 
- Protected Functions inherited from QPaintEngineEx
 QPaintEngineEx (QPaintEngineExPrivate &data)
 
- Protected Functions inherited from QPaintEngine
 QPaintEngine (QPaintEnginePrivate &data, PaintEngineFeatures devcaps=0)
 

Private Functions

void drawBitmap (const QPointF &pos, const QImage &image, QSpanData *fill)
 
bool drawCachedGlyphs (int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
 
void ensureBrush (const QBrush &brush)
 
void ensureBrush ()
 
void ensureOutlineMapper ()
 
void ensurePen (const QPen &pen)
 
void ensurePen ()
 
void ensureState ()
 
void fillRect (const QRectF &rect, QSpanData *data)
 
void init ()
 
bool setClipRectInDeviceCoords (const QRect &r, Qt::ClipOperation op)
 
void updateOutlineMapper ()
 
void updateState ()
 

Friends

class QBlitterPaintEngine
 
class QBlitterPaintEnginePrivate
 
struct QSpanData
 

Related Functions

(Note that these are not member functions.)

 QSpan
 A struct equivalent to QT_FT_Span, containing a position (x, y), the span's length in pixels and its color/coverage (a value ranging from 0 to 255). More...
 

Additional Inherited Members

- Protected Variables inherited from QPaintEngine
uint active: 1
 
QScopedPointer< QPaintEnginePrivated_ptr
 
uint extended: 1
 
PaintEngineFeatures gccaps
 
uint selfDestruct: 1
 
QPaintEngineStatestate
 

Detailed Description

The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded Linux.

This function is under development and subject to change.

Since
4.2

Note that this functionality is only available in Qt for Embedded Linux.

In Qt for Embedded Linux, painting is a pure software implementation. But starting with Qt 4.2, it is possible to add an accelerated graphics driver to take advantage of available hardware resources.

Hardware acceleration is accomplished by creating a custom screen driver, accelerating the copying from memory to the screen, and implementing a custom paint engine accelerating the various painting operations. Then a custom paint device (derived from the QCustomRasterPaintDevice class) and a custom window surface (derived from QWSWindowSurface) must be implemented to make Qt for Embedded Linux aware of the accelerated driver.

Note
The QRasterPaintEngine class does not support 8-bit images. Instead, they need to be converted to a supported format, such as QImage::Format_ARGB32_Premultiplied.

See the Adding an Accelerated Graphics Driver to Qt for Embedded Linux documentation for details.

See also
QCustomRasterPaintDevice, QPaintEngine

Definition at line 132 of file qpaintengine_raster_p.h.

Enumerations

◆ ClipType

Warning
This function is not part of the public interface.
  • RectClip Indicates that the currently set clip is a single rectangle.
  • ComplexClip Indicates that the currently set clip is a combination of several shapes.
Enumerator
RectClip 
ComplexClip 

Definition at line 205 of file qpaintengine_raster_p.h.

Constructors and Destructors

◆ QRasterPaintEngine() [1/2]

QRasterPaintEngine::QRasterPaintEngine ( QPaintDevice device)

Creates a raster based paint engine for operating on the given device, with the complete set of QPaintEngine::PaintEngineFeature {paint engine features and capabilities}.

Since
4.5

Definition at line 320 of file qpaintengine_raster.cpp.

322 {
323  d_func()->device = device;
324  init();
325 }

◆ ~QRasterPaintEngine()

QRasterPaintEngine::~QRasterPaintEngine ( )

Destroys this paint engine.

Definition at line 430 of file qpaintengine_raster.cpp.

431 {
433 
434  qt_ft_grays_raster.raster_done(*d->grayRaster.data());
435 }
double d
Definition: qnumeric_p.h:62
const QT_FT_Raster_Funcs qt_ft_grays_raster
Definition: qgrayraster.c:1931
QT_FT_Raster_DoneFunc raster_done
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ QRasterPaintEngine() [2/2]

QRasterPaintEngine::QRasterPaintEngine ( QRasterPaintEnginePrivate dd,
QPaintDevice device 
)
protected
Warning
This function is not part of the public interface.

Definition at line 330 of file qpaintengine_raster.cpp.

331  : QPaintEngineEx(dd)
332 {
333  d_func()->device = device;
334  init();
335 }

Functions

◆ alphaPenBlt()

void QRasterPaintEngine::alphaPenBlt ( const void *  src,
int  bpl,
int  depth,
int  rx,
int  ry,
int  w,
int  h 
)
Warning
This function is not part of the public interface.

Definition at line 2557 of file qpaintengine_raster.cpp.

Referenced by QProxyFontEngine::canRender(), QFontEngineQPF::draw(), and QFontEngineQPF1::draw().

2558 {
2561 
2562  if (!s->penData.blend)
2563  return;
2564 
2565  QRasterBuffer *rb = d->rasterBuffer.data();
2566 
2567  const QRect rect(rx, ry, w, h);
2568  const QClipData *clip = d->clip();
2569  bool unclipped = false;
2570  if (clip) {
2571  // inlined QRect::intersects
2572  const bool intersects = qMax(clip->xmin, rect.left()) <= qMin(clip->xmax - 1, rect.right())
2573  && qMax(clip->ymin, rect.top()) <= qMin(clip->ymax - 1, rect.bottom());
2574 
2575  if (clip->hasRectClip) {
2576  unclipped = rx > clip->xmin
2577  && rx + w < clip->xmax
2578  && ry > clip->ymin
2579  && ry + h < clip->ymax;
2580  }
2581 
2582  if (!intersects)
2583  return;
2584  } else {
2585  // inlined QRect::intersects
2586  const bool intersects = qMax(0, rect.left()) <= qMin(rb->width() - 1, rect.right())
2587  && qMax(0, rect.top()) <= qMin(rb->height() - 1, rect.bottom());
2588  if (!intersects)
2589  return;
2590 
2591  // inlined QRect::contains
2592  const bool contains = rect.left() >= 0 && rect.right() < rb->width()
2593  && rect.top() >= 0 && rect.bottom() < rb->height();
2594 
2595  unclipped = contains && d->isUnclipped_normalized(rect);
2596  }
2597 
2598  ProcessSpans blend = unclipped ? s->penData.unclipped_blend : s->penData.blend;
2599  const uchar * scanline = static_cast<const uchar *>(src);
2600 
2601  if (s->flags.fast_text) {
2602  if (unclipped) {
2603  if (depth == 1) {
2604  if (s->penData.bitmapBlit) {
2605  s->penData.bitmapBlit(rb, rx, ry, s->penData.solid.color,
2606  scanline, w, h, bpl);
2607  return;
2608  }
2609  } else if (depth == 8) {
2610  if (s->penData.alphamapBlit) {
2611  s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color,
2612  scanline, w, h, bpl, 0);
2613  return;
2614  }
2615  } else if (depth == 32) {
2616  // (A)RGB Alpha mask where the alpha component is not used.
2617  if (s->penData.alphaRGBBlit) {
2618  s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color,
2619  (const uint *) scanline, w, h, bpl / 4, 0);
2620  return;
2621  }
2622  }
2623  } else if (d->deviceDepth == 32 && (depth == 8 || depth == 32)) {
2624  // (A)RGB Alpha mask where the alpha component is not used.
2625  if (!clip) {
2626  int nx = qMax(0, rx);
2627  int ny = qMax(0, ry);
2628 
2629  // Move scanline pointer to compensate for moved x and y
2630  int xdiff = nx - rx;
2631  int ydiff = ny - ry;
2632  scanline += ydiff * bpl;
2633  scanline += xdiff * (depth == 32 ? 4 : 1);
2634 
2635  w -= xdiff;
2636  h -= ydiff;
2637 
2638  if (nx + w > d->rasterBuffer->width())
2639  w = d->rasterBuffer->width() - nx;
2640  if (ny + h > d->rasterBuffer->height())
2641  h = d->rasterBuffer->height() - ny;
2642 
2643  rx = nx;
2644  ry = ny;
2645  }
2646  if (depth == 8 && s->penData.alphamapBlit) {
2647  s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color,
2648  scanline, w, h, bpl, clip);
2649  } else if (depth == 32 && s->penData.alphaRGBBlit) {
2650  s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color,
2651  (const uint *) scanline, w, h, bpl / 4, clip);
2652  }
2653  return;
2654  }
2655  }
2656 
2657  int x0 = 0;
2658  if (rx < 0) {
2659  x0 = -rx;
2660  w -= x0;
2661  }
2662 
2663  int y0 = 0;
2664  if (ry < 0) {
2665  y0 = -ry;
2666  scanline += bpl * y0;
2667  h -= y0;
2668  }
2669 
2670  w = qMin(w, rb->width() - qMax(0, rx));
2671  h = qMin(h, rb->height() - qMax(0, ry));
2672 
2673  if (w <= 0 || h <= 0)
2674  return;
2675 
2676  const int NSPANS = 256;
2677  QSpan spans[NSPANS];
2678  int current = 0;
2679 
2680  const int x1 = x0 + w;
2681  const int y1 = y0 + h;
2682 
2683  if (depth == 1) {
2684  for (int y = y0; y < y1; ++y) {
2685  for (int x = x0; x < x1; ) {
2686  if (!monoVal(scanline, x)) {
2687  ++x;
2688  continue;
2689  }
2690 
2691  if (current == NSPANS) {
2692  blend(current, spans, &s->penData);
2693  current = 0;
2694  }
2695  spans[current].x = x + rx;
2696  spans[current].y = y + ry;
2697  spans[current].coverage = 255;
2698  int len = 1;
2699  ++x;
2700  // extend span until we find a different one.
2701  while (x < x1 && monoVal(scanline, x)) {
2702  ++x;
2703  ++len;
2704  }
2705  spans[current].len = len;
2706  ++current;
2707  }
2708  scanline += bpl;
2709  }
2710  } else if (depth == 8) {
2711  for (int y = y0; y < y1; ++y) {
2712  for (int x = x0; x < x1; ) {
2713  // Skip those with 0 coverage
2714  if (scanline[x] == 0) {
2715  ++x;
2716  continue;
2717  }
2718 
2719  if (current == NSPANS) {
2720  blend(current, spans, &s->penData);
2721  current = 0;
2722  }
2723  int coverage = scanline[x];
2724  spans[current].x = x + rx;
2725  spans[current].y = y + ry;
2726  spans[current].coverage = coverage;
2727  int len = 1;
2728  ++x;
2729 
2730  // extend span until we find a different one.
2731  while (x < x1 && scanline[x] == coverage) {
2732  ++x;
2733  ++len;
2734  }
2735  spans[current].len = len;
2736  ++current;
2737  }
2738  scanline += bpl;
2739  }
2740  } else { // 32-bit alpha...
2741  uint *sl = (uint *) src;
2742  for (int y = y0; y < y1; ++y) {
2743  for (int x = x0; x < x1; ) {
2744  // Skip those with 0 coverage
2745  if ((sl[x] & 0x00ffffff) == 0) {
2746  ++x;
2747  continue;
2748  }
2749 
2750  if (current == NSPANS) {
2751  blend(current, spans, &s->penData);
2752  current = 0;
2753  }
2754  uint rgbCoverage = sl[x];
2755  int coverage = qGreen(rgbCoverage);
2756  spans[current].x = x + rx;
2757  spans[current].y = y + ry;
2758  spans[current].coverage = coverage;
2759  int len = 1;
2760  ++x;
2761 
2762  // extend span until we find a different one.
2763  while (x < x1 && sl[x] == rgbCoverage) {
2764  ++x;
2765  ++len;
2766  }
2767  spans[current].len = len;
2768  ++current;
2769  }
2770  sl += bpl / sizeof(uint);
2771  }
2772  }
2773 // qDebug() << "alphaPenBlt: num spans=" << current
2774 // << "span:" << spans->x << spans->y << spans->len << spans->coverage;
2775  // Call span func for current set of spans.
2776  if (current != 0)
2777  blend(current, spans, &s->penData);
2778 }
double d
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
unsigned char coverage
QRasterPaintEngineState * state()
unsigned short len
AlphaRGBBlitFunc alphaRGBBlit
QT_FT_SpanFunc ProcessSpans
static bool monoVal(const uchar *s, int x)
QSolidData solid
#define Q_D(Class)
Definition: qglobal.h:2482
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
BitmapBlitFunc bitmapBlit
ProcessSpans blend
unsigned char uchar
Definition: qglobal.h:994
unsigned int uint
Definition: qglobal.h:996
void clip(const QVectorPath &path, Qt::ClipOperation op)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
Q_GUI_EXPORT_INLINE int qGreen(QRgb rgb)
Definition: qrgb.h:60
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
ProcessSpans unclipped_blend
AlphamapBlitFunc alphamapBlit

◆ begin()

bool QRasterPaintEngine::begin ( QPaintDevice device)
virtual

Reimplemented Function

Implements QPaintEngine.

Reimplemented in QDirectFBPaintEngine.

Definition at line 440 of file qpaintengine_raster.cpp.

Referenced by QVolatileImagePaintEngine::begin(), QBlitterPaintEngine::begin(), QDirectFBPaintEngine::begin(), QOnScreenRasterPaintEngine::begin(), and QBlitterPaintEngine::type().

441 {
443 
444  if (device->devType() == QInternal::Pixmap) {
445  QPixmap *pixmap = static_cast<QPixmap *>(device);
446  QPixmapData *pd = pixmap->pixmapData();
448  d->device = pd->buffer();
449  } else {
450  d->device = device;
451  }
452 
453  // Make sure QPaintEngine::paintDevice() returns the proper device.
454  d->pdev = d->device;
455 
456  Q_ASSERT(d->device->devType() == QInternal::Image
457  || d->device->devType() == QInternal::CustomRaster);
458 
459  d->systemStateChanged();
460 
463  d->outlineMapper->m_clip_rect = d->deviceRect;
464 
465  if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT)
466  d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT);
467  if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT)
468  d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT);
469 
470  d->rasterizer->setClipRect(d->deviceRect);
471 
472  s->penData.init(d->rasterBuffer.data(), this);
474  s->stroker = &d->basicStroker;
475  d->basicStroker.setClipRect(d->deviceRect);
476 
477  s->brushData.init(d->rasterBuffer.data(), this);
479 
480  d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver;
481 
483 
484 #ifdef QT_DEBUG_DRAW
485  qDebug() << "QRasterPaintEngine::begin(" << (void *) device
486  << ") devType:" << device->devType()
487  << "devRect:" << d->deviceRect;
488  if (d->baseClip) {
489  dumpClip(d->rasterBuffer->width(), d->rasterBuffer->height(), &*d->baseClip);
490  }
491 #endif
492 
493 #if defined(Q_WS_WIN)
494  d->isPlain45DegreeRotation = true;
495 #endif
496 
497  if (d->mono_surface)
498  d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono;
499 #if defined(Q_WS_WIN)
500  else if (qt_cleartype_enabled)
501 #elif defined (Q_WS_MAC)
503 #else
504  else if (false)
505 #endif
506  {
507  QImage::Format format = static_cast<QImage *>(d->device)->format();
509  d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
510  else
511  d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
512  } else
513  d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
514 
515  setActive(true);
516  return true;
517 }
double d
Definition: qnumeric_p.h:62
Format
The following image formats are available in Qt.
Definition: qimage.h:91
QRasterPaintEngineState * state()
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
virtual int devType() const
Definition: qpaintdevice.h:167
bool qt_applefontsmoothing_enabled
Q_CORE_EXPORT void qDebug(const char *,...)
const int QT_RASTER_COORD_LIMIT
void setActive(bool newState)
Sets the active state of the paint engine to state.
Definition: qpaintengine.h:155
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void setDirty(DirtyFlags df)
Definition: qpaintengine.h:349
ClassId classId() const
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Definition: qpen.cpp:797
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
The QPixmap class is an off-screen image representation that can be used as a paint device...
Definition: qpixmap.h:71
virtual QImage * buffer()
bool qt_cleartype_enabled
QBrush brush
Definition: qpainter_p.h:153
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
QPixmapData * pixmapData() const
Definition: qpixmap.cpp:2277

◆ brushChanged()

void QRasterPaintEngine::brushChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 823 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::brushChanged(), QDirectFBPaintEngine::brushChanged(), and QBlitterPaintEngine::type().

824 {
826 #ifdef QT_DEBUG_DRAW
827  qDebug() << "QRasterPaintEngine::brushChanged():" << s->brush;
828 #endif
829  s->fillFlags |= DirtyBrush;
830 }
QRasterPaintEngineState * state()
Q_CORE_EXPORT void qDebug(const char *,...)
QBrush brush
Definition: qpainter_p.h:153

◆ brushOriginChanged()

void QRasterPaintEngine::brushOriginChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Definition at line 809 of file qpaintengine_raster.cpp.

810 {
812 #ifdef QT_DEBUG_DRAW
813  qDebug() << "QRasterPaintEngine::brushOriginChanged()" << s->brushOrigin;
814 #endif
815 
817 }
QRasterPaintEngineState * state()
Q_CORE_EXPORT void qDebug(const char *,...)
QPointF brushOrigin
Definition: qpainter_p.h:149

◆ clip() [1/3]

void QRasterPaintEngine::clip ( const QVectorPath path,
Qt::ClipOperation  op 
)
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1178 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::clip(), QBlittablePixmapData::paintEngine(), QRasterPaintEngineState::QRasterPaintEngineState(), and QRasterPaintEngineState::~QRasterPaintEngineState().

1179 {
1180 #ifdef QT_DEBUG_DRAW
1181  qDebug() << "QRasterPaintEngine::clip(): " << path << op;
1182 
1183  if (path.elements()) {
1184  for (int i=0; i<path.elementCount(); ++i) {
1185  qDebug() << " - " << path.elements()[i]
1186  << '(' << path.points()[i*2] << ", " << path.points()[i*2+1] << ')';
1187  }
1188  } else {
1189  for (int i=0; i<path.elementCount(); ++i) {
1190  qDebug() << " ---- "
1191  << '(' << path.points()[i*2] << ", " << path.points()[i*2+1] << ')';
1192  }
1193  }
1194 #endif
1195 
1198 
1199  const qreal *points = path.points();
1200  const QPainterPath::ElementType *types = path.elements();
1201 
1202  // There are some cases that are not supported by clip(QRect)
1203  if (op != Qt::UniteClip && (op != Qt::IntersectClip || !s->clip
1204  || s->clip->hasRectClip || s->clip->hasRegionClip)) {
1205  if (s->matrix.type() <= QTransform::TxScale
1206  && ((path.shape() == QVectorPath::RectangleHint)
1207  || (isRect(points, path.elementCount())
1208  && (!types || (types[0] == QPainterPath::MoveToElement
1209  && types[1] == QPainterPath::LineToElement
1210  && types[2] == QPainterPath::LineToElement
1211  && types[3] == QPainterPath::LineToElement))))) {
1212 #ifdef QT_DEBUG_DRAW
1213  qDebug() << " --- optimizing vector clip to rect clip...";
1214 #endif
1215 
1216  QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
1217  if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op))
1218  return;
1219  }
1220  }
1221 
1222  if (op == Qt::NoClip) {
1224 
1225  } else {
1226  QClipData *base = d->baseClip.data();
1227 
1228  // Intersect with current clip when available...
1229  if (op == Qt::IntersectClip && s->clip)
1230  base = s->clip;
1231 
1232  // We always intersect, except when there is nothing to
1233  // intersect with, in which case we simplify the operation to
1234  // a replace...
1236  if (base == 0)
1237  isectOp = Qt::ReplaceClip;
1238 
1239  QClipData *newClip = new QClipData(d->rasterBuffer->height());
1240  newClip->initialize();
1241  ClipData clipData = { base, newClip, isectOp };
1243  d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, 0);
1244 
1245  newClip->fixup();
1246 
1247  if (op == Qt::UniteClip) {
1248  // merge clips
1249  QClipData *result = new QClipData(d->rasterBuffer->height());
1250  QClipData *current = s->clip ? s->clip : new QClipData(d->rasterBuffer->height());
1251  qt_merge_clip(current, newClip, result);
1252  result->fixup();
1253  delete newClip;
1254  if (!s->clip)
1255  delete current;
1256  newClip = result;
1257  }
1258 
1259  if (s->flags.has_clip_ownership)
1260  delete s->clip;
1261 
1262  s->clip = newClip;
1263  s->flags.has_clip_ownership = true;
1264  }
1266 }
double d
Definition: qnumeric_p.h:62
static void qt_span_clip(int count, const QSpan *spans, void *userData)
ElementType
This enum describes the types of elements used to connect vertices in subpaths.
Definition: qpainterpath.h:70
double qreal
Definition: qglobal.h:1193
int elementCount() const
QRasterPaintEngineState * state()
bool setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op)
static bool isRect(const T *pts, int elementCount)
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
static const uint base
Definition: qurl.cpp:268
const QPainterPath::ElementType * elements() const
Q_CORE_EXPORT void qDebug(const char *,...)
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static void qrasterpaintengine_dirty_clip(QRasterPaintEnginePrivate *d, QRasterPaintEngineState *s)
static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *result)
static const struct @32 types[]
const qreal * points() const
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s)
ClipOperation
Definition: qnamespace.h:1495
Hint shape() const

◆ clip() [2/3]

void QRasterPaintEngine::clip ( const QRect rect,
Qt::ClipOperation  op 
)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1273 of file qpaintengine_raster.cpp.

1274 {
1275 #ifdef QT_DEBUG_DRAW
1276  qDebug() << "QRasterPaintEngine::clip(): " << rect << op;
1277 #endif
1278 
1280 
1281  if (op == Qt::NoClip) {
1283 
1284  } else if (op == Qt::UniteClip || s->matrix.type() > QTransform::TxScale) {
1285  QPaintEngineEx::clip(rect, op);
1286  return;
1287 
1288  } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) {
1289  QPaintEngineEx::clip(rect, op);
1290  return;
1291  }
1292 }
QRasterPaintEngineState * state()
bool setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op)
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
Q_CORE_EXPORT void qDebug(const char *,...)
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s)
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0

◆ clip() [3/3]

void QRasterPaintEngine::clip ( const QRegion region,
Qt::ClipOperation  op 
)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1349 of file qpaintengine_raster.cpp.

1350 {
1351 #ifdef QT_DEBUG_DRAW
1352  qDebug() << "QRasterPaintEngine::clip(): " << region << op;
1353 #endif
1354 
1356 
1357  if (region.rectCount() == 1) {
1358  clip(region.boundingRect(), op);
1359  return;
1360  }
1361 
1363  const QClipData *clip = d->clip();
1364  const QClipData *baseClip = d->baseClip.data();
1365 
1366  if (op == Qt::NoClip) {
1368  } else if (s->matrix.type() > QTransform::TxScale
1369  || op == Qt::UniteClip
1370  || (op == Qt::IntersectClip && !clip->hasRectClip && !clip->hasRegionClip)
1371  || (op == Qt::ReplaceClip && !baseClip->hasRectClip && !baseClip->hasRegionClip)) {
1372  QPaintEngineEx::clip(region, op);
1373  } else {
1374  const QClipData *curClip;
1375  QClipData *newClip;
1376 
1377  if (op == Qt::IntersectClip)
1378  curClip = clip;
1379  else
1380  curClip = baseClip;
1381 
1382  if (s->flags.has_clip_ownership) {
1383  newClip = s->clip;
1384  Q_ASSERT(newClip);
1385  } else {
1386  newClip = new QClipData(d->rasterBuffer->height());
1387  s->clip = newClip;
1388  s->flags.has_clip_ownership = true;
1389  }
1390 
1391  QRegion r = s->matrix.map(region);
1392  if (curClip->hasRectClip)
1393  newClip->setClipRegion(r & curClip->clipRect);
1394  else if (curClip->hasRegionClip)
1395  newClip->setClipRegion(r & curClip->clipRegion);
1396 
1398  }
1399 }
double d
Definition: qnumeric_p.h:62
void setClipRegion(const QRegion &region)
QRasterPaintEngineState * state()
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
QTransform matrix
Definition: qpainter_p.h:161
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Definition: qregion.cpp:4461
Q_CORE_EXPORT void qDebug(const char *,...)
static void qrasterpaintengine_dirty_clip(QRasterPaintEnginePrivate *d, QRasterPaintEngineState *s)
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...
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void clip(const QVectorPath &path, Qt::ClipOperation op)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s)
virtual void clip(const QVectorPath &path, Qt::ClipOperation op)=0

◆ clipBoundingRect()

QRect QRasterPaintEngine::clipBoundingRect ( ) const

Returns the bounding rect of the currently set clip.

Warning
This function is not part of the public interface.

Definition at line 3637 of file qpaintengine_raster.cpp.

Referenced by QPixmapConvolutionFilter::draw().

3638 {
3639  Q_D(const QRasterPaintEngine);
3640 
3641  const QClipData *clip = d->clip();
3642 
3643  if (!clip)
3644  return d->deviceRect;
3645 
3646  if (clip->hasRectClip)
3647  return clip->clipRect;
3648 
3649  return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);
3650 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void clip(const QVectorPath &path, Qt::ClipOperation op)
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 ...

◆ clipEnabledChanged()

void QRasterPaintEngine::clipEnabledChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 972 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::clipEnabledChanged(), QDirectFBPaintEngine::clipEnabledChanged(), and QBlitterPaintEngine::type().

973 {
975 
976 #ifdef QT_DEBUG_DRAW
977  qDebug() << "QRasterPaintEngine::clipEnabledChanged()" << s->clipEnabled;
978 #endif
979 
980  if (s->clip) {
981  s->clip->enabled = s->clipEnabled;
985  }
986 }
QRasterPaintEngineState * state()
Q_CORE_EXPORT void qDebug(const char *,...)
uint clipEnabled
Definition: qpainter_p.h:169

◆ clipType()

QRasterPaintEngine::ClipType QRasterPaintEngine::clipType ( ) const

Returns the type of the clip currently set.

Warning
This function is not part of the public interface.

Definition at line 3619 of file qpaintengine_raster.cpp.

Referenced by QPixmapConvolutionFilter::draw().

3620 {
3621  Q_D(const QRasterPaintEngine);
3622 
3623  const QClipData *clip = d->clip();
3624  if (!clip || clip->hasRectClip)
3625  return RectClip;
3626  else
3627  return ComplexClip;
3628 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
void clip(const QVectorPath &path, Qt::ClipOperation op)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ compositionModeChanged()

void QRasterPaintEngine::compositionModeChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 902 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::compositionModeChanged(), QDirectFBPaintEngine::compositionModeChanged(), and QBlitterPaintEngine::type().

903 {
906 
907 #ifdef QT_DEBUG_DRAW
908  qDebug() << "QRasterPaintEngine::compositionModeChanged()" << s->composition_mode;
909 #endif
910 
913 
915  d->rasterBuffer->compositionMode = s->composition_mode;
916 
917  d->recalculateFastImages();
918 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ coordinateOffset()

QPoint QRasterPaintEngine::coordinateOffset ( ) const
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngine.

Definition at line 3460 of file qpaintengine_raster.cpp.

3461 {
3462  return QPoint(0, 0);
3463 }
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53

◆ createState()

QPainterState * QRasterPaintEngine::createState ( QPainterState orig) const
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Definition at line 688 of file qpaintengine_raster.cpp.

689 {
691  if (!orig)
692  s = new QRasterPaintEngineState();
693  else
694  s = new QRasterPaintEngineState(*static_cast<QRasterPaintEngineState *>(orig));
695 
696  return s;
697 }

◆ drawBitmap()

void QRasterPaintEngine::drawBitmap ( const QPointF pos,
const QImage image,
QSpanData fill 
)
private

Definition at line 3518 of file qpaintengine_raster.cpp.

3519 {
3520  Q_ASSERT(fg);
3521  if (!fg->blend)
3522  return;
3524 
3525  Q_ASSERT(image.depth() == 1);
3526 
3527  const int spanCount = 256;
3528  QT_FT_Span spans[spanCount];
3529  int n = 0;
3530 
3531  // Boundaries
3532  int w = image.width();
3533  int h = image.height();
3534  int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height());
3535  int ymin = qMax(qRound(pos.y()), 0);
3536  int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width());
3537  int xmin = qMax(qRound(pos.x()), 0);
3538 
3539  int x_offset = xmin - qRound(pos.x());
3540 
3541  QImage::Format format = image.format();
3542  for (int y = ymin; y < ymax; ++y) {
3543  const uchar *src = image.scanLine(y - qRound(pos.y()));
3544  if (format == QImage::Format_MonoLSB) {
3545  for (int x = 0; x < xmax - xmin; ++x) {
3546  int src_x = x + x_offset;
3547  uchar pixel = src[src_x >> 3];
3548  if (!pixel) {
3549  x += 7 - (src_x%8);
3550  continue;
3551  }
3552  if (pixel & (0x1 << (src_x & 7))) {
3553  spans[n].x = xmin + x;
3554  spans[n].y = y;
3555  spans[n].coverage = 255;
3556  int len = 1;
3557  while (src_x+1 < w && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
3558  ++src_x;
3559  ++len;
3560  }
3561  spans[n].len = ((len + spans[n].x) > xmax) ? (xmax - spans[n].x) : len;
3562  x += len;
3563  ++n;
3564  if (n == spanCount) {
3565  fg->blend(n, spans, fg);
3566  n = 0;
3567  }
3568  }
3569  }
3570  } else {
3571  for (int x = 0; x < xmax - xmin; ++x) {
3572  int src_x = x + x_offset;
3573  uchar pixel = src[src_x >> 3];
3574  if (!pixel) {
3575  x += 7 - (src_x%8);
3576  continue;
3577  }
3578  if (pixel & (0x80 >> (x & 7))) {
3579  spans[n].x = xmin + x;
3580  spans[n].y = y;
3581  spans[n].coverage = 255;
3582  int len = 1;
3583  while (src_x+1 < w && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
3584  ++src_x;
3585  ++len;
3586  }
3587  spans[n].len = ((len + spans[n].x) > xmax) ? (xmax - spans[n].x) : len;
3588  x += len;
3589  ++n;
3590  if (n == spanCount) {
3591  fg->blend(n, spans, fg);
3592  n = 0;
3593  }
3594  }
3595  }
3596  }
3597  }
3598  if (n) {
3599  fg->blend(n, spans, fg);
3600  n = 0;
3601  }
3602 }
double d
Definition: qnumeric_p.h:62
Format
The following image formats are available in Qt.
Definition: qimage.h:91
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
unsigned char coverage
unsigned short len
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
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
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
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
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ drawBufferSpan()

void QRasterPaintEngine::drawBufferSpan ( const uint buffer,
int  size,
int  x,
int  y,
int  length,
uint  alpha 
)
virtual

Draws the given buffer.

The default implementation does nothing; reimplement this function to draw a buffer that contains more than one color. Note that this function must be reimplemented if the framebuffer is not memory-mapped.

The size parameter specifies the total size of the given buffer, while the length parameter specifies the number of pixels to draw. The buffer's position is given by (x, y). The provided alpha value is added to each pixel in the buffer when drawing.

See also
drawColorSpans()

Reimplemented in QDirectFBPaintEngine.

Definition at line 3504 of file qpaintengine_raster.cpp.

Referenced by drawBufferSpan().

3506 {
3507  Q_UNUSED(buffer);
3508  Q_UNUSED(bufsize);
3509  Q_UNUSED(x);
3510  Q_UNUSED(y);
3511  Q_UNUSED(length);
3512  Q_UNUSED(const_alpha);
3513  qFatal("QRasterPaintEngine::drawBufferSpan must be reimplemented on "
3514  "a non memory-mapped device");
3515 }
Q_CORE_EXPORT void qFatal(const char *,...)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ drawCachedGlyphs()

bool QRasterPaintEngine::drawCachedGlyphs ( int  numGlyphs,
const glyph_t glyphs,
const QFixedPoint positions,
QFontEngine fontEngine 
)
private

Definition at line 2780 of file qpaintengine_raster.cpp.

2782 {
2786 
2787 #if !defined(QT_NO_FREETYPE)
2788  if (fontEngine->type() == QFontEngine::Freetype) {
2789  QFontEngineFT *fe = static_cast<QFontEngineFT *>(fontEngine);
2790  const QFixed xOffs = fe->supportsSubPixelPositions() ? 0 : offs;
2791  QFontEngineFT::GlyphFormat neededFormat =
2793  ? fe->defaultGlyphFormat()
2795 
2796  if (d_func()->mono_surface
2797  || fe->isBitmapFont() // alphaPenBlt can handle mono, too
2798  )
2799  neededFormat = QFontEngineFT::Format_Mono;
2800 
2801  if (neededFormat == QFontEngineFT::Format_None)
2802  neededFormat = QFontEngineFT::Format_A8;
2803 
2805  if (s->matrix.type() >= QTransform::TxScale) {
2806  if (s->matrix.isAffine())
2807  gset = fe->loadTransformedGlyphSet(s->matrix);
2808  else
2809  gset = 0;
2810  }
2811 
2812  if (!gset || gset->outline_drawing
2813  || !fe->loadGlyphs(gset, glyphs, numGlyphs, positions, neededFormat))
2814  return false;
2815 
2816  FT_Face lockedFace = 0;
2817 
2818  int depth;
2819  switch (neededFormat) {
2821  depth = 1;
2822  break;
2824  depth = 8;
2825  break;
2827  depth = 32;
2828  break;
2829  default:
2830  Q_ASSERT(false);
2831  depth = 0;
2832  };
2833 
2834  for (int i = 0; i < numGlyphs; i++) {
2835  QFixed spp = fe->subPixelPositionForX(positions[i].x);
2836  QFontEngineFT::Glyph *glyph = gset->getGlyph(glyphs[i], spp);
2837 
2838  if (!glyph || glyph->format != neededFormat) {
2839  if (!lockedFace)
2840  lockedFace = fe->lockFace();
2841  glyph = fe->loadGlyph(gset, glyphs[i], spp, neededFormat);
2842  }
2843 
2844  if (!glyph || !glyph->data)
2845  continue;
2846 
2847  int pitch;
2848  switch (neededFormat) {
2850  pitch = ((glyph->width + 31) & ~31) >> 3;
2851  break;
2853  pitch = (glyph->width + 3) & ~3;
2854  break;
2856  pitch = glyph->width * 4;
2857  break;
2858  default:
2859  Q_ASSERT(false);
2860  pitch = 0;
2861  };
2862 
2863  alphaPenBlt(glyph->data, pitch, depth,
2864  qFloor(positions[i].x + xOffs) + glyph->x,
2865  qFloor(positions[i].y + offs) - glyph->y,
2866  glyph->width, glyph->height);
2867  }
2868  if (lockedFace)
2869  fe->unlockFace();
2870  } else
2871 #endif
2872  {
2873  QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
2875  : d->glyphCacheType;
2876 
2877  QImageTextureGlyphCache *cache =
2878  static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphType, s->matrix));
2879  if (!cache) {
2880  cache = new QImageTextureGlyphCache(glyphType, s->matrix);
2881  fontEngine->setGlyphCache(0, cache);
2882  }
2883 
2884  cache->populate(fontEngine, numGlyphs, glyphs, positions);
2885  cache->fillInPendingGlyphs();
2886 
2887  const QImage &image = cache->image();
2888  int bpl = image.bytesPerLine();
2889 
2890  int depth = image.depth();
2891  int rightShift = 0;
2892  int leftShift = 0;
2893  if (depth == 32)
2894  leftShift = 2; // multiply by 4
2895  else if (depth == 1)
2896  rightShift = 3; // divide by 8
2897 
2898  int margin = cache->glyphMargin();
2899  const uchar *bits = image.bits();
2900  for (int i=0; i<numGlyphs; ++i) {
2901 
2902  QFixed subPixelPosition = cache->subPixelPositionForX(positions[i].x);
2903  QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition);
2904  const QTextureGlyphCache::Coord &c = cache->coords[glyph];
2905  if (c.isNull())
2906  continue;
2907 
2908  int x = qFloor(positions[i].x) + c.baseLineX - margin;
2909  int y = qFloor(positions[i].y + offs) - c.baseLineY - margin;
2910 
2911  // printf("drawing [%d %d %d %d] baseline [%d %d], glyph: %d, to: %d %d, pos: %d %d\n",
2912  // c.x, c.y,
2913  // c.w, c.h,
2914  // c.baseLineX, c.baseLineY,
2915  // glyphs[i],
2916  // x, y,
2917  // positions[i].x.toInt(), positions[i].y.toInt());
2918 
2919  alphaPenBlt(bits + ((c.x << leftShift) >> rightShift) + c.y * bpl, bpl, depth, x, y, c.w, c.h);
2920  }
2921  }
2922  return true;
2923 }
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or 0 if the painter is not acti...
Definition: qpainter.cpp:1530
static const qreal aliasedCoordinateDelta
double d
Definition: qnumeric_p.h:62
virtual bool supportsSubPixelPositions() const
unsigned char c[8]
Definition: qnumeric_p.h:62
QHash< GlyphAndSubPixelPosition, Coord > coords
QRasterPaintEngineState * state()
QFixed subPixelPositionForX(QFixed x) const
GlyphFormat defaultGlyphFormat() const
const QImage & image() const
int qFloor(qreal v)
Definition: qmath.h:73
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
QTransform matrix
Definition: qpainter_p.h:161
static QFixed fromReal(qreal r)
Definition: qfixed_p.h:70
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
virtual Type type() const =0
virtual int devType() const
Definition: qpaintdevice.h:167
Glyph * getGlyph(glyph_t index, QFixed subPixelPosition=0) const
unsigned char uchar
Definition: qglobal.h:994
QPainter * painter() const
Returns the paint engine&#39;s painter.
struct FT_FaceRec_ * FT_Face
Definition: qfont.h:50
void unlockFace() const
QGlyphSet * defaultGlyphs()
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
bool isBitmapFont() const
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
bool loadGlyphs(QGlyphSet *gs, const glyph_t *glyphs, int num_glyphs, const QFixedPoint *positions, GlyphFormat format=Format_Render)
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
bool isAffine() const
Returns true if the matrix represent an affine transformation, otherwise returns false.
Definition: qtransform.h:200
virtual int glyphMargin() const
void setGlyphCache(void *key, QFontEngineGlyphCache *data)
QFixed subPixelPositionForX(QFixed x)
bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions)
void alphaPenBlt(const void *src, int bpl, int depth, int rx, int ry, int w, int h)
FT_Face lockFace(Scaling scale=Scaled) const
QGlyphSet * loadTransformedGlyphSet(const QTransform &matrix)
QFontEngineGlyphCache * glyphCache(void *key, QFontEngineGlyphCache::Type type, const QTransform &transform) const
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Glyph * loadGlyph(uint glyph, QFixed subPixelPosition, GlyphFormat format=Format_None, bool fetchMetricsOnly=false) const

◆ drawColorSpans()

void QRasterPaintEngine::drawColorSpans ( const QSpan spans,
int  count,
uint  color 
)
virtual

Draws the given color spans with the specified color.

The count parameter specifies the number of spans.

The default implementation does nothing; reimplement this function to draw the given color spans with the specified color. Note that this function must be reimplemented if the framebuffer is not memory-mapped.

See also
drawBufferSpan()

Definition at line 3477 of file qpaintengine_raster.cpp.

3478 {
3479  Q_UNUSED(spans);
3480  Q_UNUSED(count);
3481  Q_UNUSED(color);
3482  qFatal("QRasterPaintEngine::drawColorSpans must be reimplemented on "
3483  "a non memory-mapped device");
3484 }
Q_CORE_EXPORT void qFatal(const char *,...)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ drawEllipse()

void QRasterPaintEngine::drawEllipse ( const QRectF rect)
virtual

Reimplemented Function

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

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.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3350 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::drawEllipse(), QDirectFBPaintEngine::drawEllipse(), and QBlitterPaintEngine::type().

3351 {
3354 
3355  ensurePen();
3356  if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)
3357  || (qpen_style(s->lastPen) == Qt::NoPen))
3358  && !s->flags.antialiased
3359  && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
3360  && !rect.isEmpty()
3361  && s->matrix.type() <= QTransform::TxScale) // no shear
3362  {
3363  ensureBrush();
3364  const QRectF r = s->matrix.mapRect(rect);
3365  ProcessSpans penBlend = d->getPenFunc(r, &s->penData);
3366  ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData);
3367  const QRect brect = QRect(int(r.x()), int(r.y()),
3368  int_dim(r.x(), r.width()),
3369  int_dim(r.y(), r.height()));
3370  if (brect == r) {
3371  drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend,
3372  &s->penData, &s->brushData);
3373  return;
3374  }
3375  }
3377 }
double d
Definition: qnumeric_p.h:62
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
QRasterPaintEngineState * state()
QT_FT_SpanFunc ProcessSpans
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_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
const int QT_RASTER_COORD_LIMIT
static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, ProcessSpans pen_func, ProcessSpans brush_func, QSpanData *pen_data, QSpanData *brush_data)
Draws an ellipse using the integer point midpoint algorithm.
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
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
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 ...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
virtual void drawEllipse(const QRectF &r)
Reimplement this function to draw the largest ellipse that can be contained within rectangle rect...
#define int_dim(pos, dim)

◆ drawImage() [1/2]

void QRasterPaintEngine::drawImage ( const QPointF p,
const QImage img 
)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 2164 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawImage(), QBlitterPaintEngine::drawImage(), QVolatileImagePaintEngine::drawPixmap(), QDirectFBPaintEngine::drawPixmap(), drawPixmap(), and QBlitterPaintEngine::type().

2165 {
2166 #ifdef QT_DEBUG_DRAW
2167  qDebug() << " - QRasterPaintEngine::drawImage(), p=" << p << " image=" << img.size() << "depth=" << img.depth();
2168 #endif
2169 
2172 
2173  if (s->matrix.type() > QTransform::TxTranslate) {
2174  drawImage(QRectF(p.x(), p.y(), img.width(), img.height()),
2175  img,
2176  QRectF(0, 0, img.width(), img.height()));
2177  } else {
2178 
2179  const QClipData *clip = d->clip();
2180  QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy());
2181 
2182  if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
2183  SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
2184  if (func) {
2185  if (!clip) {
2186  d->drawImage(pt, img, func, d->deviceRect, s->intOpacity);
2187  return;
2188  } else if (clip->hasRectClip) {
2189  d->drawImage(pt, img, func, clip->clipRect, s->intOpacity);
2190  return;
2191  }
2192  }
2193  }
2194 
2195 
2196 
2197  d->image_filler.clip = clip;
2198  d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect());
2199  if (!d->image_filler.blend)
2200  return;
2201  d->image_filler.dx = -pt.x();
2202  d->image_filler.dy = -pt.y();
2203  QRect rr = img.rect().translated(qRound(pt.x()), qRound(pt.y()));
2204 
2205  fillRect_normalized(rr, &d->image_filler, d);
2206  }
2207 
2208 }
double d
Definition: qnumeric_p.h:62
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QRasterPaintEngineState * state()
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]
QTransform matrix
Definition: qpainter_p.h:161
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
Definition: qimage.cpp:1603
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
Q_CORE_EXPORT void qDebug(const char *,...)
void drawImage(const QPointF &p, const QImage &img)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void clip(const QVectorPath &path, Qt::ClipOperation op)
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
void(* SrcOverBlendFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, int w, int h, int const_alpha)
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
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 ...
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ drawImage() [2/2]

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

Reimplemented Function

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 2253 of file qpaintengine_raster.cpp.

2255 {
2256 #ifdef QT_DEBUG_DRAW
2257  qDebug() << " - QRasterPaintEngine::drawImage(), r=" << r << " sr=" << sr << " image=" << img.size() << "depth=" << img.depth();
2258 #endif
2259 
2260  if (r.isEmpty())
2261  return;
2262 
2265  int sr_l = qFloor(sr.left());
2266  int sr_r = qCeil(sr.right()) - 1;
2267  int sr_t = qFloor(sr.top());
2268  int sr_b = qCeil(sr.bottom()) - 1;
2269 
2270  if (s->matrix.type() <= QTransform::TxScale && !s->flags.antialiased && sr_l == sr_r && sr_t == sr_b) {
2271  // as fillRect will apply the aliased coordinate delta we need to
2272  // subtract it here as we don't use it for image drawing
2273  QTransform old = s->matrix;
2275 
2276  // Do whatever fillRect() does, but without premultiplying the color if it's already premultiplied.
2277  QRgb color = img.pixel(sr_l, sr_t);
2278  switch (img.format()) {
2284  // Combine premultiplied color with the opacity set on the painter.
2285  d->solid_color_filler.solid.color =
2286  ((((color & 0x00ff00ff) * s->intOpacity) >> 8) & 0x00ff00ff)
2287  | ((((color & 0xff00ff00) >> 8) * s->intOpacity) & 0xff00ff00);
2288  break;
2289  default:
2290  d->solid_color_filler.solid.color = PREMUL(ARGB_COMBINE_ALPHA(color, s->intOpacity));
2291  break;
2292  }
2293 
2294  if ((d->solid_color_filler.solid.color & 0xff000000) == 0
2296  return;
2297  }
2298 
2299  d->solid_color_filler.clip = d->clip();
2300  d->solid_color_filler.adjustSpanMethods();
2301  fillRect(r, &d->solid_color_filler);
2302 
2303  s->matrix = old;
2304  return;
2305  }
2306 
2307  bool stretch_sr = r.width() != sr.width() || r.height() != sr.height();
2308 
2309  const QClipData *clip = d->clip();
2310 
2312  && !stretch_sr
2313  && (!clip || clip->hasRectClip)
2314  && s->intOpacity == 256
2315  && (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
2316  || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)
2317  && d->rasterBuffer->format == img.format()
2318  && (d->rasterBuffer->format == QImage::Format_RGB16
2319  || d->rasterBuffer->format == QImage::Format_RGB32
2320  || (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
2321  && d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)))
2322  {
2323  RotationType rotationType = qRotationType(s->matrix);
2324 
2325  if (rotationType != NoRotation && qMemRotateFunctions[d->rasterBuffer->format][rotationType] && img.rect().contains(sr.toAlignedRect())) {
2326  QRectF transformedTargetRect = s->matrix.mapRect(r);
2327 
2329  || (isPixelAligned(transformedTargetRect) && isPixelAligned(sr)))
2330  {
2331  QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect);
2332  if (clippedTransformedTargetRect.isNull())
2333  return;
2334 
2335  QRectF clippedTargetRect = s->matrix.inverted().mapRect(QRectF(clippedTransformedTargetRect));
2336 
2337  QRect clippedSourceRect
2338  = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(),
2339  clippedTargetRect.width(), clippedTargetRect.height()).toRect();
2340 
2341  uint dbpl = d->rasterBuffer->bytesPerLine();
2342  uint sbpl = img.bytesPerLine();
2343 
2344  uchar *dst = d->rasterBuffer->buffer();
2345  uint bpp = img.depth() >> 3;
2346 
2347  const uchar *srcBase = img.bits() + clippedSourceRect.y() * sbpl + clippedSourceRect.x() * bpp;
2348  uchar *dstBase = dst + clippedTransformedTargetRect.y() * dbpl + clippedTransformedTargetRect.x() * bpp;
2349 
2350  uint cw = clippedSourceRect.width();
2351  uint ch = clippedSourceRect.height();
2352 
2353  qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl);
2354 
2355  return;
2356  }
2357  }
2358  }
2359 
2360  if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) {
2361 
2362  QRectF targetBounds = s->matrix.mapRect(r);
2363  bool exceedsPrecision = targetBounds.width() > 0xffff
2364  || targetBounds.height() > 0xffff;
2365 
2366  if (!exceedsPrecision && d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
2367  if (s->matrix.type() > QTransform::TxScale) {
2368  SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()];
2369  if (func && (!clip || clip->hasRectClip)) {
2370  func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(),
2371  img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect,
2372  s->matrix, s->intOpacity);
2373  return;
2374  }
2375  } else {
2376  SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()];
2377  if (func && (!clip || clip->hasRectClip)) {
2378  func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(),
2379  img.bits(), img.bytesPerLine(), img.height(),
2381  !clip ? d->deviceRect : clip->clipRect,
2382  s->intOpacity);
2383  return;
2384  }
2385  }
2386  }
2387 
2388  QTransform copy = s->matrix;
2389  copy.translate(r.x(), r.y());
2390  if (stretch_sr)
2391  copy.scale(r.width() / sr.width(), r.height() / sr.height());
2392  copy.translate(-sr.x(), -sr.y());
2393 
2394  d->image_filler_xform.clip = clip;
2395  d->image_filler_xform.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr));
2396  if (!d->image_filler_xform.blend)
2397  return;
2398  d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
2399 
2400  if (!s->flags.antialiased && s->matrix.type() == QTransform::TxScale) {
2401  QPointF rr_tl = s->matrix.map(r.topLeft());
2402  QPointF rr_br = s->matrix.map(r.bottomRight());
2403 
2404  int x1 = qRound(rr_tl.x());
2405  int y1 = qRound(rr_tl.y());
2406  int x2 = qRound(rr_br.x());
2407  int y2 = qRound(rr_br.y());
2408 
2409  if (x1 > x2)
2410  qSwap(x1, x2);
2411  if (y1 > y2)
2412  qSwap(y1, y2);
2413 
2414  fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d);
2415  return;
2416  }
2417 
2418 #ifdef QT_FAST_SPANS
2419  ensureState();
2420  if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
2421  d->initializeRasterizer(&d->image_filler_xform);
2422  d->rasterizer->setAntialiased(s->flags.antialiased);
2423 
2425 
2426  const QRectF &rect = r.normalized();
2427  const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs;
2428  const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs;
2429 
2430  if (s->flags.tx_noshear)
2431  d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width());
2432  else
2433  d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width())));
2434  return;
2435  }
2436 #endif
2437  const qreal offs = s->flags.antialiased ? qreal(0) : aliasedCoordinateDelta;
2438  QPainterPath path;
2439  path.addRect(r);
2440  QTransform m = s->matrix;
2441  s->matrix = QTransform(m.m11(), m.m12(), m.m13(),
2442  m.m21(), m.m22(), m.m23(),
2443  m.m31() - offs, m.m32() - offs, m.m33());
2444  fillPath(path, &d->image_filler_xform);
2445  s->matrix = m;
2446  } else {
2447  if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
2448  SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
2449  if (func) {
2450  QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy());
2451  if (!clip) {
2452  d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect());
2453  return;
2454  } else if (clip->hasRectClip) {
2455  d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect());
2456  return;
2457  }
2458  }
2459  }
2460 
2461  d->image_filler.clip = clip;
2462  d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr));
2463  if (!d->image_filler.blend)
2464  return;
2465  d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x();
2466  d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y();
2467 
2468  QRectF rr = r;
2469  rr.translate(s->matrix.dx(), s->matrix.dy());
2470 
2471  const int x1 = qRound(rr.x());
2472  const int y1 = qRound(rr.y());
2473  const int x2 = qRound(rr.right());
2474  const int y2 = qRound(rr.bottom());
2475 
2476  fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d);
2477  }
2478 }
static const qreal aliasedCoordinateDelta
double d
Definition: qnumeric_p.h:62
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
QPointF bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:540
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
qreal right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:527
unsigned int QRgb
Definition: qrgb.h:53
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
void(* SrcOverScaleFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clipRect, int const_alpha)
double qreal
Definition: qglobal.h:1193
QRasterPaintEngineState * state()
qreal m32() const
Returns the vertical translation factor.
Definition: qtransform.h:265
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
int qCeil(qreal v)
Definition: qmath.h:63
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
int qFloor(qreal v)
Definition: qmath.h:73
qreal m21() const
Returns the horizontal shearing factor.
Definition: qtransform.h:249
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
qreal left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:525
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
long ASN1_INTEGER_get ASN1_INTEGER * a
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
void fillPath(const QPainterPath &path, QSpanData *fillData)
QPointF bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:542
SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]
QTransform matrix
Definition: qpainter_p.h:161
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3]
Definition: qmemrotate.cpp:627
QRectF qt_mapRect_non_normalizing(const QRectF &r, const QTransform &t)
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
Q_CORE_EXPORT void qDebug(const char *,...)
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
unsigned char uchar
Definition: qglobal.h:994
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
#define ARGB_COMBINE_ALPHA(argb, alpha)
SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
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...
unsigned int uint
Definition: qglobal.h:996
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
void clip(const QVectorPath &path, Qt::ClipOperation op)
void(* SrcOverBlendFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, int w, int h, int const_alpha)
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
Definition: qrect.h:716
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
qreal m31() const
Returns the horizontal translation factor.
Definition: qtransform.h:261
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
void fillRect(const QRectF &rect, const QBrush &brush)
Reimplemented Function
qreal m23() const
Returns the vertical projection factor.
Definition: qtransform.h:257
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
qreal top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:526
static QTransform fromTranslate(qreal dx, qreal dy)
Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis...
Definition: qtransform.cpp:462
QTransform & scale(qreal sx, qreal sy)
Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the mat...
Definition: qtransform.cpp:485
void(* SrcOverTransformFunc)(uchar *destPixels, int dbpl, const uchar *src, int spbl, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clipRect, const QTransform &targetRectTransform, int const_alpha)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
qreal m13() const
Returns the horizontal projection factor.
Definition: qtransform.h:245
qreal bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:528
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
QPointF topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:541
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822
SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
qreal m33() const
Returns the division factor.
Definition: qtransform.h:269
static const QRect toAlignedRect_positive(const QRectF &rect)
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ drawLines() [1/2]

void QRasterPaintEngine::drawLines ( const QLine line,
int  lineCount 
)
virtual

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3252 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawLines().

3253 {
3254 #ifdef QT_DEBUG_DRAW
3255  qDebug() << " - QRasterPaintEngine::drawLines(QLine*)" << lineCount;
3256 #endif
3259 
3260  ensurePen();
3261  if (!s->penData.blend)
3262  return;
3263 
3264  if (s->flags.fast_pen) {
3265  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
3266  for (int i=0; i<lineCount; ++i) {
3267  const QLine &l = lines[i];
3268  stroker.drawLine(l.p1(), l.p2());
3269  }
3270  } else {
3271  QPaintEngineEx::drawLines(lines, lineCount);
3272  }
3273 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
The QLine class provides a two-dimensional vector using integer precision.
Definition: qline.h:57
QPoint p1() const
Returns the line&#39;s start point.
Definition: qline.h:132
QPoint p2() const
Returns the line&#39;s end point.
Definition: qline.h:137
#define Q_D(Class)
Definition: qglobal.h:2482
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
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...
QFactoryLoader * l
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawLines() [2/2]

void QRasterPaintEngine::drawLines ( const QLineF line,
int  lineCount 
)
virtual

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3324 of file qpaintengine_raster.cpp.

3325 {
3326 #ifdef QT_DEBUG_DRAW
3327  qDebug() << " - QRasterPaintEngine::drawLines(QLineF *)" << lineCount;
3328 #endif
3331 
3332  ensurePen();
3333  if (!s->penData.blend)
3334  return;
3335  if (s->flags.fast_pen) {
3336  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
3337  for (int i=0; i<lineCount; ++i) {
3338  QLineF line = lines[i];
3339  stroker.drawLine(line.p1(), line.p2());
3340  }
3341  } else {
3342  QPaintEngineEx::drawLines(lines, lineCount);
3343  }
3344 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QPointF p1() const
Returns the line&#39;s start point.
Definition: qline.h:314
#define Q_D(Class)
Definition: qglobal.h:2482
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
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...
QPointF p2() const
Returns the line&#39;s end point.
Definition: qline.h:319
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawPixmap() [1/2]

void QRasterPaintEngine::drawPixmap ( const QPointF pos,
const QPixmap pixmap 
)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 2045 of file qpaintengine_raster.cpp.

Referenced by QVolatileImagePaintEngine::drawPixmap(), QBlitterPaintEngine::drawPixmap(), QDirectFBPaintEngine::drawPixmap(), and QBlitterPaintEngine::type().

2046 {
2047 #ifdef QT_DEBUG_DRAW
2048  qDebug() << " - QRasterPaintEngine::drawPixmap(), pos=" << pos << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth();
2049 #endif
2050 
2051  QPixmapData *pd = pixmap.pixmapData();
2052  if (pd->classId() == QPixmapData::RasterClass) {
2053  const QImage &image = static_cast<QRasterPixmapData *>(pd)->image;
2054  if (image.depth() == 1) {
2057  if (s->matrix.type() <= QTransform::TxTranslate) {
2058  ensurePen();
2059  drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData);
2060  } else {
2061  drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color()));
2062  }
2063  } else {
2064  QRasterPaintEngine::drawImage(pos, image);
2065  }
2066  } else {
2067  const QImage image = pixmap.toImage();
2068  if (pixmap.depth() == 1) {
2071  if (s->matrix.type() <= QTransform::TxTranslate) {
2072  ensurePen();
2073  drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData);
2074  } else {
2075  drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color()));
2076  }
2077  } else {
2078  QRasterPaintEngine::drawImage(pos, image);
2079  }
2080  }
2081 }
double d
Definition: qnumeric_p.h:62
QImage toImage() const
Converts the pixmap to a QImage.
Definition: qpixmap.cpp:542
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QSize size() const
Returns the size of the pixmap.
Definition: qpixmap.cpp:661
QRasterPaintEngineState * state()
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
void drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fill)
QTransform matrix
Definition: qpainter_p.h:161
int depth() const
Returns the depth of the pixmap.
Definition: qpixmap.cpp:695
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 *,...)
void drawImage(const QPointF &p, const QImage &img)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
ClassId classId() const
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
QPixmapData * pixmapData() const
Definition: qpixmap.cpp:2277

◆ drawPixmap() [2/2]

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

Reimplemented Function

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 2086 of file qpaintengine_raster.cpp.

2087 {
2088 #ifdef QT_DEBUG_DRAW
2089  qDebug() << " - QRasterPaintEngine::drawPixmap(), r=" << r << " sr=" << sr << " pixmap=" << pixmap.size() << "depth=" << pixmap.depth();
2090 #endif
2091 
2092  QPixmapData* pd = pixmap.pixmapData();
2093  if (pd->classId() == QPixmapData::RasterClass) {
2094  const QImage &image = static_cast<QRasterPixmapData *>(pd)->image;
2095  if (image.depth() == 1) {
2098  if (s->matrix.type() <= QTransform::TxTranslate
2099  && r.size() == sr.size()
2100  && r.size() == pixmap.size()) {
2101  ensurePen();
2102  drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData);
2103  return;
2104  } else {
2105  drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr);
2106  }
2107  } else {
2108  drawImage(r, image, sr);
2109  }
2110  } else {
2111  QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect());
2112  const QImage image = pd->toImage(clippedSource);
2113  QRectF translatedSource = sr.translated(-clippedSource.topLeft());
2114  if (image.depth() == 1) {
2117  if (s->matrix.type() <= QTransform::TxTranslate
2118  && r.size() == sr.size()
2119  && r.size() == pixmap.size()) {
2120  ensurePen();
2121  drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData);
2122  return;
2123  } else {
2124  drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource);
2125  }
2126  } else {
2127  drawImage(r, image, translatedSource);
2128  }
2129  }
2130 }
double d
Definition: qnumeric_p.h:62
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
Definition: qrect.cpp:2817
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QRasterPaintEngineState * state()
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
void drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fill)
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
Definition: qrect.h:481
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 *,...)
void drawImage(const QPointF &p, const QImage &img)
virtual QImage toImage() const =0
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
ClassId classId() const
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
QRectF translated(qreal dx, qreal dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:740
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

◆ drawPoints() [1/2]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3212 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawPoints(), QBlitterPaintEngine::drawPoints(), and QBlitterPaintEngine::type().

3213 {
3216 
3217  ensurePen();
3218  if (!s->penData.blend)
3219  return;
3220 
3221  if (!s->flags.fast_pen) {
3222  QPaintEngineEx::drawPoints(points, pointCount);
3223  return;
3224  }
3225 
3226  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
3227  stroker.drawPoints(points, pointCount);
3228 }
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
#define Q_D(Class)
Definition: qglobal.h:2482
ProcessSpans blend
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawPoints() [2/2]

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

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3231 of file qpaintengine_raster.cpp.

3232 {
3235 
3236  ensurePen();
3237  if (!s->penData.blend)
3238  return;
3239 
3240  if (!s->flags.fast_pen) {
3241  QPaintEngineEx::drawPoints(points, pointCount);
3242  return;
3243  }
3244 
3245  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
3246  stroker.drawPoints(points, pointCount);
3247 }
virtual void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the buffer points.
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
#define Q_D(Class)
Definition: qglobal.h:2482
ProcessSpans blend
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawPolygon() [1/2]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1933 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::drawPolygon(), QDirectFBPaintEngine::drawPolygon(), and QBlitterPaintEngine::type().

1934 {
1937 
1938 #ifdef QT_DEBUG_DRAW
1939  qDebug(" - QRasterPaintEngine::drawPolygon(F), pointCount=%d", pointCount);
1940  for (int i=0; i<pointCount; ++i)
1941  qDebug() << " - " << points[i];
1942 #endif
1943  Q_ASSERT(pointCount >= 2);
1944 
1945  if (mode != PolylineMode && isRect((qreal *) points, pointCount)) {
1946  QRectF r(points[0], points[2]);
1947  drawRects(&r, 1);
1948  return;
1949  }
1950 
1951  ensurePen();
1952  if (mode != PolylineMode) {
1953  // Do the fill...
1954  ensureBrush();
1955  if (s->brushData.blend)
1956  fillPolygon(points, pointCount, mode);
1957  }
1958 
1959  // Do the outline...
1960  if (s->penData.blend) {
1961  QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
1962  if (s->flags.fast_pen) {
1963  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
1964  stroker.drawPath(vp);
1965  } else {
1967  }
1968  }
1969 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
QRasterPaintEngineState * state()
static bool isRect(const T *pts, int elementCount)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
void drawRects(const QRect *rects, int rectCount)
Reimplemented Function
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
virtual void stroke(const QVectorPath &path, const QPen &pen)
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawPolygon() [2/2]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1974 of file qpaintengine_raster.cpp.

1975 {
1978 
1979 #ifdef QT_DEBUG_DRAW
1980  qDebug(" - QRasterPaintEngine::drawPolygon(I), pointCount=%d", pointCount);
1981  for (int i=0; i<pointCount; ++i)
1982  qDebug() << " - " << points[i];
1983 #endif
1984  Q_ASSERT(pointCount >= 2);
1985  if (mode != PolylineMode && isRect((int *) points, pointCount)) {
1986  QRect r(points[0].x(),
1987  points[0].y(),
1988  points[2].x() - points[0].x(),
1989  points[2].y() - points[0].y());
1990  drawRects(&r, 1);
1991  return;
1992  }
1993 
1994  ensurePen();
1995 
1996  // Do the fill
1997  if (mode != PolylineMode) {
1998  ensureBrush();
1999  if (s->brushData.blend) {
2000  // Compose polygon fill..,
2002  d->outlineMapper->beginOutline(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill);
2003  d->outlineMapper->moveTo(*points);
2004  const QPoint *p = points;
2005  const QPoint *ep = points + pointCount - 1;
2006  do {
2007  d->outlineMapper->lineTo(*(++p));
2008  } while (p < ep);
2009  d->outlineMapper->endOutline();
2010 
2011  // scanconvert.
2012  ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect,
2013  &s->brushData);
2014  d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data());
2015  }
2016  }
2017 
2018  // Do the outline...
2019  if (s->penData.blend) {
2020  int count = pointCount * 2;
2021  QVarLengthArray<qreal> fpoints(count);
2022  #ifdef Q_WS_MAC
2023  for (int i=0; i<count; i+=2) {
2024  fpoints[i] = ((int *) points)[i+1];
2025  fpoints[i+1] = ((int *) points)[i];
2026  }
2027  #else
2028  for (int i=0; i<count; ++i)
2029  fpoints[i] = ((int *) points)[i];
2030  #endif
2031  QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode));
2032 
2033  if (s->flags.fast_pen) {
2034  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
2035  stroker.drawPath(vp);
2036  } else {
2038  }
2039  }
2040 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
QRasterPaintEngineState * state()
static bool isRect(const T *pts, int elementCount)
QT_FT_SpanFunc ProcessSpans
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
void drawRects(const QRect *rects, int rectCount)
Reimplemented Function
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
virtual void stroke(const QVectorPath &path, const QPen &pen)
static uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
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
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ drawRects() [1/2]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1509 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawRects(), QBlitterPaintEngine::drawRects(), and QBlitterPaintEngine::type().

1510 {
1511 #ifdef QT_DEBUG_DRAW
1512  qDebug(" - QRasterPaintEngine::drawRect(), rectCount=%d", rectCount);
1513 #endif
1515  ensureState();
1517 
1518  // Fill
1519  ensureBrush();
1520  if (s->brushData.blend) {
1521  if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxTranslate) {
1522  const QRect *r = rects;
1523  const QRect *lastRect = rects + rectCount;
1524 
1525  int offset_x = int(s->matrix.dx());
1526  int offset_y = int(s->matrix.dy());
1527  while (r < lastRect) {
1528  QRect rect = r->normalized();
1529  QRect rr = rect.translated(offset_x, offset_y);
1530  fillRect_normalized(rr, &s->brushData, d);
1531  ++r;
1532  }
1533  } else {
1534  QRectVectorPath path;
1535  for (int i=0; i<rectCount; ++i) {
1536  path.set(rects[i]);
1537  fill(path, s->brush);
1538  }
1539  }
1540  }
1541 
1542  ensurePen();
1543  if (s->penData.blend) {
1544  QRectVectorPath path;
1545  if (s->flags.fast_pen) {
1546  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
1547  for (int i = 0; i < rectCount; ++i) {
1548  path.set(rects[i]);
1549  stroker.drawPath(path);
1550  }
1551  } else {
1552  for (int i = 0; i < rectCount; ++i) {
1553  path.set(rects[i]);
1554  stroke(path, s->pen);
1555  }
1556  }
1557  }
1558 }
double d
Definition: qnumeric_p.h:62
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QRasterPaintEngineState * state()
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:322
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
void set(const QRect &r)
#define Q_D(Class)
Definition: qglobal.h:2482
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
void fill(const QVectorPath &path, const QBrush &brush)
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
QBrush brush
Definition: qpainter_p.h:153
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
void stroke(const QVectorPath &path, const QPen &pen)
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)

◆ drawRects() [2/2]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1563 of file qpaintengine_raster.cpp.

1564 {
1565 #ifdef QT_DEBUG_DRAW
1566  qDebug(" - QRasterPaintEngine::drawRect(QRectF*), rectCount=%d", rectCount);
1567 #endif
1568 #ifdef QT_FAST_SPANS
1570  ensureState();
1572 
1573 
1574  if (s->flags.tx_noshear) {
1575  ensureBrush();
1576  if (s->brushData.blend) {
1577  d->initializeRasterizer(&s->brushData);
1578  for (int i = 0; i < rectCount; ++i) {
1579  const QRectF &rect = rects[i].normalized();
1580  if (rect.isEmpty())
1581  continue;
1582  const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
1583  const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f);
1584  d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width());
1585  }
1586  }
1587 
1588  ensurePen();
1589  if (s->penData.blend) {
1590  QRectVectorPath path;
1591  if (s->flags.fast_pen) {
1592  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
1593  for (int i = 0; i < rectCount; ++i) {
1594  path.set(rects[i]);
1595  stroker.drawPath(path);
1596  }
1597  } else {
1598  for (int i = 0; i < rectCount; ++i) {
1599  path.set(rects[i]);
1600  QPaintEngineEx::stroke(path, s->lastPen);
1601  }
1602  }
1603  }
1604 
1605  return;
1606  }
1607 #endif // QT_FAST_SPANS
1608  QPaintEngineEx::drawRects(rects, rectCount);
1609 }
double d
Definition: qnumeric_p.h:62
QPointF bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:540
QRasterPaintEngineState * state()
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
long ASN1_INTEGER_get ASN1_INTEGER * a
QPointF bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:542
QTransform matrix
Definition: qpainter_p.h:161
void set(const QRect &r)
#define Q_D(Class)
Definition: qglobal.h:2482
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
virtual void stroke(const QVectorPath &path, const QPen &pen)
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
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...
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
virtual void drawRects(const QRect *rects, int rectCount)
The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF an...
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
QPointF topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:541
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822

◆ drawStaticTextItem()

void QRasterPaintEngine::drawStaticTextItem ( QStaticTextItem textItem)
virtual

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3071 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::drawStaticTextItem(), QDirectFBPaintEngine::drawStaticTextItem(), and QBlitterPaintEngine::type().

3072 {
3073  ensurePen();
3074  ensureState();
3075 
3076  QFontEngine *fontEngine = textItem->fontEngine();
3077  if (!supportsTransformations(fontEngine)) {
3078  drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
3079  fontEngine);
3080  } else {
3082  }
3083 }
QFontEngine * fontEngine() const
QFixedPoint * glyphPositions
bool supportsTransformations(const QFontEngine *fontEngine) const
virtual void drawStaticTextItem(QStaticTextItem *)
bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
glyph_t * glyphs

◆ drawTextItem()

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

Reimplemented Function

Reimplemented from QPaintEngine.

Reimplemented in QDirectFBPaintEngine.

Definition at line 3088 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::drawTextItem(), QDirectFBPaintEngine::drawTextItem(), and QBlitterPaintEngine::type().

3089 {
3090  const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
3092 
3093 #ifdef QT_DEBUG_DRAW
3095  fprintf(stderr," - QRasterPaintEngine::drawTextItem(), (%.2f,%.2f), string=%s ct=%d\n",
3096  p.x(), p.y(), QString::fromRawData(ti.chars, ti.num_chars).toLatin1().data(),
3097  d->glyphCacheType);
3098 #endif
3099 
3100  ensurePen();
3101  ensureState();
3102 
3103 #if defined (Q_WS_WIN) || defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
3104 
3107  QVarLengthArray<glyph_t> glyphs;
3108 
3109  QTransform matrix = s->matrix;
3110  matrix.translate(p.x(), p.y());
3111 
3112  ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
3113 
3114  drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine);
3115  return;
3116  }
3117 
3118 #elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_WS_WIN || Q_WS_MAC
3119  if (s->matrix.type() <= QTransform::TxTranslate
3120  || (s->matrix.type() == QTransform::TxScale
3121  && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) {
3122  drawGlyphsS60(p, ti);
3123  return;
3124  }
3125 #else // Q_WS_WIN || Q_WS_MAC
3126 
3127  QFontEngine *fontEngine = ti.fontEngine;
3128 
3129 #if defined(Q_WS_QWS)
3130  if (fontEngine->type() == QFontEngine::Box) {
3131  fontEngine->draw(this, qFloor(p.x()), qFloor(p.y()), ti);
3132  return;
3133  }
3134 
3135  if (s->matrix.type() < QTransform::TxScale
3136  && (fontEngine->type() == QFontEngine::QPF1 || fontEngine->type() == QFontEngine::QPF2
3137  || (fontEngine->type() == QFontEngine::Proxy
3138  && !(static_cast<QProxyFontEngine *>(fontEngine)->drawAsOutline()))
3139  )) {
3140  fontEngine->draw(this, qFloor(p.x() + aliasedCoordinateDelta), qFloor(p.y() + aliasedCoordinateDelta), ti);
3141  return;
3142  }
3143 #endif // Q_WS_QWS
3144 
3145 #ifdef Q_WS_QPA
3146  if (s->matrix.type() < QTransform::TxScale) {
3147 
3149  QVarLengthArray<glyph_t> glyphs;
3150  QTransform matrix = state()->transform();
3151 
3152  qreal _x = qFloor(p.x());
3153  qreal _y = qFloor(p.y());
3154  matrix.translate(_x, _y);
3155 
3156  fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
3157  if (glyphs.size() == 0)
3158  return;
3159 
3160  for(int i = 0; i < glyphs.size(); i++) {
3161  QImage img = fontEngine->alphaMapForGlyph(glyphs[i]);
3162  glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[i]);
3163  // ### hm, perhaps an QFixed offs = QFixed::fromReal(aliasedCoordinateDelta) is needed here?
3164  alphaPenBlt(img.bits(), img.bytesPerLine(), img.depth(),
3165  qRound(positions[i].x + metrics.x),
3166  qRound(positions[i].y + metrics.y),
3167  img.width(), img.height());
3168  }
3169  return;
3170  }
3171 #endif //Q_WS_QPA
3172 
3173 #if (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE)
3174 
3175 #if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2)
3176  if (fontEngine->type() == QFontEngine::QPF2) {
3177  QFontEngine *renderingEngine = static_cast<QFontEngineQPF *>(fontEngine)->renderingEngine();
3178  if (renderingEngine)
3179  fontEngine = renderingEngine;
3180  }
3181 #endif
3182 
3183  if (fontEngine->type() != QFontEngine::Freetype) {
3185  return;
3186  }
3187 
3188  QFontEngineFT *fe = static_cast<QFontEngineFT *>(fontEngine);
3189 
3190  QTransform matrix = s->matrix;
3191  matrix.translate(p.x(), p.y());
3192 
3194  QVarLengthArray<glyph_t> glyphs;
3195  fe->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
3196  if (glyphs.size() == 0)
3197  return;
3198 
3199  if (!drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), fontEngine))
3201 
3202  return;
3203 #endif
3204 #endif
3205 
3207 }
static const qreal aliasedCoordinateDelta
double d
Definition: qnumeric_p.h:62
QFontEngine * fontEngine
const T * constData() const
double qreal
Definition: qglobal.h:1193
virtual QImage alphaMapForGlyph(glyph_t)
char * data()
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:429
QRasterPaintEngineState * state()
const QChar * chars
int qFloor(qreal v)
Definition: qmath.h:73
RenderFlags flags
QTransform transform() const
Returns the matrix in the current paint engine state.
Definition: qpainter.cpp:9377
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
static Q_DECL_CONSTEXPR bool qFuzzyCompare(double p1, double p2)
Definition: qglobal.h:2030
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
QTransform matrix
Definition: qpainter_p.h:161
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
virtual Type type() const =0
static QString fromRawData(const QChar *, int size)
Constructs a QString that uses the first size Unicode characters in the array unicode.
Definition: qstring.cpp:7673
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QGlyphLayout glyphs
static const QCssKnownValue positions[NumKnownPositionModes - 1]
Definition: qcssparser.cpp:329
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
Internal QTextItem.
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)=0
bool supportsTransformations(const QFontEngine *fontEngine) 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
void alphaPenBlt(const void *src, int bpl, int depth, int rx, int ry, int w, int h)
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
bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
int size() const
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65
virtual void drawTextItem(const QPointF &p, const QTextItem &textItem)
This function draws the text item textItem at position p.

◆ drawTiledPixmap()

void QRasterPaintEngine::drawTiledPixmap ( const QRectF r,
const QPixmap pm,
const QPointF sr 
)
virtual

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 2483 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawTiledPixmap(), QBlitterPaintEngine::drawTiledPixmap(), and QBlitterPaintEngine::type().

2484 {
2485 #ifdef QT_DEBUG_DRAW
2486  qDebug() << " - QRasterPaintEngine::drawTiledPixmap(), r=" << r << "pixmap=" << pixmap.size();
2487 #endif
2490 
2491  QImage image;
2492 
2493  QPixmapData *pd = pixmap.pixmapData();
2494  if (pd->classId() == QPixmapData::RasterClass) {
2495  image = static_cast<QRasterPixmapData *>(pd)->image;
2496  } else {
2497  image = pixmap.toImage();
2498  }
2499 
2500  if (image.depth() == 1)
2501  image = d->rasterBuffer->colorizeBitmap(image, s->pen.color());
2502 
2503  if (s->matrix.type() > QTransform::TxTranslate) {
2504  QTransform copy = s->matrix;
2505  copy.translate(r.x(), r.y());
2506  copy.translate(-sr.x(), -sr.y());
2507  d->image_filler_xform.clip = d->clip();
2508  d->image_filler_xform.initTexture(&image, s->intOpacity, QTextureData::Tiled);
2509  if (!d->image_filler_xform.blend)
2510  return;
2511  d->image_filler_xform.setupMatrix(copy, s->flags.bilinear);
2512 
2513 #ifdef QT_FAST_SPANS
2514  ensureState();
2515  if (s->flags.tx_noshear || s->matrix.type() == QTransform::TxScale) {
2516  d->initializeRasterizer(&d->image_filler_xform);
2517  d->rasterizer->setAntialiased(s->flags.antialiased);
2518 
2519  const QRectF &rect = r.normalized();
2520  const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f);
2521  const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f);
2522  if (s->flags.tx_noshear)
2523  d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width());
2524  else
2525  d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width())));
2526  return;
2527  }
2528 #endif
2529  QPainterPath path;
2530  path.addRect(r);
2531  fillPath(path, &d->image_filler_xform);
2532  } else {
2533  d->image_filler.clip = d->clip();
2534 
2535  d->image_filler.initTexture(&image, s->intOpacity, QTextureData::Tiled);
2536  if (!d->image_filler.blend)
2537  return;
2538  d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x();
2539  d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y();
2540 
2541  QRectF rr = r;
2542  rr.translate(s->matrix.dx(), s->matrix.dy());
2543  fillRect_normalized(rr.toRect().normalized(), &d->image_filler, d);
2544  }
2545 }
double d
Definition: qnumeric_p.h:62
QPointF bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:540
qreal y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:667
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QRasterPaintEngineState * state()
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:322
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
QColor color() const
Returns the color of this pen&#39;s brush.
Definition: qpen.cpp:771
long ASN1_INTEGER_get ASN1_INTEGER * a
void fillPath(const QPainterPath &path, QSpanData *fillData)
QPointF bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:542
QTransform matrix
Definition: qpainter_p.h:161
QTransform & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
Definition: qtransform.cpp:417
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
Q_CORE_EXPORT void qDebug(const char *,...)
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
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...
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
ClassId classId() const
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
void translate(qreal dx, qreal dy)
Moves the rectangle dx along the x-axis and dy along the y-axis, relative to the current position...
Definition: qrect.h:716
QRect toRect() const
Returns a QRect based on the values of this rectangle.
Definition: qrect.h:845
qreal x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:664
QSizeF size() const
Returns the size of the rectangle.
Definition: qrect.h:713
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
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 ...
QPointF topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:541
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ end()

bool QRasterPaintEngine::end ( )
virtual

Reimplemented Function

Implements QPaintEngine.

Reimplemented in QDirectFBPaintEngine.

Definition at line 522 of file qpaintengine_raster.cpp.

Referenced by QVolatileImagePaintEngine::end(), QBlitterPaintEngine::end(), QDirectFBPaintEngine::end(), QOnScreenRasterPaintEngine::end(), and QBlitterPaintEngine::type().

523 {
524 #ifdef QT_DEBUG_DRAW
526  qDebug() << "QRasterPaintEngine::end devRect:" << d->deviceRect;
527  if (d->baseClip) {
528  dumpClip(d->rasterBuffer->width(), d->rasterBuffer->height(), &*d->baseClip);
529  }
530 #endif
531 
532  return true;
533 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ ensureBrush() [1/2]

void QRasterPaintEngine::ensureBrush ( const QBrush brush)
inlineprivate

Definition at line 272 of file qpaintengine_raster_p.h.

272  {
273  if (!qbrush_fast_equals(state()->lastBrush, brush) || (brush.style() != Qt::NoBrush && state()->fillFlags))
274  updateBrush(brush);
275  }
QRasterPaintEngineState * state()
bool qbrush_fast_equals(const QBrush &a, const QBrush &b)
Definition: qpainter_p.h:95
void updateBrush(const QBrush &brush)
Qt::BrushStyle style() const
Returns the brush style.
Definition: qbrush.h:182

◆ ensureBrush() [2/2]

void QRasterPaintEngine::ensureBrush ( )
inlineprivate

Definition at line 276 of file qpaintengine_raster_p.h.

Referenced by ensureBrush().

276 { ensureBrush(state()->brush); }
QRasterPaintEngineState * state()

◆ ensureOutlineMapper()

void QRasterPaintEngine::ensureOutlineMapper ( )
inlineprivate

Definition at line 552 of file qpaintengine_raster_p.h.

Referenced by begin(), and updateMatrix().

552  {
553  if (d_func()->outlinemapper_xform_dirty)
555 }

◆ ensurePen() [1/2]

void QRasterPaintEngine::ensurePen ( const QPen pen)
inlineprivate

Definition at line 278 of file qpaintengine_raster_p.h.

278  {
279  if (!qpen_fast_equals(state()->lastPen, pen) || (pen.style() != Qt::NoPen && state()->strokeFlags))
280  updatePen(pen);
281  }
QRasterPaintEngineState * state()
Qt::PenStyle style() const
Returns the pen style.
Definition: qpen.cpp:428
bool qpen_fast_equals(const QPen &a, const QPen &b)
Definition: qpainter_p.h:86
void updatePen(const QPen &pen)

◆ ensurePen() [2/2]

void QRasterPaintEngine::ensurePen ( )
inlineprivate

Definition at line 282 of file qpaintengine_raster_p.h.

Referenced by ensurePen().

282 { ensurePen(state()->pen); }
QRasterPaintEngineState * state()

◆ ensureState()

void QRasterPaintEngine::ensureState ( )
inlineprivate

Definition at line 288 of file qpaintengine_raster_p.h.

288  {
289  if (state()->dirty)
290  updateState();
291  }
QRasterPaintEngineState * state()

◆ fill()

void QRasterPaintEngine::fill ( const QVectorPath path,
const QBrush brush 
)
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1699 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::fill(), QDirectFBPaintEngine::fill(), and QBlitterPaintEngine::type().

1700 {
1701  if (path.isEmpty())
1702  return;
1703 #ifdef QT_DEBUG_DRAW
1704  QRectF rf = path.controlPointRect();
1705  qDebug() << "QRasterPaintEngine::fill(): "
1706  << "size=" << path.elementCount()
1707  << ", hints=" << hex << path.hints()
1708  << rf << brush;
1709 #endif
1710 
1713 
1714  ensureBrush(brush);
1715  if (!s->brushData.blend)
1716  return;
1717 
1718  if (path.shape() == QVectorPath::RectangleHint) {
1719  if (!s->flags.antialiased && s->matrix.type() <= QTransform::TxScale) {
1720  const qreal *p = path.points();
1721  QPointF tl = QPointF(p[0], p[1]) * s->matrix;
1722  QPointF br = QPointF(p[4], p[5]) * s->matrix;
1724  return;
1725  }
1726  ensureState();
1727  if (s->flags.tx_noshear) {
1728  d->initializeRasterizer(&s->brushData);
1729  // ### Is normalizing really necessary here?
1730  const qreal *p = path.points();
1731  QRectF r = QRectF(p[0], p[1], p[2] - p[0], p[7] - p[1]).normalized();
1732  if (!r.isEmpty()) {
1733  const QPointF a = s->matrix.map((r.topLeft() + r.bottomLeft()) * 0.5f);
1734  const QPointF b = s->matrix.map((r.topRight() + r.bottomRight()) * 0.5f);
1735  d->rasterizer->rasterizeLine(a, b, r.height() / r.width());
1736  }
1737  return;
1738  }
1739  }
1740 
1741  // ### Optimize for non transformed ellipses and rectangles...
1742  QRectF cpRect = path.controlPointRect();
1743  const QRect deviceRect = s->matrix.mapRect(cpRect).toRect();
1744  ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData);
1745 
1746  // ### Falcon
1747 // const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT
1748 // || deviceRect.right() > QT_RASTER_COORD_LIMIT
1749 // || deviceRect.top() < -QT_RASTER_COORD_LIMIT
1750 // || deviceRect.bottom() > QT_RASTER_COORD_LIMIT);
1751 
1752  // ### Falonc: implement....
1753 // if (!s->flags.antialiased && !do_clip) {
1754 // d->initializeRasterizer(&s->brushData);
1755 // d->rasterizer->rasterize(path * d->matrix, path.fillRule());
1756 // return;
1757 // }
1758 
1760  d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data());
1761 }
double d
Definition: qnumeric_p.h:62
QPointF bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:540
double qreal
Definition: qglobal.h:1193
int elementCount() const
QRasterPaintEngineState * state()
bool isEmpty() const
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QT_FT_SpanFunc ProcessSpans
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
long ASN1_INTEGER_get ASN1_INTEGER * a
QPointF bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:542
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 QTextStream & hex(QTextStream &s)
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
QRectF controlPointRect() const
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static QRect toNormalizedFillRect(const QRectF &rect)
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
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...
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
uint hints() const
const qreal * points() const
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 ...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
QPointF topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:541
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)
Hint shape() const

◆ fillPath()

void QRasterPaintEngine::fillPath ( const QPainterPath path,
QSpanData fillData 
)
Warning
This function is not part of the public interface.

Definition at line 1404 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::fillPath(), and QBlitterPaintEngine::type().

1405 {
1406 #ifdef QT_DEBUG_DRAW
1407  qDebug() << " --- fillPath, bounds=" << path.boundingRect();
1408 #endif
1409 
1410  if (!fillData->blend)
1411  return;
1412 
1414 
1415  const QRectF controlPointRect = path.controlPointRect();
1416 
1418  const QRect deviceRect = s->matrix.mapRect(controlPointRect).toRect();
1419  ProcessSpans blend = d->getBrushFunc(deviceRect, fillData);
1420  const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT
1421  || deviceRect.right() > QT_RASTER_COORD_LIMIT
1422  || deviceRect.top() < -QT_RASTER_COORD_LIMIT
1423  || deviceRect.bottom() > QT_RASTER_COORD_LIMIT);
1424 
1425  if (!s->flags.antialiased && !do_clip) {
1426  d->initializeRasterizer(fillData);
1427  d->rasterizer->rasterize(path * s->matrix, path.fillRule());
1428  return;
1429  }
1430 
1432  d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer.data());
1433 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QT_FT_SpanFunc ProcessSpans
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
QTransform matrix
Definition: qpainter_p.h:161
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
#define Q_D(Class)
Definition: qglobal.h:2482
QRectF boundingRect() const
Returns the bounding rectangle of this painter path as a rectangle with floating point precision...
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
const int QT_RASTER_COORD_LIMIT
Qt::FillRule fillRule() const
Returns the painter path&#39;s currently set fill rule.
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
QRectF controlPointRect() const
Returns the rectangle containing all the points and control points in this path.
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 ...

◆ fillPolygon()

void QRasterPaintEngine::fillPolygon ( const QPointF points,
int  pointCount,
PolygonDrawMode  mode 
)
Warning
This function is not part of the public interface.

Definition at line 1899 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::fillPolygon(), and QBlitterPaintEngine::type().

1900 {
1903 
1904  const int maxPoints = 0xffff;
1905 
1906  // max amount of points that raster engine can reliably handle
1907  if (pointCount > maxPoints) {
1908  QVector<QPointF> upper, lower;
1909 
1910  if (splitPolygon(points, pointCount, &upper, &lower)) {
1911  fillPolygon(upper.constData(), upper.size(), mode);
1912  fillPolygon(lower.constData(), lower.size(), mode);
1913  } else
1914  qWarning("Polygon too complex for filling.");
1915 
1916  return;
1917  }
1918 
1919  // Compose polygon fill..,
1920  QVectorPath vp((qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode));
1922  QT_FT_Outline *outline = d->outlineMapper->convertPath(vp);
1923 
1924  // scanconvert.
1925  ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect,
1926  &s->brushData);
1927  d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data());
1928 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
QRasterPaintEngineState * state()
QT_FT_SpanFunc ProcessSpans
#define Q_D(Class)
Definition: qglobal.h:2482
static bool splitPolygon(const QPointF *points, int pointCount, QVector< QPointF > *upper, QVector< QPointF > *lower)
static uint polygonFlags(QPaintEngine::PolygonDrawMode mode)
Q_CORE_EXPORT void qWarning(const char *,...)
void fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
const T * constData() const
Returns a const pointer to the data stored in the vector.
Definition: qvector.h:154
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ fillRect() [1/3]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1804 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), and QBlitterPaintEngine::type().

1805 {
1806 #ifdef QT_DEBUG_DRAW
1807  qDebug() << "QRasterPaintEngine::fillRecct(): " << r << brush;
1808 #endif
1810 
1811  ensureBrush(brush);
1812  if (!s->brushData.blend)
1813  return;
1814 
1815  fillRect(r, &s->brushData);
1816 }
QRasterPaintEngineState * state()
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
void fillRect(const QRectF &rect, const QBrush &brush)
Reimplemented Function

◆ fillRect() [2/3]

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

Reimplemented Function

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1821 of file qpaintengine_raster.cpp.

1822 {
1823 #ifdef QT_DEBUG_DRAW
1824  qDebug() << "QRasterPaintEngine::fillRect(): " << r << color;
1825 #endif
1828 
1829  d->solid_color_filler.solid.color = PREMUL(ARGB_COMBINE_ALPHA(color.rgba(), s->intOpacity));
1830  if ((d->solid_color_filler.solid.color & 0xff000000) == 0
1832  return;
1833  }
1834  d->solid_color_filler.clip = d->clip();
1835  d->solid_color_filler.adjustSpanMethods();
1836  fillRect(r, &d->solid_color_filler);
1837 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
#define ARGB_COMBINE_ALPHA(argb, alpha)
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
void fillRect(const QRectF &rect, const QBrush &brush)
Reimplemented Function
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ fillRect() [3/3]

void QRasterPaintEngine::fillRect ( const QRectF rect,
QSpanData data 
)
private

Definition at line 1763 of file qpaintengine_raster.cpp.

1764 {
1767 
1768  if (!s->flags.antialiased) {
1769  uint txop = s->matrix.type();
1770  if (txop == QTransform::TxNone) {
1772  return;
1773  } else if (txop == QTransform::TxTranslate) {
1774  const QRect rr = toNormalizedFillRect(r.translated(s->matrix.dx(), s->matrix.dy()));
1775  fillRect_normalized(rr, data, d);
1776  return;
1777  } else if (txop == QTransform::TxScale) {
1778  const QRect rr = toNormalizedFillRect(s->matrix.mapRect(r));
1779  fillRect_normalized(rr, data, d);
1780  return;
1781  }
1782  }
1783  ensureState();
1784  if (s->flags.tx_noshear) {
1785  d->initializeRasterizer(data);
1786  QRectF nr = r.normalized();
1787  if (!nr.isEmpty()) {
1788  const QPointF a = s->matrix.map((nr.topLeft() + nr.bottomLeft()) * 0.5f);
1789  const QPointF b = s->matrix.map((nr.topRight() + nr.bottomRight()) * 0.5f);
1790  d->rasterizer->rasterizeLine(a, b, nr.height() / nr.width());
1791  }
1792  return;
1793  }
1794 
1795  QPainterPath path;
1796  path.addRect(r);
1798  fillPath(path, data);
1799 }
double d
Definition: qnumeric_p.h:62
QPointF bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:540
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
QRasterPaintEngineState * state()
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
Definition: qpainterpath.h:67
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QPointF topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:539
long ASN1_INTEGER_get ASN1_INTEGER * a
void fillPath(const QPainterPath &path, QSpanData *fillData)
QPointF bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:542
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
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static QRect toNormalizedFillRect(const QRectF &rect)
qreal height() const
Returns the height of the rectangle.
Definition: qrect.h:710
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...
unsigned int uint
Definition: qglobal.h:996
void addRect(const QRectF &rect)
Adds the given rectangle to this path as a closed subpath.
qreal width() const
Returns the width of the rectangle.
Definition: qrect.h:707
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:658
QPointF topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:541
QRectF normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
Definition: qrect.cpp:1822
static void fillRect_normalized(const QRect &r, QSpanData *data, QRasterPaintEnginePrivate *pe)

◆ getCGContext()

CGContextRef QRasterPaintEngine::getCGContext ( ) const
Warning
This function is not part of the public interface.

Definition at line 3392 of file qpaintengine_raster.cpp.

3393 {
3394  Q_D(const QRasterPaintEngine);
3395  return d->cgContext;
3396 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ getDC()

HDC QRasterPaintEngine::getDC ( ) const
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngine.

Definition at line 3411 of file qpaintengine_raster.cpp.

3412 {
3413  Q_D(const QRasterPaintEngine);
3414  return d->hdc;
3415 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ init()

void QRasterPaintEngine::init ( )
private

Definition at line 337 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine().

338 {
340 
341 
342 #ifdef Q_WS_WIN
343  d->hdc = 0;
344 #endif
345 
346  // The antialiasing raster.
347  d->grayRaster.reset(new QT_FT_Raster);
348  Q_CHECK_PTR(d->grayRaster.data());
349  if (qt_ft_grays_raster.raster_new(d->grayRaster.data()))
350  QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc
351 
352 
353  d->rasterizer.reset(new QRasterizer);
354  d->rasterBuffer.reset(new QRasterBuffer());
355  d->outlineMapper.reset(new QOutlineMapper);
356  d->outlinemapper_xform_dirty = true;
357 
358  d->basicStroker.setMoveToHook(qt_ft_outline_move_to);
359  d->basicStroker.setLineToHook(qt_ft_outline_line_to);
360  d->basicStroker.setCubicToHook(qt_ft_outline_cubic_to);
361 
362  d->baseClip.reset(new QClipData(d->device->height()));
363  d->baseClip->setClipRect(QRect(0, 0, d->device->width(), d->device->height()));
364 
365  d->image_filler.init(d->rasterBuffer.data(), this);
366  d->image_filler.type = QSpanData::Texture;
367 
368  d->image_filler_xform.init(d->rasterBuffer.data(), this);
369  d->image_filler_xform.type = QSpanData::Texture;
370 
371  d->solid_color_filler.init(d->rasterBuffer.data(), this);
372  d->solid_color_filler.type = QSpanData::Solid;
373 
374  d->deviceDepth = d->device->depth();
375 
376  d->mono_surface = false;
377  gccaps &= ~PorterDuff;
378 
380 
381  switch (d->device->devType()) {
382  case QInternal::Pixmap:
383  qWarning("QRasterPaintEngine: unsupported for pixmaps...");
384  break;
385  case QInternal::Image:
386  format = d->rasterBuffer->prepare(static_cast<QImage *>(d->device));
387  break;
388 #ifdef Q_WS_QWS
390  d->rasterBuffer->prepare(static_cast<QCustomRasterPaintDevice*>(d->device));
391  break;
392 #endif
393  default:
394  qWarning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType());
395  d->device = 0;
396  return;
397  }
398 
399  switch (format) {
401  case QImage::Format_Mono:
402  d->mono_surface = true;
403  break;
410  gccaps |= PorterDuff;
411  break;
418  break;
419  default:
420  break;
421  }
422 }
double d
Definition: qnumeric_p.h:62
const QT_FT_Raster_Funcs qt_ft_grays_raster
Definition: qgrayraster.c:1931
Format
The following image formats are available in Qt.
Definition: qimage.h:91
static void qt_ft_outline_move_to(qfixed x, qfixed y, void *data)
PaintEngineFeatures gccaps
Definition: qpaintengine.h:240
static void qt_ft_outline_line_to(qfixed x, qfixed y, void *data)
#define Q_D(Class)
Definition: qglobal.h:2482
#define QT_THROW(A)
Definition: qglobal.h:1538
Q_CORE_EXPORT void qWarning(const char *,...)
static void qt_ft_outline_cubic_to(qfixed c1x, qfixed c1y, qfixed c2x, qfixed c2y, qfixed ex, qfixed ey, void *data)
#define Q_CHECK_PTR(p)
Definition: qglobal.h:1853
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 ...
QT_FT_Raster_NewFunc raster_new

◆ opacityChanged()

void QRasterPaintEngine::opacityChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 884 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::opacityChanged(), QDirectFBPaintEngine::opacityChanged(), and QBlitterPaintEngine::type().

885 {
887 
888 #ifdef QT_DEBUG_DRAW
889  qDebug() << "QRasterPaintEngine::opacityChanged()" << s->opacity;
890 #endif
891 
892  s->fillFlags |= DirtyOpacity;
895  s->dirty |= DirtyOpacity;
896  s->intOpacity = (int) (s->opacity * 256);
897 }
QRasterPaintEngineState * state()
Q_CORE_EXPORT void qDebug(const char *,...)

◆ penChanged()

void QRasterPaintEngine::penChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 722 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::penChanged(), QDirectFBPaintEngine::penChanged(), and QBlitterPaintEngine::type().

723 {
724 #ifdef QT_DEBUG_DRAW
725  qDebug() << "QRasterPaintEngine::penChanged():" << state()->pen;
726 #endif
728  s->strokeFlags |= DirtyPen;
729  s->dirty |= DirtyPen;
730 }
QRasterPaintEngineState * state()
Q_CORE_EXPORT void qDebug(const char *,...)

◆ releaseBuffer()

void QRasterPaintEngine::releaseBuffer ( )
Warning
This function is not part of the public interface.

Definition at line 538 of file qpaintengine_raster.cpp.

539 {
541  d->rasterBuffer.reset(new QRasterBuffer);
542 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ releaseDC()

void QRasterPaintEngine::releaseDC ( HDC  hdc) const
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngine.

Definition at line 3420 of file qpaintengine_raster.cpp.

3421 {
3422 }

◆ renderHintsChanged()

void QRasterPaintEngine::renderHintsChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 923 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::renderHintsChanged(), QDirectFBPaintEngine::renderHintsChanged(), and QBlitterPaintEngine::type().

924 {
926 
927 #ifdef QT_DEBUG_DRAW
928  qDebug() << "QRasterPaintEngine::renderHintsChanged()" << hex << s->renderHints;
929 #endif
930 
931  bool was_aa = s->flags.antialiased;
932  bool was_bilinear = s->flags.bilinear;
933 
936 
937  if (was_aa != s->flags.antialiased)
938  s->strokeFlags |= DirtyHints;
939 
940  if (was_bilinear != s->flags.bilinear) {
941  s->strokeFlags |= DirtyPen;
942  s->fillFlags |= DirtyBrush;
943  }
944 
946  d->recalculateFastImages();
947 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QPainter::RenderHints renderHints
Definition: qpainter_p.h:158
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT QTextStream & hex(QTextStream &s)
Q_CORE_EXPORT void qDebug(const char *,...)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ saveBuffer()

void QRasterPaintEngine::saveBuffer ( const QString s) const
Warning
This function is not part of the public interface.

Definition at line 557 of file qpaintengine_raster.cpp.

558 {
559  Q_D(const QRasterPaintEngine);
560  d->rasterBuffer->bufferImage().save(s, "PNG");
561 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ setCGContext()

void QRasterPaintEngine::setCGContext ( CGContextRef  ctx)
Warning
This function is not part of the public interface.

Definition at line 3383 of file qpaintengine_raster.cpp.

3384 {
3386  d->cgContext = ctx;
3387 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define ctx
Definition: qgl.cpp:6094
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ setClipRectInDeviceCoords()

bool QRasterPaintEngine::setClipRectInDeviceCoords ( const QRect r,
Qt::ClipOperation  op 
)
private

Definition at line 1295 of file qpaintengine_raster.cpp.

1296 {
1298  QRect clipRect = r & d->deviceRect;
1300 
1301  if (op == Qt::ReplaceClip || s->clip == 0) {
1302 
1303  // No current clip, hence we intersect with sysclip and be
1304  // done with it...
1305  QRegion clipRegion = systemClip();
1306  QClipData *clip = new QClipData(d->rasterBuffer->height());
1307 
1308  if (clipRegion.isEmpty())
1309  clip->setClipRect(clipRect);
1310  else
1311  clip->setClipRegion(clipRegion & clipRect);
1312 
1313  if (s->flags.has_clip_ownership)
1314  delete s->clip;
1315 
1316  s->clip = clip;
1317  s->clip->enabled = true;
1318  s->flags.has_clip_ownership = true;
1319 
1320  } else if (op == Qt::IntersectClip){ // intersect clip with current clip
1321  QClipData *base = s->clip;
1322 
1323  Q_ASSERT(base);
1324  if (base->hasRectClip || base->hasRegionClip) {
1325  if (!s->flags.has_clip_ownership) {
1326  s->clip = new QClipData(d->rasterBuffer->height());
1327  s->flags.has_clip_ownership = true;
1328  }
1329  if (base->hasRectClip)
1330  s->clip->setClipRect(base->clipRect & clipRect);
1331  else
1332  s->clip->setClipRegion(base->clipRegion & clipRect);
1333  s->clip->enabled = true;
1334  } else {
1335  return false;
1336  }
1337  } else {
1338  return false;
1339  }
1340 
1342  return true;
1343 }
double d
Definition: qnumeric_p.h:62
void setClipRegion(const QRegion &region)
QRasterPaintEngineState * state()
void setClipRect(const QRect &rect)
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
#define Q_D(Class)
Definition: qglobal.h:2482
static const uint base
Definition: qurl.cpp:268
static void qrasterpaintengine_dirty_clip(QRasterPaintEnginePrivate *d, QRasterPaintEngineState *s)
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
void clip(const QVectorPath &path, Qt::ClipOperation op)
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 ...
QRegion systemClip() const
Returns the system clip.

◆ setDC()

void QRasterPaintEngine::setDC ( HDC  hdc)
Warning
This function is not part of the public interface.

Definition at line 3403 of file qpaintengine_raster.cpp.

3403  {
3405  d->hdc = hdc;
3406 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ setState()

void QRasterPaintEngine::setState ( QPainterState s)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 702 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::setState(), QDirectFBPaintEngine::setState(), and QBlitterPaintEngine::type().

703 {
706  d->rasterBuffer->compositionMode = s->composition_mode;
707 }
double d
Definition: qnumeric_p.h:62
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
#define Q_D(Class)
Definition: qglobal.h:2482
virtual void setState(QPainterState *s)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ size()

QSize QRasterPaintEngine::size ( ) const
Warning
This function is not part of the public interface.

Definition at line 547 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::drawBufferSpan().

548 {
549  Q_D(const QRasterPaintEngine);
550  return QSize(d->rasterBuffer->width(), d->rasterBuffer->height());
551 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ state() [1/2]

QRasterPaintEngineState * QRasterPaintEngine::state ( )
inline
Warning
This function is not part of the public interface.

Definition at line 157 of file qpaintengine_raster_p.h.

Referenced by QDirectFBPaintEngine::begin(), begin(), QDirectFBPaintEnginePrivate::blit(), QBlitterPaintEngine::brushChanged(), QDirectFBPaintEngine::brushChanged(), QBlitterPaintEngine::clipEnabledChanged(), QBlitterPaintEngine::compositionModeChanged(), QDirectFBPaintEngine::compositionModeChanged(), QDirectFBPaintEngine::drawImage(), QDirectFBPaintEngine::drawLines(), QBlitterPaintEngine::drawPixmap(), QDirectFBPaintEngine::drawPixmap(), QDirectFBPaintEngine::drawPoints(), QDirectFBPaintEngine::drawRects(), QBlitterPaintEngine::drawRects(), QDirectFBPaintEngine::drawTiledPixmap(), QDirectFBPaintEnginePrivate::drawTiledPixmap(), QBlitterPaintEngine::fillRect(), QDirectFBPaintEngine::fillRect(), QBlitterPaintEngine::opacityChanged(), QDirectFBPaintEngine::opacityChanged(), QBlittablePixmapData::paintEngine(), QBlitterPaintEngine::penChanged(), QDirectFBPaintEngine::penChanged(), QDirectFBPaintEnginePrivate::prepareForDraw(), rasterFallbackWarn(), QBlitterPaintEngine::renderHintsChanged(), QDirectFBPaintEngine::renderHintsChanged(), QDirectFBPaintEnginePrivate::setRenderHints(), QDirectFBPaintEnginePrivate::setTransform(), QDirectFBPaintEnginePrivate::supportsStretchBlit(), QBlitterPaintEngine::transformChanged(), QDirectFBPaintEngine::transformChanged(), and updateMatrix().

157  {
158  return static_cast<QRasterPaintEngineState *>(QPaintEngineEx::state());
159  }
QPainterState * state()

◆ state() [2/2]

const QRasterPaintEngineState * QRasterPaintEngine::state ( ) const
inline
Warning
This function is not part of the public interface.

Definition at line 160 of file qpaintengine_raster_p.h.

160  {
161  return static_cast<const QRasterPaintEngineState *>(QPaintEngineEx::state());
162  }
QPainterState * state()

◆ stroke()

void QRasterPaintEngine::stroke ( const QVectorPath path,
const QPen pen 
)
virtual
Warning
This function is not part of the public interface.

Reimplemented from QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 1615 of file qpaintengine_raster.cpp.

Referenced by QDirectFBPaintEngine::stroke(), QBlitterPaintEngine::stroke(), and QBlitterPaintEngine::type().

1616 {
1619 
1620  ensurePen(pen);
1621  if (!s->penData.blend)
1622  return;
1623 
1624  if (s->flags.fast_pen) {
1625  QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped);
1626  stroker.drawPath(path);
1627  } else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
1628  qreal width = s->lastPen.isCosmetic()
1629  ? (qpen_widthf(s->lastPen) == 0 ? 1 : qpen_widthf(s->lastPen))
1630  : qpen_widthf(s->lastPen) * s->txscale;
1631  int dashIndex = 0;
1632  qreal dashOffset = s->lastPen.dashOffset();
1633  bool inDash = true;
1634  qreal patternLength = 0;
1635  const QVector<qreal> pattern = s->lastPen.dashPattern();
1636  for (int i = 0; i < pattern.size(); ++i)
1637  patternLength += pattern.at(i);
1638 
1639  if (patternLength > 0) {
1640  int n = qFloor(dashOffset / patternLength);
1641  dashOffset -= n * patternLength;
1642  while (dashOffset >= pattern.at(dashIndex)) {
1643  dashOffset -= pattern.at(dashIndex);
1644  if (++dashIndex >= pattern.size())
1645  dashIndex = 0;
1646  inDash = !inDash;
1647  }
1648  }
1649 
1651  d->initializeRasterizer(&s->penData);
1652  int lineCount = path.elementCount() / 2;
1653  const QLineF *lines = reinterpret_cast<const QLineF *>(path.points());
1654 
1655  for (int i = 0; i < lineCount; ++i) {
1656  if (lines[i].p1() == lines[i].p2()) {
1657  if (s->lastPen.capStyle() != Qt::FlatCap) {
1658  QPointF p = lines[i].p1();
1659  QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*qreal(0.5), p.y()),
1660  QPointF(p.x() + width*qreal(0.5), p.y())));
1661  d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1);
1662  }
1663  continue;
1664  }
1665 
1666  const QLineF line = s->matrix.map(lines[i]);
1667  if (qpen_style(s->lastPen) == Qt::SolidLine) {
1668  d->rasterizer->rasterizeLine(line.p1(), line.p2(),
1669  width / line.length(),
1670  s->lastPen.capStyle() == Qt::SquareCap);
1671  } else {
1672  d->rasterizeLine_dashed(line, width,
1673  &dashIndex, &dashOffset, &inDash);
1674  }
1675  }
1676  }
1677  else
1678  QPaintEngineEx::stroke(path, pen);
1679 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
qreal length() const
Returns the length of the line.
Definition: qline.cpp:698
int elementCount() const
QRasterPaintEngineState * state()
int qFloor(qreal v)
Definition: qmath.h:73
QPointF p1() const
Returns the line&#39;s start point.
Definition: qline.h:314
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QTransform matrix
Definition: qpainter_p.h:161
#define Q_D(Class)
Definition: qglobal.h:2482
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
Definition: qpen.cpp:466
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
The QLineF class provides a two-dimensional vector using floating point precision.
Definition: qline.h:212
ProcessSpans blend
virtual void stroke(const QVectorPath &path, const QPen &pen)
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Definition: qpen.cpp:840
qreal qpen_widthf(const QPen &p)
Definition: qpainter_p.h:88
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...
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
const qreal * points() const
QPointF p2() const
Returns the line&#39;s end point.
Definition: qline.h:319
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
qreal dashOffset() const
Returns the dash offset for the pen.
Definition: qpen.cpp:547
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
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
Hint shape() const

◆ supportsTransformations() [1/2]

bool QRasterPaintEngine::supportsTransformations ( const QFontEngine fontEngine) const

Definition at line 3426 of file qpaintengine_raster.cpp.

3427 {
3428  const QTransform &m = state()->matrix;
3429 #if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
3430  QFontEngine::Type fontEngineType = fontEngine->type();
3431  if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) fontEngine)->ttf && m.type() > QTransform::TxTranslate)
3432  || (m.type() <= QTransform::TxTranslate
3433  && (fontEngineType == QFontEngine::TestFontEngine
3434  || fontEngineType == QFontEngine::Box))) {
3435  return true;
3436  }
3437 #endif
3438  return supportsTransformations(fontEngine->fontDef.pixelSize, m);
3439 }
QRasterPaintEngineState * state()
QTransform matrix
Definition: qpainter_p.h:161
TransformationType type() const
Returns the transformation type of this matrix.
virtual Type type() const =0
bool supportsTransformations(const QFontEngine *fontEngine) const
qreal pixelSize
Definition: qfont_p.h:90
QFontDef fontDef
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

◆ supportsTransformations() [2/2]

bool QRasterPaintEngine::supportsTransformations ( qreal  pixelSize,
const QTransform m 
) const
virtual

Reimplemented from QPaintEngineEx.

Definition at line 3441 of file qpaintengine_raster.cpp.

3442 {
3443 #if defined(Q_WS_MAC) || (defined(Q_OS_MAC) && defined(Q_WS_QPA))
3444  // Mac font engines don't support scaling and rotation
3445  if (m.type() > QTransform::TxTranslate)
3446 #else
3447  if (m.type() >= QTransform::TxProject)
3448 #endif
3449  return true;
3450 
3451  if (pixelSize * pixelSize * qAbs(m.determinant()) >= 64 * 64)
3452  return true;
3453 
3454  return false;
3455 }
qreal determinant() const
Returns the matrix&#39;s determinant.
Definition: qtransform.h:228
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
TransformationType type() const
Returns the transformation type of this matrix.
static float pixelSize(const QFontDef &request, int dpi)
Definition: qfont_win.cpp:80

◆ transformChanged()

void QRasterPaintEngine::transformChanged ( )
virtual
Warning
This function is not part of the public interface.

Implements QPaintEngineEx.

Reimplemented in QDirectFBPaintEngine.

Definition at line 952 of file qpaintengine_raster.cpp.

Referenced by QBlitterPaintEngine::transformChanged(), QDirectFBPaintEngine::transformChanged(), and QBlitterPaintEngine::type().

953 {
955 
956 #ifdef QT_DEBUG_DRAW
957  qDebug() << "QRasterPaintEngine::transformChanged()" << s->matrix;
958 #endif
959 
962 
963  s->dirty |= DirtyTransform;
964 
966  d->recalculateFastImages();
967 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QTransform matrix
Definition: qpainter_p.h:161
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ type()

Type QRasterPaintEngine::type ( ) const
inlinevirtual

Reimplemented Function

Implements QPaintEngine.

Definition at line 240 of file qpaintengine_raster_p.h.

240 { return Raster; }

◆ updateBrush()

void QRasterPaintEngine::updateBrush ( const QBrush brush)
Warning
This function is not part of the public interface.

Definition at line 838 of file qpaintengine_raster.cpp.

839 {
840 #ifdef QT_DEBUG_DRAW
841  qDebug() << "QRasterPaintEngine::updateBrush()" << brush;
842 #endif
845  // must set clip prior to setup, as setup uses it...
846  s->brushData.clip = d->clip();
847  s->brushData.setup(brush, s->intOpacity, s->composition_mode);
848  if (s->fillFlags & DirtyTransform
849  || brush.transform().type() >= QTransform::TxNone)
850  d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix());
851  s->lastBrush = brush;
852  s->fillFlags = 0;
853 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
Q_CORE_EXPORT void qDebug(const char *,...)
const QClipData * clip
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ updateMatrix()

void QRasterPaintEngine::updateMatrix ( const QTransform matrix)
Warning
This function is not part of the public interface.

Definition at line 567 of file qpaintengine_raster.cpp.

568 {
570  // FALCON: get rid of this line, see drawImage call below.
571  s->matrix = matrix;
573 
574  switch (txop) {
575 
576  case QTransform::TxNone:
577  s->flags.int_xform = true;
578  break;
579 
581  s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
582  && qreal(int(s->matrix.dy())) == s->matrix.dy();
583  break;
584 
585  case QTransform::TxScale:
586  s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
587  && qreal(int(s->matrix.dy())) == s->matrix.dy()
588  && qreal(int(s->matrix.m11())) == s->matrix.m11()
589  && qreal(int(s->matrix.m22())) == s->matrix.m22();
590  break;
591 
592  default: // shear / perspective...
593  s->flags.int_xform = false;
594  break;
595  }
596 
598 
600 
601 #ifdef Q_WS_WIN
603  d->isPlain45DegreeRotation = false;
604  if (txop >= QTransform::TxRotate) {
605  d->isPlain45DegreeRotation =
606  (qFuzzyIsNull(matrix.m11())
607  && qFuzzyIsNull(matrix.m12() - qreal(1))
608  && qFuzzyIsNull(matrix.m21() + qreal(1))
609  && qFuzzyIsNull(matrix.m22())
610  )
611  ||
612  (qFuzzyIsNull(matrix.m11() + qreal(1))
613  && qFuzzyIsNull(matrix.m12())
614  && qFuzzyIsNull(matrix.m21())
615  && qFuzzyIsNull(matrix.m22() + qreal(1))
616  )
617  ||
618  (qFuzzyIsNull(matrix.m11())
619  && qFuzzyIsNull(matrix.m12() + qreal(1))
620  && qFuzzyIsNull(matrix.m21() - qreal(1))
621  && qFuzzyIsNull(matrix.m22())
622  )
623  ;
624  }
625 #endif
626 
627 }
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
QRasterPaintEngineState * state()
qreal m21() const
Returns the horizontal shearing factor.
Definition: qtransform.h:249
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
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
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
TransformationType
Definition: qtransform.h:68
Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale)
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
static Q_DECL_CONSTEXPR bool qFuzzyIsNull(double d)
Definition: qglobal.h:2043
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237

◆ updateOutlineMapper()

void QRasterPaintEngine::updateOutlineMapper ( )
private

Definition at line 855 of file qpaintengine_raster.cpp.

856 {
858  d->outlineMapper->setMatrix(state()->matrix);
859 }
double d
Definition: qnumeric_p.h:62
QRasterPaintEngineState * state()
#define Q_D(Class)
Definition: qglobal.h:2482
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...

◆ updatePen()

void QRasterPaintEngine::updatePen ( const QPen pen)
Warning
This function is not part of the public interface.

Definition at line 735 of file qpaintengine_raster.cpp.

736 {
739 #ifdef QT_DEBUG_DRAW
740  qDebug() << "QRasterPaintEngine::updatePen():" << s->pen;
741 #endif
742 
743  Qt::PenStyle pen_style = qpen_style(pen);
744 
745  s->lastPen = pen;
746  s->strokeFlags = 0;
747 
748  s->penData.clip = d->clip();
749  s->penData.setup(pen_style == Qt::NoPen ? QBrush() : pen.brush(), s->intOpacity, s->composition_mode);
750 
752  || pen.brush().transform().type() >= QTransform::TxNone) {
753  d->updateMatrixData(&s->penData, pen.brush(), s->matrix);
754  }
755 
756  // Slightly ugly handling of an uncommon case... We need to change
757  // the pen because it is reused in draw_midpoint to decide dashed
758  // or non-dashed.
759  if (pen_style == Qt::CustomDashLine && pen.dashPattern().size() == 0) {
760  pen_style = Qt::SolidLine;
762  }
763 
764  d->basicStroker.setJoinStyle(qpen_joinStyle(pen));
765  d->basicStroker.setCapStyle(qpen_capStyle(pen));
766  d->basicStroker.setMiterLimit(pen.miterLimit());
767 
768  qreal penWidth = qpen_widthf(pen);
769  if (penWidth == 0)
770  d->basicStroker.setStrokeWidth(1);
771  else
772  d->basicStroker.setStrokeWidth(penWidth);
773 
774  if(pen_style == Qt::SolidLine) {
775  s->stroker = &d->basicStroker;
776  } else if (pen_style != Qt::NoPen) {
777  if (!d->dashStroker)
778  d->dashStroker.reset(new QDashStroker(&d->basicStroker));
779  if (pen.isCosmetic()) {
780  d->dashStroker->setClipRect(d->deviceRect);
781  } else {
782  // ### I've seen this inverted devrect multiple places now...
783  QRectF clipRect = s->matrix.inverted().mapRect(QRectF(d->deviceRect));
784  d->dashStroker->setClipRect(clipRect);
785  }
786  d->dashStroker->setDashPattern(pen.dashPattern());
787  d->dashStroker->setDashOffset(pen.dashOffset());
788  s->stroker = d->dashStroker.data();
789  } else {
790  s->stroker = 0;
791  }
792 
793  ensureState(); // needed because of tx_noshear...
794  s->flags.fast_pen = pen_style > Qt::NoPen
795  && s->penData.blend
796  && ((pen.isCosmetic() && penWidth <= 1)
797  || (!pen.isCosmetic() && s->flags.tx_noshear && penWidth * s->txscale <= 1));
798 
800 
801  s->strokeFlags = 0;
802 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
QRasterPaintEngineState * state()
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
Qt::PenJoinStyle qpen_joinStyle(const QPen &p)
Definition: qpainter_p.h:91
QTransform matrix
Definition: qpainter_p.h:161
Qt::PenCapStyle qpen_capStyle(const QPen &p)
Definition: qpainter_p.h:90
TransformationType type() const
Returns the transformation type of this matrix.
#define Q_D(Class)
Definition: qglobal.h:2482
QTransform transform() const
Returns the current transformation matrix for the brush.
Definition: qbrush.h:185
QVector< qreal > dashPattern() const
Returns the dash pattern of this pen.
Definition: qpen.cpp:466
PenStyle
Definition: qnamespace.h:1134
QTransform inverted(bool *invertible=0) const
Returns an inverted copy of this matrix.
Definition: qtransform.cpp:364
ProcessSpans blend
Q_CORE_EXPORT void qDebug(const char *,...)
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
bool isCosmetic() const
Returns true if the pen is cosmetic; otherwise returns false.
Definition: qpen.cpp:840
qreal qpen_widthf(const QPen &p)
Definition: qpainter_p.h:88
QBrush brush() const
Returns the brush used to fill strokes generated with this pen.
Definition: qpen.cpp:797
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:76
const QClipData * clip
void setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
qreal miterLimit() const
Returns the miter limit of the pen.
Definition: qpen.cpp:589
qreal dashOffset() const
Returns the dash offset for the pen.
Definition: qpen.cpp:547
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
Qt::PenStyle qpen_style(const QPen &p)
Definition: qpainter_p.h:89
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
void setStyle(Qt::PenStyle)
Sets the pen style to the given style.
Definition: qpen.cpp:450

◆ updateState()

void QRasterPaintEngine::updateState ( )
private

Definition at line 861 of file qpaintengine_raster.cpp.

862 {
864 
865  if (s->dirty & DirtyTransform)
866  updateMatrix(s->matrix);
867 
871  && s->intOpacity == 256
874  && qAlpha(s->penData.solid.color) == 255));
875  }
876 
877  s->dirty = 0;
878 }
QRasterPaintEngineState * state()
CompositionMode
Defines the modes supported for digital image compositing.
Definition: qpainter.h:138
QPainter::CompositionMode composition_mode
Definition: qpainter_p.h:174
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
Definition: qrgb.h:66
QTransform matrix
Definition: qpainter_p.h:161
QSolidData solid
void updateMatrix(const QTransform &matrix)
enum QSpanData::Type type

Friends and Related Functions

◆ QBlitterPaintEngine

friend class QBlitterPaintEngine
friend

Definition at line 256 of file qpaintengine_raster_p.h.

◆ QBlitterPaintEnginePrivate

Definition at line 257 of file qpaintengine_raster_p.h.

◆ QSpan()

QSpan
related

A struct equivalent to QT_FT_Span, containing a position (x, y), the span's length in pixels and its color/coverage (a value ranging from 0 to 255).

◆ QSpanData

friend struct QSpanData
friend

Definition at line 255 of file qpaintengine_raster_p.h.


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