Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QSpanData Struct Reference

#include <qdrawhelper_p.h>

Public Types

enum  Type {
  None, Solid, LinearGradient, RadialGradient,
  ConicalGradient, Texture
}
 

Public Functions

void adjustSpanMethods ()
 
void init (QRasterBuffer *rb, const QRasterPaintEngine *pe)
 
void initTexture (const QImage *image, int alpha, QTextureData::Type=QTextureData::Plain, const QRect &sourceRect=QRect())
 
 QSpanData ()
 
void setup (const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode)
 
void setupMatrix (const QTransform &matrix, int bilinear)
 
 ~QSpanData ()
 

Public Variables

union {
   QGradientData   gradient
 
   QSolidData   solid
 
   QTextureData   texture
 
}; 
 
AlphamapBlitFunc alphamapBlit
 
AlphaRGBBlitFunc alphaRGBBlit
 
bool bilinear
 
BitmapBlitFunc bitmapBlit
 
ProcessSpans blend
 
const QClipDataclip
 
qreal dx
 
qreal dy
 
int fast_matrix: 1
 
RectFillFunc fillRect
 
qreal m11
 
qreal m12
 
qreal m13
 
qreal m21
 
qreal m22
 
qreal m23
 
qreal m33
 
QRasterBufferrasterBuffer
 
QRasterPaintEnginerasterEngine
 
QImagetempImage
 
int txop: 8
 
enum QSpanData::Type type
 
ProcessSpans unclipped_blend
 

Detailed Description

Definition at line 311 of file qdrawhelper_p.h.

Enumerations

◆ Type

Enumerator
None 
Solid 
LinearGradient 
RadialGradient 
ConicalGradient 
Texture 

Definition at line 328 of file qdrawhelper_p.h.

Constructors and Destructors

◆ QSpanData()

QSpanData::QSpanData ( )
inline

Definition at line 313 of file qdrawhelper_p.h.

313 : tempImage(0) {}
QImage * tempImage

◆ ~QSpanData()

QSpanData::~QSpanData ( )
inline

Definition at line 314 of file qdrawhelper_p.h.

314 { delete tempImage; }
QImage * tempImage

Functions

◆ adjustSpanMethods()

void QSpanData::adjustSpanMethods ( )

Definition at line 4927 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::drawImage(), QRasterPaintEngine::fillRect(), qrasterpaintengine_dirty_clip(), and QRasterPaintEnginePrivate::updateMatrixData().

4928 {
4929  bitmapBlit = 0;
4930  alphamapBlit = 0;
4931  alphaRGBBlit = 0;
4932 
4933  fillRect = 0;
4934 
4935  switch(type) {
4936  case None:
4937  unclipped_blend = 0;
4938  break;
4939  case Solid:
4945  break;
4946  case LinearGradient:
4947  case RadialGradient:
4948  case ConicalGradient:
4950  break;
4951  case Texture:
4952 #ifdef Q_WS_QWS
4953 #ifndef QT_NO_RASTERCALLBACKS
4954  if (!rasterBuffer->buffer())
4956  else
4957 #endif
4959 #else
4961 #endif
4962  if (!texture.imageData)
4963  unclipped_blend = 0;
4964 
4965  break;
4966  }
4967  // setup clipping
4968  if (!unclipped_blend) {
4969  blend = 0;
4970  } else if (!clip) {
4972  } else if (clip->hasRectClip) {
4974  } else {
4976  }
4977 }
void qBlendTextureCallback(int count, const QSpan *spans, void *userData)
AlphamapBlitFunc alphamapBlit
BitmapBlitFunc bitmapBlit
AlphaRGBBlitFunc alphaRGBBlit
RectFillFunc fillRect
ProcessSpans blendColor
BitmapBlitFunc bitmapBlit
AlphaRGBBlitFunc alphaRGBBlit
const uchar * imageData
ProcessSpans blend
static void qt_span_fill_clipped(int count, const QSpan *spans, void *userData)
void qBlendTexture(int count, const QSpan *spans, void *userData)
RectFillFunc fillRect
ProcessSpans blendGradient
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
Definition: qrect.h:234
const QClipData * clip
QRasterBuffer * rasterBuffer
DrawHelper * drawHelper
uchar * buffer() const
ProcessSpans unclipped_blend
enum QSpanData::Type type
AlphamapBlitFunc alphamapBlit
static void qt_span_fill_clipRect(int count, const QSpan *spans, void *userData)
QTextureData texture

◆ init()

void QSpanData::init ( QRasterBuffer rb,
const QRasterPaintEngine pe 
)

Definition at line 4801 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::begin(), blendCursor(), QScreen::compose(), and QScreen::paintBackground().

4802 {
4803  rasterBuffer = rb;
4804 #ifdef Q_WS_QWS
4805  rasterEngine = const_cast<QRasterPaintEngine *>(pe);
4806 #endif
4807  type = None;
4808  txop = 0;
4809  bilinear = false;
4810  m11 = m22 = m33 = 1.;
4811  m12 = m13 = m21 = m23 = dx = dy = 0.0;
4812  clip = pe ? pe->d_func()->clip() : 0;
4813 }
void clip(const QVectorPath &path, Qt::ClipOperation op)
const QClipData * clip
QRasterPaintEngine * rasterEngine
QRasterBuffer * rasterBuffer
The QRasterPaintEngine class enables hardware acceleration of painting operations in Qt for Embedded ...
enum QSpanData::Type type

◆ initTexture()

void QSpanData::initTexture ( const QImage image,
int  alpha,
QTextureData::Type  _type = QTextureData::Plain,
const QRect sourceRect = QRect() 
)

Definition at line 5010 of file qpaintengine_raster.cpp.

Referenced by blendCursor(), QScreen::compose(), QRasterPaintEngine::drawImage(), and QRasterPaintEngine::drawTiledPixmap().

5011 {
5012  const QImageData *d = const_cast<QImage *>(image)->data_ptr();
5013  if (!d || d->height == 0) {
5014  texture.imageData = 0;
5015  texture.width = 0;
5016  texture.height = 0;
5017  texture.x1 = 0;
5018  texture.y1 = 0;
5019  texture.x2 = 0;
5020  texture.y2 = 0;
5021  texture.bytesPerLine = 0;
5023  texture.colorTable = 0;
5024  texture.hasAlpha = alpha != 256;
5025  } else {
5026  texture.imageData = d->data;
5027  texture.width = d->width;
5028  texture.height = d->height;
5029 
5030  if (sourceRect.isNull()) {
5031  texture.x1 = 0;
5032  texture.y1 = 0;
5033  texture.x2 = texture.width;
5035  } else {
5036  texture.x1 = sourceRect.x();
5037  texture.y1 = sourceRect.y();
5038  texture.x2 = qMin(texture.x1 + sourceRect.width(), d->width);
5039  texture.y2 = qMin(texture.y1 + sourceRect.height(), d->height);
5040  }
5041 
5043 
5044  texture.format = d->format;
5046  texture.hasAlpha = image->hasAlphaChannel() || alpha != 256;
5047  }
5048  texture.const_alpha = alpha;
5049  texture.type = _type;
5050 
5052 }
double d
Definition: qnumeric_p.h:62
int width
Definition: qimage_p.h:76
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QVector< QRgb > colortable
Definition: qimage_p.h:80
const uchar * imageData
int height
Definition: qimage_p.h:77
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
int bytes_per_line
Definition: qimage_p.h:86
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
QImage::Format format
Definition: qimage_p.h:85
void * data_ptr(const QTransform &t)
Definition: qpainter_p.h:81
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
uchar * data
Definition: qimage_p.h:81
const QVector< QRgb > * colorTable
bool isEmpty() const
Returns true if the vector has size 0; otherwise returns false.
Definition: qvector.h:139
QImage::Format format
QTextureData texture

◆ setup()

void QSpanData::setup ( const QBrush brush,
int  alpha,
QPainter::CompositionMode  compositionMode 
)

Definition at line 4817 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::begin(), QScreen::compose(), QScreen::paintBackground(), QRasterPaintEngine::updateBrush(), and QRasterPaintEngine::updatePen().

4818 {
4819  Qt::BrushStyle brushStyle = qbrush_style(brush);
4820  switch (brushStyle) {
4821  case Qt::SolidPattern: {
4822  type = Solid;
4823  QColor c = qbrush_color(brush);
4824  QRgb rgba = c.rgba();
4825  solid.color = PREMUL(ARGB_COMBINE_ALPHA(rgba, alpha));
4826  if ((solid.color & 0xff000000) == 0
4827  && compositionMode == QPainter::CompositionMode_SourceOver) {
4828  type = None;
4829  }
4830  break;
4831  }
4832 
4834  {
4835  type = LinearGradient;
4836  const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
4837  gradient.alphaColor = !brush.isOpaque() || alpha != 256;
4838  gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha));
4839  gradient.spread = g->spread();
4840 
4841  QLinearGradientData &linearData = gradient.linear;
4842 
4843  linearData.origin.x = g->start().x();
4844  linearData.origin.y = g->start().y();
4845  linearData.end.x = g->finalStop().x();
4846  linearData.end.y = g->finalStop().y();
4847  break;
4848  }
4849 
4851  {
4852  type = RadialGradient;
4853  const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
4854  gradient.alphaColor = !brush.isOpaque() || alpha != 256;
4855  gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha));
4856  gradient.spread = g->spread();
4857 
4858  QRadialGradientData &radialData = gradient.radial;
4859 
4860  QPointF center = g->center();
4861  radialData.center.x = center.x();
4862  radialData.center.y = center.y();
4863  radialData.center.radius = g->centerRadius();
4864  QPointF focal = g->focalPoint();
4865  radialData.focal.x = focal.x();
4866  radialData.focal.y = focal.y();
4867  radialData.focal.radius = g->focalRadius();
4868  }
4869  break;
4870 
4872  {
4874  const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
4875  gradient.alphaColor = !brush.isOpaque() || alpha != 256;
4876  gradient.colorTable = const_cast<uint*>(qt_gradient_cache()->getBuffer(*g, alpha));
4878 
4879  QConicalGradientData &conicalData = gradient.conical;
4880 
4881  QPointF center = g->center();
4882  conicalData.center.x = center.x();
4883  conicalData.center.y = center.y();
4884  conicalData.angle = g->angle() * 2 * Q_PI / 360.0;
4885  }
4886  break;
4887 
4888  case Qt::Dense1Pattern:
4889  case Qt::Dense2Pattern:
4890  case Qt::Dense3Pattern:
4891  case Qt::Dense4Pattern:
4892  case Qt::Dense5Pattern:
4893  case Qt::Dense6Pattern:
4894  case Qt::Dense7Pattern:
4895  case Qt::HorPattern:
4896  case Qt::VerPattern:
4897  case Qt::CrossPattern:
4898  case Qt::BDiagPattern:
4899  case Qt::FDiagPattern:
4900  case Qt::DiagCrossPattern:
4901  type = Texture;
4902  if (!tempImage)
4903  tempImage = new QImage();
4904  *tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color());
4906  break;
4907  case Qt::TexturePattern:
4908  type = Texture;
4909  if (!tempImage)
4910  tempImage = new QImage();
4911 
4912  if (qHasPixmapTexture(brush) && brush.texture().isQBitmap())
4913  *tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color());
4914  else
4915  *tempImage = brush.textureImage();
4917  break;
4918 
4919  case Qt::NoBrush:
4920  default:
4921  type = None;
4922  break;
4923  }
4925 }
qreal focalRadius() const
Returns the focal radius of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2211
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
QPointF focalPoint() const
Returns the focal point of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2251
unsigned int QRgb
Definition: qrgb.h:53
BrushStyle
Definition: qnamespace.h:1162
unsigned char c[8]
Definition: qnumeric_p.h:62
const QColor & color() const
Returns the brush color.
Definition: qbrush.h:183
const QGradient * gradient() const
Returns the gradient describing this brush.
Definition: qbrush.cpp:871
Qt::BrushStyle qbrush_style(const QBrush &b)
Definition: qpainter_p.h:96
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
Definition: qbrush.h:329
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
Definition: qbrush.h:297
QRect rect() const
Returns the enclosing rectangle (0, 0, width(), height()) of the image.
Definition: qimage.cpp:1603
QGradient::Spread spread
QSolidData solid
QImage * tempImage
qreal angle() const
Returns the start angle of the conical gradient in logical coordinates.
Definition: qbrush.cpp:2433
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
QPointF center() const
Returns the center of the conical gradient in logical coordinates.
Definition: qbrush.cpp:2391
struct QConicalGradientData::@233 center
#define ARGB_COMBINE_ALPHA(argb, alpha)
bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush &brush)
Definition: qbrush.cpp:223
Q_STATIC_INLINE_FUNCTION uint PREMUL(uint x)
Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert)
Definition: qbrush.cpp:167
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
bool isQBitmap() const
Returns true if this is a QBitmap; otherwise returns false.
Definition: qpixmap.cpp:599
unsigned int uint
Definition: qglobal.h:996
QImage colorizeBitmap(const QImage &image, const QColor &color)
void initTexture(const QImage *image, int alpha, QTextureData::Type=QTextureData::Plain, const QRect &sourceRect=QRect())
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
Definition: qbrush.cpp:785
bool isOpaque() const
Returns true if the brush is fully opaque otherwise false.
Definition: qbrush.cpp:910
QPointF start() const
Returns the start point of this linear gradient in logical coordinates.
Definition: qbrush.cpp:1796
QConicalGradientData conical
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
Definition: qbrush.h:280
QRasterBuffer * rasterBuffer
struct QLinearGradientData::@229 origin
QGradientData gradient
struct QRadialGradientData::@232 focal
const QColor & qbrush_color(const QBrush &b)
Definition: qpainter_p.h:97
Spread spread() const
Returns the spread method use by this gradient.
Definition: qbrush.h:235
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
QPointF center() const
Returns the center of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2102
QRadialGradientData radial
struct QLinearGradientData::@230 end
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
qreal centerRadius() const
Returns the center radius of this radial gradient in logical coordinates.
Definition: qbrush.cpp:2182
QLinearGradientData linear
QImage textureImage() const
Returns the custom brush pattern, or a null image if no custom brush pattern has been set...
Definition: qbrush.cpp:829
enum QSpanData::Type type
struct QRadialGradientData::@231 center
QPointF finalStop() const
Returns the final stop point of this linear gradient in logical coordinates.
Definition: qbrush.cpp:1856
static const qreal Q_PI
Definition: qmath_p.h:61

◆ setupMatrix()

void QSpanData::setupMatrix ( const QTransform matrix,
int  bilinear 
)

Definition at line 4979 of file qpaintengine_raster.cpp.

Referenced by QRasterPaintEngine::drawImage(), QRasterPaintEngine::drawTiledPixmap(), and QRasterPaintEnginePrivate::updateMatrixData().

4980 {
4981  QTransform delta;
4982  // make sure we round off correctly in qdrawhelper.cpp
4983  delta.translate(1.0 / 65536, 1.0 / 65536);
4984 
4985  QTransform inv = (delta * matrix).inverted();
4986  m11 = inv.m11();
4987  m12 = inv.m12();
4988  m13 = inv.m13();
4989  m21 = inv.m21();
4990  m22 = inv.m22();
4991  m23 = inv.m23();
4992  m33 = inv.m33();
4993  dx = inv.dx();
4994  dy = inv.dy();
4995  txop = inv.type();
4996  bilinear = bilin;
4997 
4998  const bool affine = !m13 && !m23;
4999  fast_matrix = affine
5000  && m11 * m11 + m21 * m21 < 1e4
5001  && m12 * m12 + m22 * m22 < 1e4
5002  && qAbs(dx) < 1e4
5003  && qAbs(dy) < 1e4;
5004 
5006 }
qreal dy() const
Returns the vertical translation factor.
Definition: qtransform.h:277
static const uchar inv
Definition: qisciicodec.cpp:91
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 & 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.
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
qreal m23() const
Returns the vertical projection factor.
Definition: qtransform.h:257
qreal dx() const
Returns the horizontal translation factor.
Definition: qtransform.h:273
qreal m13() const
Returns the horizontal projection factor.
Definition: qtransform.h:245
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
qreal m33() const
Returns the division factor.
Definition: qtransform.h:269
The QTransform class specifies 2D transformations of a coordinate system.
Definition: qtransform.h:65

Properties

◆ @237

union { ... }

◆ alphamapBlit

AlphamapBlitFunc QSpanData::alphamapBlit

Definition at line 323 of file qdrawhelper_p.h.

Referenced by QRasterPaintEngine::alphaPenBlt().

◆ alphaRGBBlit

AlphaRGBBlitFunc QSpanData::alphaRGBBlit

Definition at line 324 of file qdrawhelper_p.h.

Referenced by QRasterPaintEngine::alphaPenBlt().

◆ bilinear

bool QSpanData::bilinear

Definition at line 338 of file qdrawhelper_p.h.

Referenced by getBlendType(), and QRasterPaintEnginePrivate::updateMatrixData().

◆ bitmapBlit

BitmapBlitFunc QSpanData::bitmapBlit

Definition at line 322 of file qdrawhelper_p.h.

Referenced by QRasterPaintEngine::alphaPenBlt().

◆ blend

ProcessSpans QSpanData::blend

◆ clip

const QClipData* QSpanData::clip

◆ dx

qreal QSpanData::dx

◆ dy

qreal QSpanData::dy

◆ fast_matrix

int QSpanData::fast_matrix

◆ fillRect

RectFillFunc QSpanData::fillRect

Definition at line 325 of file qdrawhelper_p.h.

Referenced by fillRect_normalized().

◆ gradient

QGradientData QSpanData::gradient

◆ m11

qreal QSpanData::m11

◆ m12

qreal QSpanData::m12

◆ m13

qreal QSpanData::m13

◆ m21

qreal QSpanData::m21

◆ m22

qreal QSpanData::m22

◆ m23

qreal QSpanData::m23

◆ m33

qreal QSpanData::m33

◆ rasterBuffer

QRasterBuffer* QSpanData::rasterBuffer

◆ rasterEngine

QRasterPaintEngine* QSpanData::rasterEngine

Definition at line 318 of file qdrawhelper_p.h.

Referenced by drawBufferSpan().

◆ solid

QSolidData QSpanData::solid

◆ tempImage

QImage* QSpanData::tempImage

Definition at line 339 of file qdrawhelper_p.h.

Referenced by QRasterPaintEngineState::QRasterPaintEngineState().

◆ texture

QTextureData QSpanData::texture

Definition at line 343 of file qdrawhelper_p.h.

Referenced by blend_tiled_argb(), blend_tiled_argb4444(), blend_tiled_argb6666(), blend_tiled_argb8555(), blend_tiled_argb8565(), blend_tiled_generic(), blend_tiled_rgb444(), blend_tiled_rgb555(), blend_tiled_rgb565(), blend_tiled_rgb666(), blend_tiled_rgb888(), blend_transformed_argb(), blend_transformed_argb4444(), blend_transformed_argb6666(), blend_transformed_argb8555(), blend_transformed_argb8565(), blend_transformed_bilinear_argb4444(), blend_transformed_bilinear_argb6666(), blend_transformed_bilinear_argb8555(), blend_transformed_bilinear_argb8565(), blend_transformed_bilinear_rgb444(), blend_transformed_bilinear_rgb555(), blend_transformed_bilinear_rgb565(), blend_transformed_bilinear_rgb666(), blend_transformed_bilinear_rgb888(), blend_transformed_rgb444(), blend_transformed_rgb555(), blend_transformed_rgb565(), blend_transformed_rgb666(), blend_transformed_rgb888(), blend_transformed_tiled_argb(), blend_transformed_tiled_argb4444(), blend_transformed_tiled_argb6666(), blend_transformed_tiled_argb8555(), blend_transformed_tiled_argb8565(), blend_transformed_tiled_rgb444(), blend_transformed_tiled_rgb555(), blend_transformed_tiled_rgb565(), blend_transformed_tiled_rgb666(), blend_transformed_tiled_rgb888(), blend_untransformed_argb(), blend_untransformed_argb4444(), blend_untransformed_argb6666(), blend_untransformed_argb8555(), blend_untransformed_argb8565(), blend_untransformed_generic(), blend_untransformed_rgb444(), blend_untransformed_rgb555(), blend_untransformed_rgb565(), blend_untransformed_rgb666(), blend_untransformed_rgb888(), blendTiled(), blendTransformed(), blendTransformedBilinear(), blendTransformedTiled(), blendUntransformed(), fetchTransformed(), fetchTransformedBilinear(), getBlendType(), getOperator(), handleSpans(), and qt_fetchUntransformed().

◆ txop

int QSpanData::txop

◆ type

enum QSpanData::Type QSpanData::type

◆ unclipped_blend

ProcessSpans QSpanData::unclipped_blend

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