| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpaintengine_raster.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||
| 16 | class QRectVectorPath : public QVectorPath { | - | ||||||||||||||||||||||||||||||
| 17 | public: | - | ||||||||||||||||||||||||||||||
| 18 | inline void set(const QRect &r) { | - | ||||||||||||||||||||||||||||||
| 19 | qreal left = r.x(); | - | ||||||||||||||||||||||||||||||
| 20 | qreal right = r.x() + r.width(); | - | ||||||||||||||||||||||||||||||
| 21 | qreal top = r.y(); | - | ||||||||||||||||||||||||||||||
| 22 | qreal bottom = r.y() + r.height(); | - | ||||||||||||||||||||||||||||||
| 23 | pts[0] = left; | - | ||||||||||||||||||||||||||||||
| 24 | pts[1] = top; | - | ||||||||||||||||||||||||||||||
| 25 | pts[2] = right; | - | ||||||||||||||||||||||||||||||
| 26 | pts[3] = top; | - | ||||||||||||||||||||||||||||||
| 27 | pts[4] = right; | - | ||||||||||||||||||||||||||||||
| 28 | pts[5] = bottom; | - | ||||||||||||||||||||||||||||||
| 29 | pts[6] = left; | - | ||||||||||||||||||||||||||||||
| 30 | pts[7] = bottom; | - | ||||||||||||||||||||||||||||||
| 31 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||||||||
| 33 | inline void set(const QRectF &r) { | - | ||||||||||||||||||||||||||||||
| 34 | qreal left = r.x(); | - | ||||||||||||||||||||||||||||||
| 35 | qreal right = r.x() + r.width(); | - | ||||||||||||||||||||||||||||||
| 36 | qreal top = r.y(); | - | ||||||||||||||||||||||||||||||
| 37 | qreal bottom = r.y() + r.height(); | - | ||||||||||||||||||||||||||||||
| 38 | pts[0] = left; | - | ||||||||||||||||||||||||||||||
| 39 | pts[1] = top; | - | ||||||||||||||||||||||||||||||
| 40 | pts[2] = right; | - | ||||||||||||||||||||||||||||||
| 41 | pts[3] = top; | - | ||||||||||||||||||||||||||||||
| 42 | pts[4] = right; | - | ||||||||||||||||||||||||||||||
| 43 | pts[5] = bottom; | - | ||||||||||||||||||||||||||||||
| 44 | pts[6] = left; | - | ||||||||||||||||||||||||||||||
| 45 | pts[7] = bottom; | - | ||||||||||||||||||||||||||||||
| 46 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 47 | inline QRectVectorPath(const QRect &r) | - | ||||||||||||||||||||||||||||||
| 48 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - | ||||||||||||||||||||||||||||||
| 49 | { | - | ||||||||||||||||||||||||||||||
| 50 | set(r); | - | ||||||||||||||||||||||||||||||
| 51 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 52 | inline QRectVectorPath(const QRectF &r) | - | ||||||||||||||||||||||||||||||
| 53 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - | ||||||||||||||||||||||||||||||
| 54 | { | - | ||||||||||||||||||||||||||||||
| 55 | set(r); | - | ||||||||||||||||||||||||||||||
| 56 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 57 | inline QRectVectorPath() | - | ||||||||||||||||||||||||||||||
| 58 | : QVectorPath(pts, 4, 0, QVectorPath::RectangleHint | QVectorPath::ImplicitClose) | - | ||||||||||||||||||||||||||||||
| 59 | { } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||||||||
| 61 | qreal pts[8]; | - | ||||||||||||||||||||||||||||||
| 62 | }; | - | ||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||
| 64 | __attribute__((visibility("default"))) extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); | - | ||||||||||||||||||||||||||||||
| 65 | static const qreal aliasedCoordinateDelta = 0.5 - 0.015625; | - | ||||||||||||||||||||||||||||||
| 66 | static void qt_span_fill_clipRect(int count, const QSpan *spans, void *userData); | - | ||||||||||||||||||||||||||||||
| 67 | static void qt_span_fill_clipped(int count, const QSpan *spans, void *userData); | - | ||||||||||||||||||||||||||||||
| 68 | static void qt_span_clip(int count, const QSpan *spans, void *userData); | - | ||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||
| 70 | struct ClipData | - | ||||||||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||||||||
| 72 | QClipData *oldClip; | - | ||||||||||||||||||||||||||||||
| 73 | QClipData *newClip; | - | ||||||||||||||||||||||||||||||
| 74 | Qt::ClipOperation operation; | - | ||||||||||||||||||||||||||||||
| 75 | }; | - | ||||||||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||||||||
| 77 | enum LineDrawMode { | - | ||||||||||||||||||||||||||||||
| 78 | LineDrawClipped, | - | ||||||||||||||||||||||||||||||
| 79 | LineDrawNormal, | - | ||||||||||||||||||||||||||||||
| 80 | LineDrawIncludeLastPixel | - | ||||||||||||||||||||||||||||||
| 81 | }; | - | ||||||||||||||||||||||||||||||
| 82 | - | |||||||||||||||||||||||||||||||
| 83 | static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 84 | ProcessSpans pen_func, ProcessSpans brush_func, | - | ||||||||||||||||||||||||||||||
| 85 | QSpanData *pen_data, QSpanData *brush_data); | - | ||||||||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||||||||
| 87 | struct QRasterFloatPoint { | - | ||||||||||||||||||||||||||||||
| 88 | qreal x; | - | ||||||||||||||||||||||||||||||
| 89 | qreal y; | - | ||||||||||||||||||||||||||||||
| 90 | }; | - | ||||||||||||||||||||||||||||||
| 91 | static void qt_ft_outline_move_to(qfixed x, qfixed y, void *data) | - | ||||||||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||||||||
| 93 | ((QOutlineMapper *) data)->moveTo(QPointF(x, y)); | - | ||||||||||||||||||||||||||||||
| 94 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||
| 96 | static void qt_ft_outline_line_to(qfixed x, qfixed y, void *data) | - | ||||||||||||||||||||||||||||||
| 97 | { | - | ||||||||||||||||||||||||||||||
| 98 | ((QOutlineMapper *) data)->lineTo(QPointF(x, y)); | - | ||||||||||||||||||||||||||||||
| 99 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||||||||
| 101 | static void qt_ft_outline_cubic_to(qfixed c1x, qfixed c1y, | - | ||||||||||||||||||||||||||||||
| 102 | qfixed c2x, qfixed c2y, | - | ||||||||||||||||||||||||||||||
| 103 | qfixed ex, qfixed ey, | - | ||||||||||||||||||||||||||||||
| 104 | void *data) | - | ||||||||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||||||||
| 106 | ((QOutlineMapper *) data)->curveTo(QPointF(c1x, c1y), | - | ||||||||||||||||||||||||||||||
| 107 | QPointF(c2x, c2y), | - | ||||||||||||||||||||||||||||||
| 108 | QPointF(ex, ey)); | - | ||||||||||||||||||||||||||||||
| 109 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 110 | QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : | - | ||||||||||||||||||||||||||||||
| 111 | QPaintEngineExPrivate(), | - | ||||||||||||||||||||||||||||||
| 112 | cachedLines(0) | - | ||||||||||||||||||||||||||||||
| 113 | { | - | ||||||||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 115 | QRasterPaintEngine::QRasterPaintEngine(QPaintDevice *device) | - | ||||||||||||||||||||||||||||||
| 116 | : QPaintEngineEx(*(new QRasterPaintEnginePrivate)) | - | ||||||||||||||||||||||||||||||
| 117 | { | - | ||||||||||||||||||||||||||||||
| 118 | d_func()->device = device; | - | ||||||||||||||||||||||||||||||
| 119 | init(); | - | ||||||||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||
| 124 | - | |||||||||||||||||||||||||||||||
| 125 | QRasterPaintEngine::QRasterPaintEngine(QRasterPaintEnginePrivate &dd, QPaintDevice *device) | - | ||||||||||||||||||||||||||||||
| 126 | : QPaintEngineEx(dd) | - | ||||||||||||||||||||||||||||||
| 127 | { | - | ||||||||||||||||||||||||||||||
| 128 | d_func()->device = device; | - | ||||||||||||||||||||||||||||||
| 129 | init(); | - | ||||||||||||||||||||||||||||||
| 130 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||
| 132 | void QRasterPaintEngine::init() | - | ||||||||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||||||||
| 134 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||||||||
| 142 | d->grayRaster.reset(new QT_FT_Raster); | - | ||||||||||||||||||||||||||||||
| 143 | do {if(!(d->grayRaster.data())
never executed: } while (0);qt_check_pointer(__FILE__,364); | 0 | ||||||||||||||||||||||||||||||
| 144 | if (qt_ft_grays_raster.raster_new(d->grayRaster.data())
| 0 | ||||||||||||||||||||||||||||||
| 145 | qt_noop(); never executed: qt_noop(); | 0 | ||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | - | |||||||||||||||||||||||||||||||
| 148 | d->rasterizer.reset(new QRasterizer); | - | ||||||||||||||||||||||||||||||
| 149 | d->rasterBuffer.reset(new QRasterBuffer()); | - | ||||||||||||||||||||||||||||||
| 150 | d->outlineMapper.reset(new QOutlineMapper); | - | ||||||||||||||||||||||||||||||
| 151 | d->outlinemapper_xform_dirty = true; | - | ||||||||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||||||||
| 153 | d->basicStroker.setMoveToHook(qt_ft_outline_move_to); | - | ||||||||||||||||||||||||||||||
| 154 | d->basicStroker.setLineToHook(qt_ft_outline_line_to); | - | ||||||||||||||||||||||||||||||
| 155 | d->basicStroker.setCubicToHook(qt_ft_outline_cubic_to); | - | ||||||||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||||||||
| 157 | d->baseClip.reset(new QClipData(d->device->height())); | - | ||||||||||||||||||||||||||||||
| 158 | d->baseClip->setClipRect(QRect(0, 0, d->device->width(), d->device->height())); | - | ||||||||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||||||||
| 160 | d->image_filler.init(d->rasterBuffer.data(), this); | - | ||||||||||||||||||||||||||||||
| 161 | d->image_filler.type = QSpanData::Texture; | - | ||||||||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||||||||
| 163 | d->image_filler_xform.init(d->rasterBuffer.data(), this); | - | ||||||||||||||||||||||||||||||
| 164 | d->image_filler_xform.type = QSpanData::Texture; | - | ||||||||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||||||||
| 166 | d->solid_color_filler.init(d->rasterBuffer.data(), this); | - | ||||||||||||||||||||||||||||||
| 167 | d->solid_color_filler.type = QSpanData::Solid; | - | ||||||||||||||||||||||||||||||
| 168 | - | |||||||||||||||||||||||||||||||
| 169 | d->deviceDepth = d->device->depth(); | - | ||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||
| 171 | d->mono_surface = false; | - | ||||||||||||||||||||||||||||||
| 172 | gccaps &= ~PorterDuff; | - | ||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||
| 174 | QImage::Format format = QImage::Format_Invalid; | - | ||||||||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||||||||
| 176 | switch (d->device->devType()) { | - | ||||||||||||||||||||||||||||||
| 177 | case never executed: QInternal::Pixmap:case QInternal::Pixmap:never executed: case QInternal::Pixmap: | 0 | ||||||||||||||||||||||||||||||
| 178 | QMessageLogger(__FILE__, 399, __PRETTY_FUNCTION__).warning("QRasterPaintEngine: unsupported for pixmaps..."); | - | ||||||||||||||||||||||||||||||
| 179 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 180 | case never executed: QInternal::Image:case QInternal::Image:never executed: case QInternal::Image: | 0 | ||||||||||||||||||||||||||||||
| 181 | format = d->rasterBuffer->prepare(static_cast<QImage *>(d->device)); | - | ||||||||||||||||||||||||||||||
| 182 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 183 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 184 | QMessageLogger(__FILE__, 405, __PRETTY_FUNCTION__).warning("QRasterPaintEngine: unsupported target device %d\n", d->device->devType()); | - | ||||||||||||||||||||||||||||||
| 185 | d->device = 0; | - | ||||||||||||||||||||||||||||||
| 186 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 187 | } | - | ||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||
| 189 | switch (format) { | - | ||||||||||||||||||||||||||||||
| 190 | case never executed: QImage::Format_MonoLSB:case QImage::Format_MonoLSB:never executed: case QImage::Format_MonoLSB: | 0 | ||||||||||||||||||||||||||||||
| 191 | case never executed: QImage::Format_Mono:case QImage::Format_Mono:never executed: case QImage::Format_Mono: | 0 | ||||||||||||||||||||||||||||||
| 192 | d->mono_surface = true; | - | ||||||||||||||||||||||||||||||
| 193 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 194 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 195 | if (QImage::toPixelFormat(format).alphaUsage() == QPixelFormat::UsesAlpha
| 0 | ||||||||||||||||||||||||||||||
| 196 | gccaps |= PorterDuff; never executed: gccaps |= PorterDuff; | 0 | ||||||||||||||||||||||||||||||
| 197 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 198 | } | - | ||||||||||||||||||||||||||||||
| 199 | } | - | ||||||||||||||||||||||||||||||
| 200 | - | |||||||||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||||||||
| 205 | QRasterPaintEngine::~QRasterPaintEngine() | - | ||||||||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||||||||
| 207 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||||||||
| 209 | qt_ft_grays_raster.raster_done(*d->grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||||||||
| 215 | bool QRasterPaintEngine::begin(QPaintDevice *device) | - | ||||||||||||||||||||||||||||||
| 216 | { | - | ||||||||||||||||||||||||||||||
| 217 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||||||||
| 219 | if (device->devType() == QInternal::Pixmap
| 0 | ||||||||||||||||||||||||||||||
| 220 | QPixmap *pixmap = static_cast<QPixmap *>(device); | - | ||||||||||||||||||||||||||||||
| 221 | QPlatformPixmap *pd = pixmap->handle(); | - | ||||||||||||||||||||||||||||||
| 222 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 223 | d->device = pd->buffer(); never executed: d->device = pd->buffer(); | 0 | ||||||||||||||||||||||||||||||
| 224 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 225 | d->device = device; | - | ||||||||||||||||||||||||||||||
| 226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||||||||
| 229 | d->pdev = d->device; | - | ||||||||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||||||||
| 231 | ((!(d->device->devType() == QInternal::Image || d->device->devType() == QInternal::CustomRaster)) ? qt_assert("d->device->devType() == QInternal::Image || d->device->devType() == QInternal::CustomRaster", | - | ||||||||||||||||||||||||||||||
| 232 | __FILE__ | - | ||||||||||||||||||||||||||||||
| 233 | , | - | ||||||||||||||||||||||||||||||
| 234 | 453 | - | ||||||||||||||||||||||||||||||
| 235 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||
| 236 | ; | - | ||||||||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||||||||
| 238 | d->systemStateChanged(); | - | ||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||
| 240 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 241 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 242 | d->outlineMapper->m_clip_rect = d->deviceRect; | - | ||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||
| 244 | if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 245 | d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT); never executed: d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT); | 0 | ||||||||||||||||||||||||||||||
| 246 | if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 247 | d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT); never executed: d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT); | 0 | ||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||
| 249 | d->rasterizer->setClipRect(d->deviceRect); | - | ||||||||||||||||||||||||||||||
| 250 | - | |||||||||||||||||||||||||||||||
| 251 | s->penData.init(d->rasterBuffer.data(), this); | - | ||||||||||||||||||||||||||||||
| 252 | s->penData.setup(s->pen.brush(), s->intOpacity, s->composition_mode); | - | ||||||||||||||||||||||||||||||
| 253 | s->stroker = &d->basicStroker; | - | ||||||||||||||||||||||||||||||
| 254 | d->basicStroker.setClipRect(d->deviceRect); | - | ||||||||||||||||||||||||||||||
| 255 | - | |||||||||||||||||||||||||||||||
| 256 | s->brushData.init(d->rasterBuffer.data(), this); | - | ||||||||||||||||||||||||||||||
| 257 | s->brushData.setup(s->brush, s->intOpacity, s->composition_mode); | - | ||||||||||||||||||||||||||||||
| 258 | - | |||||||||||||||||||||||||||||||
| 259 | d->rasterBuffer->compositionMode = QPainter::CompositionMode_SourceOver; | - | ||||||||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||||||||
| 261 | setDirty(DirtyBrushOrigin); | - | ||||||||||||||||||||||||||||||
| 262 | if (d->mono_surface
| 0 | ||||||||||||||||||||||||||||||
| 263 | d->glyphCacheFormat = QFontEngine::Format_Mono; never executed: d->glyphCacheFormat = QFontEngine::Format_Mono; | 0 | ||||||||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||||||||
| 267 | else if (false) | - | ||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||
| 269 | { dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 270 | QImage::Format format = static_cast<QImage *>(d->device)->format(); dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 271 | if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 272 | d->glyphCacheFormat = QFontEngine::Format_A32; dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 273 | else dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 274 | d->glyphCacheFormat = QFontEngine::Format_A8; dead code: { QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 275 | } dead code: else{ QImage::Format format = static_cast<QImage *>(d->device)->format(); if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32) d->glyphCacheFormat = QFontEngine::Format_A32; else d->glyphCacheFormat = QFontEngine::Format_A8; } | - | ||||||||||||||||||||||||||||||
| 276 | d->glyphCacheFormat = QFontEngine::Format_A8; never executed: d->glyphCacheFormat = QFontEngine::Format_A8; | 0 | ||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | setActive(true); | - | ||||||||||||||||||||||||||||||
| 279 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 280 | } | - | ||||||||||||||||||||||||||||||
| 281 | - | |||||||||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||||||||
| 283 | - | |||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||
| 285 | bool QRasterPaintEngine::end() | - | ||||||||||||||||||||||||||||||
| 286 | { | - | ||||||||||||||||||||||||||||||
| 287 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 288 | } | - | ||||||||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||||||||
| 293 | void QRasterPaintEngine::releaseBuffer() | - | ||||||||||||||||||||||||||||||
| 294 | { | - | ||||||||||||||||||||||||||||||
| 295 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 296 | d->rasterBuffer.reset(new QRasterBuffer); | - | ||||||||||||||||||||||||||||||
| 297 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||||||||
| 301 | - | |||||||||||||||||||||||||||||||
| 302 | QSize QRasterPaintEngine::size() const | - | ||||||||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||||||||
| 304 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 305 | return never executed: QSize(d->rasterBuffer->width(), d->rasterBuffer->height());return QSize(d->rasterBuffer->width(), d->rasterBuffer->height());never executed: return QSize(d->rasterBuffer->width(), d->rasterBuffer->height()); | 0 | ||||||||||||||||||||||||||||||
| 306 | } | - | ||||||||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||||||||
| 311 | - | |||||||||||||||||||||||||||||||
| 312 | void QRasterPaintEngine::saveBuffer(const QString &s) const | - | ||||||||||||||||||||||||||||||
| 313 | { | - | ||||||||||||||||||||||||||||||
| 314 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 315 | d->rasterBuffer->bufferImage().save(s, "PNG"); | - | ||||||||||||||||||||||||||||||
| 316 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||
| 322 | void QRasterPaintEngine::updateMatrix(const QTransform &matrix) | - | ||||||||||||||||||||||||||||||
| 323 | { | - | ||||||||||||||||||||||||||||||
| 324 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 325 | - | |||||||||||||||||||||||||||||||
| 326 | s->matrix = matrix; | - | ||||||||||||||||||||||||||||||
| 327 | QTransform::TransformationType txop = s->matrix.type(); | - | ||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||
| 329 | switch (txop) { | - | ||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||
| 331 | case never executed: QTransform::TxNone:case QTransform::TxNone:never executed: case QTransform::TxNone: | 0 | ||||||||||||||||||||||||||||||
| 332 | s->flags.int_xform = true; | - | ||||||||||||||||||||||||||||||
| 333 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||
| 335 | case never executed: QTransform::TxTranslate:case QTransform::TxTranslate:never executed: case QTransform::TxTranslate: | 0 | ||||||||||||||||||||||||||||||
| 336 | s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
| 0 | ||||||||||||||||||||||||||||||
| 337 | && qreal(int(s->matrix.dy())) == s->matrix.dy()
| 0 | ||||||||||||||||||||||||||||||
| 338 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||||||||
| 340 | case never executed: QTransform::TxScale:case QTransform::TxScale:never executed: case QTransform::TxScale: | 0 | ||||||||||||||||||||||||||||||
| 341 | s->flags.int_xform = qreal(int(s->matrix.dx())) == s->matrix.dx()
| 0 | ||||||||||||||||||||||||||||||
| 342 | && qreal(int(s->matrix.dy())) == s->matrix.dy()
| 0 | ||||||||||||||||||||||||||||||
| 343 | && qreal(int(s->matrix.m11())) == s->matrix.m11()
| 0 | ||||||||||||||||||||||||||||||
| 344 | && qreal(int(s->matrix.m22())) == s->matrix.m22()
| 0 | ||||||||||||||||||||||||||||||
| 345 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||||||||
| 347 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 348 | s->flags.int_xform = false; | - | ||||||||||||||||||||||||||||||
| 349 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 350 | } | - | ||||||||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||||||||
| 352 | s->flags.tx_noshear = qt_scaleForTransform(s->matrix, &s->txscale); | - | ||||||||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||||||||
| 354 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 355 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||||||||
| 359 | QRasterPaintEngineState::~QRasterPaintEngineState() | - | ||||||||||||||||||||||||||||||
| 360 | { | - | ||||||||||||||||||||||||||||||
| 361 | if (flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 362 | delete clip; never executed: delete clip; | 0 | ||||||||||||||||||||||||||||||
| 363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 364 | - | |||||||||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||||||||
| 366 | QRasterPaintEngineState::QRasterPaintEngineState() | - | ||||||||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||||||||
| 368 | stroker = 0; | - | ||||||||||||||||||||||||||||||
| 369 | - | |||||||||||||||||||||||||||||||
| 370 | fillFlags = 0; | - | ||||||||||||||||||||||||||||||
| 371 | strokeFlags = 0; | - | ||||||||||||||||||||||||||||||
| 372 | pixmapFlags = 0; | - | ||||||||||||||||||||||||||||||
| 373 | - | |||||||||||||||||||||||||||||||
| 374 | intOpacity = 256; | - | ||||||||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||||||||
| 376 | txscale = 1.; | - | ||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||
| 378 | flags.fast_pen = true; | - | ||||||||||||||||||||||||||||||
| 379 | flags.antialiased = false; | - | ||||||||||||||||||||||||||||||
| 380 | flags.bilinear = false; | - | ||||||||||||||||||||||||||||||
| 381 | flags.legacy_rounding = false; | - | ||||||||||||||||||||||||||||||
| 382 | flags.fast_text = true; | - | ||||||||||||||||||||||||||||||
| 383 | flags.int_xform = true; | - | ||||||||||||||||||||||||||||||
| 384 | flags.tx_noshear = true; | - | ||||||||||||||||||||||||||||||
| 385 | flags.fast_images = true; | - | ||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||
| 387 | clip = 0; | - | ||||||||||||||||||||||||||||||
| 388 | flags.has_clip_ownership = false; | - | ||||||||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||||||||
| 390 | dirty = 0; | - | ||||||||||||||||||||||||||||||
| 391 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||||||||
| 393 | QRasterPaintEngineState::QRasterPaintEngineState(QRasterPaintEngineState &s) | - | ||||||||||||||||||||||||||||||
| 394 | : QPainterState(s) | - | ||||||||||||||||||||||||||||||
| 395 | , lastPen(s.lastPen) | - | ||||||||||||||||||||||||||||||
| 396 | , penData(s.penData) | - | ||||||||||||||||||||||||||||||
| 397 | , stroker(s.stroker) | - | ||||||||||||||||||||||||||||||
| 398 | , strokeFlags(s.strokeFlags) | - | ||||||||||||||||||||||||||||||
| 399 | , lastBrush(s.lastBrush) | - | ||||||||||||||||||||||||||||||
| 400 | , brushData(s.brushData) | - | ||||||||||||||||||||||||||||||
| 401 | , fillFlags(s.fillFlags) | - | ||||||||||||||||||||||||||||||
| 402 | , pixmapFlags(s.pixmapFlags) | - | ||||||||||||||||||||||||||||||
| 403 | , intOpacity(s.intOpacity) | - | ||||||||||||||||||||||||||||||
| 404 | , txscale(s.txscale) | - | ||||||||||||||||||||||||||||||
| 405 | , clip(s.clip) | - | ||||||||||||||||||||||||||||||
| 406 | , dirty(s.dirty) | - | ||||||||||||||||||||||||||||||
| 407 | , flag_bits(s.flag_bits) | - | ||||||||||||||||||||||||||||||
| 408 | { | - | ||||||||||||||||||||||||||||||
| 409 | brushData.tempImage = 0; | - | ||||||||||||||||||||||||||||||
| 410 | penData.tempImage = 0; | - | ||||||||||||||||||||||||||||||
| 411 | flags.has_clip_ownership = false; | - | ||||||||||||||||||||||||||||||
| 412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 413 | - | |||||||||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||
| 416 | - | |||||||||||||||||||||||||||||||
| 417 | QPainterState *QRasterPaintEngine::createState(QPainterState *orig) const | - | ||||||||||||||||||||||||||||||
| 418 | { | - | ||||||||||||||||||||||||||||||
| 419 | QRasterPaintEngineState *s; | - | ||||||||||||||||||||||||||||||
| 420 | if (!orig
| 0 | ||||||||||||||||||||||||||||||
| 421 | s = new QRasterPaintEngineState(); never executed: s = new QRasterPaintEngineState(); | 0 | ||||||||||||||||||||||||||||||
| 422 | else | - | ||||||||||||||||||||||||||||||
| 423 | s = new QRasterPaintEngineState(*static_cast<QRasterPaintEngineState *>(orig)); never executed: s = new QRasterPaintEngineState(*static_cast<QRasterPaintEngineState *>(orig)); | 0 | ||||||||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||||||||
| 425 | return never executed: s;return s;never executed: return s; | 0 | ||||||||||||||||||||||||||||||
| 426 | } | - | ||||||||||||||||||||||||||||||
| 427 | - | |||||||||||||||||||||||||||||||
| 428 | - | |||||||||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||
| 431 | void QRasterPaintEngine::setState(QPainterState *s) | - | ||||||||||||||||||||||||||||||
| 432 | { | - | ||||||||||||||||||||||||||||||
| 433 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 434 | QPaintEngineEx::setState(s); | - | ||||||||||||||||||||||||||||||
| 435 | d->rasterBuffer->compositionMode = s->composition_mode; | - | ||||||||||||||||||||||||||||||
| 436 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 437 | void QRasterPaintEngine::penChanged() | - | ||||||||||||||||||||||||||||||
| 438 | { | - | ||||||||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||||||||
| 442 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 443 | ((!(s)) ? qt_assert("s",__FILE__,692) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 444 | s->strokeFlags |= DirtyPen; | - | ||||||||||||||||||||||||||||||
| 445 | s->dirty |= DirtyPen; | - | ||||||||||||||||||||||||||||||
| 446 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||||||||
| 451 | void QRasterPaintEngine::updatePen(const QPen &pen) | - | ||||||||||||||||||||||||||||||
| 452 | { | - | ||||||||||||||||||||||||||||||
| 453 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 454 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||||||||
| 459 | Qt::PenStyle pen_style = qpen_style(pen); | - | ||||||||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||||||||
| 461 | s->lastPen = pen; | - | ||||||||||||||||||||||||||||||
| 462 | s->strokeFlags = 0; | - | ||||||||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||||||||
| 464 | s->penData.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 465 | s->penData.setup(pen_style == Qt::NoPen ? QBrush() : pen.brush(), s->intOpacity, s->composition_mode); | - | ||||||||||||||||||||||||||||||
| 466 | - | |||||||||||||||||||||||||||||||
| 467 | if (s->strokeFlags & QRasterPaintEngine::DirtyTransform
| 0 | ||||||||||||||||||||||||||||||
| 468 | || pen.brush().transform().type() >= QTransform::TxNone
| 0 | ||||||||||||||||||||||||||||||
| 469 | d->updateMatrixData(&s->penData, pen.brush(), s->matrix); | - | ||||||||||||||||||||||||||||||
| 470 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 471 | - | |||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||||||||
| 474 | - | |||||||||||||||||||||||||||||||
| 475 | if (pen_style == Qt::CustomDashLine
| 0 | ||||||||||||||||||||||||||||||
| 476 | pen_style = Qt::SolidLine; | - | ||||||||||||||||||||||||||||||
| 477 | s->lastPen.setStyle(Qt::SolidLine); | - | ||||||||||||||||||||||||||||||
| 478 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||||||||
| 480 | d->basicStroker.setJoinStyle(qpen_joinStyle(pen)); | - | ||||||||||||||||||||||||||||||
| 481 | d->basicStroker.setCapStyle(qpen_capStyle(pen)); | - | ||||||||||||||||||||||||||||||
| 482 | d->basicStroker.setMiterLimit(pen.miterLimit()); | - | ||||||||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||||||||
| 484 | qreal penWidth = qpen_widthf(pen); | - | ||||||||||||||||||||||||||||||
| 485 | if (penWidth == 0
| 0 | ||||||||||||||||||||||||||||||
| 486 | d->basicStroker.setStrokeWidth(1); never executed: d->basicStroker.setStrokeWidth(1); | 0 | ||||||||||||||||||||||||||||||
| 487 | else | - | ||||||||||||||||||||||||||||||
| 488 | d->basicStroker.setStrokeWidth(penWidth); never executed: d->basicStroker.setStrokeWidth(penWidth); | 0 | ||||||||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||||||||
| 490 | if(pen_style == Qt::SolidLine
| 0 | ||||||||||||||||||||||||||||||
| 491 | s->stroker = &d->basicStroker; | - | ||||||||||||||||||||||||||||||
| 492 | } never executed: else if (pen_style != Qt::NoPenend of block
| 0 | ||||||||||||||||||||||||||||||
| 493 | if (!d->dashStroker
| 0 | ||||||||||||||||||||||||||||||
| 494 | d->dashStroker.reset(new QDashStroker(&d->basicStroker)); never executed: d->dashStroker.reset(new QDashStroker(&d->basicStroker)); | 0 | ||||||||||||||||||||||||||||||
| 495 | if (qt_pen_is_cosmetic(pen, s->renderHints)
| 0 | ||||||||||||||||||||||||||||||
| 496 | d->dashStroker->setClipRect(d->deviceRect); | - | ||||||||||||||||||||||||||||||
| 497 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||||||||
| 499 | QRectF clipRect = s->matrix.inverted().mapRect(QRectF(d->deviceRect)); | - | ||||||||||||||||||||||||||||||
| 500 | d->dashStroker->setClipRect(clipRect); | - | ||||||||||||||||||||||||||||||
| 501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 502 | d->dashStroker->setDashPattern(pen.dashPattern()); | - | ||||||||||||||||||||||||||||||
| 503 | d->dashStroker->setDashOffset(pen.dashOffset()); | - | ||||||||||||||||||||||||||||||
| 504 | s->stroker = d->dashStroker.data(); | - | ||||||||||||||||||||||||||||||
| 505 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 506 | s->stroker = 0; | - | ||||||||||||||||||||||||||||||
| 507 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||
| 509 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 510 | bool cosmetic = qt_pen_is_cosmetic(pen, s->renderHints); | - | ||||||||||||||||||||||||||||||
| 511 | s->flags.fast_pen = pen_style > Qt::NoPen
| 0 | ||||||||||||||||||||||||||||||
| 512 | && s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 513 | && ((cosmetic
| 0 | ||||||||||||||||||||||||||||||
| 514 | || (!cosmetic
| 0 | ||||||||||||||||||||||||||||||
| 515 | - | |||||||||||||||||||||||||||||||
| 516 | s->flags.non_complex_pen = qpen_capStyle(s->lastPen) <= Qt::SquareCap
| 0 | ||||||||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||||||||
| 518 | s->strokeFlags = 0; | - | ||||||||||||||||||||||||||||||
| 519 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||||||||
| 526 | void QRasterPaintEngine::brushOriginChanged() | - | ||||||||||||||||||||||||||||||
| 527 | { | - | ||||||||||||||||||||||||||||||
| 528 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 529 | - | |||||||||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||||||||
| 533 | s->fillFlags |= DirtyBrushOrigin; | - | ||||||||||||||||||||||||||||||
| 534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||
| 540 | void QRasterPaintEngine::brushChanged() | - | ||||||||||||||||||||||||||||||
| 541 | { | - | ||||||||||||||||||||||||||||||
| 542 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||
| 545 | - | |||||||||||||||||||||||||||||||
| 546 | s->fillFlags |= DirtyBrush; | - | ||||||||||||||||||||||||||||||
| 547 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||||||||
| 549 | - | |||||||||||||||||||||||||||||||
| 550 | - | |||||||||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||||||||
| 552 | - | |||||||||||||||||||||||||||||||
| 553 | - | |||||||||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||||||||
| 555 | void QRasterPaintEngine::updateBrush(const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 556 | { | - | ||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||||||||
| 560 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 561 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||||||||
| 563 | s->brushData.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 564 | s->brushData.setup(brush, s->intOpacity, s->composition_mode); | - | ||||||||||||||||||||||||||||||
| 565 | if (s->fillFlags & DirtyTransform
| 0 | ||||||||||||||||||||||||||||||
| 566 | || brush.transform().type() >= QTransform::TxNone
| 0 | ||||||||||||||||||||||||||||||
| 567 | d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix()); never executed: d_func()->updateMatrixData(&s->brushData, brush, d->brushMatrix()); | 0 | ||||||||||||||||||||||||||||||
| 568 | s->lastBrush = brush; | - | ||||||||||||||||||||||||||||||
| 569 | s->fillFlags = 0; | - | ||||||||||||||||||||||||||||||
| 570 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||
| 572 | void QRasterPaintEngine::updateOutlineMapper() | - | ||||||||||||||||||||||||||||||
| 573 | { | - | ||||||||||||||||||||||||||||||
| 574 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 575 | d->outlineMapper->setMatrix(state()->matrix); | - | ||||||||||||||||||||||||||||||
| 576 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 577 | - | |||||||||||||||||||||||||||||||
| 578 | void QRasterPaintEngine::updateRasterState() | - | ||||||||||||||||||||||||||||||
| 579 | { | - | ||||||||||||||||||||||||||||||
| 580 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||||||||
| 582 | if (s->dirty & DirtyTransform
| 0 | ||||||||||||||||||||||||||||||
| 583 | updateMatrix(s->matrix); never executed: updateMatrix(s->matrix); | 0 | ||||||||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||||||||
| 585 | if (s->dirty & (DirtyPen|DirtyCompositionMode|DirtyOpacity)
| 0 | ||||||||||||||||||||||||||||||
| 586 | const QPainter::CompositionMode mode = s->composition_mode; | - | ||||||||||||||||||||||||||||||
| 587 | s->flags.fast_text = (
| 0 | ||||||||||||||||||||||||||||||
| 588 | && s->intOpacity == 256
| 0 | ||||||||||||||||||||||||||||||
| 589 | && (mode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 590 | || (mode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 591 | && s->penData.solid.color.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 592 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||||||||
| 594 | s->dirty = 0; | - | ||||||||||||||||||||||||||||||
| 595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||||||||
| 601 | void QRasterPaintEngine::opacityChanged() | - | ||||||||||||||||||||||||||||||
| 602 | { | - | ||||||||||||||||||||||||||||||
| 603 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||||||||
| 605 | - | |||||||||||||||||||||||||||||||
| 606 | - | |||||||||||||||||||||||||||||||
| 607 | - | |||||||||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||||||||
| 609 | s->fillFlags |= DirtyOpacity; | - | ||||||||||||||||||||||||||||||
| 610 | s->strokeFlags |= DirtyOpacity; | - | ||||||||||||||||||||||||||||||
| 611 | s->pixmapFlags |= DirtyOpacity; | - | ||||||||||||||||||||||||||||||
| 612 | s->dirty |= DirtyOpacity; | - | ||||||||||||||||||||||||||||||
| 613 | s->intOpacity = (int) (s->opacity * 256); | - | ||||||||||||||||||||||||||||||
| 614 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||
| 618 | - | |||||||||||||||||||||||||||||||
| 619 | void QRasterPaintEngine::compositionModeChanged() | - | ||||||||||||||||||||||||||||||
| 620 | { | - | ||||||||||||||||||||||||||||||
| 621 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 622 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||||||||
| 624 | - | |||||||||||||||||||||||||||||||
| 625 | - | |||||||||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||||||||
| 628 | s->fillFlags |= DirtyCompositionMode; | - | ||||||||||||||||||||||||||||||
| 629 | s->dirty |= DirtyCompositionMode; | - | ||||||||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||||||||
| 631 | s->strokeFlags |= DirtyCompositionMode; | - | ||||||||||||||||||||||||||||||
| 632 | d->rasterBuffer->compositionMode = s->composition_mode; | - | ||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||
| 634 | d->recalculateFastImages(); | - | ||||||||||||||||||||||||||||||
| 635 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||||||||
| 638 | - | |||||||||||||||||||||||||||||||
| 639 | - | |||||||||||||||||||||||||||||||
| 640 | void QRasterPaintEngine::renderHintsChanged() | - | ||||||||||||||||||||||||||||||
| 641 | { | - | ||||||||||||||||||||||||||||||
| 642 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||||||||
| 646 | - | |||||||||||||||||||||||||||||||
| 647 | - | |||||||||||||||||||||||||||||||
| 648 | bool was_aa = s->flags.antialiased; | - | ||||||||||||||||||||||||||||||
| 649 | bool was_bilinear = s->flags.bilinear; | - | ||||||||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||||||||
| 651 | s->flags.antialiased = bool(s->renderHints & (QPainter::Antialiasing | QPainter::HighQualityAntialiasing)); | - | ||||||||||||||||||||||||||||||
| 652 | s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||||||||
| 653 | s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing)
| 0 | ||||||||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||||||||
| 655 | if (was_aa != s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 656 | s->strokeFlags |= DirtyHints; never executed: s->strokeFlags |= DirtyHints; | 0 | ||||||||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||||||||
| 658 | if (was_bilinear != s->flags.bilinear
| 0 | ||||||||||||||||||||||||||||||
| 659 | s->strokeFlags |= DirtyPen; | - | ||||||||||||||||||||||||||||||
| 660 | s->fillFlags |= DirtyBrush; | - | ||||||||||||||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||||||||
| 663 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 664 | d->recalculateFastImages(); | - | ||||||||||||||||||||||||||||||
| 665 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||||||||
| 670 | void QRasterPaintEngine::transformChanged() | - | ||||||||||||||||||||||||||||||
| 671 | { | - | ||||||||||||||||||||||||||||||
| 672 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||||||||
| 675 | - | |||||||||||||||||||||||||||||||
| 676 | - | |||||||||||||||||||||||||||||||
| 677 | - | |||||||||||||||||||||||||||||||
| 678 | s->fillFlags |= DirtyTransform; | - | ||||||||||||||||||||||||||||||
| 679 | s->strokeFlags |= DirtyTransform; | - | ||||||||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||||||||
| 681 | s->dirty |= DirtyTransform; | - | ||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||
| 683 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 684 | d->recalculateFastImages(); | - | ||||||||||||||||||||||||||||||
| 685 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||||||||
| 687 | - | |||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||
| 689 | - | |||||||||||||||||||||||||||||||
| 690 | void QRasterPaintEngine::clipEnabledChanged() | - | ||||||||||||||||||||||||||||||
| 691 | { | - | ||||||||||||||||||||||||||||||
| 692 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||
| 698 | if (s->clip
| 0 | ||||||||||||||||||||||||||||||
| 699 | s->clip->enabled = s->clipEnabled; | - | ||||||||||||||||||||||||||||||
| 700 | s->fillFlags |= DirtyClipEnabled; | - | ||||||||||||||||||||||||||||||
| 701 | s->strokeFlags |= DirtyClipEnabled; | - | ||||||||||||||||||||||||||||||
| 702 | s->pixmapFlags |= DirtyClipEnabled; | - | ||||||||||||||||||||||||||||||
| 703 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 704 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 705 | - | |||||||||||||||||||||||||||||||
| 706 | void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, | - | ||||||||||||||||||||||||||||||
| 707 | const QImage &img, | - | ||||||||||||||||||||||||||||||
| 708 | SrcOverBlendFunc func, | - | ||||||||||||||||||||||||||||||
| 709 | const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 710 | int alpha, | - | ||||||||||||||||||||||||||||||
| 711 | const QRect &sr) | - | ||||||||||||||||||||||||||||||
| 712 | { | - | ||||||||||||||||||||||||||||||
| 713 | if (alpha == 0
| 0 | ||||||||||||||||||||||||||||||
| 714 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||||||||
| 716 | ((!(img.depth() >= 8)) ? qt_assert("img.depth() >= 8",__FILE__,965) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||||||||
| 718 | int srcBPL = img.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 719 | const uchar *srcBits = img.bits(); | - | ||||||||||||||||||||||||||||||
| 720 | int srcSize = img.depth() >> 3; | - | ||||||||||||||||||||||||||||||
| 721 | int iw = img.width(); | - | ||||||||||||||||||||||||||||||
| 722 | int ih = img.height(); | - | ||||||||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||||||||
| 724 | if (!sr.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 725 | iw = sr.width(); | - | ||||||||||||||||||||||||||||||
| 726 | ih = sr.height(); | - | ||||||||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||||||||
| 728 | srcBits += ((sr.y() * srcBPL) + sr.x() * srcSize); | - | ||||||||||||||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||||||||
| 732 | int x = qRound(pt.x()); | - | ||||||||||||||||||||||||||||||
| 733 | int cx1 = clip.x(); | - | ||||||||||||||||||||||||||||||
| 734 | int cx2 = clip.x() + clip.width(); | - | ||||||||||||||||||||||||||||||
| 735 | if (x < cx1
| 0 | ||||||||||||||||||||||||||||||
| 736 | int d = cx1 - x; | - | ||||||||||||||||||||||||||||||
| 737 | srcBits += srcSize * d; | - | ||||||||||||||||||||||||||||||
| 738 | iw -= d; | - | ||||||||||||||||||||||||||||||
| 739 | x = cx1; | - | ||||||||||||||||||||||||||||||
| 740 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 741 | if (x + iw > cx2
| 0 | ||||||||||||||||||||||||||||||
| 742 | int d = x + iw - cx2; | - | ||||||||||||||||||||||||||||||
| 743 | iw -= d; | - | ||||||||||||||||||||||||||||||
| 744 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 745 | if (iw <= 0
| 0 | ||||||||||||||||||||||||||||||
| 746 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||||||||
| 748 | - | |||||||||||||||||||||||||||||||
| 749 | int cy1 = clip.y(); | - | ||||||||||||||||||||||||||||||
| 750 | int cy2 = clip.y() + clip.height(); | - | ||||||||||||||||||||||||||||||
| 751 | int y = qRound(pt.y()); | - | ||||||||||||||||||||||||||||||
| 752 | if (y < cy1
| 0 | ||||||||||||||||||||||||||||||
| 753 | int d = cy1 - y; | - | ||||||||||||||||||||||||||||||
| 754 | srcBits += srcBPL * d; | - | ||||||||||||||||||||||||||||||
| 755 | ih -= d; | - | ||||||||||||||||||||||||||||||
| 756 | y = cy1; | - | ||||||||||||||||||||||||||||||
| 757 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 758 | if (y + ih > cy2
| 0 | ||||||||||||||||||||||||||||||
| 759 | int d = y + ih - cy2; | - | ||||||||||||||||||||||||||||||
| 760 | ih -= d; | - | ||||||||||||||||||||||||||||||
| 761 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 762 | if (ih <= 0
| 0 | ||||||||||||||||||||||||||||||
| 763 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||||||||
| 765 | - | |||||||||||||||||||||||||||||||
| 766 | int dstSize = rasterBuffer->bytesPerPixel(); | - | ||||||||||||||||||||||||||||||
| 767 | int dstBPL = rasterBuffer->bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 768 | func(rasterBuffer->buffer() + x * dstSize + y * dstBPL, dstBPL, | - | ||||||||||||||||||||||||||||||
| 769 | srcBits, srcBPL, | - | ||||||||||||||||||||||||||||||
| 770 | iw, ih, | - | ||||||||||||||||||||||||||||||
| 771 | alpha); | - | ||||||||||||||||||||||||||||||
| 772 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||||||||
| 775 | void QRasterPaintEnginePrivate::systemStateChanged() | - | ||||||||||||||||||||||||||||||
| 776 | { | - | ||||||||||||||||||||||||||||||
| 777 | deviceRectUnclipped = QRect(0, 0, | - | ||||||||||||||||||||||||||||||
| 778 | qMin(QT_RASTER_COORD_LIMIT, device->width()), | - | ||||||||||||||||||||||||||||||
| 779 | qMin(QT_RASTER_COORD_LIMIT, device->height())); | - | ||||||||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||||||||
| 781 | if (!systemClip.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 782 | QRegion clippedDeviceRgn = systemClip & deviceRectUnclipped; | - | ||||||||||||||||||||||||||||||
| 783 | deviceRect = clippedDeviceRgn.boundingRect(); | - | ||||||||||||||||||||||||||||||
| 784 | baseClip->setClipRegion(clippedDeviceRgn); | - | ||||||||||||||||||||||||||||||
| 785 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 786 | deviceRect = deviceRectUnclipped; | - | ||||||||||||||||||||||||||||||
| 787 | baseClip->setClipRect(deviceRect); | - | ||||||||||||||||||||||||||||||
| 788 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||||||||
| 793 | exDeviceRect = deviceRect; | - | ||||||||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||||||||
| 795 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 796 | if (q->state()
| 0 | ||||||||||||||||||||||||||||||
| 797 | q->state()->strokeFlags |= QPaintEngine::DirtyClipRegion; | - | ||||||||||||||||||||||||||||||
| 798 | q->state()->fillFlags |= QPaintEngine::DirtyClipRegion; | - | ||||||||||||||||||||||||||||||
| 799 | q->state()->pixmapFlags |= QPaintEngine::DirtyClipRegion; | - | ||||||||||||||||||||||||||||||
| 800 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 801 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 802 | - | |||||||||||||||||||||||||||||||
| 803 | void QRasterPaintEnginePrivate::updateMatrixData(QSpanData *spanData, const QBrush &b, const QTransform &m) | - | ||||||||||||||||||||||||||||||
| 804 | { | - | ||||||||||||||||||||||||||||||
| 805 | if (b.d->style == Qt::NoBrush
| 0 | ||||||||||||||||||||||||||||||
| 806 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 807 | - | |||||||||||||||||||||||||||||||
| 808 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 809 | bool bilinear = q->state()->flags.bilinear; | - | ||||||||||||||||||||||||||||||
| 810 | - | |||||||||||||||||||||||||||||||
| 811 | if (b.d->transform.type() > QTransform::TxNone
| 0 | ||||||||||||||||||||||||||||||
| 812 | spanData->setupMatrix(b.transform() * m, bilinear); | - | ||||||||||||||||||||||||||||||
| 813 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 814 | if (m.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 815 | - | |||||||||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||||||||
| 817 | spanData->m11 = 1; | - | ||||||||||||||||||||||||||||||
| 818 | spanData->m12 = 0; | - | ||||||||||||||||||||||||||||||
| 819 | spanData->m13 = 0; | - | ||||||||||||||||||||||||||||||
| 820 | spanData->m21 = 0; | - | ||||||||||||||||||||||||||||||
| 821 | spanData->m22 = 1; | - | ||||||||||||||||||||||||||||||
| 822 | spanData->m23 = 0; | - | ||||||||||||||||||||||||||||||
| 823 | spanData->m33 = 1; | - | ||||||||||||||||||||||||||||||
| 824 | spanData->dx = -m.dx(); | - | ||||||||||||||||||||||||||||||
| 825 | spanData->dy = -m.dy(); | - | ||||||||||||||||||||||||||||||
| 826 | spanData->txop = m.type(); | - | ||||||||||||||||||||||||||||||
| 827 | spanData->bilinear = bilinear; | - | ||||||||||||||||||||||||||||||
| 828 | spanData->fast_matrix = qAbs(m.dx()) < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 829 | spanData->adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 830 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 831 | spanData->setupMatrix(m, bilinear); | - | ||||||||||||||||||||||||||||||
| 832 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 833 | } | - | ||||||||||||||||||||||||||||||
| 834 | } | - | ||||||||||||||||||||||||||||||
| 835 | static void qrasterpaintengine_state_setNoClip(QRasterPaintEngineState *s) | - | ||||||||||||||||||||||||||||||
| 836 | { | - | ||||||||||||||||||||||||||||||
| 837 | if (s->flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 838 | delete s->clip; never executed: delete s->clip; | 0 | ||||||||||||||||||||||||||||||
| 839 | s->clip = 0; | - | ||||||||||||||||||||||||||||||
| 840 | s->flags.has_clip_ownership = false; | - | ||||||||||||||||||||||||||||||
| 841 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||
| 843 | static void qrasterpaintengine_dirty_clip(QRasterPaintEnginePrivate *d, QRasterPaintEngineState *s) | - | ||||||||||||||||||||||||||||||
| 844 | { | - | ||||||||||||||||||||||||||||||
| 845 | s->fillFlags |= QPaintEngine::DirtyClipPath; | - | ||||||||||||||||||||||||||||||
| 846 | s->strokeFlags |= QPaintEngine::DirtyClipPath; | - | ||||||||||||||||||||||||||||||
| 847 | s->pixmapFlags |= QPaintEngine::DirtyClipPath; | - | ||||||||||||||||||||||||||||||
| 848 | - | |||||||||||||||||||||||||||||||
| 849 | d->solid_color_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 850 | d->solid_color_filler.adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||||||||
| 856 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 857 | - | |||||||||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||||||||
| 859 | - | |||||||||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||||||||
| 862 | void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) | - | ||||||||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||||||||
| 864 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 865 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 866 | - | |||||||||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||||||||
| 868 | if (op != Qt::IntersectClip
| 0 | ||||||||||||||||||||||||||||||
| 869 | if (s->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 870 | && path.isRect()
| 0 | ||||||||||||||||||||||||||||||
| 871 | - | |||||||||||||||||||||||||||||||
| 872 | - | |||||||||||||||||||||||||||||||
| 873 | - | |||||||||||||||||||||||||||||||
| 874 | const qreal *points = path.points(); | - | ||||||||||||||||||||||||||||||
| 875 | QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); | - | ||||||||||||||||||||||||||||||
| 876 | if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op)
| 0 | ||||||||||||||||||||||||||||||
| 877 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 878 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 879 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 880 | - | |||||||||||||||||||||||||||||||
| 881 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||||||||
| 882 | qrasterpaintengine_state_setNoClip(s); | - | ||||||||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||||||||
| 884 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 885 | QClipData *base = d->baseClip.data(); | - | ||||||||||||||||||||||||||||||
| 886 | - | |||||||||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||||||||
| 888 | if (op == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||||||||
| 889 | base = s->clip; never executed: base = s->clip; | 0 | ||||||||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||||||||
| 894 | Qt::ClipOperation isectOp = Qt::IntersectClip; | - | ||||||||||||||||||||||||||||||
| 895 | if (base == 0
| 0 | ||||||||||||||||||||||||||||||
| 896 | isectOp = Qt::ReplaceClip; never executed: isectOp = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||||||||
| 898 | QClipData *newClip = new QClipData(d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 899 | newClip->initialize(); | - | ||||||||||||||||||||||||||||||
| 900 | ClipData clipData = { base, newClip, isectOp }; | - | ||||||||||||||||||||||||||||||
| 901 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 902 | d->rasterize(d->outlineMapper->convertPath(path), qt_span_clip, &clipData, 0); | - | ||||||||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||||||||
| 904 | newClip->fixup(); | - | ||||||||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||||||||
| 906 | if (s->flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 907 | delete s->clip; never executed: delete s->clip; | 0 | ||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||
| 909 | s->clip = newClip; | - | ||||||||||||||||||||||||||||||
| 910 | s->flags.has_clip_ownership = true; | - | ||||||||||||||||||||||||||||||
| 911 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 912 | qrasterpaintengine_dirty_clip(d, s); | - | ||||||||||||||||||||||||||||||
| 913 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||||||||
| 918 | - | |||||||||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||||||||
| 920 | void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) | - | ||||||||||||||||||||||||||||||
| 921 | { | - | ||||||||||||||||||||||||||||||
| 922 | - | |||||||||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||
| 926 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||||||||
| 928 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||||||||
| 929 | qrasterpaintengine_state_setNoClip(s); | - | ||||||||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||||||||
| 931 | } never executed: else if (s->matrix.type() > QTransform::TxScaleend of block
| 0 | ||||||||||||||||||||||||||||||
| 932 | QPaintEngineEx::clip(rect, op); | - | ||||||||||||||||||||||||||||||
| 933 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||||||||
| 935 | } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)
| 0 | ||||||||||||||||||||||||||||||
| 936 | QPaintEngineEx::clip(rect, op); | - | ||||||||||||||||||||||||||||||
| 937 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 938 | } | - | ||||||||||||||||||||||||||||||
| 939 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 940 | - | |||||||||||||||||||||||||||||||
| 941 | - | |||||||||||||||||||||||||||||||
| 942 | bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op) | - | ||||||||||||||||||||||||||||||
| 943 | { | - | ||||||||||||||||||||||||||||||
| 944 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 945 | QRect clipRect = r & d->deviceRect; | - | ||||||||||||||||||||||||||||||
| 946 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||||||||
| 948 | if (op == Qt::ReplaceClip
| 0 | ||||||||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||||||||
| 950 | - | |||||||||||||||||||||||||||||||
| 951 | - | |||||||||||||||||||||||||||||||
| 952 | QRegion clipRegion = systemClip(); | - | ||||||||||||||||||||||||||||||
| 953 | QClipData *clip = new QClipData(d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 954 | - | |||||||||||||||||||||||||||||||
| 955 | if (clipRegion.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 956 | clip->setClipRect(clipRect); never executed: clip->setClipRect(clipRect); | 0 | ||||||||||||||||||||||||||||||
| 957 | else | - | ||||||||||||||||||||||||||||||
| 958 | clip->setClipRegion(clipRegion & clipRect); never executed: clip->setClipRegion(clipRegion & clipRect); | 0 | ||||||||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||||||||
| 960 | if (s->flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 961 | delete s->clip; never executed: delete s->clip; | 0 | ||||||||||||||||||||||||||||||
| 962 | - | |||||||||||||||||||||||||||||||
| 963 | s->clip = clip; | - | ||||||||||||||||||||||||||||||
| 964 | s->clip->enabled = true; | - | ||||||||||||||||||||||||||||||
| 965 | s->flags.has_clip_ownership = true; | - | ||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||
| 967 | } never executed: else if (op == Qt::IntersectClipend of block
| 0 | ||||||||||||||||||||||||||||||
| 968 | QClipData *base = s->clip; | - | ||||||||||||||||||||||||||||||
| 969 | - | |||||||||||||||||||||||||||||||
| 970 | ((!(base)) ? qt_assert("base",__FILE__,1264) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 971 | if (base->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 972 | if (!s->flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 973 | s->clip = new QClipData(d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 974 | s->flags.has_clip_ownership = true; | - | ||||||||||||||||||||||||||||||
| 975 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 976 | if (base->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 977 | s->clip->setClipRect(base->clipRect & clipRect); never executed: s->clip->setClipRect(base->clipRect & clipRect); | 0 | ||||||||||||||||||||||||||||||
| 978 | else | - | ||||||||||||||||||||||||||||||
| 979 | s->clip->setClipRegion(base->clipRegion & clipRect); never executed: s->clip->setClipRegion(base->clipRegion & clipRect); | 0 | ||||||||||||||||||||||||||||||
| 980 | s->clip->enabled = true; | - | ||||||||||||||||||||||||||||||
| 981 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 982 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 983 | } | - | ||||||||||||||||||||||||||||||
| 984 | } else { | - | ||||||||||||||||||||||||||||||
| 985 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 986 | } | - | ||||||||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||||||||
| 988 | qrasterpaintengine_dirty_clip(d, s); | - | ||||||||||||||||||||||||||||||
| 989 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 990 | } | - | ||||||||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||||||||
| 992 | - | |||||||||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||||||||
| 996 | void QRasterPaintEngine::clip(const QRegion ®ion, Qt::ClipOperation op) | - | ||||||||||||||||||||||||||||||
| 997 | { | - | ||||||||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||||||||
| 1002 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||||||||
| 1004 | if (region.rectCount() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1005 | clip(region.boundingRect(), op); | - | ||||||||||||||||||||||||||||||
| 1006 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1007 | } | - | ||||||||||||||||||||||||||||||
| 1008 | - | |||||||||||||||||||||||||||||||
| 1009 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1010 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1011 | const QClipData *baseClip = d->baseClip.data(); | - | ||||||||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||||||||
| 1013 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||||||||
| 1014 | qrasterpaintengine_state_setNoClip(s); | - | ||||||||||||||||||||||||||||||
| 1015 | } never executed: else if (s->matrix.type() > QTransform::TxScaleend of block
| 0 | ||||||||||||||||||||||||||||||
| 1016 | || (op == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||||||||
| 1017 | || (op == Qt::ReplaceClip
| 0 | ||||||||||||||||||||||||||||||
| 1018 | QPaintEngineEx::clip(region, op); | - | ||||||||||||||||||||||||||||||
| 1019 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1020 | const QClipData *curClip; | - | ||||||||||||||||||||||||||||||
| 1021 | QClipData *newClip; | - | ||||||||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||||||||
| 1023 | if (op == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||||||||
| 1024 | curClip = clip; never executed: curClip = clip; | 0 | ||||||||||||||||||||||||||||||
| 1025 | else | - | ||||||||||||||||||||||||||||||
| 1026 | curClip = baseClip; never executed: curClip = baseClip; | 0 | ||||||||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||||||||
| 1028 | if (s->flags.has_clip_ownership
| 0 | ||||||||||||||||||||||||||||||
| 1029 | newClip = s->clip; | - | ||||||||||||||||||||||||||||||
| 1030 | ((!(newClip)) ? qt_assert("newClip",__FILE__,1324) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1031 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1032 | newClip = new QClipData(d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 1033 | s->clip = newClip; | - | ||||||||||||||||||||||||||||||
| 1034 | s->flags.has_clip_ownership = true; | - | ||||||||||||||||||||||||||||||
| 1035 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||||||||
| 1037 | QRegion r = s->matrix.map(region); | - | ||||||||||||||||||||||||||||||
| 1038 | if (curClip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 1039 | newClip->setClipRegion(r & curClip->clipRect); never executed: newClip->setClipRegion(r & curClip->clipRect); | 0 | ||||||||||||||||||||||||||||||
| 1040 | else if (curClip->hasRegionClip
| 0 | ||||||||||||||||||||||||||||||
| 1041 | newClip->setClipRegion(r & curClip->clipRegion); never executed: newClip->setClipRegion(r & curClip->clipRegion); | 0 | ||||||||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||||||||
| 1043 | qrasterpaintengine_dirty_clip(d, s); | - | ||||||||||||||||||||||||||||||
| 1044 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1045 | } | - | ||||||||||||||||||||||||||||||
| 1046 | void QRasterPaintEngine::fillPath(const QPainterPath &path, QSpanData *fillData) | - | ||||||||||||||||||||||||||||||
| 1047 | { | - | ||||||||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||||||||
| 1052 | if (!fillData->blend
| 0 | ||||||||||||||||||||||||||||||
| 1053 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1054 | - | |||||||||||||||||||||||||||||||
| 1055 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1056 | - | |||||||||||||||||||||||||||||||
| 1057 | const QRectF controlPointRect = path.controlPointRect(); | - | ||||||||||||||||||||||||||||||
| 1058 | - | |||||||||||||||||||||||||||||||
| 1059 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1060 | const QRect deviceRect = s->matrix.mapRect(controlPointRect).toRect(); | - | ||||||||||||||||||||||||||||||
| 1061 | ProcessSpans blend = d->getBrushFunc(deviceRect, fillData); | - | ||||||||||||||||||||||||||||||
| 1062 | const bool do_clip = (deviceRect.left() < -QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 1063 | || deviceRect.right() > QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 1064 | || deviceRect.top() < -QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 1065 | || deviceRect.bottom() > QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||
| 1067 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 1068 | d->initializeRasterizer(fillData); | - | ||||||||||||||||||||||||||||||
| 1069 | d->rasterizer->rasterize(path * s->matrix, path.fillRule()); | - | ||||||||||||||||||||||||||||||
| 1070 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1071 | } | - | ||||||||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||||||||
| 1073 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1074 | d->rasterize(d->outlineMapper->convertPath(path), blend, fillData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1075 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||||||||
| 1077 | static void fillRect_normalized(const QRect &r, QSpanData *data, | - | ||||||||||||||||||||||||||||||
| 1078 | QRasterPaintEnginePrivate *pe) | - | ||||||||||||||||||||||||||||||
| 1079 | { | - | ||||||||||||||||||||||||||||||
| 1080 | int x1, x2, y1, y2; | - | ||||||||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||||||||
| 1082 | bool rectClipped = true; | - | ||||||||||||||||||||||||||||||
| 1083 | - | |||||||||||||||||||||||||||||||
| 1084 | if (data->clip
| 0 | ||||||||||||||||||||||||||||||
| 1085 | x1 = qMax(r.x(), data->clip->xmin); | - | ||||||||||||||||||||||||||||||
| 1086 | x2 = qMin(r.x() + r.width(), data->clip->xmax); | - | ||||||||||||||||||||||||||||||
| 1087 | y1 = qMax(r.y(), data->clip->ymin); | - | ||||||||||||||||||||||||||||||
| 1088 | y2 = qMin(r.y() + r.height(), data->clip->ymax); | - | ||||||||||||||||||||||||||||||
| 1089 | rectClipped = data->clip->hasRectClip; | - | ||||||||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||||||||
| 1091 | } never executed: else if (peend of block
| 0 | ||||||||||||||||||||||||||||||
| 1092 | x1 = qMax(r.x(), pe->deviceRect.x()); | - | ||||||||||||||||||||||||||||||
| 1093 | x2 = qMin(r.x() + r.width(), pe->deviceRect.x() + pe->deviceRect.width()); | - | ||||||||||||||||||||||||||||||
| 1094 | y1 = qMax(r.y(), pe->deviceRect.y()); | - | ||||||||||||||||||||||||||||||
| 1095 | y2 = qMin(r.y() + r.height(), pe->deviceRect.y() + pe->deviceRect.height()); | - | ||||||||||||||||||||||||||||||
| 1096 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1097 | x1 = qMax(r.x(), 0); | - | ||||||||||||||||||||||||||||||
| 1098 | x2 = qMin(r.x() + r.width(), data->rasterBuffer->width()); | - | ||||||||||||||||||||||||||||||
| 1099 | y1 = qMax(r.y(), 0); | - | ||||||||||||||||||||||||||||||
| 1100 | y2 = qMin(r.y() + r.height(), data->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 1101 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||||||||
| 1103 | if (x2 <= x1
| 0 | ||||||||||||||||||||||||||||||
| 1104 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1105 | - | |||||||||||||||||||||||||||||||
| 1106 | const int width = x2 - x1; | - | ||||||||||||||||||||||||||||||
| 1107 | const int height = y2 - y1; | - | ||||||||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||||||||
| 1109 | bool isUnclipped = rectClipped
| 0 | ||||||||||||||||||||||||||||||
| 1110 | || (pe
| 0 | ||||||||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||||||||
| 1112 | if (pe
| 0 | ||||||||||||||||||||||||||||||
| 1113 | const QPainter::CompositionMode mode = pe->rasterBuffer->compositionMode; | - | ||||||||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||||||||
| 1115 | if (data->fillRect
| 0 | ||||||||||||||||||||||||||||||
| 1116 | || (mode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1117 | && data->solid.color.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 1118 | { | - | ||||||||||||||||||||||||||||||
| 1119 | data->fillRect(data->rasterBuffer, x1, y1, width, height, data->solid.color); | - | ||||||||||||||||||||||||||||||
| 1120 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1121 | } | - | ||||||||||||||||||||||||||||||
| 1122 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||||||||
| 1124 | ProcessSpans blend = isUnclipped
| 0 | ||||||||||||||||||||||||||||||
| 1125 | - | |||||||||||||||||||||||||||||||
| 1126 | const int nspans = 256; | - | ||||||||||||||||||||||||||||||
| 1127 | QT_FT_Span spans[nspans]; | - | ||||||||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||||||||
| 1129 | ((!(data->blend)) ? qt_assert("data->blend",__FILE__,1434) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1130 | int y = y1; | - | ||||||||||||||||||||||||||||||
| 1131 | while (y < y2
| 0 | ||||||||||||||||||||||||||||||
| 1132 | int n = qMin(nspans, y2 - y); | - | ||||||||||||||||||||||||||||||
| 1133 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 1134 | while (i < n
| 0 | ||||||||||||||||||||||||||||||
| 1135 | spans[i].x = x1; | - | ||||||||||||||||||||||||||||||
| 1136 | spans[i].len = width; | - | ||||||||||||||||||||||||||||||
| 1137 | spans[i].y = y + i; | - | ||||||||||||||||||||||||||||||
| 1138 | spans[i].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 1139 | ++i; | - | ||||||||||||||||||||||||||||||
| 1140 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1141 | - | |||||||||||||||||||||||||||||||
| 1142 | blend(n, spans, data); | - | ||||||||||||||||||||||||||||||
| 1143 | y += n; | - | ||||||||||||||||||||||||||||||
| 1144 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1145 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1146 | - | |||||||||||||||||||||||||||||||
| 1147 | - | |||||||||||||||||||||||||||||||
| 1148 | - | |||||||||||||||||||||||||||||||
| 1149 | - | |||||||||||||||||||||||||||||||
| 1150 | void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) | - | ||||||||||||||||||||||||||||||
| 1151 | { | - | ||||||||||||||||||||||||||||||
| 1152 | - | |||||||||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||||||||
| 1155 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1156 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 1157 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||||||||
| 1160 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1161 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1162 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 1163 | const QRect *r = rects; | - | ||||||||||||||||||||||||||||||
| 1164 | const QRect *lastRect = rects + rectCount; | - | ||||||||||||||||||||||||||||||
| 1165 | - | |||||||||||||||||||||||||||||||
| 1166 | int offset_x = int(s->matrix.dx()); | - | ||||||||||||||||||||||||||||||
| 1167 | int offset_y = int(s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 1168 | while (r < lastRect
| 0 | ||||||||||||||||||||||||||||||
| 1169 | QRect rect = r->normalized(); | - | ||||||||||||||||||||||||||||||
| 1170 | QRect rr = rect.translated(offset_x, offset_y); | - | ||||||||||||||||||||||||||||||
| 1171 | fillRect_normalized(rr, &s->brushData, d); | - | ||||||||||||||||||||||||||||||
| 1172 | ++r; | - | ||||||||||||||||||||||||||||||
| 1173 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1174 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1175 | QRectVectorPath path; | - | ||||||||||||||||||||||||||||||
| 1176 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1177 | path.set(rects[i]); | - | ||||||||||||||||||||||||||||||
| 1178 | fill(path, s->brush); | - | ||||||||||||||||||||||||||||||
| 1179 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1180 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1181 | } | - | ||||||||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||||||||
| 1183 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1184 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1185 | QRectVectorPath path; | - | ||||||||||||||||||||||||||||||
| 1186 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1187 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1188 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1189 | for (int i = 0; i < rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1190 | path.set(rects[i]); | - | ||||||||||||||||||||||||||||||
| 1191 | stroker.drawPath(path); | - | ||||||||||||||||||||||||||||||
| 1192 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1193 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1194 | for (int i = 0; i < rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1195 | path.set(rects[i]); | - | ||||||||||||||||||||||||||||||
| 1196 | stroke(path, s->pen); | - | ||||||||||||||||||||||||||||||
| 1197 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1198 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1199 | } | - | ||||||||||||||||||||||||||||||
| 1200 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||||||||
| 1205 | void QRasterPaintEngine::drawRects(const QRectF *rects, int rectCount) | - | ||||||||||||||||||||||||||||||
| 1206 | { | - | ||||||||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||
| 1209 | - | |||||||||||||||||||||||||||||||
| 1210 | - | |||||||||||||||||||||||||||||||
| 1211 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1212 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 1213 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1214 | - | |||||||||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||||||||
| 1216 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 1217 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1218 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1219 | d->initializeRasterizer(&s->brushData); | - | ||||||||||||||||||||||||||||||
| 1220 | for (int i = 0; i < rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1221 | const QRectF &rect = rects[i].normalized(); | - | ||||||||||||||||||||||||||||||
| 1222 | if (rect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1223 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1224 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1225 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1226 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | - | ||||||||||||||||||||||||||||||
| 1227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1228 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1229 | - | |||||||||||||||||||||||||||||||
| 1230 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1231 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1232 | QRectVectorPath path; | - | ||||||||||||||||||||||||||||||
| 1233 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1234 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1235 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1236 | for (int i = 0; i < rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1237 | path.set(rects[i]); | - | ||||||||||||||||||||||||||||||
| 1238 | stroker.drawPath(path); | - | ||||||||||||||||||||||||||||||
| 1239 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1240 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1241 | for (int i = 0; i < rectCount
| 0 | ||||||||||||||||||||||||||||||
| 1242 | path.set(rects[i]); | - | ||||||||||||||||||||||||||||||
| 1243 | QPaintEngineEx::stroke(path, s->lastPen); | - | ||||||||||||||||||||||||||||||
| 1244 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1245 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1246 | } | - | ||||||||||||||||||||||||||||||
| 1247 | - | |||||||||||||||||||||||||||||||
| 1248 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1249 | } | - | ||||||||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||||||||
| 1251 | QPaintEngineEx::drawRects(rects, rectCount); | - | ||||||||||||||||||||||||||||||
| 1252 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||||||||
| 1254 | - | |||||||||||||||||||||||||||||||
| 1255 | - | |||||||||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||||||||
| 1257 | - | |||||||||||||||||||||||||||||||
| 1258 | void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen) | - | ||||||||||||||||||||||||||||||
| 1259 | { | - | ||||||||||||||||||||||||||||||
| 1260 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1261 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||
| 1263 | ensurePen(pen); | - | ||||||||||||||||||||||||||||||
| 1264 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1265 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||||||||
| 1267 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1268 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1269 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1270 | stroker.drawPath(path); | - | ||||||||||||||||||||||||||||||
| 1271 | } never executed: else if (s->flags.non_complex_penend of block
| 0 | ||||||||||||||||||||||||||||||
| 1272 | qreal width = qt_pen_is_cosmetic(s->lastPen, s->renderHints)
| 0 | ||||||||||||||||||||||||||||||
| 1273 | ? (qpen_widthf(s->lastPen) == 0
| 0 | ||||||||||||||||||||||||||||||
| 1274 | : qpen_widthf(s->lastPen) * s->txscale; | - | ||||||||||||||||||||||||||||||
| 1275 | int dashIndex = 0; | - | ||||||||||||||||||||||||||||||
| 1276 | qreal dashOffset = s->lastPen.dashOffset(); | - | ||||||||||||||||||||||||||||||
| 1277 | bool inDash = true; | - | ||||||||||||||||||||||||||||||
| 1278 | qreal patternLength = 0; | - | ||||||||||||||||||||||||||||||
| 1279 | const QVector<qreal> pattern = s->lastPen.dashPattern(); | - | ||||||||||||||||||||||||||||||
| 1280 | for (int i = 0; i < pattern.size()
| 0 | ||||||||||||||||||||||||||||||
| 1281 | patternLength += pattern.at(i); never executed: patternLength += pattern.at(i); | 0 | ||||||||||||||||||||||||||||||
| 1282 | - | |||||||||||||||||||||||||||||||
| 1283 | if (patternLength > 0
| 0 | ||||||||||||||||||||||||||||||
| 1284 | int n = qFloor(dashOffset / patternLength); | - | ||||||||||||||||||||||||||||||
| 1285 | dashOffset -= n * patternLength; | - | ||||||||||||||||||||||||||||||
| 1286 | while (dashOffset >= pattern.at(dashIndex)
| 0 | ||||||||||||||||||||||||||||||
| 1287 | dashOffset -= pattern.at(dashIndex); | - | ||||||||||||||||||||||||||||||
| 1288 | if (++
| 0 | ||||||||||||||||||||||||||||||
| 1289 | dashIndex = 0; never executed: dashIndex = 0; | 0 | ||||||||||||||||||||||||||||||
| 1290 | inDash = !inDash; | - | ||||||||||||||||||||||||||||||
| 1291 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1292 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||||||||
| 1294 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1295 | d->initializeRasterizer(&s->penData); | - | ||||||||||||||||||||||||||||||
| 1296 | int lineCount = path.elementCount() / 2; | - | ||||||||||||||||||||||||||||||
| 1297 | const QLineF *lines = reinterpret_cast<const QLineF *>(path.points()); | - | ||||||||||||||||||||||||||||||
| 1298 | - | |||||||||||||||||||||||||||||||
| 1299 | for (int i = 0; i < lineCount
| 0 | ||||||||||||||||||||||||||||||
| 1300 | if (lines[i].p1() == lines[i].p2()
| 0 | ||||||||||||||||||||||||||||||
| 1301 | if (s->lastPen.capStyle() != Qt::FlatCap
| 0 | ||||||||||||||||||||||||||||||
| 1302 | QPointF p = lines[i].p1(); | - | ||||||||||||||||||||||||||||||
| 1303 | QLineF line = s->matrix.map(QLineF(QPointF(p.x() - width*0.5, p.y()), | - | ||||||||||||||||||||||||||||||
| 1304 | QPointF(p.x() + width*0.5, p.y()))); | - | ||||||||||||||||||||||||||||||
| 1305 | d->rasterizer->rasterizeLine(line.p1(), line.p2(), 1); | - | ||||||||||||||||||||||||||||||
| 1306 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1307 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 1308 | } | - | ||||||||||||||||||||||||||||||
| 1309 | - | |||||||||||||||||||||||||||||||
| 1310 | const QLineF line = s->matrix.map(lines[i]); | - | ||||||||||||||||||||||||||||||
| 1311 | if (qpen_style(s->lastPen) == Qt::SolidLine
| 0 | ||||||||||||||||||||||||||||||
| 1312 | d->rasterizer->rasterizeLine(line.p1(), line.p2(), | - | ||||||||||||||||||||||||||||||
| 1313 | width / line.length(), | - | ||||||||||||||||||||||||||||||
| 1314 | s->lastPen.capStyle() == Qt::SquareCap); | - | ||||||||||||||||||||||||||||||
| 1315 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1316 | d->rasterizeLine_dashed(line, width, | - | ||||||||||||||||||||||||||||||
| 1317 | &dashIndex, &dashOffset, &inDash); | - | ||||||||||||||||||||||||||||||
| 1318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1319 | } | - | ||||||||||||||||||||||||||||||
| 1320 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1321 | else | - | ||||||||||||||||||||||||||||||
| 1322 | QPaintEngineEx::stroke(path, pen); never executed: QPaintEngineEx::stroke(path, pen); | 0 | ||||||||||||||||||||||||||||||
| 1323 | } | - | ||||||||||||||||||||||||||||||
| 1324 | - | |||||||||||||||||||||||||||||||
| 1325 | QRect QRasterPaintEngine::toNormalizedFillRect(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 1326 | { | - | ||||||||||||||||||||||||||||||
| 1327 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1328 | - | |||||||||||||||||||||||||||||||
| 1329 | qreal delta = s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 1330 | - | |||||||||||||||||||||||||||||||
| 1331 | int x1 = qRound(rect.x() + delta); | - | ||||||||||||||||||||||||||||||
| 1332 | int y1 = qRound(rect.y() + delta); | - | ||||||||||||||||||||||||||||||
| 1333 | int x2 = qRound(rect.right() + delta); | - | ||||||||||||||||||||||||||||||
| 1334 | int y2 = qRound(rect.bottom() + delta); | - | ||||||||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||||||||
| 1336 | if (x2 < x1
| 0 | ||||||||||||||||||||||||||||||
| 1337 | qSwap(x1, x2); never executed: qSwap(x1, x2); | 0 | ||||||||||||||||||||||||||||||
| 1338 | if (y2 < y1
| 0 | ||||||||||||||||||||||||||||||
| 1339 | qSwap(y1, y2); never executed: qSwap(y1, y2); | 0 | ||||||||||||||||||||||||||||||
| 1340 | - | |||||||||||||||||||||||||||||||
| 1341 | return never executed: QRect(x1, y1, x2 - x1, y2 - y1);return QRect(x1, y1, x2 - x1, y2 - y1);never executed: return QRect(x1, y1, x2 - x1, y2 - y1); | 0 | ||||||||||||||||||||||||||||||
| 1342 | } | - | ||||||||||||||||||||||||||||||
| 1343 | - | |||||||||||||||||||||||||||||||
| 1344 | - | |||||||||||||||||||||||||||||||
| 1345 | - | |||||||||||||||||||||||||||||||
| 1346 | - | |||||||||||||||||||||||||||||||
| 1347 | void QRasterPaintEngine::fill(const QVectorPath &path, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1348 | { | - | ||||||||||||||||||||||||||||||
| 1349 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1350 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1351 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1352 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1353 | - | |||||||||||||||||||||||||||||||
| 1354 | ensureBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1355 | if (!s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1356 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||||||||
| 1358 | if (path.shape() == QVectorPath::RectangleHint
| 0 | ||||||||||||||||||||||||||||||
| 1359 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 1360 | const qreal *p = path.points(); | - | ||||||||||||||||||||||||||||||
| 1361 | QPointF tl = QPointF(p[0], p[1]) * s->matrix; | - | ||||||||||||||||||||||||||||||
| 1362 | QPointF br = QPointF(p[4], p[5]) * s->matrix; | - | ||||||||||||||||||||||||||||||
| 1363 | fillRect_normalized(toNormalizedFillRect(QRectF(tl, br)), &s->brushData, d); | - | ||||||||||||||||||||||||||||||
| 1364 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1365 | } | - | ||||||||||||||||||||||||||||||
| 1366 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 1367 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 1368 | d->initializeRasterizer(&s->brushData); | - | ||||||||||||||||||||||||||||||
| 1369 | - | |||||||||||||||||||||||||||||||
| 1370 | const qreal *p = path.points(); | - | ||||||||||||||||||||||||||||||
| 1371 | QRectF r = QRectF(p[0], p[1], p[2] - p[0], p[7] - p[1]).normalized(); | - | ||||||||||||||||||||||||||||||
| 1372 | if (!r.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1373 | const QPointF a = s->matrix.map((r.topLeft() + r.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1374 | const QPointF b = s->matrix.map((r.topRight() + r.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1375 | d->rasterizer->rasterizeLine(a, b, r.height() / r.width()); | - | ||||||||||||||||||||||||||||||
| 1376 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1377 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1378 | } | - | ||||||||||||||||||||||||||||||
| 1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||||||||
| 1382 | QRectF cpRect = path.controlPointRect(); | - | ||||||||||||||||||||||||||||||
| 1383 | const QRect pathDeviceRect = s->matrix.mapRect(cpRect).toRect(); | - | ||||||||||||||||||||||||||||||
| 1384 | - | |||||||||||||||||||||||||||||||
| 1385 | if (!pathDeviceRect.intersects(d->deviceRect)
| 0 | ||||||||||||||||||||||||||||||
| 1386 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1387 | - | |||||||||||||||||||||||||||||||
| 1388 | ProcessSpans blend = d->getBrushFunc(pathDeviceRect, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1389 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1390 | d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1391 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1392 | - | |||||||||||||||||||||||||||||||
| 1393 | void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data) | - | ||||||||||||||||||||||||||||||
| 1394 | { | - | ||||||||||||||||||||||||||||||
| 1395 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1396 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||||||||
| 1398 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 1399 | uint txop = s->matrix.type(); | - | ||||||||||||||||||||||||||||||
| 1400 | if (txop == QTransform::TxNone
| 0 | ||||||||||||||||||||||||||||||
| 1401 | fillRect_normalized(toNormalizedFillRect(r), data, d); | - | ||||||||||||||||||||||||||||||
| 1402 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1403 | } else if (txop == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1404 | const QRect rr = toNormalizedFillRect(r.translated(s->matrix.dx(), s->matrix.dy())); | - | ||||||||||||||||||||||||||||||
| 1405 | fillRect_normalized(rr, data, d); | - | ||||||||||||||||||||||||||||||
| 1406 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1407 | } else if (txop == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1408 | const QRect rr = toNormalizedFillRect(s->matrix.mapRect(r)); | - | ||||||||||||||||||||||||||||||
| 1409 | fillRect_normalized(rr, data, d); | - | ||||||||||||||||||||||||||||||
| 1410 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1411 | } | - | ||||||||||||||||||||||||||||||
| 1412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1413 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 1414 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 1415 | d->initializeRasterizer(data); | - | ||||||||||||||||||||||||||||||
| 1416 | QRectF nr = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 1417 | if (!nr.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1418 | const QPointF a = s->matrix.map((nr.topLeft() + nr.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1419 | const QPointF b = s->matrix.map((nr.topRight() + nr.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1420 | d->rasterizer->rasterizeLine(a, b, nr.height() / nr.width()); | - | ||||||||||||||||||||||||||||||
| 1421 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1422 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1423 | } | - | ||||||||||||||||||||||||||||||
| 1424 | - | |||||||||||||||||||||||||||||||
| 1425 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 1426 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 1427 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1428 | fillPath(path, data); | - | ||||||||||||||||||||||||||||||
| 1429 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1430 | - | |||||||||||||||||||||||||||||||
| 1431 | - | |||||||||||||||||||||||||||||||
| 1432 | - | |||||||||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||||||||
| 1434 | void QRasterPaintEngine::fillRect(const QRectF &r, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1435 | { | - | ||||||||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||||||||
| 1437 | - | |||||||||||||||||||||||||||||||
| 1438 | - | |||||||||||||||||||||||||||||||
| 1439 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||||||||
| 1441 | ensureBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1442 | if (!s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1443 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||
| 1445 | fillRect(r, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1446 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1447 | - | |||||||||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||||||||
| 1449 | - | |||||||||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||||||||
| 1451 | void QRasterPaintEngine::fillRect(const QRectF &r, const QColor &color) | - | ||||||||||||||||||||||||||||||
| 1452 | { | - | ||||||||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||||||||
| 1455 | - | |||||||||||||||||||||||||||||||
| 1456 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1457 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1458 | - | |||||||||||||||||||||||||||||||
| 1459 | d->solid_color_filler.solid.color = qPremultiply(combineAlpha256(color.rgba64(), s->intOpacity)); | - | ||||||||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||||||||
| 1461 | if (d->solid_color_filler.solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 1462 | && s->composition_mode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1463 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1464 | } | - | ||||||||||||||||||||||||||||||
| 1465 | d->solid_color_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1466 | d->solid_color_filler.adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 1467 | fillRect(r, &d->solid_color_filler); | - | ||||||||||||||||||||||||||||||
| 1468 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1469 | - | |||||||||||||||||||||||||||||||
| 1470 | static inline bool isAbove(const QPointF *a, const QPointF *b) | - | ||||||||||||||||||||||||||||||
| 1471 | { | - | ||||||||||||||||||||||||||||||
| 1472 | return never executed: a->y() < b->y();return a->y() < b->y();never executed: return a->y() < b->y(); | 0 | ||||||||||||||||||||||||||||||
| 1473 | } | - | ||||||||||||||||||||||||||||||
| 1474 | - | |||||||||||||||||||||||||||||||
| 1475 | static bool splitPolygon(const QPointF *points, int pointCount, QVector<QPointF> *upper, QVector<QPointF> *lower) | - | ||||||||||||||||||||||||||||||
| 1476 | { | - | ||||||||||||||||||||||||||||||
| 1477 | ((!(upper)) ? qt_assert("upper",__FILE__,1804) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1478 | ((!(lower)) ? qt_assert("lower",__FILE__,1805) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1479 | - | |||||||||||||||||||||||||||||||
| 1480 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1807) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1481 | - | |||||||||||||||||||||||||||||||
| 1482 | QVector<const QPointF *> sorted; | - | ||||||||||||||||||||||||||||||
| 1483 | sorted.reserve(pointCount); | - | ||||||||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||||||||
| 1485 | upper->reserve(pointCount * 3 / 4); | - | ||||||||||||||||||||||||||||||
| 1486 | lower->reserve(pointCount * 3 / 4); | - | ||||||||||||||||||||||||||||||
| 1487 | - | |||||||||||||||||||||||||||||||
| 1488 | for (int i = 0; i < pointCount
| 0 | ||||||||||||||||||||||||||||||
| 1489 | sorted << points + i; never executed: sorted << points + i; | 0 | ||||||||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||||||||
| 1491 | std::sort(sorted.begin(), sorted.end(), isAbove); | - | ||||||||||||||||||||||||||||||
| 1492 | - | |||||||||||||||||||||||||||||||
| 1493 | qreal splitY = sorted.at(sorted.size() / 2)->y(); | - | ||||||||||||||||||||||||||||||
| 1494 | - | |||||||||||||||||||||||||||||||
| 1495 | const QPointF *end = points + pointCount; | - | ||||||||||||||||||||||||||||||
| 1496 | const QPointF *last = end - 1; | - | ||||||||||||||||||||||||||||||
| 1497 | - | |||||||||||||||||||||||||||||||
| 1498 | QVector<QPointF> *bin[2] = { upper, lower }; | - | ||||||||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||||||||
| 1500 | for (const QPointF *p = points; p < end
| 0 | ||||||||||||||||||||||||||||||
| 1501 | int side = p->y() < splitY; | - | ||||||||||||||||||||||||||||||
| 1502 | int lastSide = last->y() < splitY; | - | ||||||||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||||||||
| 1504 | if (side != lastSide
| 0 | ||||||||||||||||||||||||||||||
| 1505 | if (qFuzzyCompare(p->y(), splitY)
| 0 | ||||||||||||||||||||||||||||||
| 1506 | bin[!side]->append(*p); | - | ||||||||||||||||||||||||||||||
| 1507 | } never executed: else if (qFuzzyCompare(last->y(), splitY)end of block
| 0 | ||||||||||||||||||||||||||||||
| 1508 | bin[side]->append(*last); | - | ||||||||||||||||||||||||||||||
| 1509 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1510 | QPointF delta = *p - *last; | - | ||||||||||||||||||||||||||||||
| 1511 | QPointF intersection(p->x() + delta.x() * (splitY - p->y()) / delta.y(), splitY); | - | ||||||||||||||||||||||||||||||
| 1512 | - | |||||||||||||||||||||||||||||||
| 1513 | bin[0]->append(intersection); | - | ||||||||||||||||||||||||||||||
| 1514 | bin[1]->append(intersection); | - | ||||||||||||||||||||||||||||||
| 1515 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1516 | } | - | ||||||||||||||||||||||||||||||
| 1517 | - | |||||||||||||||||||||||||||||||
| 1518 | bin[side]->append(*p); | - | ||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||
| 1520 | last = p; | - | ||||||||||||||||||||||||||||||
| 1521 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||||||||
| 1524 | return never executed: upper->size() < pointCount && lower->size() < pointCount;return upper->size() < pointCount && lower->size() < pointCount;never executed: return upper->size() < pointCount && lower->size() < pointCount; | 0 | ||||||||||||||||||||||||||||||
| 1525 | } | - | ||||||||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||||||||
| 1528 | - | |||||||||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||||||||
| 1530 | void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1531 | { | - | ||||||||||||||||||||||||||||||
| 1532 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1533 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1534 | - | |||||||||||||||||||||||||||||||
| 1535 | const int maxPoints = 0xffff; | - | ||||||||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||||||||
| 1537 | - | |||||||||||||||||||||||||||||||
| 1538 | if (pointCount > maxPoints
| 0 | ||||||||||||||||||||||||||||||
| 1539 | QVector<QPointF> upper, lower; | - | ||||||||||||||||||||||||||||||
| 1540 | - | |||||||||||||||||||||||||||||||
| 1541 | if (splitPolygon(points, pointCount, &upper, &lower)
| 0 | ||||||||||||||||||||||||||||||
| 1542 | fillPolygon(upper.constData(), upper.size(), mode); | - | ||||||||||||||||||||||||||||||
| 1543 | fillPolygon(lower.constData(), lower.size(), mode); | - | ||||||||||||||||||||||||||||||
| 1544 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||
| 1545 | QMessageLogger(__FILE__, 1872, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); never executed: QMessageLogger(__FILE__, 1872, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); | 0 | ||||||||||||||||||||||||||||||
| 1546 | - | |||||||||||||||||||||||||||||||
| 1547 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1548 | } | - | ||||||||||||||||||||||||||||||
| 1549 | - | |||||||||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||||||||
| 1551 | QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1552 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1553 | QT_FT_Outline *outline = d->outlineMapper->convertPath(vp); | - | ||||||||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||||||||
| 1555 | - | |||||||||||||||||||||||||||||||
| 1556 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - | ||||||||||||||||||||||||||||||
| 1557 | &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1558 | d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1559 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1560 | - | |||||||||||||||||||||||||||||||
| 1561 | - | |||||||||||||||||||||||||||||||
| 1562 | - | |||||||||||||||||||||||||||||||
| 1563 | - | |||||||||||||||||||||||||||||||
| 1564 | void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1565 | { | - | ||||||||||||||||||||||||||||||
| 1566 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1567 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||||||||
| 1571 | - | |||||||||||||||||||||||||||||||
| 1572 | - | |||||||||||||||||||||||||||||||
| 1573 | - | |||||||||||||||||||||||||||||||
| 1574 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1901) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1575 | - | |||||||||||||||||||||||||||||||
| 1576 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1577 | QRectF r(points[0], points[2]); | - | ||||||||||||||||||||||||||||||
| 1578 | drawRects(&r, 1); | - | ||||||||||||||||||||||||||||||
| 1579 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1580 | } | - | ||||||||||||||||||||||||||||||
| 1581 | - | |||||||||||||||||||||||||||||||
| 1582 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1583 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||||||||
| 1585 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1586 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1587 | fillPolygon(points, pointCount, mode); never executed: fillPolygon(points, pointCount, mode); | 0 | ||||||||||||||||||||||||||||||
| 1588 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||||||||
| 1590 | - | |||||||||||||||||||||||||||||||
| 1591 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1592 | QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1593 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1594 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1595 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1596 | stroker.drawPath(vp); | - | ||||||||||||||||||||||||||||||
| 1597 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1598 | QPaintEngineEx::stroke(vp, s->lastPen); | - | ||||||||||||||||||||||||||||||
| 1599 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1600 | } | - | ||||||||||||||||||||||||||||||
| 1601 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1602 | - | |||||||||||||||||||||||||||||||
| 1603 | - | |||||||||||||||||||||||||||||||
| 1604 | - | |||||||||||||||||||||||||||||||
| 1605 | - | |||||||||||||||||||||||||||||||
| 1606 | void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1607 | { | - | ||||||||||||||||||||||||||||||
| 1608 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1609 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||||||||
| 1613 | - | |||||||||||||||||||||||||||||||
| 1614 | - | |||||||||||||||||||||||||||||||
| 1615 | - | |||||||||||||||||||||||||||||||
| 1616 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1943) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1617 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1618 | QRect r(points[0].x(), | - | ||||||||||||||||||||||||||||||
| 1619 | points[0].y(), | - | ||||||||||||||||||||||||||||||
| 1620 | points[2].x() - points[0].x(), | - | ||||||||||||||||||||||||||||||
| 1621 | points[2].y() - points[0].y()); | - | ||||||||||||||||||||||||||||||
| 1622 | drawRects(&r, 1); | - | ||||||||||||||||||||||||||||||
| 1623 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1624 | } | - | ||||||||||||||||||||||||||||||
| 1625 | - | |||||||||||||||||||||||||||||||
| 1626 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1627 | - | |||||||||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||||||||
| 1629 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1630 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1631 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1632 | - | |||||||||||||||||||||||||||||||
| 1633 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1634 | d->outlineMapper->beginOutline(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill); | - | ||||||||||||||||||||||||||||||
| 1635 | d->outlineMapper->moveTo(*points); | - | ||||||||||||||||||||||||||||||
| 1636 | const QPoint *p = points; | - | ||||||||||||||||||||||||||||||
| 1637 | const QPoint *ep = points + pointCount - 1; | - | ||||||||||||||||||||||||||||||
| 1638 | do { | - | ||||||||||||||||||||||||||||||
| 1639 | d->outlineMapper->lineTo(*(++p)); | - | ||||||||||||||||||||||||||||||
| 1640 | } never executed: while (p < epend of block
| 0 | ||||||||||||||||||||||||||||||
| 1641 | d->outlineMapper->endOutline(); | - | ||||||||||||||||||||||||||||||
| 1642 | - | |||||||||||||||||||||||||||||||
| 1643 | - | |||||||||||||||||||||||||||||||
| 1644 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - | ||||||||||||||||||||||||||||||
| 1645 | &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1646 | d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1647 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1648 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||||||||
| 1650 | - | |||||||||||||||||||||||||||||||
| 1651 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1652 | int count = pointCount * 2; | - | ||||||||||||||||||||||||||||||
| 1653 | QVarLengthArray<qreal> fpoints(count); | - | ||||||||||||||||||||||||||||||
| 1654 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||
| 1655 | fpoints[i] = ((const int *) points)[i]; never executed: fpoints[i] = ((const int *) points)[i]; | 0 | ||||||||||||||||||||||||||||||
| 1656 | QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1657 | - | |||||||||||||||||||||||||||||||
| 1658 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1659 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1660 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1661 | stroker.drawPath(vp); | - | ||||||||||||||||||||||||||||||
| 1662 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1663 | QPaintEngineEx::stroke(vp, s->lastPen); | - | ||||||||||||||||||||||||||||||
| 1664 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1665 | } | - | ||||||||||||||||||||||||||||||
| 1666 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1667 | - | |||||||||||||||||||||||||||||||
| 1668 | - | |||||||||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||||||||
| 1671 | void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) | - | ||||||||||||||||||||||||||||||
| 1672 | { | - | ||||||||||||||||||||||||||||||
| 1673 | - | |||||||||||||||||||||||||||||||
| 1674 | - | |||||||||||||||||||||||||||||||
| 1675 | - | |||||||||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||||||||
| 1677 | QPlatformPixmap *pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 1678 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 1679 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 1680 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1681 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1682 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1683 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1684 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1685 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1686 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1687 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - | ||||||||||||||||||||||||||||||
| 1688 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1689 | } else { | - | ||||||||||||||||||||||||||||||
| 1690 | QRasterPaintEngine::drawImage(pos, image); | - | ||||||||||||||||||||||||||||||
| 1691 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1692 | } else { | - | ||||||||||||||||||||||||||||||
| 1693 | const QImage image = pixmap.toImage(); | - | ||||||||||||||||||||||||||||||
| 1694 | if (pixmap.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1695 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1696 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1697 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1698 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1699 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1700 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1701 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - | ||||||||||||||||||||||||||||||
| 1702 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1703 | } else { | - | ||||||||||||||||||||||||||||||
| 1704 | QRasterPaintEngine::drawImage(pos, image); | - | ||||||||||||||||||||||||||||||
| 1705 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1706 | } | - | ||||||||||||||||||||||||||||||
| 1707 | } | - | ||||||||||||||||||||||||||||||
| 1708 | - | |||||||||||||||||||||||||||||||
| 1709 | - | |||||||||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||||||||
| 1711 | - | |||||||||||||||||||||||||||||||
| 1712 | void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr) | - | ||||||||||||||||||||||||||||||
| 1713 | { | - | ||||||||||||||||||||||||||||||
| 1714 | - | |||||||||||||||||||||||||||||||
| 1715 | - | |||||||||||||||||||||||||||||||
| 1716 | - | |||||||||||||||||||||||||||||||
| 1717 | - | |||||||||||||||||||||||||||||||
| 1718 | QPlatformPixmap* pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 1719 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 1720 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 1721 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1722 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1723 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1724 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1725 | && r.size() == sr.size()
| 0 | ||||||||||||||||||||||||||||||
| 1726 | && r.size() == pixmap.size()
| 0 | ||||||||||||||||||||||||||||||
| 1727 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1728 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1729 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1730 | } else { | - | ||||||||||||||||||||||||||||||
| 1731 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); | - | ||||||||||||||||||||||||||||||
| 1732 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1733 | } else { | - | ||||||||||||||||||||||||||||||
| 1734 | drawImage(r, image, sr); | - | ||||||||||||||||||||||||||||||
| 1735 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1736 | } else { | - | ||||||||||||||||||||||||||||||
| 1737 | QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect()); | - | ||||||||||||||||||||||||||||||
| 1738 | const QImage image = pd->toImage(clippedSource); | - | ||||||||||||||||||||||||||||||
| 1739 | QRectF translatedSource = sr.translated(-clippedSource.topLeft()); | - | ||||||||||||||||||||||||||||||
| 1740 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1741 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1742 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1743 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1744 | && r.size() == sr.size()
| 0 | ||||||||||||||||||||||||||||||
| 1745 | && r.size() == pixmap.size()
| 0 | ||||||||||||||||||||||||||||||
| 1746 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1747 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1748 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1749 | } else { | - | ||||||||||||||||||||||||||||||
| 1750 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource); | - | ||||||||||||||||||||||||||||||
| 1751 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1752 | } else { | - | ||||||||||||||||||||||||||||||
| 1753 | drawImage(r, image, translatedSource); | - | ||||||||||||||||||||||||||||||
| 1754 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1755 | } | - | ||||||||||||||||||||||||||||||
| 1756 | } | - | ||||||||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||||||||
| 1758 | static inline int fast_ceil_positive(const qreal &v) | - | ||||||||||||||||||||||||||||||
| 1759 | { | - | ||||||||||||||||||||||||||||||
| 1760 | const int iv = int(v); | - | ||||||||||||||||||||||||||||||
| 1761 | if (v - iv == 0
| 0 | ||||||||||||||||||||||||||||||
| 1762 | return never executed: iv;return iv;never executed: return iv; | 0 | ||||||||||||||||||||||||||||||
| 1763 | else | - | ||||||||||||||||||||||||||||||
| 1764 | return never executed: iv + 1;return iv + 1;never executed: return iv + 1; | 0 | ||||||||||||||||||||||||||||||
| 1765 | } | - | ||||||||||||||||||||||||||||||
| 1766 | - | |||||||||||||||||||||||||||||||
| 1767 | static inline const QRect toAlignedRect_positive(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 1768 | { | - | ||||||||||||||||||||||||||||||
| 1769 | const int xmin = int(rect.x()); | - | ||||||||||||||||||||||||||||||
| 1770 | const int xmax = int(fast_ceil_positive(rect.right())); | - | ||||||||||||||||||||||||||||||
| 1771 | const int ymin = int(rect.y()); | - | ||||||||||||||||||||||||||||||
| 1772 | const int ymax = int(fast_ceil_positive(rect.bottom())); | - | ||||||||||||||||||||||||||||||
| 1773 | return never executed: QRect(xmin, ymin, xmax - xmin, ymax - ymin);return QRect(xmin, ymin, xmax - xmin, ymax - ymin);never executed: return QRect(xmin, ymin, xmax - xmin, ymax - ymin); | 0 | ||||||||||||||||||||||||||||||
| 1774 | } | - | ||||||||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||||||||
| 1776 | - | |||||||||||||||||||||||||||||||
| 1777 | - | |||||||||||||||||||||||||||||||
| 1778 | - | |||||||||||||||||||||||||||||||
| 1779 | void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img) | - | ||||||||||||||||||||||||||||||
| 1780 | { | - | ||||||||||||||||||||||||||||||
| 1781 | - | |||||||||||||||||||||||||||||||
| 1782 | - | |||||||||||||||||||||||||||||||
| 1783 | - | |||||||||||||||||||||||||||||||
| 1784 | - | |||||||||||||||||||||||||||||||
| 1785 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1786 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1787 | qreal scale = img.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 1788 | - | |||||||||||||||||||||||||||||||
| 1789 | if (scale > 1.0
| 0 | ||||||||||||||||||||||||||||||
| 1790 | drawImage(QRectF(p.x(), p.y(), img.width() / scale, img.height() / scale), | - | ||||||||||||||||||||||||||||||
| 1791 | img, | - | ||||||||||||||||||||||||||||||
| 1792 | QRectF(0, 0, img.width(), img.height())); | - | ||||||||||||||||||||||||||||||
| 1793 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1794 | - | |||||||||||||||||||||||||||||||
| 1795 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1796 | QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 1797 | - | |||||||||||||||||||||||||||||||
| 1798 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)
| 0 | ||||||||||||||||||||||||||||||
| 1799 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 1800 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 1801 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 1802 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1803 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1804 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 1805 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1806 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1807 | } | - | ||||||||||||||||||||||||||||||
| 1808 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1809 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1810 | - | |||||||||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||||||||
| 1813 | d->image_filler.clip = clip; | - | ||||||||||||||||||||||||||||||
| 1814 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect()); | - | ||||||||||||||||||||||||||||||
| 1815 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 1816 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1817 | d->image_filler.dx = -pt.x(); | - | ||||||||||||||||||||||||||||||
| 1818 | d->image_filler.dy = -pt.y(); | - | ||||||||||||||||||||||||||||||
| 1819 | QRect rr = img.rect().translated(qRound(pt.x()), qRound(pt.y())); | - | ||||||||||||||||||||||||||||||
| 1820 | - | |||||||||||||||||||||||||||||||
| 1821 | fillRect_normalized(rr, &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 1822 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1823 | - | |||||||||||||||||||||||||||||||
| 1824 | } | - | ||||||||||||||||||||||||||||||
| 1825 | - | |||||||||||||||||||||||||||||||
| 1826 | QRectF qt_mapRect_non_normalizing(const QRectF &r, const QTransform &t) | - | ||||||||||||||||||||||||||||||
| 1827 | { | - | ||||||||||||||||||||||||||||||
| 1828 | return never executed: QRectF(r.topLeft() * t, r.bottomRight() * t);return QRectF(r.topLeft() * t, r.bottomRight() * t);never executed: return QRectF(r.topLeft() * t, r.bottomRight() * t); | 0 | ||||||||||||||||||||||||||||||
| 1829 | } | - | ||||||||||||||||||||||||||||||
| 1830 | - | |||||||||||||||||||||||||||||||
| 1831 | namespace { | - | ||||||||||||||||||||||||||||||
| 1832 | enum RotationType { | - | ||||||||||||||||||||||||||||||
| 1833 | Rotation90, | - | ||||||||||||||||||||||||||||||
| 1834 | Rotation180, | - | ||||||||||||||||||||||||||||||
| 1835 | Rotation270, | - | ||||||||||||||||||||||||||||||
| 1836 | NoRotation | - | ||||||||||||||||||||||||||||||
| 1837 | }; | - | ||||||||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||||||||
| 1839 | inline RotationType qRotationType(const QTransform &transform) | - | ||||||||||||||||||||||||||||||
| 1840 | { | - | ||||||||||||||||||||||||||||||
| 1841 | QTransform::TransformationType type = transform.type(); | - | ||||||||||||||||||||||||||||||
| 1842 | - | |||||||||||||||||||||||||||||||
| 1843 | if (type > QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1844 | return never executed: NoRotation;return NoRotation;never executed: return NoRotation; | 0 | ||||||||||||||||||||||||||||||
| 1845 | - | |||||||||||||||||||||||||||||||
| 1846 | if (type == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1847 | && qFuzzyCompare(transform.m21(), qreal(1))
| 0 | ||||||||||||||||||||||||||||||
| 1848 | return never executed: Rotation90;return Rotation90;never executed: return Rotation90; | 0 | ||||||||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||||||||
| 1850 | if (type == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1851 | && qFuzzyIsNull(transform.m21())
| 0 | ||||||||||||||||||||||||||||||
| 1852 | return never executed: Rotation180;return Rotation180;never executed: return Rotation180; | 0 | ||||||||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||||||||
| 1854 | if (type == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1855 | && qFuzzyCompare(transform.m21(), qreal(-1))
| 0 | ||||||||||||||||||||||||||||||
| 1856 | return never executed: Rotation270;return Rotation270;never executed: return Rotation270; | 0 | ||||||||||||||||||||||||||||||
| 1857 | - | |||||||||||||||||||||||||||||||
| 1858 | return never executed: NoRotation;return NoRotation;never executed: return NoRotation; | 0 | ||||||||||||||||||||||||||||||
| 1859 | } | - | ||||||||||||||||||||||||||||||
| 1860 | - | |||||||||||||||||||||||||||||||
| 1861 | inline bool isPixelAligned(const QRectF &rect) { | - | ||||||||||||||||||||||||||||||
| 1862 | return never executed: QRectF(rect.toRect()) == rect;return QRectF(rect.toRect()) == rect;never executed: return QRectF(rect.toRect()) == rect; | 0 | ||||||||||||||||||||||||||||||
| 1863 | } | - | ||||||||||||||||||||||||||||||
| 1864 | } | - | ||||||||||||||||||||||||||||||
| 1865 | - | |||||||||||||||||||||||||||||||
| 1866 | - | |||||||||||||||||||||||||||||||
| 1867 | - | |||||||||||||||||||||||||||||||
| 1868 | - | |||||||||||||||||||||||||||||||
| 1869 | void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, | - | ||||||||||||||||||||||||||||||
| 1870 | Qt::ImageConversionFlags) | - | ||||||||||||||||||||||||||||||
| 1871 | { | - | ||||||||||||||||||||||||||||||
| 1872 | - | |||||||||||||||||||||||||||||||
| 1873 | - | |||||||||||||||||||||||||||||||
| 1874 | - | |||||||||||||||||||||||||||||||
| 1875 | - | |||||||||||||||||||||||||||||||
| 1876 | if (r.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1877 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1878 | - | |||||||||||||||||||||||||||||||
| 1879 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1880 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1881 | ((!(s)) ? qt_assert("s",__FILE__,2208) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1882 | int sr_l = qFloor(sr.left()); | - | ||||||||||||||||||||||||||||||
| 1883 | int sr_r = qCeil(sr.right()) - 1; | - | ||||||||||||||||||||||||||||||
| 1884 | int sr_t = qFloor(sr.top()); | - | ||||||||||||||||||||||||||||||
| 1885 | int sr_b = qCeil(sr.bottom()) - 1; | - | ||||||||||||||||||||||||||||||
| 1886 | - | |||||||||||||||||||||||||||||||
| 1887 | if (s->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||||||||
| 1889 | - | |||||||||||||||||||||||||||||||
| 1890 | QTransform old = s->matrix; | - | ||||||||||||||||||||||||||||||
| 1891 | - | |||||||||||||||||||||||||||||||
| 1892 | if (s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 1893 | s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); never executed: s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); | 0 | ||||||||||||||||||||||||||||||
| 1894 | - | |||||||||||||||||||||||||||||||
| 1895 | - | |||||||||||||||||||||||||||||||
| 1896 | QRgb color = img.pixel(sr_l, sr_t); | - | ||||||||||||||||||||||||||||||
| 1897 | switch (img.format()) { | - | ||||||||||||||||||||||||||||||
| 1898 | case never executed: QImage::Format_ARGB32_Premultiplied:case QImage::Format_ARGB32_Premultiplied:never executed: case QImage::Format_ARGB32_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1899 | case never executed: QImage::Format_ARGB8565_Premultiplied:case QImage::Format_ARGB8565_Premultiplied:never executed: case QImage::Format_ARGB8565_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1900 | case never executed: QImage::Format_ARGB6666_Premultiplied:case QImage::Format_ARGB6666_Premultiplied:never executed: case QImage::Format_ARGB6666_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1901 | case never executed: QImage::Format_ARGB8555_Premultiplied:case QImage::Format_ARGB8555_Premultiplied:never executed: case QImage::Format_ARGB8555_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1902 | case never executed: QImage::Format_ARGB4444_Premultiplied:case QImage::Format_ARGB4444_Premultiplied:never executed: case QImage::Format_ARGB4444_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1903 | case never executed: QImage::Format_RGBA8888_Premultiplied:case QImage::Format_RGBA8888_Premultiplied:never executed: case QImage::Format_RGBA8888_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1904 | case never executed: QImage::Format_A2BGR30_Premultiplied:case QImage::Format_A2BGR30_Premultiplied:never executed: case QImage::Format_A2BGR30_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1905 | case never executed: QImage::Format_A2RGB30_Premultiplied:case QImage::Format_A2RGB30_Premultiplied:never executed: case QImage::Format_A2RGB30_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1906 | - | |||||||||||||||||||||||||||||||
| 1907 | d->solid_color_filler.solid.color = multiplyAlpha256(QRgba64::fromArgb32(color), s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1908 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1909 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1910 | d->solid_color_filler.solid.color = qPremultiply(combineAlpha256(QRgba64::fromArgb32(color), s->intOpacity)); | - | ||||||||||||||||||||||||||||||
| 1911 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1912 | } | - | ||||||||||||||||||||||||||||||
| 1913 | - | |||||||||||||||||||||||||||||||
| 1914 | if (d->solid_color_filler.solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 1915 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1916 | - | |||||||||||||||||||||||||||||||
| 1917 | d->solid_color_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1918 | d->solid_color_filler.adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 1919 | fillRect(r, &d->solid_color_filler); | - | ||||||||||||||||||||||||||||||
| 1920 | - | |||||||||||||||||||||||||||||||
| 1921 | s->matrix = old; | - | ||||||||||||||||||||||||||||||
| 1922 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1923 | } | - | ||||||||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||||||||
| 1925 | bool stretch_sr = r.width() != sr.width()
| 0 | ||||||||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||||||||
| 1927 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||||||||
| 1929 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1930 | && !stretch_sr
| 0 | ||||||||||||||||||||||||||||||
| 1931 | && (!clip
| 0 | ||||||||||||||||||||||||||||||
| 1932 | && s->intOpacity == 256
| 0 | ||||||||||||||||||||||||||||||
| 1933 | && (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1934 | || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1935 | && d->rasterBuffer->format == img.format()
| 0 | ||||||||||||||||||||||||||||||
| 1936 | && (d->rasterBuffer->format == QImage::Format_RGB16
| 0 | ||||||||||||||||||||||||||||||
| 1937 | || d->rasterBuffer->format == QImage::Format_RGB32
| 0 | ||||||||||||||||||||||||||||||
| 1938 | || (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||||||||||||||
| 1939 | && d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1940 | { | - | ||||||||||||||||||||||||||||||
| 1941 | RotationType rotationType = qRotationType(s->matrix); | - | ||||||||||||||||||||||||||||||
| 1942 | - | |||||||||||||||||||||||||||||||
| 1943 | if (rotationType != NoRotation
| 0 | ||||||||||||||||||||||||||||||
| 1944 | QRectF transformedTargetRect = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 1945 | - | |||||||||||||||||||||||||||||||
| 1946 | if ((!(s->renderHints & QPainter::SmoothPixmapTransform)
| 0 | ||||||||||||||||||||||||||||||
| 1947 | || (isPixelAligned(transformedTargetRect)
| 0 | ||||||||||||||||||||||||||||||
| 1948 | { | - | ||||||||||||||||||||||||||||||
| 1949 | QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect); | - | ||||||||||||||||||||||||||||||
| 1950 | if (clippedTransformedTargetRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 1951 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1952 | - | |||||||||||||||||||||||||||||||
| 1953 | QRectF clippedTargetRect = s->matrix.inverted().mapRect(QRectF(clippedTransformedTargetRect)); | - | ||||||||||||||||||||||||||||||
| 1954 | - | |||||||||||||||||||||||||||||||
| 1955 | QRect clippedSourceRect | - | ||||||||||||||||||||||||||||||
| 1956 | = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(), | - | ||||||||||||||||||||||||||||||
| 1957 | clippedTargetRect.width(), clippedTargetRect.height()).toRect(); | - | ||||||||||||||||||||||||||||||
| 1958 | - | |||||||||||||||||||||||||||||||
| 1959 | clippedSourceRect = clippedSourceRect.intersected(img.rect()); | - | ||||||||||||||||||||||||||||||
| 1960 | - | |||||||||||||||||||||||||||||||
| 1961 | uint dbpl = d->rasterBuffer->bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 1962 | uint sbpl = img.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 1963 | - | |||||||||||||||||||||||||||||||
| 1964 | uchar *dst = d->rasterBuffer->buffer(); | - | ||||||||||||||||||||||||||||||
| 1965 | uint bpp = img.depth() >> 3; | - | ||||||||||||||||||||||||||||||
| 1966 | - | |||||||||||||||||||||||||||||||
| 1967 | const uchar *srcBase = img.bits() + clippedSourceRect.y() * sbpl + clippedSourceRect.x() * bpp; | - | ||||||||||||||||||||||||||||||
| 1968 | uchar *dstBase = dst + clippedTransformedTargetRect.y() * dbpl + clippedTransformedTargetRect.x() * bpp; | - | ||||||||||||||||||||||||||||||
| 1969 | - | |||||||||||||||||||||||||||||||
| 1970 | uint cw = clippedSourceRect.width(); | - | ||||||||||||||||||||||||||||||
| 1971 | uint ch = clippedSourceRect.height(); | - | ||||||||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||||||||
| 1973 | qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); | - | ||||||||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||||||||
| 1975 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1976 | } | - | ||||||||||||||||||||||||||||||
| 1977 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1978 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1979 | - | |||||||||||||||||||||||||||||||
| 1980 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1981 | - | |||||||||||||||||||||||||||||||
| 1982 | QRectF targetBounds = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 1983 | bool exceedsPrecision = targetBounds.width() > 0xffff
| 0 | ||||||||||||||||||||||||||||||
| 1984 | || targetBounds.height() > 0xffff
| 0 | ||||||||||||||||||||||||||||||
| 1985 | - | |||||||||||||||||||||||||||||||
| 1986 | if (!exceedsPrecision
| 0 | ||||||||||||||||||||||||||||||
| 1987 | if (s->matrix.type() > QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1988 | SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 1989 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 1990 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(), | - | ||||||||||||||||||||||||||||||
| 1991 | img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect, | - | ||||||||||||||||||||||||||||||
| 1992 | s->matrix, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1993 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1994 | } | - | ||||||||||||||||||||||||||||||
| 1995 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1996 | - | |||||||||||||||||||||||||||||||
| 1997 | bool sourceRect2x = r.width() * 2 == sr.width()
| 0 | ||||||||||||||||||||||||||||||
| 1998 | bool scale2x = (
| 0 | ||||||||||||||||||||||||||||||
| 1999 | if (s->matrix.type() == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 2000 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 2001 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 2002 | QPointF pt(r.x() * 2 + s->matrix.dx(), r.y() * 2 + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2003 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2004 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2005 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2006 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2007 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2008 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2009 | } | - | ||||||||||||||||||||||||||||||
| 2010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2011 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2012 | SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 2013 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 2014 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), | - | ||||||||||||||||||||||||||||||
| 2015 | img.bits(), img.bytesPerLine(), img.height(), | - | ||||||||||||||||||||||||||||||
| 2016 | qt_mapRect_non_normalizing(r, s->matrix), sr, | - | ||||||||||||||||||||||||||||||
| 2017 | !clip ? d->deviceRect : clip->clipRect, | - | ||||||||||||||||||||||||||||||
| 2018 | s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 2019 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2020 | } | - | ||||||||||||||||||||||||||||||
| 2021 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2022 | } | - | ||||||||||||||||||||||||||||||
| 2023 | - | |||||||||||||||||||||||||||||||
| 2024 | QTransform copy = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2025 | copy.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||||||||
| 2026 | if (stretch_sr
| 0 | ||||||||||||||||||||||||||||||
| 2027 | copy.scale(r.width() / sr.width(), r.height() / sr.height()); never executed: copy.scale(r.width() / sr.width(), r.height() / sr.height()); | 0 | ||||||||||||||||||||||||||||||
| 2028 | copy.translate(-sr.x(), -sr.y()); | - | ||||||||||||||||||||||||||||||
| 2029 | - | |||||||||||||||||||||||||||||||
| 2030 | d->image_filler_xform.clip = clip; | - | ||||||||||||||||||||||||||||||
| 2031 | d->image_filler_xform.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - | ||||||||||||||||||||||||||||||
| 2032 | if (!d->image_filler_xform.blend
| 0 | ||||||||||||||||||||||||||||||
| 2033 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2034 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - | ||||||||||||||||||||||||||||||
| 2035 | - | |||||||||||||||||||||||||||||||
| 2036 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2037 | QRectF rr = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 2038 | - | |||||||||||||||||||||||||||||||
| 2039 | const int x1 = qRound(rr.x()); | - | ||||||||||||||||||||||||||||||
| 2040 | const int y1 = qRound(rr.y()); | - | ||||||||||||||||||||||||||||||
| 2041 | const int x2 = qRound(rr.right()); | - | ||||||||||||||||||||||||||||||
| 2042 | const int y2 = qRound(rr.bottom()); | - | ||||||||||||||||||||||||||||||
| 2043 | - | |||||||||||||||||||||||||||||||
| 2044 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); | - | ||||||||||||||||||||||||||||||
| 2045 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2046 | } | - | ||||||||||||||||||||||||||||||
| 2047 | - | |||||||||||||||||||||||||||||||
| 2048 | - | |||||||||||||||||||||||||||||||
| 2049 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2050 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2051 | d->initializeRasterizer(&d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2052 | d->rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 2053 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2054 | - | |||||||||||||||||||||||||||||||
| 2055 | const QPointF offs = s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 2056 | - | |||||||||||||||||||||||||||||||
| 2057 | const QRectF &rect = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 2058 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs; | - | ||||||||||||||||||||||||||||||
| 2059 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs; | - | ||||||||||||||||||||||||||||||
| 2060 | - | |||||||||||||||||||||||||||||||
| 2061 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2062 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); never executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | 0 | ||||||||||||||||||||||||||||||
| 2063 | else | - | ||||||||||||||||||||||||||||||
| 2064 | d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); never executed: d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); | 0 | ||||||||||||||||||||||||||||||
| 2065 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2066 | } | - | ||||||||||||||||||||||||||||||
| 2067 | - | |||||||||||||||||||||||||||||||
| 2068 | const qreal offs = s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 2069 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 2070 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 2071 | QTransform m = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2072 | s->matrix = QTransform(m.m11(), m.m12(), m.m13(), | - | ||||||||||||||||||||||||||||||
| 2073 | m.m21(), m.m22(), m.m23(), | - | ||||||||||||||||||||||||||||||
| 2074 | m.m31() - offs, m.m32() - offs, m.m33()); | - | ||||||||||||||||||||||||||||||
| 2075 | fillPath(path, &d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2076 | s->matrix = m; | - | ||||||||||||||||||||||||||||||
| 2077 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2078 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)
| 0 | ||||||||||||||||||||||||||||||
| 2079 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 2080 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 2081 | QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2082 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2083 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2084 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2085 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2086 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2087 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2088 | } | - | ||||||||||||||||||||||||||||||
| 2089 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2090 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2091 | - | |||||||||||||||||||||||||||||||
| 2092 | d->image_filler.clip = clip; | - | ||||||||||||||||||||||||||||||
| 2093 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - | ||||||||||||||||||||||||||||||
| 2094 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 2095 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2096 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - | ||||||||||||||||||||||||||||||
| 2097 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - | ||||||||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||||||||
| 2099 | QRectF rr = r; | - | ||||||||||||||||||||||||||||||
| 2100 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2101 | - | |||||||||||||||||||||||||||||||
| 2102 | const int x1 = qRound(rr.x()); | - | ||||||||||||||||||||||||||||||
| 2103 | const int y1 = qRound(rr.y()); | - | ||||||||||||||||||||||||||||||
| 2104 | const int x2 = qRound(rr.right()); | - | ||||||||||||||||||||||||||||||
| 2105 | const int y2 = qRound(rr.bottom()); | - | ||||||||||||||||||||||||||||||
| 2106 | - | |||||||||||||||||||||||||||||||
| 2107 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 2108 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2109 | } | - | ||||||||||||||||||||||||||||||
| 2110 | - | |||||||||||||||||||||||||||||||
| 2111 | - | |||||||||||||||||||||||||||||||
| 2112 | - | |||||||||||||||||||||||||||||||
| 2113 | - | |||||||||||||||||||||||||||||||
| 2114 | void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &sr) | - | ||||||||||||||||||||||||||||||
| 2115 | { | - | ||||||||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||||||||
| 2117 | - | |||||||||||||||||||||||||||||||
| 2118 | - | |||||||||||||||||||||||||||||||
| 2119 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2120 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2121 | ((!(s)) ? qt_assert("s",__FILE__,2448) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2122 | - | |||||||||||||||||||||||||||||||
| 2123 | QImage image; | - | ||||||||||||||||||||||||||||||
| 2124 | - | |||||||||||||||||||||||||||||||
| 2125 | QPlatformPixmap *pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 2126 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 2127 | image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 2128 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2129 | image = pixmap.toImage(); | - | ||||||||||||||||||||||||||||||
| 2130 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2131 | - | |||||||||||||||||||||||||||||||
| 2132 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 2133 | image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); never executed: image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); | 0 | ||||||||||||||||||||||||||||||
| 2134 | - | |||||||||||||||||||||||||||||||
| 2135 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 2136 | QTransform copy = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2137 | copy.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||||||||
| 2138 | copy.translate(-sr.x(), -sr.y()); | - | ||||||||||||||||||||||||||||||
| 2139 | d->image_filler_xform.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2140 | d->image_filler_xform.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 2141 | if (!d->image_filler_xform.blend
| 0 | ||||||||||||||||||||||||||||||
| 2142 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2143 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - | ||||||||||||||||||||||||||||||
| 2144 | - | |||||||||||||||||||||||||||||||
| 2145 | - | |||||||||||||||||||||||||||||||
| 2146 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2147 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2148 | d->initializeRasterizer(&d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2149 | d->rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 2150 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2151 | - | |||||||||||||||||||||||||||||||
| 2152 | const QRectF &rect = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 2153 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 2154 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 2155 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2156 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); never executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | 0 | ||||||||||||||||||||||||||||||
| 2157 | else | - | ||||||||||||||||||||||||||||||
| 2158 | d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); never executed: d->rasterizer->rasterizeLine(a, b, qAbs((s->matrix.m22() * rect.height()) / (s->matrix.m11() * rect.width()))); | 0 | ||||||||||||||||||||||||||||||
| 2159 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2160 | } | - | ||||||||||||||||||||||||||||||
| 2161 | - | |||||||||||||||||||||||||||||||
| 2162 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 2163 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 2164 | fillPath(path, &d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2165 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2166 | d->image_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2167 | - | |||||||||||||||||||||||||||||||
| 2168 | d->image_filler.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 2169 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 2170 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2171 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - | ||||||||||||||||||||||||||||||
| 2172 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - | ||||||||||||||||||||||||||||||
| 2173 | - | |||||||||||||||||||||||||||||||
| 2174 | QRectF rr = r; | - | ||||||||||||||||||||||||||||||
| 2175 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2176 | fillRect_normalized(rr.toRect().normalized(), &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 2177 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2178 | } | - | ||||||||||||||||||||||||||||||
| 2179 | - | |||||||||||||||||||||||||||||||
| 2180 | - | |||||||||||||||||||||||||||||||
| 2181 | - | |||||||||||||||||||||||||||||||
| 2182 | static inline bool monoVal(const uchar* s, int x) | - | ||||||||||||||||||||||||||||||
| 2183 | { | - | ||||||||||||||||||||||||||||||
| 2184 | return never executed: (s[x>>3] << (x&7)) & 0x80;return (s[x>>3] << (x&7)) & 0x80;never executed: return (s[x>>3] << (x&7)) & 0x80; | 0 | ||||||||||||||||||||||||||||||
| 2185 | } | - | ||||||||||||||||||||||||||||||
| 2186 | - | |||||||||||||||||||||||||||||||
| 2187 | - | |||||||||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||||||||
| 2189 | - | |||||||||||||||||||||||||||||||
| 2190 | QRasterBuffer *QRasterPaintEngine::rasterBuffer() | - | ||||||||||||||||||||||||||||||
| 2191 | { | - | ||||||||||||||||||||||||||||||
| 2192 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2193 | return never executed: d->rasterBuffer.data();return d->rasterBuffer.data();never executed: return d->rasterBuffer.data(); | 0 | ||||||||||||||||||||||||||||||
| 2194 | } | - | ||||||||||||||||||||||||||||||
| 2195 | - | |||||||||||||||||||||||||||||||
| 2196 | - | |||||||||||||||||||||||||||||||
| 2197 | - | |||||||||||||||||||||||||||||||
| 2198 | - | |||||||||||||||||||||||||||||||
| 2199 | void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h) | - | ||||||||||||||||||||||||||||||
| 2200 | { | - | ||||||||||||||||||||||||||||||
| 2201 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2202 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2203 | - | |||||||||||||||||||||||||||||||
| 2204 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2205 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2206 | - | |||||||||||||||||||||||||||||||
| 2207 | QRasterBuffer *rb = d->rasterBuffer.data(); | - | ||||||||||||||||||||||||||||||
| 2208 | - | |||||||||||||||||||||||||||||||
| 2209 | const QRect rect(rx, ry, w, h); | - | ||||||||||||||||||||||||||||||
| 2210 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2211 | bool unclipped = false; | - | ||||||||||||||||||||||||||||||
| 2212 | if (clip
| 0 | ||||||||||||||||||||||||||||||
| 2213 | - | |||||||||||||||||||||||||||||||
| 2214 | const bool intersects = qMax(clip->xmin, rect.left()) <= qMin(clip->xmax - 1, rect.right())
| 0 | ||||||||||||||||||||||||||||||
| 2215 | && qMax(clip->ymin, rect.top()) <= qMin(clip->ymax - 1, rect.bottom())
| 0 | ||||||||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||||||||
| 2217 | if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2218 | unclipped = rx > clip->xmin
| 0 | ||||||||||||||||||||||||||||||
| 2219 | && rx + w < clip->xmax
| 0 | ||||||||||||||||||||||||||||||
| 2220 | && ry > clip->ymin
| 0 | ||||||||||||||||||||||||||||||
| 2221 | && ry + h < clip->ymax
| 0 | ||||||||||||||||||||||||||||||
| 2222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2223 | - | |||||||||||||||||||||||||||||||
| 2224 | if (!intersects
| 0 | ||||||||||||||||||||||||||||||
| 2225 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2226 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2227 | - | |||||||||||||||||||||||||||||||
| 2228 | const bool intersects = qMax(0, rect.left()) <= qMin(rb->width() - 1, rect.right())
| 0 | ||||||||||||||||||||||||||||||
| 2229 | && qMax(0, rect.top()) <= qMin(rb->height() - 1, rect.bottom())
| 0 | ||||||||||||||||||||||||||||||
| 2230 | if (!intersects
| 0 | ||||||||||||||||||||||||||||||
| 2231 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2232 | - | |||||||||||||||||||||||||||||||
| 2233 | - | |||||||||||||||||||||||||||||||
| 2234 | const bool contains = rect.left() >= 0
| 0 | ||||||||||||||||||||||||||||||
| 2235 | && rect.top() >= 0
| 0 | ||||||||||||||||||||||||||||||
| 2236 | - | |||||||||||||||||||||||||||||||
| 2237 | unclipped = contains
| 0 | ||||||||||||||||||||||||||||||
| 2238 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2239 | - | |||||||||||||||||||||||||||||||
| 2240 | ProcessSpans blend = unclipped
| 0 | ||||||||||||||||||||||||||||||
| 2241 | const uchar * scanline = static_cast<const uchar *>(src); | - | ||||||||||||||||||||||||||||||
| 2242 | - | |||||||||||||||||||||||||||||||
| 2243 | if (s->flags.fast_text
| 0 | ||||||||||||||||||||||||||||||
| 2244 | if (unclipped
| 0 | ||||||||||||||||||||||||||||||
| 2245 | if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2246 | if (s->penData.bitmapBlit
| 0 | ||||||||||||||||||||||||||||||
| 2247 | s->penData.bitmapBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2248 | scanline, w, h, bpl); | - | ||||||||||||||||||||||||||||||
| 2249 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2250 | } | - | ||||||||||||||||||||||||||||||
| 2251 | } never executed: else if (depth == 8end of block
| 0 | ||||||||||||||||||||||||||||||
| 2252 | if (s->penData.alphamapBlit
| 0 | ||||||||||||||||||||||||||||||
| 2253 | s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2254 | scanline, w, h, bpl, 0); | - | ||||||||||||||||||||||||||||||
| 2255 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2256 | } | - | ||||||||||||||||||||||||||||||
| 2257 | } never executed: else if (depth == 32end of block
| 0 | ||||||||||||||||||||||||||||||
| 2258 | - | |||||||||||||||||||||||||||||||
| 2259 | if (s->penData.alphaRGBBlit
| 0 | ||||||||||||||||||||||||||||||
| 2260 | s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2261 | (const uint *) scanline, w, h, bpl / 4, 0); | - | ||||||||||||||||||||||||||||||
| 2262 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2263 | } | - | ||||||||||||||||||||||||||||||
| 2264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2265 | } never executed: else if (d->deviceDepth == 32end of block
| 0 | ||||||||||||||||||||||||||||||
| 2266 | - | |||||||||||||||||||||||||||||||
| 2267 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2268 | int nx = qMax(0, rx); | - | ||||||||||||||||||||||||||||||
| 2269 | int ny = qMax(0, ry); | - | ||||||||||||||||||||||||||||||
| 2270 | - | |||||||||||||||||||||||||||||||
| 2271 | - | |||||||||||||||||||||||||||||||
| 2272 | int xdiff = nx - rx; | - | ||||||||||||||||||||||||||||||
| 2273 | int ydiff = ny - ry; | - | ||||||||||||||||||||||||||||||
| 2274 | scanline += ydiff * bpl; | - | ||||||||||||||||||||||||||||||
| 2275 | scanline += xdiff * (depth == 32 ? 4 : 1); | - | ||||||||||||||||||||||||||||||
| 2276 | - | |||||||||||||||||||||||||||||||
| 2277 | w -= xdiff; | - | ||||||||||||||||||||||||||||||
| 2278 | h -= ydiff; | - | ||||||||||||||||||||||||||||||
| 2279 | - | |||||||||||||||||||||||||||||||
| 2280 | if (nx + w > d->rasterBuffer->width()
| 0 | ||||||||||||||||||||||||||||||
| 2281 | w = d->rasterBuffer->width() - nx; never executed: w = d->rasterBuffer->width() - nx; | 0 | ||||||||||||||||||||||||||||||
| 2282 | if (ny + h > d->rasterBuffer->height()
| 0 | ||||||||||||||||||||||||||||||
| 2283 | h = d->rasterBuffer->height() - ny; never executed: h = d->rasterBuffer->height() - ny; | 0 | ||||||||||||||||||||||||||||||
| 2284 | - | |||||||||||||||||||||||||||||||
| 2285 | rx = nx; | - | ||||||||||||||||||||||||||||||
| 2286 | ry = ny; | - | ||||||||||||||||||||||||||||||
| 2287 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2288 | if (depth == 8
| 0 | ||||||||||||||||||||||||||||||
| 2289 | s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, never executed: s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, scanline, w, h, bpl, clip); | 0 | ||||||||||||||||||||||||||||||
| 2290 | scanline, w, h, bpl, clip); never executed: s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, scanline, w, h, bpl, clip); | 0 | ||||||||||||||||||||||||||||||
| 2291 | else if (depth == 32
| 0 | ||||||||||||||||||||||||||||||
| 2292 | s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, never executed: s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, (const uint *) scanline, w, h, bpl / 4, clip); | 0 | ||||||||||||||||||||||||||||||
| 2293 | (const uint *) scanline, w, h, bpl / 4, clip); never executed: s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, (const uint *) scanline, w, h, bpl / 4, clip); | 0 | ||||||||||||||||||||||||||||||
| 2294 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2295 | } | - | ||||||||||||||||||||||||||||||
| 2296 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2297 | - | |||||||||||||||||||||||||||||||
| 2298 | int x0 = 0; | - | ||||||||||||||||||||||||||||||
| 2299 | if (rx < 0
| 0 | ||||||||||||||||||||||||||||||
| 2300 | x0 = -rx; | - | ||||||||||||||||||||||||||||||
| 2301 | w -= x0; | - | ||||||||||||||||||||||||||||||
| 2302 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2303 | - | |||||||||||||||||||||||||||||||
| 2304 | int y0 = 0; | - | ||||||||||||||||||||||||||||||
| 2305 | if (ry < 0
| 0 | ||||||||||||||||||||||||||||||
| 2306 | y0 = -ry; | - | ||||||||||||||||||||||||||||||
| 2307 | scanline += bpl * y0; | - | ||||||||||||||||||||||||||||||
| 2308 | h -= y0; | - | ||||||||||||||||||||||||||||||
| 2309 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2310 | - | |||||||||||||||||||||||||||||||
| 2311 | w = qMin(w, rb->width() - qMax(0, rx)); | - | ||||||||||||||||||||||||||||||
| 2312 | h = qMin(h, rb->height() - qMax(0, ry)); | - | ||||||||||||||||||||||||||||||
| 2313 | - | |||||||||||||||||||||||||||||||
| 2314 | if (w <= 0
| 0 | ||||||||||||||||||||||||||||||
| 2315 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||||||||
| 2317 | const int NSPANS = 256; | - | ||||||||||||||||||||||||||||||
| 2318 | QSpan spans[NSPANS]; | - | ||||||||||||||||||||||||||||||
| 2319 | int current = 0; | - | ||||||||||||||||||||||||||||||
| 2320 | - | |||||||||||||||||||||||||||||||
| 2321 | const int x1 = x0 + w; | - | ||||||||||||||||||||||||||||||
| 2322 | const int y1 = y0 + h; | - | ||||||||||||||||||||||||||||||
| 2323 | - | |||||||||||||||||||||||||||||||
| 2324 | if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2325 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2326 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2327 | if (!monoVal(scanline, x)
| 0 | ||||||||||||||||||||||||||||||
| 2328 | ++x; | - | ||||||||||||||||||||||||||||||
| 2329 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2330 | } | - | ||||||||||||||||||||||||||||||
| 2331 | - | |||||||||||||||||||||||||||||||
| 2332 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2333 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2334 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2335 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2336 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2337 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2338 | spans[current].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 2339 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2340 | ++x; | - | ||||||||||||||||||||||||||||||
| 2341 | - | |||||||||||||||||||||||||||||||
| 2342 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2343 | ++x; | - | ||||||||||||||||||||||||||||||
| 2344 | ++len; | - | ||||||||||||||||||||||||||||||
| 2345 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2346 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2347 | ++current; | - | ||||||||||||||||||||||||||||||
| 2348 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2349 | scanline += bpl; | - | ||||||||||||||||||||||||||||||
| 2350 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2351 | } never executed: else if (depth == 8end of block
| 0 | ||||||||||||||||||||||||||||||
| 2352 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2353 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2354 | - | |||||||||||||||||||||||||||||||
| 2355 | if (scanline[x] == 0
| 0 | ||||||||||||||||||||||||||||||
| 2356 | ++x; | - | ||||||||||||||||||||||||||||||
| 2357 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2358 | } | - | ||||||||||||||||||||||||||||||
| 2359 | - | |||||||||||||||||||||||||||||||
| 2360 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2361 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2362 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2364 | int coverage = scanline[x]; | - | ||||||||||||||||||||||||||||||
| 2365 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2366 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2367 | spans[current].coverage = coverage; | - | ||||||||||||||||||||||||||||||
| 2368 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2369 | ++x; | - | ||||||||||||||||||||||||||||||
| 2370 | - | |||||||||||||||||||||||||||||||
| 2371 | - | |||||||||||||||||||||||||||||||
| 2372 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2373 | ++x; | - | ||||||||||||||||||||||||||||||
| 2374 | ++len; | - | ||||||||||||||||||||||||||||||
| 2375 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2376 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2377 | ++current; | - | ||||||||||||||||||||||||||||||
| 2378 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2379 | scanline += bpl; | - | ||||||||||||||||||||||||||||||
| 2380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2381 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2382 | const uint *sl = (const uint *) scanline; | - | ||||||||||||||||||||||||||||||
| 2383 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2384 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2385 | - | |||||||||||||||||||||||||||||||
| 2386 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 2387 | ++x; | - | ||||||||||||||||||||||||||||||
| 2388 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2389 | } | - | ||||||||||||||||||||||||||||||
| 2390 | - | |||||||||||||||||||||||||||||||
| 2391 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2392 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2393 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2394 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2395 | uint rgbCoverage = sl[x]; | - | ||||||||||||||||||||||||||||||
| 2396 | int coverage = qGreen(rgbCoverage); | - | ||||||||||||||||||||||||||||||
| 2397 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2398 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2399 | spans[current].coverage = coverage; | - | ||||||||||||||||||||||||||||||
| 2400 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2401 | ++x; | - | ||||||||||||||||||||||||||||||
| 2402 | - | |||||||||||||||||||||||||||||||
| 2403 | - | |||||||||||||||||||||||||||||||
| 2404 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2405 | ++x; | - | ||||||||||||||||||||||||||||||
| 2406 | ++len; | - | ||||||||||||||||||||||||||||||
| 2407 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2408 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2409 | ++current; | - | ||||||||||||||||||||||||||||||
| 2410 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2411 | sl += bpl / sizeof(uint); | - | ||||||||||||||||||||||||||||||
| 2412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2413 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2414 | - | |||||||||||||||||||||||||||||||
| 2415 | - | |||||||||||||||||||||||||||||||
| 2416 | - | |||||||||||||||||||||||||||||||
| 2417 | if (current != 0
| 0 | ||||||||||||||||||||||||||||||
| 2418 | blend(current, spans, &s->penData); never executed: blend(current, spans, &s->penData); | 0 | ||||||||||||||||||||||||||||||
| 2419 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2420 | - | |||||||||||||||||||||||||||||||
| 2421 | - | |||||||||||||||||||||||||||||||
| 2422 | - | |||||||||||||||||||||||||||||||
| 2423 | - | |||||||||||||||||||||||||||||||
| 2424 | bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, | - | ||||||||||||||||||||||||||||||
| 2425 | const QFixedPoint *positions, QFontEngine *fontEngine) | - | ||||||||||||||||||||||||||||||
| 2426 | { | - | ||||||||||||||||||||||||||||||
| 2427 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2428 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2429 | - | |||||||||||||||||||||||||||||||
| 2430 | if (fontEngine->hasInternalCaching()
| 0 | ||||||||||||||||||||||||||||||
| 2431 | QFontEngine::GlyphFormat neededFormat = | - | ||||||||||||||||||||||||||||||
| 2432 | painter()->device()->devType() == QInternal::Widget
| 0 | ||||||||||||||||||||||||||||||
| 2433 | ? QFontEngine::Format_None | - | ||||||||||||||||||||||||||||||
| 2434 | : QFontEngine::Format_A8; | - | ||||||||||||||||||||||||||||||
| 2435 | - | |||||||||||||||||||||||||||||||
| 2436 | if (d_func()->mono_surface
| 0 | ||||||||||||||||||||||||||||||
| 2437 | neededFormat = QFontEngine::Format_Mono; never executed: neededFormat = QFontEngine::Format_Mono; | 0 | ||||||||||||||||||||||||||||||
| 2438 | - | |||||||||||||||||||||||||||||||
| 2439 | for (int i = 0; i < numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2440 | QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); | - | ||||||||||||||||||||||||||||||
| 2441 | - | |||||||||||||||||||||||||||||||
| 2442 | QPoint offset; | - | ||||||||||||||||||||||||||||||
| 2443 | const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, | - | ||||||||||||||||||||||||||||||
| 2444 | &offset); | - | ||||||||||||||||||||||||||||||
| 2445 | if (alphaMap == 0
| 0 | ||||||||||||||||||||||||||||||
| 2446 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2447 | - | |||||||||||||||||||||||||||||||
| 2448 | alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), | - | ||||||||||||||||||||||||||||||
| 2449 | qFloor(positions[i].x) + offset.x(), | - | ||||||||||||||||||||||||||||||
| 2450 | qRound(positions[i].y) + offset.y(), | - | ||||||||||||||||||||||||||||||
| 2451 | alphaMap->width(), alphaMap->height()); | - | ||||||||||||||||||||||||||||||
| 2452 | - | |||||||||||||||||||||||||||||||
| 2453 | fontEngine->unlockAlphaMapForGlyph(); | - | ||||||||||||||||||||||||||||||
| 2454 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2455 | - | |||||||||||||||||||||||||||||||
| 2456 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2457 | QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
| 0 | ||||||||||||||||||||||||||||||
| 2458 | - | |||||||||||||||||||||||||||||||
| 2459 | QImageTextureGlyphCache *cache = | - | ||||||||||||||||||||||||||||||
| 2460 | static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix)); | - | ||||||||||||||||||||||||||||||
| 2461 | if (!cache
| 0 | ||||||||||||||||||||||||||||||
| 2462 | cache = new QImageTextureGlyphCache(glyphFormat, s->matrix); | - | ||||||||||||||||||||||||||||||
| 2463 | fontEngine->setGlyphCache(0, cache); | - | ||||||||||||||||||||||||||||||
| 2464 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2465 | - | |||||||||||||||||||||||||||||||
| 2466 | cache->populate(fontEngine, numGlyphs, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2467 | cache->fillInPendingGlyphs(); | - | ||||||||||||||||||||||||||||||
| 2468 | - | |||||||||||||||||||||||||||||||
| 2469 | const QImage &image = cache->image(); | - | ||||||||||||||||||||||||||||||
| 2470 | int bpl = image.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 2471 | - | |||||||||||||||||||||||||||||||
| 2472 | int depth = image.depth(); | - | ||||||||||||||||||||||||||||||
| 2473 | int rightShift = 0; | - | ||||||||||||||||||||||||||||||
| 2474 | int leftShift = 0; | - | ||||||||||||||||||||||||||||||
| 2475 | if (depth == 32
| 0 | ||||||||||||||||||||||||||||||
| 2476 | leftShift = 2; never executed: leftShift = 2; | 0 | ||||||||||||||||||||||||||||||
| 2477 | else if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2478 | rightShift = 3; never executed: rightShift = 3; | 0 | ||||||||||||||||||||||||||||||
| 2479 | - | |||||||||||||||||||||||||||||||
| 2480 | int margin = fontEngine->glyphMargin(glyphFormat); | - | ||||||||||||||||||||||||||||||
| 2481 | const uchar *bits = image.bits(); | - | ||||||||||||||||||||||||||||||
| 2482 | for (int i=0; i<numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2483 | - | |||||||||||||||||||||||||||||||
| 2484 | QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x); | - | ||||||||||||||||||||||||||||||
| 2485 | QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition); | - | ||||||||||||||||||||||||||||||
| 2486 | const QTextureGlyphCache::Coord &c = cache->coords[glyph]; | - | ||||||||||||||||||||||||||||||
| 2487 | if (c.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 2488 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2489 | - | |||||||||||||||||||||||||||||||
| 2490 | int x = qFloor(positions[i].x) + c.baseLineX - margin; | - | ||||||||||||||||||||||||||||||
| 2491 | int y = qRound(positions[i].y) - c.baseLineY - margin; | - | ||||||||||||||||||||||||||||||
| 2492 | const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl; | - | ||||||||||||||||||||||||||||||
| 2493 | - | |||||||||||||||||||||||||||||||
| 2494 | if (glyphFormat == QFontEngine::Format_ARGB
| 0 | ||||||||||||||||||||||||||||||
| 2495 | - | |||||||||||||||||||||||||||||||
| 2496 | - | |||||||||||||||||||||||||||||||
| 2497 | - | |||||||||||||||||||||||||||||||
| 2498 | QTransform originalTransform = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2499 | s->matrix = QTransform(); | - | ||||||||||||||||||||||||||||||
| 2500 | drawImage(QPoint(x, y), QImage(glyphBits, c.w, c.h, bpl, image.format())); | - | ||||||||||||||||||||||||||||||
| 2501 | s->matrix = originalTransform; | - | ||||||||||||||||||||||||||||||
| 2502 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2503 | alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h); | - | ||||||||||||||||||||||||||||||
| 2504 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2505 | } | - | ||||||||||||||||||||||||||||||
| 2506 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2507 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2508 | } | - | ||||||||||||||||||||||||||||||
| 2509 | - | |||||||||||||||||||||||||||||||
| 2510 | - | |||||||||||||||||||||||||||||||
| 2511 | - | |||||||||||||||||||||||||||||||
| 2512 | - | |||||||||||||||||||||||||||||||
| 2513 | - | |||||||||||||||||||||||||||||||
| 2514 | - | |||||||||||||||||||||||||||||||
| 2515 | bool QRasterPaintEnginePrivate::isUnclipped_normalized(const QRect &r) const | - | ||||||||||||||||||||||||||||||
| 2516 | { | - | ||||||||||||||||||||||||||||||
| 2517 | const QClipData *cl = clip(); | - | ||||||||||||||||||||||||||||||
| 2518 | if (!cl
| 0 | ||||||||||||||||||||||||||||||
| 2519 | - | |||||||||||||||||||||||||||||||
| 2520 | const QRect &r1 = deviceRect; | - | ||||||||||||||||||||||||||||||
| 2521 | return never executed: (r.left() >= r1.left() && r.right() <= r1.right()return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom());never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2522 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2523 | } | - | ||||||||||||||||||||||||||||||
| 2524 | - | |||||||||||||||||||||||||||||||
| 2525 | - | |||||||||||||||||||||||||||||||
| 2526 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2527 | - | |||||||||||||||||||||||||||||||
| 2528 | if (cl->clipRect == deviceRect
| 0 | ||||||||||||||||||||||||||||||
| 2529 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2530 | - | |||||||||||||||||||||||||||||||
| 2531 | - | |||||||||||||||||||||||||||||||
| 2532 | const QRect &r1 = cl->clipRect; | - | ||||||||||||||||||||||||||||||
| 2533 | return never executed: (r.left() >= r1.left() && r.right() <= r1.right()return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom());never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2534 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2535 | } else { | - | ||||||||||||||||||||||||||||||
| 2536 | return never executed: qt_region_strictContains(cl->clipRegion, r);return qt_region_strictContains(cl->clipRegion, r);never executed: return qt_region_strictContains(cl->clipRegion, r); | 0 | ||||||||||||||||||||||||||||||
| 2537 | } | - | ||||||||||||||||||||||||||||||
| 2538 | } | - | ||||||||||||||||||||||||||||||
| 2539 | - | |||||||||||||||||||||||||||||||
| 2540 | bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 2541 | int penWidth) const | - | ||||||||||||||||||||||||||||||
| 2542 | { | - | ||||||||||||||||||||||||||||||
| 2543 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2544 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2545 | const QClipData *cl = clip(); | - | ||||||||||||||||||||||||||||||
| 2546 | if (!cl
| 0 | ||||||||||||||||||||||||||||||
| 2547 | QRect r = rect.normalized(); | - | ||||||||||||||||||||||||||||||
| 2548 | - | |||||||||||||||||||||||||||||||
| 2549 | const QRect &r1 = deviceRect; | - | ||||||||||||||||||||||||||||||
| 2550 | return never executed: (r.left() >= r1.left() && r.right() <= r1.right()return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom());never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2551 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2552 | } | - | ||||||||||||||||||||||||||||||
| 2553 | - | |||||||||||||||||||||||||||||||
| 2554 | - | |||||||||||||||||||||||||||||||
| 2555 | - | |||||||||||||||||||||||||||||||
| 2556 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2557 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2558 | - | |||||||||||||||||||||||||||||||
| 2559 | if (s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2560 | ++ never executed: penWidth;++penWidth;never executed: ++penWidth; | 0 | ||||||||||||||||||||||||||||||
| 2561 | - | |||||||||||||||||||||||||||||||
| 2562 | QRect r = rect.normalized(); | - | ||||||||||||||||||||||||||||||
| 2563 | if (penWidth > 0
| 0 | ||||||||||||||||||||||||||||||
| 2564 | r.setX(r.x() - penWidth); | - | ||||||||||||||||||||||||||||||
| 2565 | r.setY(r.y() - penWidth); | - | ||||||||||||||||||||||||||||||
| 2566 | r.setWidth(r.width() + 2 * penWidth); | - | ||||||||||||||||||||||||||||||
| 2567 | r.setHeight(r.height() + 2 * penWidth); | - | ||||||||||||||||||||||||||||||
| 2568 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2569 | - | |||||||||||||||||||||||||||||||
| 2570 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2571 | - | |||||||||||||||||||||||||||||||
| 2572 | const QRect &r1 = cl->clipRect; | - | ||||||||||||||||||||||||||||||
| 2573 | return never executed: (r.left() >= r1.left() && r.right() <= r1.right()return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom());never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2574 | && r.top() >= r1.top() && r.bottom() <= r1.bottom()); never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2575 | } else { | - | ||||||||||||||||||||||||||||||
| 2576 | return never executed: qt_region_strictContains(cl->clipRegion, r);return qt_region_strictContains(cl->clipRegion, r);never executed: return qt_region_strictContains(cl->clipRegion, r); | 0 | ||||||||||||||||||||||||||||||
| 2577 | } | - | ||||||||||||||||||||||||||||||
| 2578 | } | - | ||||||||||||||||||||||||||||||
| 2579 | - | |||||||||||||||||||||||||||||||
| 2580 | inline bool QRasterPaintEnginePrivate::isUnclipped(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2581 | int penWidth) const | - | ||||||||||||||||||||||||||||||
| 2582 | { | - | ||||||||||||||||||||||||||||||
| 2583 | return never executed: isUnclipped(rect.normalized().toAlignedRect(), penWidth);return isUnclipped(rect.normalized().toAlignedRect(), penWidth);never executed: return isUnclipped(rect.normalized().toAlignedRect(), penWidth); | 0 | ||||||||||||||||||||||||||||||
| 2584 | } | - | ||||||||||||||||||||||||||||||
| 2585 | - | |||||||||||||||||||||||||||||||
| 2586 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2587 | QRasterPaintEnginePrivate::getBrushFunc(const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 2588 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2589 | { | - | ||||||||||||||||||||||||||||||
| 2590 | return never executed: isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;never executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2591 | } | - | ||||||||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||||||||
| 2593 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2594 | QRasterPaintEnginePrivate::getBrushFunc(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2595 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2596 | { | - | ||||||||||||||||||||||||||||||
| 2597 | return never executed: isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;never executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2598 | } | - | ||||||||||||||||||||||||||||||
| 2599 | - | |||||||||||||||||||||||||||||||
| 2600 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2601 | QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2602 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2603 | { | - | ||||||||||||||||||||||||||||||
| 2604 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2605 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2606 | - | |||||||||||||||||||||||||||||||
| 2607 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2608 | return never executed: data->blend;return data->blend;never executed: return data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2609 | const int penWidth = s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2610 | return never executed: isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;never executed: return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2611 | } | - | ||||||||||||||||||||||||||||||
| 2612 | - | |||||||||||||||||||||||||||||||
| 2613 | static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine, | - | ||||||||||||||||||||||||||||||
| 2614 | glyph_t *glyphs, QFixedPoint *positions, int numGlyphs) | - | ||||||||||||||||||||||||||||||
| 2615 | { | - | ||||||||||||||||||||||||||||||
| 2616 | QFixed clipLeft = QFixed::fromReal(clip.left()); | - | ||||||||||||||||||||||||||||||
| 2617 | QFixed clipRight = QFixed::fromReal(clip.right()); | - | ||||||||||||||||||||||||||||||
| 2618 | QFixed clipTop = QFixed::fromReal(clip.top()); | - | ||||||||||||||||||||||||||||||
| 2619 | QFixed clipBottom = QFixed::fromReal(clip.bottom()); | - | ||||||||||||||||||||||||||||||
| 2620 | - | |||||||||||||||||||||||||||||||
| 2621 | int first = 0; | - | ||||||||||||||||||||||||||||||
| 2622 | while (first < numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2623 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[first]); | - | ||||||||||||||||||||||||||||||
| 2624 | QFixed left = metrics.x + positions[first].x; | - | ||||||||||||||||||||||||||||||
| 2625 | QFixed top = metrics.y + positions[first].y; | - | ||||||||||||||||||||||||||||||
| 2626 | QFixed right = left + metrics.width; | - | ||||||||||||||||||||||||||||||
| 2627 | QFixed bottom = top + metrics.height; | - | ||||||||||||||||||||||||||||||
| 2628 | if (left < clipRight
| 0 | ||||||||||||||||||||||||||||||
| 2629 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2630 | ++first; | - | ||||||||||||||||||||||||||||||
| 2631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2632 | int last = numGlyphs - 1; | - | ||||||||||||||||||||||||||||||
| 2633 | while (last > first
| 0 | ||||||||||||||||||||||||||||||
| 2634 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[last]); | - | ||||||||||||||||||||||||||||||
| 2635 | QFixed left = metrics.x + positions[last].x; | - | ||||||||||||||||||||||||||||||
| 2636 | QFixed top = metrics.y + positions[last].y; | - | ||||||||||||||||||||||||||||||
| 2637 | QFixed right = left + metrics.width; | - | ||||||||||||||||||||||||||||||
| 2638 | QFixed bottom = top + metrics.height; | - | ||||||||||||||||||||||||||||||
| 2639 | if (left < clipRight
| 0 | ||||||||||||||||||||||||||||||
| 2640 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2641 | --last; | - | ||||||||||||||||||||||||||||||
| 2642 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2643 | return never executed: QPair<int, int>(first, last + 1);return QPair<int, int>(first, last + 1);never executed: return QPair<int, int>(first, last + 1); | 0 | ||||||||||||||||||||||||||||||
| 2644 | } | - | ||||||||||||||||||||||||||||||
| 2645 | - | |||||||||||||||||||||||||||||||
| 2646 | - | |||||||||||||||||||||||||||||||
| 2647 | - | |||||||||||||||||||||||||||||||
| 2648 | - | |||||||||||||||||||||||||||||||
| 2649 | void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) | - | ||||||||||||||||||||||||||||||
| 2650 | { | - | ||||||||||||||||||||||||||||||
| 2651 | if (textItem->numGlyphs == 0
| 0 | ||||||||||||||||||||||||||||||
| 2652 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2653 | - | |||||||||||||||||||||||||||||||
| 2654 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2655 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||||||||
| 2657 | QTransform matrix = state()->matrix; | - | ||||||||||||||||||||||||||||||
| 2658 | - | |||||||||||||||||||||||||||||||
| 2659 | QFontEngine *fontEngine = textItem->fontEngine(); | - | ||||||||||||||||||||||||||||||
| 2660 | if (shouldDrawCachedGlyphs(fontEngine, matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2661 | drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, | - | ||||||||||||||||||||||||||||||
| 2662 | fontEngine); | - | ||||||||||||||||||||||||||||||
| 2663 | } never executed: else if (matrix.type() < QTransform::TxProjectend of block
| 0 | ||||||||||||||||||||||||||||||
| 2664 | bool invertible; | - | ||||||||||||||||||||||||||||||
| 2665 | QTransform invMat = matrix.inverted(&invertible); | - | ||||||||||||||||||||||||||||||
| 2666 | if (!invertible
| 0 | ||||||||||||||||||||||||||||||
| 2667 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2668 | - | |||||||||||||||||||||||||||||||
| 2669 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - | ||||||||||||||||||||||||||||||
| 2670 | textItem->fontEngine(), textItem->glyphs, | - | ||||||||||||||||||||||||||||||
| 2671 | textItem->glyphPositions, textItem->numGlyphs); | - | ||||||||||||||||||||||||||||||
| 2672 | QStaticTextItem copy = *textItem; | - | ||||||||||||||||||||||||||||||
| 2673 | copy.glyphs += range.first; | - | ||||||||||||||||||||||||||||||
| 2674 | copy.glyphPositions += range.first; | - | ||||||||||||||||||||||||||||||
| 2675 | copy.numGlyphs = range.second - range.first; | - | ||||||||||||||||||||||||||||||
| 2676 | QPaintEngineEx::drawStaticTextItem(©); | - | ||||||||||||||||||||||||||||||
| 2677 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2678 | QPaintEngineEx::drawStaticTextItem(textItem); | - | ||||||||||||||||||||||||||||||
| 2679 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2680 | } | - | ||||||||||||||||||||||||||||||
| 2681 | - | |||||||||||||||||||||||||||||||
| 2682 | - | |||||||||||||||||||||||||||||||
| 2683 | - | |||||||||||||||||||||||||||||||
| 2684 | - | |||||||||||||||||||||||||||||||
| 2685 | void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - | ||||||||||||||||||||||||||||||
| 2686 | { | - | ||||||||||||||||||||||||||||||
| 2687 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||||||||||||||||||||
| 2688 | if (ti.glyphs.numGlyphs == 0
| 0 | ||||||||||||||||||||||||||||||
| 2689 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2690 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2691 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2692 | - | |||||||||||||||||||||||||||||||
| 2693 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2694 | QTransform matrix = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2695 | - | |||||||||||||||||||||||||||||||
| 2696 | if (shouldDrawCachedGlyphs(ti.fontEngine, matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2697 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
| 2698 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
| 2699 | - | |||||||||||||||||||||||||||||||
| 2700 | matrix.translate(p.x(), p.y()); | - | ||||||||||||||||||||||||||||||
| 2701 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2702 | - | |||||||||||||||||||||||||||||||
| 2703 | drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine); | - | ||||||||||||||||||||||||||||||
| 2704 | } never executed: else if (matrix.type() < QTransform::TxProjectend of block
| 0 | ||||||||||||||||||||||||||||||
| 2705 | && ti.fontEngine->supportsTransformation(matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2706 | bool invertible; | - | ||||||||||||||||||||||||||||||
| 2707 | QTransform invMat = matrix.inverted(&invertible); | - | ||||||||||||||||||||||||||||||
| 2708 | if (!invertible
| 0 | ||||||||||||||||||||||||||||||
| 2709 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2710 | - | |||||||||||||||||||||||||||||||
| 2711 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
| 2712 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
| 2713 | - | |||||||||||||||||||||||||||||||
| 2714 | ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()), | - | ||||||||||||||||||||||||||||||
| 2715 | ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2716 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - | ||||||||||||||||||||||||||||||
| 2717 | ti.fontEngine, glyphs.data(), positions.data(), | - | ||||||||||||||||||||||||||||||
| 2718 | glyphs.size()); | - | ||||||||||||||||||||||||||||||
| 2719 | - | |||||||||||||||||||||||||||||||
| 2720 | if (range.first >= range.second
| 0 | ||||||||||||||||||||||||||||||
| 2721 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2722 | - | |||||||||||||||||||||||||||||||
| 2723 | QStaticTextItem staticTextItem; | - | ||||||||||||||||||||||||||||||
| 2724 | staticTextItem.color = s->pen.color(); | - | ||||||||||||||||||||||||||||||
| 2725 | staticTextItem.font = s->font; | - | ||||||||||||||||||||||||||||||
| 2726 | staticTextItem.setFontEngine(ti.fontEngine); | - | ||||||||||||||||||||||||||||||
| 2727 | staticTextItem.numGlyphs = range.second - range.first; | - | ||||||||||||||||||||||||||||||
| 2728 | staticTextItem.glyphs = glyphs.data() + range.first; | - | ||||||||||||||||||||||||||||||
| 2729 | staticTextItem.glyphPositions = positions.data() + range.first; | - | ||||||||||||||||||||||||||||||
| 2730 | QPaintEngineEx::drawStaticTextItem(&staticTextItem); | - | ||||||||||||||||||||||||||||||
| 2731 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2732 | QPaintEngineEx::drawTextItem(p, ti); | - | ||||||||||||||||||||||||||||||
| 2733 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2734 | } | - | ||||||||||||||||||||||||||||||
| 2735 | - | |||||||||||||||||||||||||||||||
| 2736 | - | |||||||||||||||||||||||||||||||
| 2737 | - | |||||||||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||||||||
| 2739 | void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount) | - | ||||||||||||||||||||||||||||||
| 2740 | { | - | ||||||||||||||||||||||||||||||
| 2741 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2742 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2743 | - | |||||||||||||||||||||||||||||||
| 2744 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2745 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2746 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2747 | - | |||||||||||||||||||||||||||||||
| 2748 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2749 | QPaintEngineEx::drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2750 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2751 | } | - | ||||||||||||||||||||||||||||||
| 2752 | - | |||||||||||||||||||||||||||||||
| 2753 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2754 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2755 | stroker.drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2756 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2757 | - | |||||||||||||||||||||||||||||||
| 2758 | - | |||||||||||||||||||||||||||||||
| 2759 | void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) | - | ||||||||||||||||||||||||||||||
| 2760 | { | - | ||||||||||||||||||||||||||||||
| 2761 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2762 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2763 | - | |||||||||||||||||||||||||||||||
| 2764 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2765 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2766 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2767 | - | |||||||||||||||||||||||||||||||
| 2768 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2769 | QPaintEngineEx::drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2770 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2771 | } | - | ||||||||||||||||||||||||||||||
| 2772 | - | |||||||||||||||||||||||||||||||
| 2773 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2774 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2775 | stroker.drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2776 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2777 | - | |||||||||||||||||||||||||||||||
| 2778 | - | |||||||||||||||||||||||||||||||
| 2779 | - | |||||||||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||||||||
| 2781 | void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount) | - | ||||||||||||||||||||||||||||||
| 2782 | { | - | ||||||||||||||||||||||||||||||
| 2783 | - | |||||||||||||||||||||||||||||||
| 2784 | - | |||||||||||||||||||||||||||||||
| 2785 | - | |||||||||||||||||||||||||||||||
| 2786 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2787 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2788 | - | |||||||||||||||||||||||||||||||
| 2789 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2790 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2791 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2792 | - | |||||||||||||||||||||||||||||||
| 2793 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2794 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2795 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2796 | for (int i=0; i<lineCount
| 0 | ||||||||||||||||||||||||||||||
| 2797 | const QLine &l = lines[i]; | - | ||||||||||||||||||||||||||||||
| 2798 | stroker.drawLine(l.p1(), l.p2()); | - | ||||||||||||||||||||||||||||||
| 2799 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2800 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2801 | QPaintEngineEx::drawLines(lines, lineCount); | - | ||||||||||||||||||||||||||||||
| 2802 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2803 | } | - | ||||||||||||||||||||||||||||||
| 2804 | - | |||||||||||||||||||||||||||||||
| 2805 | void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, | - | ||||||||||||||||||||||||||||||
| 2806 | qreal width, | - | ||||||||||||||||||||||||||||||
| 2807 | int *dashIndex, | - | ||||||||||||||||||||||||||||||
| 2808 | qreal *dashOffset, | - | ||||||||||||||||||||||||||||||
| 2809 | bool *inDash) | - | ||||||||||||||||||||||||||||||
| 2810 | { | - | ||||||||||||||||||||||||||||||
| 2811 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2812 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2813 | - | |||||||||||||||||||||||||||||||
| 2814 | const QPen &pen = s->lastPen; | - | ||||||||||||||||||||||||||||||
| 2815 | const bool squareCap = (pen.capStyle() == Qt::SquareCap); | - | ||||||||||||||||||||||||||||||
| 2816 | const QVector<qreal> pattern = pen.dashPattern(); | - | ||||||||||||||||||||||||||||||
| 2817 | - | |||||||||||||||||||||||||||||||
| 2818 | qreal patternLength = 0; | - | ||||||||||||||||||||||||||||||
| 2819 | for (int i = 0; i < pattern.size()
| 0 | ||||||||||||||||||||||||||||||
| 2820 | patternLength += pattern.at(i); never executed: patternLength += pattern.at(i); | 0 | ||||||||||||||||||||||||||||||
| 2821 | - | |||||||||||||||||||||||||||||||
| 2822 | if (patternLength <= 0
| 0 | ||||||||||||||||||||||||||||||
| 2823 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2824 | - | |||||||||||||||||||||||||||||||
| 2825 | qreal length = line.length(); | - | ||||||||||||||||||||||||||||||
| 2826 | ((!(length > 0)) ? qt_assert("length > 0",__FILE__,3170) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2827 | while (length > 0
| 0 | ||||||||||||||||||||||||||||||
| 2828 | const bool rasterize = *inDash; | - | ||||||||||||||||||||||||||||||
| 2829 | qreal dash = (pattern.at(*dashIndex) - *dashOffset) * width; | - | ||||||||||||||||||||||||||||||
| 2830 | QLineF l = line; | - | ||||||||||||||||||||||||||||||
| 2831 | - | |||||||||||||||||||||||||||||||
| 2832 | if (dash >= length
| 0 | ||||||||||||||||||||||||||||||
| 2833 | dash = length; | - | ||||||||||||||||||||||||||||||
| 2834 | *dashOffset += dash / width; | - | ||||||||||||||||||||||||||||||
| 2835 | length = 0; | - | ||||||||||||||||||||||||||||||
| 2836 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2837 | *dashOffset = 0; | - | ||||||||||||||||||||||||||||||
| 2838 | *inDash = !(*inDash); | - | ||||||||||||||||||||||||||||||
| 2839 | if (++*
| 0 | ||||||||||||||||||||||||||||||
| 2840 | * never executed: dashIndex = 0;*dashIndex = 0;never executed: *dashIndex = 0; | 0 | ||||||||||||||||||||||||||||||
| 2841 | length -= dash; | - | ||||||||||||||||||||||||||||||
| 2842 | l.setLength(dash); | - | ||||||||||||||||||||||||||||||
| 2843 | line.setP1(l.p2()); | - | ||||||||||||||||||||||||||||||
| 2844 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2845 | - | |||||||||||||||||||||||||||||||
| 2846 | if (rasterize
| 0 | ||||||||||||||||||||||||||||||
| 2847 | rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); never executed: rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); | 0 | ||||||||||||||||||||||||||||||
| 2848 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2849 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2850 | - | |||||||||||||||||||||||||||||||
| 2851 | - | |||||||||||||||||||||||||||||||
| 2852 | - | |||||||||||||||||||||||||||||||
| 2853 | - | |||||||||||||||||||||||||||||||
| 2854 | void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) | - | ||||||||||||||||||||||||||||||
| 2855 | { | - | ||||||||||||||||||||||||||||||
| 2856 | - | |||||||||||||||||||||||||||||||
| 2857 | - | |||||||||||||||||||||||||||||||
| 2858 | - | |||||||||||||||||||||||||||||||
| 2859 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2860 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2861 | - | |||||||||||||||||||||||||||||||
| 2862 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2863 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2864 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2865 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2866 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2867 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2868 | for (int i=0; i<lineCount
| 0 | ||||||||||||||||||||||||||||||
| 2869 | QLineF line = lines[i]; | - | ||||||||||||||||||||||||||||||
| 2870 | stroker.drawLine(line.p1(), line.p2()); | - | ||||||||||||||||||||||||||||||
| 2871 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2872 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2873 | QPaintEngineEx::drawLines(lines, lineCount); | - | ||||||||||||||||||||||||||||||
| 2874 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2875 | } | - | ||||||||||||||||||||||||||||||
| 2876 | - | |||||||||||||||||||||||||||||||
| 2877 | - | |||||||||||||||||||||||||||||||
| 2878 | - | |||||||||||||||||||||||||||||||
| 2879 | - | |||||||||||||||||||||||||||||||
| 2880 | - | |||||||||||||||||||||||||||||||
| 2881 | void QRasterPaintEngine::drawEllipse(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 2882 | { | - | ||||||||||||||||||||||||||||||
| 2883 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2884 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2885 | - | |||||||||||||||||||||||||||||||
| 2886 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2887 | if (((qpen_style(s->lastPen) == Qt::SolidLine
| 0 | ||||||||||||||||||||||||||||||
| 2888 | || (
| 0 | ||||||||||||||||||||||||||||||
| 2889 | && !s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2890 | && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 2891 | && !rect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2892 | && s->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 2893 | { | - | ||||||||||||||||||||||||||||||
| 2894 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 2895 | const QRectF r = s->matrix.mapRect(rect); | - | ||||||||||||||||||||||||||||||
| 2896 | ProcessSpans penBlend = d->getPenFunc(r, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2897 | ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 2898 | const QRect brect = QRect(int(r.x()), int(r.y()), | - | ||||||||||||||||||||||||||||||
| 2899 | (int(r.x()+r.width()) - int(r.x())), | - | ||||||||||||||||||||||||||||||
| 2900 | (int(r.y()+r.height()) - int(r.y()))); | - | ||||||||||||||||||||||||||||||
| 2901 | if (brect == r
| 0 | ||||||||||||||||||||||||||||||
| 2902 | drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, | - | ||||||||||||||||||||||||||||||
| 2903 | &s->penData, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 2904 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2905 | } | - | ||||||||||||||||||||||||||||||
| 2906 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2907 | QPaintEngineEx::drawEllipse(rect); | - | ||||||||||||||||||||||||||||||
| 2908 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2909 | bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const | - | ||||||||||||||||||||||||||||||
| 2910 | { | - | ||||||||||||||||||||||||||||||
| 2911 | - | |||||||||||||||||||||||||||||||
| 2912 | if (shouldDrawCachedGlyphs(fontEngine, m)
| 0 | ||||||||||||||||||||||||||||||
| 2913 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2914 | - | |||||||||||||||||||||||||||||||
| 2915 | - | |||||||||||||||||||||||||||||||
| 2916 | return never executed: QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);never executed: return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m); | 0 | ||||||||||||||||||||||||||||||
| 2917 | } | - | ||||||||||||||||||||||||||||||
| 2918 | - | |||||||||||||||||||||||||||||||
| 2919 | - | |||||||||||||||||||||||||||||||
| 2920 | - | |||||||||||||||||||||||||||||||
| 2921 | - | |||||||||||||||||||||||||||||||
| 2922 | - | |||||||||||||||||||||||||||||||
| 2923 | bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const | - | ||||||||||||||||||||||||||||||
| 2924 | { | - | ||||||||||||||||||||||||||||||
| 2925 | - | |||||||||||||||||||||||||||||||
| 2926 | if (m.type() >= QTransform::TxProject
| 0 | ||||||||||||||||||||||||||||||
| 2927 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2928 | - | |||||||||||||||||||||||||||||||
| 2929 | - | |||||||||||||||||||||||||||||||
| 2930 | - | |||||||||||||||||||||||||||||||
| 2931 | - | |||||||||||||||||||||||||||||||
| 2932 | - | |||||||||||||||||||||||||||||||
| 2933 | - | |||||||||||||||||||||||||||||||
| 2934 | if (!fontEngine->hasInternalCaching()
| 0 | ||||||||||||||||||||||||||||||
| 2935 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||||||||
| 2937 | return never executed: QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m);return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m);never executed: return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m); | 0 | ||||||||||||||||||||||||||||||
| 2938 | } | - | ||||||||||||||||||||||||||||||
| 2939 | - | |||||||||||||||||||||||||||||||
| 2940 | - | |||||||||||||||||||||||||||||||
| 2941 | - | |||||||||||||||||||||||||||||||
| 2942 | - | |||||||||||||||||||||||||||||||
| 2943 | QPoint QRasterPaintEngine::coordinateOffset() const | - | ||||||||||||||||||||||||||||||
| 2944 | { | - | ||||||||||||||||||||||||||||||
| 2945 | return never executed: QPoint(0, 0);return QPoint(0, 0);never executed: return QPoint(0, 0); | 0 | ||||||||||||||||||||||||||||||
| 2946 | } | - | ||||||||||||||||||||||||||||||
| 2947 | - | |||||||||||||||||||||||||||||||
| 2948 | void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg) | - | ||||||||||||||||||||||||||||||
| 2949 | { | - | ||||||||||||||||||||||||||||||
| 2950 | ((!(fg)) ? qt_assert("fg",__FILE__,3326) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2951 | if (!fg->blend
| 0 | ||||||||||||||||||||||||||||||
| 2952 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2953 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2954 | - | |||||||||||||||||||||||||||||||
| 2955 | ((!(image.depth() == 1)) ? qt_assert("image.depth() == 1",__FILE__,3331) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2956 | - | |||||||||||||||||||||||||||||||
| 2957 | const int spanCount = 256; | - | ||||||||||||||||||||||||||||||
| 2958 | QT_FT_Span spans[spanCount]; | - | ||||||||||||||||||||||||||||||
| 2959 | int n = 0; | - | ||||||||||||||||||||||||||||||
| 2960 | - | |||||||||||||||||||||||||||||||
| 2961 | - | |||||||||||||||||||||||||||||||
| 2962 | int w = image.width(); | - | ||||||||||||||||||||||||||||||
| 2963 | int h = image.height(); | - | ||||||||||||||||||||||||||||||
| 2964 | int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 2965 | int ymin = qMax(qRound(pos.y()), 0); | - | ||||||||||||||||||||||||||||||
| 2966 | int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width()); | - | ||||||||||||||||||||||||||||||
| 2967 | int xmin = qMax(qRound(pos.x()), 0); | - | ||||||||||||||||||||||||||||||
| 2968 | - | |||||||||||||||||||||||||||||||
| 2969 | int x_offset = xmin - qRound(pos.x()); | - | ||||||||||||||||||||||||||||||
| 2970 | - | |||||||||||||||||||||||||||||||
| 2971 | QImage::Format format = image.format(); | - | ||||||||||||||||||||||||||||||
| 2972 | for (int y = ymin; y < ymax
| 0 | ||||||||||||||||||||||||||||||
| 2973 | const uchar *src = image.scanLine(y - qRound(pos.y())); | - | ||||||||||||||||||||||||||||||
| 2974 | if (format == QImage::Format_MonoLSB
| 0 | ||||||||||||||||||||||||||||||
| 2975 | for (int x = 0; x < xmax - xmin
| 0 | ||||||||||||||||||||||||||||||
| 2976 | int src_x = x + x_offset; | - | ||||||||||||||||||||||||||||||
| 2977 | uchar pixel = src[src_x >> 3]; | - | ||||||||||||||||||||||||||||||
| 2978 | if (!pixel
| 0 | ||||||||||||||||||||||||||||||
| 2979 | x += 7 - (src_x%8); | - | ||||||||||||||||||||||||||||||
| 2980 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2981 | } | - | ||||||||||||||||||||||||||||||
| 2982 | if (pixel & (0x1 << (src_x & 7))
| 0 | ||||||||||||||||||||||||||||||
| 2983 | spans[n].x = xmin + x; | - | ||||||||||||||||||||||||||||||
| 2984 | spans[n].y = y; | - | ||||||||||||||||||||||||||||||
| 2985 | spans[n].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 2986 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2987 | while (src_x+1 < w
| 0 | ||||||||||||||||||||||||||||||
| 2988 | ++src_x; | - | ||||||||||||||||||||||||||||||
| 2989 | ++len; | - | ||||||||||||||||||||||||||||||
| 2990 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2991 | spans[n].len = ((
| 0 | ||||||||||||||||||||||||||||||
| 2992 | x += len; | - | ||||||||||||||||||||||||||||||
| 2993 | ++n; | - | ||||||||||||||||||||||||||||||
| 2994 | if (n == spanCount
| 0 | ||||||||||||||||||||||||||||||
| 2995 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 2996 | n = 0; | - | ||||||||||||||||||||||||||||||
| 2997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2998 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2999 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3000 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3001 | for (int x = 0; x < xmax - xmin
| 0 | ||||||||||||||||||||||||||||||
| 3002 | int src_x = x + x_offset; | - | ||||||||||||||||||||||||||||||
| 3003 | uchar pixel = src[src_x >> 3]; | - | ||||||||||||||||||||||||||||||
| 3004 | if (!pixel
| 0 | ||||||||||||||||||||||||||||||
| 3005 | x += 7 - (src_x%8); | - | ||||||||||||||||||||||||||||||
| 3006 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3007 | } | - | ||||||||||||||||||||||||||||||
| 3008 | if (pixel & (0x80 >> (x & 7))
| 0 | ||||||||||||||||||||||||||||||
| 3009 | spans[n].x = xmin + x; | - | ||||||||||||||||||||||||||||||
| 3010 | spans[n].y = y; | - | ||||||||||||||||||||||||||||||
| 3011 | spans[n].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3012 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 3013 | while (src_x+1 < w
| 0 | ||||||||||||||||||||||||||||||
| 3014 | ++src_x; | - | ||||||||||||||||||||||||||||||
| 3015 | ++len; | - | ||||||||||||||||||||||||||||||
| 3016 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3017 | spans[n].len = ((
| 0 | ||||||||||||||||||||||||||||||
| 3018 | x += len; | - | ||||||||||||||||||||||||||||||
| 3019 | ++n; | - | ||||||||||||||||||||||||||||||
| 3020 | if (n == spanCount
| 0 | ||||||||||||||||||||||||||||||
| 3021 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 3022 | n = 0; | - | ||||||||||||||||||||||||||||||
| 3023 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3024 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3025 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3026 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3027 | } | - | ||||||||||||||||||||||||||||||
| 3028 | if (n
| 0 | ||||||||||||||||||||||||||||||
| 3029 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 3030 | n = 0; | - | ||||||||||||||||||||||||||||||
| 3031 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3032 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3033 | QRasterPaintEngine::ClipType QRasterPaintEngine::clipType() const | - | ||||||||||||||||||||||||||||||
| 3034 | { | - | ||||||||||||||||||||||||||||||
| 3035 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3036 | - | |||||||||||||||||||||||||||||||
| 3037 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 3038 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 3039 | return never executed: RectClip;return RectClip;never executed: return RectClip; | 0 | ||||||||||||||||||||||||||||||
| 3040 | else | - | ||||||||||||||||||||||||||||||
| 3041 | return never executed: ComplexClip;return ComplexClip;never executed: return ComplexClip; | 0 | ||||||||||||||||||||||||||||||
| 3042 | } | - | ||||||||||||||||||||||||||||||
| 3043 | - | |||||||||||||||||||||||||||||||
| 3044 | - | |||||||||||||||||||||||||||||||
| 3045 | - | |||||||||||||||||||||||||||||||
| 3046 | - | |||||||||||||||||||||||||||||||
| 3047 | - | |||||||||||||||||||||||||||||||
| 3048 | QRect QRasterPaintEngine::clipBoundingRect() const | - | ||||||||||||||||||||||||||||||
| 3049 | { | - | ||||||||||||||||||||||||||||||
| 3050 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3051 | - | |||||||||||||||||||||||||||||||
| 3052 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 3053 | - | |||||||||||||||||||||||||||||||
| 3054 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 3055 | return never executed: d->deviceRect;return d->deviceRect;never executed: return d->deviceRect; | 0 | ||||||||||||||||||||||||||||||
| 3056 | - | |||||||||||||||||||||||||||||||
| 3057 | if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3058 | return never executed: clip->clipRect;return clip->clipRect;never executed: return clip->clipRect; | 0 | ||||||||||||||||||||||||||||||
| 3059 | - | |||||||||||||||||||||||||||||||
| 3060 | return never executed: QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);never executed: return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin); | 0 | ||||||||||||||||||||||||||||||
| 3061 | } | - | ||||||||||||||||||||||||||||||
| 3062 | - | |||||||||||||||||||||||||||||||
| 3063 | void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) | - | ||||||||||||||||||||||||||||||
| 3064 | { | - | ||||||||||||||||||||||||||||||
| 3065 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3066 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3067 | - | |||||||||||||||||||||||||||||||
| 3068 | rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 3069 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 3070 | - | |||||||||||||||||||||||||||||||
| 3071 | QRect clipRect(deviceRect); | - | ||||||||||||||||||||||||||||||
| 3072 | ProcessSpans blend; | - | ||||||||||||||||||||||||||||||
| 3073 | - | |||||||||||||||||||||||||||||||
| 3074 | - | |||||||||||||||||||||||||||||||
| 3075 | const QClipData *c = clip(); | - | ||||||||||||||||||||||||||||||
| 3076 | if (c
| 0 | ||||||||||||||||||||||||||||||
| 3077 | const QRect r(QPoint(c->xmin, c->ymin), | - | ||||||||||||||||||||||||||||||
| 3078 | QSize(c->xmax - c->xmin, c->ymax - c->ymin)); | - | ||||||||||||||||||||||||||||||
| 3079 | clipRect = clipRect.intersected(r); | - | ||||||||||||||||||||||||||||||
| 3080 | blend = data->blend; | - | ||||||||||||||||||||||||||||||
| 3081 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3082 | blend = data->unclipped_blend; | - | ||||||||||||||||||||||||||||||
| 3083 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||||||||
| 3085 | rasterizer->setClipRect(clipRect); | - | ||||||||||||||||||||||||||||||
| 3086 | rasterizer->initialize(blend, data); | - | ||||||||||||||||||||||||||||||
| 3087 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3088 | - | |||||||||||||||||||||||||||||||
| 3089 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - | ||||||||||||||||||||||||||||||
| 3090 | ProcessSpans callback, | - | ||||||||||||||||||||||||||||||
| 3091 | QSpanData *spanData, QRasterBuffer *rasterBuffer) | - | ||||||||||||||||||||||||||||||
| 3092 | { | - | ||||||||||||||||||||||||||||||
| 3093 | if (!callback
| 0 | ||||||||||||||||||||||||||||||
| 3094 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3095 | - | |||||||||||||||||||||||||||||||
| 3096 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3097 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3098 | - | |||||||||||||||||||||||||||||||
| 3099 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 3100 | initializeRasterizer(spanData); | - | ||||||||||||||||||||||||||||||
| 3101 | - | |||||||||||||||||||||||||||||||
| 3102 | const Qt::FillRule fillRule = outline->flags == 0x0
| 0 | ||||||||||||||||||||||||||||||
| 3103 | ? Qt::WindingFill | - | ||||||||||||||||||||||||||||||
| 3104 | : Qt::OddEvenFill; | - | ||||||||||||||||||||||||||||||
| 3105 | - | |||||||||||||||||||||||||||||||
| 3106 | rasterizer->rasterize(outline, fillRule); | - | ||||||||||||||||||||||||||||||
| 3107 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3108 | } | - | ||||||||||||||||||||||||||||||
| 3109 | - | |||||||||||||||||||||||||||||||
| 3110 | rasterize(outline, callback, (void *)spanData, rasterBuffer); | - | ||||||||||||||||||||||||||||||
| 3111 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3112 | - | |||||||||||||||||||||||||||||||
| 3113 | extern "C" { | - | ||||||||||||||||||||||||||||||
| 3114 | int q_gray_rendered_spans(QT_FT_Raster raster); | - | ||||||||||||||||||||||||||||||
| 3115 | } | - | ||||||||||||||||||||||||||||||
| 3116 | - | |||||||||||||||||||||||||||||||
| 3117 | static inline uchar *alignAddress(uchar *address, quintptr alignmentMask) | - | ||||||||||||||||||||||||||||||
| 3118 | { | - | ||||||||||||||||||||||||||||||
| 3119 | return never executed: (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask);return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask);never executed: return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask); | 0 | ||||||||||||||||||||||||||||||
| 3120 | } | - | ||||||||||||||||||||||||||||||
| 3121 | - | |||||||||||||||||||||||||||||||
| 3122 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - | ||||||||||||||||||||||||||||||
| 3123 | ProcessSpans callback, | - | ||||||||||||||||||||||||||||||
| 3124 | void *userData, QRasterBuffer *) | - | ||||||||||||||||||||||||||||||
| 3125 | { | - | ||||||||||||||||||||||||||||||
| 3126 | if (!callback
| 0 | ||||||||||||||||||||||||||||||
| 3127 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3128 | - | |||||||||||||||||||||||||||||||
| 3129 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3130 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3131 | - | |||||||||||||||||||||||||||||||
| 3132 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 3133 | rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 3134 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 3135 | rasterizer->setClipRect(deviceRect); | - | ||||||||||||||||||||||||||||||
| 3136 | rasterizer->initialize(callback, userData); | - | ||||||||||||||||||||||||||||||
| 3137 | - | |||||||||||||||||||||||||||||||
| 3138 | const Qt::FillRule fillRule = outline->flags == 0x0
| 0 | ||||||||||||||||||||||||||||||
| 3139 | ? Qt::WindingFill | - | ||||||||||||||||||||||||||||||
| 3140 | : Qt::OddEvenFill; | - | ||||||||||||||||||||||||||||||
| 3141 | - | |||||||||||||||||||||||||||||||
| 3142 | rasterizer->rasterize(outline, fillRule); | - | ||||||||||||||||||||||||||||||
| 3143 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3144 | } | - | ||||||||||||||||||||||||||||||
| 3145 | - | |||||||||||||||||||||||||||||||
| 3146 | - | |||||||||||||||||||||||||||||||
| 3147 | - | |||||||||||||||||||||||||||||||
| 3148 | - | |||||||||||||||||||||||||||||||
| 3149 | - | |||||||||||||||||||||||||||||||
| 3150 | int rasterPoolSize = 8192; | - | ||||||||||||||||||||||||||||||
| 3151 | uchar rasterPoolOnStack[8192 + 0xf]; | - | ||||||||||||||||||||||||||||||
| 3152 | uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf); | - | ||||||||||||||||||||||||||||||
| 3153 | uchar *rasterPoolOnHeap = 0; | - | ||||||||||||||||||||||||||||||
| 3154 | - | |||||||||||||||||||||||||||||||
| 3155 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - | ||||||||||||||||||||||||||||||
| 3156 | - | |||||||||||||||||||||||||||||||
| 3157 | void *data = userData; | - | ||||||||||||||||||||||||||||||
| 3158 | - | |||||||||||||||||||||||||||||||
| 3159 | QT_FT_BBox clip_box = { deviceRect.x(), | - | ||||||||||||||||||||||||||||||
| 3160 | deviceRect.y(), | - | ||||||||||||||||||||||||||||||
| 3161 | deviceRect.x() + deviceRect.width(), | - | ||||||||||||||||||||||||||||||
| 3162 | deviceRect.y() + deviceRect.height() }; | - | ||||||||||||||||||||||||||||||
| 3163 | - | |||||||||||||||||||||||||||||||
| 3164 | QT_FT_Raster_Params rasterParams; | - | ||||||||||||||||||||||||||||||
| 3165 | rasterParams.target = 0; | - | ||||||||||||||||||||||||||||||
| 3166 | rasterParams.source = outline; | - | ||||||||||||||||||||||||||||||
| 3167 | rasterParams.flags = 0x4; | - | ||||||||||||||||||||||||||||||
| 3168 | rasterParams.gray_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3169 | rasterParams.black_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3170 | rasterParams.bit_test = 0; | - | ||||||||||||||||||||||||||||||
| 3171 | rasterParams.bit_set = 0; | - | ||||||||||||||||||||||||||||||
| 3172 | rasterParams.user = data; | - | ||||||||||||||||||||||||||||||
| 3173 | rasterParams.clip_box = clip_box; | - | ||||||||||||||||||||||||||||||
| 3174 | - | |||||||||||||||||||||||||||||||
| 3175 | bool done = false; | - | ||||||||||||||||||||||||||||||
| 3176 | int error; | - | ||||||||||||||||||||||||||||||
| 3177 | - | |||||||||||||||||||||||||||||||
| 3178 | int rendered_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3179 | - | |||||||||||||||||||||||||||||||
| 3180 | while (!done
| 0 | ||||||||||||||||||||||||||||||
| 3181 | - | |||||||||||||||||||||||||||||||
| 3182 | rasterParams.flags |= (0x1 | 0x2); | - | ||||||||||||||||||||||||||||||
| 3183 | rasterParams.gray_spans = callback; | - | ||||||||||||||||||||||||||||||
| 3184 | rasterParams.skip_spans = rendered_spans; | - | ||||||||||||||||||||||||||||||
| 3185 | error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams); | - | ||||||||||||||||||||||||||||||
| 3186 | - | |||||||||||||||||||||||||||||||
| 3187 | - | |||||||||||||||||||||||||||||||
| 3188 | if (error == -6
| 0 | ||||||||||||||||||||||||||||||
| 3189 | rasterPoolSize *= 2; | - | ||||||||||||||||||||||||||||||
| 3190 | if (rasterPoolSize > 1024 * 1024
| 0 | ||||||||||||||||||||||||||||||
| 3191 | QMessageLogger(__FILE__, 3580, __PRETTY_FUNCTION__).warning("QPainter: Rasterization of primitive failed"); | - | ||||||||||||||||||||||||||||||
| 3192 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3193 | } | - | ||||||||||||||||||||||||||||||
| 3194 | - | |||||||||||||||||||||||||||||||
| 3195 | rendered_spans += q_gray_rendered_spans(*grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3196 | - | |||||||||||||||||||||||||||||||
| 3197 | free(rasterPoolOnHeap); | - | ||||||||||||||||||||||||||||||
| 3198 | rasterPoolOnHeap = (uchar *)malloc(rasterPoolSize + 0xf); | - | ||||||||||||||||||||||||||||||
| 3199 | - | |||||||||||||||||||||||||||||||
| 3200 | do {if(!(rasterPoolOnHeap)
never executed: } while (0);qt_check_pointer(__FILE__,3589); | 0 | ||||||||||||||||||||||||||||||
| 3201 | - | |||||||||||||||||||||||||||||||
| 3202 | rasterPoolBase = alignAddress(rasterPoolOnHeap, 0xf); | - | ||||||||||||||||||||||||||||||
| 3203 | - | |||||||||||||||||||||||||||||||
| 3204 | qt_ft_grays_raster.raster_done(*grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3205 | qt_ft_grays_raster.raster_new(grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3206 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - | ||||||||||||||||||||||||||||||
| 3207 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3208 | done = true; | - | ||||||||||||||||||||||||||||||
| 3209 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3210 | } | - | ||||||||||||||||||||||||||||||
| 3211 | - | |||||||||||||||||||||||||||||||
| 3212 | free(rasterPoolOnHeap); | - | ||||||||||||||||||||||||||||||
| 3213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3214 | - | |||||||||||||||||||||||||||||||
| 3215 | void QRasterPaintEnginePrivate::recalculateFastImages() | - | ||||||||||||||||||||||||||||||
| 3216 | { | - | ||||||||||||||||||||||||||||||
| 3217 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3218 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3219 | - | |||||||||||||||||||||||||||||||
| 3220 | s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform)
| 0 | ||||||||||||||||||||||||||||||
| 3221 | && s->matrix.type() <= QTransform::TxShear
| 0 | ||||||||||||||||||||||||||||||
| 3222 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3223 | - | |||||||||||||||||||||||||||||||
| 3224 | bool QRasterPaintEnginePrivate::canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const | - | ||||||||||||||||||||||||||||||
| 3225 | { | - | ||||||||||||||||||||||||||||||
| 3226 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3227 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3228 | - | |||||||||||||||||||||||||||||||
| 3229 | return never executed: s->flags.fast_imagesreturn s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel()));never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3230 | && (mode == QPainter::CompositionMode_SourceOver never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3231 | || (mode == QPainter::CompositionMode_Source never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3232 | && !image.hasAlphaChannel())); never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3233 | } | - | ||||||||||||||||||||||||||||||
| 3234 | - | |||||||||||||||||||||||||||||||
| 3235 | QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color) | - | ||||||||||||||||||||||||||||||
| 3236 | { | - | ||||||||||||||||||||||||||||||
| 3237 | ((!(image.depth() == 1)) ? qt_assert("image.depth() == 1",__FILE__,3626) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3238 | - | |||||||||||||||||||||||||||||||
| 3239 | const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB); | - | ||||||||||||||||||||||||||||||
| 3240 | QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||||||||
| 3241 | - | |||||||||||||||||||||||||||||||
| 3242 | QRgb fg = qPremultiply(color.rgba()); | - | ||||||||||||||||||||||||||||||
| 3243 | QRgb bg = 0; | - | ||||||||||||||||||||||||||||||
| 3244 | - | |||||||||||||||||||||||||||||||
| 3245 | int height = sourceImage.height(); | - | ||||||||||||||||||||||||||||||
| 3246 | int width = sourceImage.width(); | - | ||||||||||||||||||||||||||||||
| 3247 | for (int y=0; y<height
| 0 | ||||||||||||||||||||||||||||||
| 3248 | const uchar *source = sourceImage.constScanLine(y); | - | ||||||||||||||||||||||||||||||
| 3249 | QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y)); | - | ||||||||||||||||||||||||||||||
| 3250 | if (!source
| 0 | ||||||||||||||||||||||||||||||
| 3251 | qt_noop(); never executed: qt_noop(); | 0 | ||||||||||||||||||||||||||||||
| 3252 | for (int x=0; x < width
| 0 | ||||||||||||||||||||||||||||||
| 3253 | target[x] = (
never executed: target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; | 0 | ||||||||||||||||||||||||||||||
| 3254 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3255 | return never executed: dest;return dest;never executed: return dest; | 0 | ||||||||||||||||||||||||||||||
| 3256 | } | - | ||||||||||||||||||||||||||||||
| 3257 | - | |||||||||||||||||||||||||||||||
| 3258 | QRasterBuffer::~QRasterBuffer() | - | ||||||||||||||||||||||||||||||
| 3259 | { | - | ||||||||||||||||||||||||||||||
| 3260 | } | - | ||||||||||||||||||||||||||||||
| 3261 | - | |||||||||||||||||||||||||||||||
| 3262 | void QRasterBuffer::init() | - | ||||||||||||||||||||||||||||||
| 3263 | { | - | ||||||||||||||||||||||||||||||
| 3264 | compositionMode = QPainter::CompositionMode_SourceOver; | - | ||||||||||||||||||||||||||||||
| 3265 | monoDestinationWithClut = false; | - | ||||||||||||||||||||||||||||||
| 3266 | destColor0 = 0; | - | ||||||||||||||||||||||||||||||
| 3267 | destColor1 = 0; | - | ||||||||||||||||||||||||||||||
| 3268 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||||||||
| 3270 | QImage::Format QRasterBuffer::prepare(QImage *image) | - | ||||||||||||||||||||||||||||||
| 3271 | { | - | ||||||||||||||||||||||||||||||
| 3272 | m_buffer = (uchar *)image->bits(); | - | ||||||||||||||||||||||||||||||
| 3273 | m_width = qMin(QT_RASTER_COORD_LIMIT, image->width()); | - | ||||||||||||||||||||||||||||||
| 3274 | m_height = qMin(QT_RASTER_COORD_LIMIT, image->height()); | - | ||||||||||||||||||||||||||||||
| 3275 | bytes_per_pixel = image->depth()/8; | - | ||||||||||||||||||||||||||||||
| 3276 | bytes_per_line = image->bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 3277 | - | |||||||||||||||||||||||||||||||
| 3278 | format = image->format(); | - | ||||||||||||||||||||||||||||||
| 3279 | drawHelper = qDrawHelper + format; | - | ||||||||||||||||||||||||||||||
| 3280 | if (image->depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 3281 | monoDestinationWithClut = true; | - | ||||||||||||||||||||||||||||||
| 3282 | const QVector<QRgb> colorTable = image->colorTable(); | - | ||||||||||||||||||||||||||||||
| 3283 | destColor0 = qPremultiply(colorTable[0]); | - | ||||||||||||||||||||||||||||||
| 3284 | destColor1 = qPremultiply(colorTable[1]); | - | ||||||||||||||||||||||||||||||
| 3285 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3286 | - | |||||||||||||||||||||||||||||||
| 3287 | return never executed: format;return format;never executed: return format; | 0 | ||||||||||||||||||||||||||||||
| 3288 | } | - | ||||||||||||||||||||||||||||||
| 3289 | - | |||||||||||||||||||||||||||||||
| 3290 | void QRasterBuffer::resetBuffer(int val) | - | ||||||||||||||||||||||||||||||
| 3291 | { | - | ||||||||||||||||||||||||||||||
| 3292 | memset(m_buffer, val, m_height*bytes_per_line); | - | ||||||||||||||||||||||||||||||
| 3293 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3294 | - | |||||||||||||||||||||||||||||||
| 3295 | QClipData::QClipData(int height) | - | ||||||||||||||||||||||||||||||
| 3296 | { | - | ||||||||||||||||||||||||||||||
| 3297 | clipSpanHeight = height; | - | ||||||||||||||||||||||||||||||
| 3298 | m_clipLines = 0; | - | ||||||||||||||||||||||||||||||
| 3299 | - | |||||||||||||||||||||||||||||||
| 3300 | allocated = 0; | - | ||||||||||||||||||||||||||||||
| 3301 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3302 | xmin = xmax = ymin = ymax = 0; | - | ||||||||||||||||||||||||||||||
| 3303 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3304 | - | |||||||||||||||||||||||||||||||
| 3305 | enabled = true; | - | ||||||||||||||||||||||||||||||
| 3306 | hasRectClip = hasRegionClip = false; | - | ||||||||||||||||||||||||||||||
| 3307 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3308 | - | |||||||||||||||||||||||||||||||
| 3309 | QClipData::~QClipData() | - | ||||||||||||||||||||||||||||||
| 3310 | { | - | ||||||||||||||||||||||||||||||
| 3311 | if (m_clipLines
| 0 | ||||||||||||||||||||||||||||||
| 3312 | free(m_clipLines); never executed: free(m_clipLines); | 0 | ||||||||||||||||||||||||||||||
| 3313 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3314 | free(m_spans); never executed: free(m_spans); | 0 | ||||||||||||||||||||||||||||||
| 3315 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3316 | - | |||||||||||||||||||||||||||||||
| 3317 | void QClipData::initialize() | - | ||||||||||||||||||||||||||||||
| 3318 | { | - | ||||||||||||||||||||||||||||||
| 3319 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3320 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3321 | - | |||||||||||||||||||||||||||||||
| 3322 | if (!m_clipLines
| 0 | ||||||||||||||||||||||||||||||
| 3323 | m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); never executed: m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); | 0 | ||||||||||||||||||||||||||||||
| 3324 | - | |||||||||||||||||||||||||||||||
| 3325 | do {if(!(m_clipLines)
never executed: } while (0);qt_check_pointer(__FILE__,3714); | 0 | ||||||||||||||||||||||||||||||
| 3326 | if (true) { | - | ||||||||||||||||||||||||||||||
| 3327 | m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan)); | - | ||||||||||||||||||||||||||||||
| 3328 | allocated = clipSpanHeight; | - | ||||||||||||||||||||||||||||||
| 3329 | do {if(!(m_spans)
never executed: } while (0);qt_check_pointer(__FILE__,3718); | 0 | ||||||||||||||||||||||||||||||
| 3330 | - | |||||||||||||||||||||||||||||||
| 3331 | if (true) { | - | ||||||||||||||||||||||||||||||
| 3332 | if (hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3333 | int y = 0; | - | ||||||||||||||||||||||||||||||
| 3334 | while (y < ymin
| 0 | ||||||||||||||||||||||||||||||
| 3335 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3336 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3337 | ++y; | - | ||||||||||||||||||||||||||||||
| 3338 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3339 | - | |||||||||||||||||||||||||||||||
| 3340 | const int len = clipRect.width(); | - | ||||||||||||||||||||||||||||||
| 3341 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3342 | while (y < ymax
| 0 | ||||||||||||||||||||||||||||||
| 3343 | QSpan *span = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3344 | span->x = xmin; | - | ||||||||||||||||||||||||||||||
| 3345 | span->len = len; | - | ||||||||||||||||||||||||||||||
| 3346 | span->y = y; | - | ||||||||||||||||||||||||||||||
| 3347 | span->coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3348 | ++count; | - | ||||||||||||||||||||||||||||||
| 3349 | - | |||||||||||||||||||||||||||||||
| 3350 | m_clipLines[y].spans = span; | - | ||||||||||||||||||||||||||||||
| 3351 | m_clipLines[y].count = 1; | - | ||||||||||||||||||||||||||||||
| 3352 | ++y; | - | ||||||||||||||||||||||||||||||
| 3353 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3354 | - | |||||||||||||||||||||||||||||||
| 3355 | while (y < clipSpanHeight
| 0 | ||||||||||||||||||||||||||||||
| 3356 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3357 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3358 | ++y; | - | ||||||||||||||||||||||||||||||
| 3359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3360 | } never executed: else if (hasRegionClipend of block
| 0 | ||||||||||||||||||||||||||||||
| 3361 | - | |||||||||||||||||||||||||||||||
| 3362 | const QVector<QRect> rects = clipRegion.rects(); | - | ||||||||||||||||||||||||||||||
| 3363 | const int numRects = rects.size(); | - | ||||||||||||||||||||||||||||||
| 3364 | - | |||||||||||||||||||||||||||||||
| 3365 | { | - | ||||||||||||||||||||||||||||||
| 3366 | const int maxSpans = (ymax - ymin) * numRects; | - | ||||||||||||||||||||||||||||||
| 3367 | if (maxSpans > allocated
| 0 | ||||||||||||||||||||||||||||||
| 3368 | m_spans = q_check_ptr((QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan))); | - | ||||||||||||||||||||||||||||||
| 3369 | allocated = maxSpans; | - | ||||||||||||||||||||||||||||||
| 3370 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3371 | } | - | ||||||||||||||||||||||||||||||
| 3372 | - | |||||||||||||||||||||||||||||||
| 3373 | int y = 0; | - | ||||||||||||||||||||||||||||||
| 3374 | int firstInBand = 0; | - | ||||||||||||||||||||||||||||||
| 3375 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3376 | while (firstInBand < numRects
| 0 | ||||||||||||||||||||||||||||||
| 3377 | const int currMinY = rects.at(firstInBand).y(); | - | ||||||||||||||||||||||||||||||
| 3378 | const int currMaxY = currMinY + rects.at(firstInBand).height(); | - | ||||||||||||||||||||||||||||||
| 3379 | - | |||||||||||||||||||||||||||||||
| 3380 | while (y < currMinY
| 0 | ||||||||||||||||||||||||||||||
| 3381 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3382 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3383 | ++y; | - | ||||||||||||||||||||||||||||||
| 3384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3385 | - | |||||||||||||||||||||||||||||||
| 3386 | int lastInBand = firstInBand; | - | ||||||||||||||||||||||||||||||
| 3387 | while (lastInBand + 1 < numRects
| 0 | ||||||||||||||||||||||||||||||
| 3388 | ++ never executed: lastInBand;++lastInBand;never executed: ++lastInBand; | 0 | ||||||||||||||||||||||||||||||
| 3389 | - | |||||||||||||||||||||||||||||||
| 3390 | while (y < currMaxY
| 0 | ||||||||||||||||||||||||||||||
| 3391 | - | |||||||||||||||||||||||||||||||
| 3392 | m_clipLines[y].spans = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3393 | m_clipLines[y].count = lastInBand - firstInBand + 1; | - | ||||||||||||||||||||||||||||||
| 3394 | - | |||||||||||||||||||||||||||||||
| 3395 | for (int r = firstInBand; r <= lastInBand
| 0 | ||||||||||||||||||||||||||||||
| 3396 | const QRect &currRect = rects.at(r); | - | ||||||||||||||||||||||||||||||
| 3397 | QSpan *span = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3398 | span->x = currRect.x(); | - | ||||||||||||||||||||||||||||||
| 3399 | span->len = currRect.width(); | - | ||||||||||||||||||||||||||||||
| 3400 | span->y = y; | - | ||||||||||||||||||||||||||||||
| 3401 | span->coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3402 | ++count; | - | ||||||||||||||||||||||||||||||
| 3403 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3404 | ++y; | - | ||||||||||||||||||||||||||||||
| 3405 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3406 | - | |||||||||||||||||||||||||||||||
| 3407 | firstInBand = lastInBand + 1; | - | ||||||||||||||||||||||||||||||
| 3408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3409 | - | |||||||||||||||||||||||||||||||
| 3410 | ((!(count <= allocated)) ? qt_assert("count <= allocated",__FILE__,3799) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3411 | - | |||||||||||||||||||||||||||||||
| 3412 | while (y < clipSpanHeight
| 0 | ||||||||||||||||||||||||||||||
| 3413 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3414 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3415 | ++y; | - | ||||||||||||||||||||||||||||||
| 3416 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3417 | - | |||||||||||||||||||||||||||||||
| 3418 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3419 | } never executed: else {end of blockdead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3420 | free(m_spans); dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3421 | m_spans = 0; dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3422 | qt_noop(); dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3423 | } dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3424 | } else { dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3425 | free(m_clipLines); dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3426 | m_clipLines = 0; dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3427 | qt_noop(); dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3428 | } dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3429 | } | - | ||||||||||||||||||||||||||||||
| 3430 | - | |||||||||||||||||||||||||||||||
| 3431 | void QClipData::fixup() | - | ||||||||||||||||||||||||||||||
| 3432 | { | - | ||||||||||||||||||||||||||||||
| 3433 | ((!(m_spans)) ? qt_assert("m_spans",__FILE__,3822) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3434 | - | |||||||||||||||||||||||||||||||
| 3435 | if (count == 0
| 0 | ||||||||||||||||||||||||||||||
| 3436 | ymin = ymax = xmin = xmax = 0; | - | ||||||||||||||||||||||||||||||
| 3437 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3438 | } | - | ||||||||||||||||||||||||||||||
| 3439 | - | |||||||||||||||||||||||||||||||
| 3440 | int y = -1; | - | ||||||||||||||||||||||||||||||
| 3441 | ymin = m_spans[0].y; | - | ||||||||||||||||||||||||||||||
| 3442 | ymax = m_spans[count-1].y + 1; | - | ||||||||||||||||||||||||||||||
| 3443 | xmin = 2147483647; | - | ||||||||||||||||||||||||||||||
| 3444 | xmax = 0; | - | ||||||||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||||||||
| 3446 | const int firstLeft = m_spans[0].x; | - | ||||||||||||||||||||||||||||||
| 3447 | const int firstRight = m_spans[0].x + m_spans[0].len; | - | ||||||||||||||||||||||||||||||
| 3448 | bool isRect = true; | - | ||||||||||||||||||||||||||||||
| 3449 | - | |||||||||||||||||||||||||||||||
| 3450 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 3451 | QT_FT_Span_& span = m_spans[i]; | - | ||||||||||||||||||||||||||||||
| 3452 | - | |||||||||||||||||||||||||||||||
| 3453 | if (span.y != y
| 0 | ||||||||||||||||||||||||||||||
| 3454 | if (span.y != y + 1
| 0 | ||||||||||||||||||||||||||||||
| 3455 | isRect = false; never executed: isRect = false; | 0 | ||||||||||||||||||||||||||||||
| 3456 | y = span.y; | - | ||||||||||||||||||||||||||||||
| 3457 | m_clipLines[y].spans = &span; | - | ||||||||||||||||||||||||||||||
| 3458 | m_clipLines[y].count = 1; | - | ||||||||||||||||||||||||||||||
| 3459 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||
| 3460 | ++ never executed: m_clipLines[y].count;++m_clipLines[y].count;never executed: ++m_clipLines[y].count; | 0 | ||||||||||||||||||||||||||||||
| 3461 | - | |||||||||||||||||||||||||||||||
| 3462 | const int spanLeft = span.x; | - | ||||||||||||||||||||||||||||||
| 3463 | const int spanRight = spanLeft + span.len; | - | ||||||||||||||||||||||||||||||
| 3464 | - | |||||||||||||||||||||||||||||||
| 3465 | if (spanLeft < xmin
| 0 | ||||||||||||||||||||||||||||||
| 3466 | xmin = spanLeft; never executed: xmin = spanLeft; | 0 | ||||||||||||||||||||||||||||||
| 3467 | - | |||||||||||||||||||||||||||||||
| 3468 | if (spanRight > xmax
| 0 | ||||||||||||||||||||||||||||||
| 3469 | xmax = spanRight; never executed: xmax = spanRight; | 0 | ||||||||||||||||||||||||||||||
| 3470 | - | |||||||||||||||||||||||||||||||
| 3471 | if (spanLeft != firstLeft
| 0 | ||||||||||||||||||||||||||||||
| 3472 | isRect = false; never executed: isRect = false; | 0 | ||||||||||||||||||||||||||||||
| 3473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3474 | - | |||||||||||||||||||||||||||||||
| 3475 | if (isRect
| 0 | ||||||||||||||||||||||||||||||
| 3476 | hasRectClip = true; | - | ||||||||||||||||||||||||||||||
| 3477 | clipRect.setRect(xmin, ymin, xmax - xmin, ymax - ymin); | - | ||||||||||||||||||||||||||||||
| 3478 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3479 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3480 | - | |||||||||||||||||||||||||||||||
| 3481 | - | |||||||||||||||||||||||||||||||
| 3482 | - | |||||||||||||||||||||||||||||||
| 3483 | - | |||||||||||||||||||||||||||||||
| 3484 | void QClipData::setClipRect(const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 3485 | { | - | ||||||||||||||||||||||||||||||
| 3486 | if (hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3487 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3488 | - | |||||||||||||||||||||||||||||||
| 3489 | - | |||||||||||||||||||||||||||||||
| 3490 | hasRectClip = true; | - | ||||||||||||||||||||||||||||||
| 3491 | hasRegionClip = false; | - | ||||||||||||||||||||||||||||||
| 3492 | clipRect = rect; | - | ||||||||||||||||||||||||||||||
| 3493 | - | |||||||||||||||||||||||||||||||
| 3494 | xmin = rect.x(); | - | ||||||||||||||||||||||||||||||
| 3495 | xmax = rect.x() + rect.width(); | - | ||||||||||||||||||||||||||||||
| 3496 | ymin = qMin(rect.y(), clipSpanHeight); | - | ||||||||||||||||||||||||||||||
| 3497 | ymax = qMin(rect.y() + rect.height(), clipSpanHeight); | - | ||||||||||||||||||||||||||||||
| 3498 | - | |||||||||||||||||||||||||||||||
| 3499 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3500 | free(m_spans); | - | ||||||||||||||||||||||||||||||
| 3501 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3502 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3503 | - | |||||||||||||||||||||||||||||||
| 3504 | - | |||||||||||||||||||||||||||||||
| 3505 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3506 | - | |||||||||||||||||||||||||||||||
| 3507 | - | |||||||||||||||||||||||||||||||
| 3508 | - | |||||||||||||||||||||||||||||||
| 3509 | - | |||||||||||||||||||||||||||||||
| 3510 | void QClipData::setClipRegion(const QRegion ®ion) | - | ||||||||||||||||||||||||||||||
| 3511 | { | - | ||||||||||||||||||||||||||||||
| 3512 | if (region.rectCount() == 1
| 0 | ||||||||||||||||||||||||||||||
| 3513 | setClipRect(region.boundingRect()); | - | ||||||||||||||||||||||||||||||
| 3514 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3515 | } | - | ||||||||||||||||||||||||||||||
| 3516 | - | |||||||||||||||||||||||||||||||
| 3517 | hasRegionClip = true; | - | ||||||||||||||||||||||||||||||
| 3518 | hasRectClip = false; | - | ||||||||||||||||||||||||||||||
| 3519 | clipRegion = region; | - | ||||||||||||||||||||||||||||||
| 3520 | - | |||||||||||||||||||||||||||||||
| 3521 | { | - | ||||||||||||||||||||||||||||||
| 3522 | const QRect rect = region.boundingRect(); | - | ||||||||||||||||||||||||||||||
| 3523 | xmin = rect.x(); | - | ||||||||||||||||||||||||||||||
| 3524 | xmax = rect.x() + rect.width(); | - | ||||||||||||||||||||||||||||||
| 3525 | ymin = rect.y(); | - | ||||||||||||||||||||||||||||||
| 3526 | ymax = rect.y() + rect.height(); | - | ||||||||||||||||||||||||||||||
| 3527 | } | - | ||||||||||||||||||||||||||||||
| 3528 | - | |||||||||||||||||||||||||||||||
| 3529 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3530 | free(m_spans); | - | ||||||||||||||||||||||||||||||
| 3531 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3532 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3533 | - | |||||||||||||||||||||||||||||||
| 3534 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3535 | - | |||||||||||||||||||||||||||||||
| 3536 | - | |||||||||||||||||||||||||||||||
| 3537 | - | |||||||||||||||||||||||||||||||
| 3538 | - | |||||||||||||||||||||||||||||||
| 3539 | - | |||||||||||||||||||||||||||||||
| 3540 | static const QSpan *qt_intersect_spans(const QClipData *clip, int *currentClip, | - | ||||||||||||||||||||||||||||||
| 3541 | const QSpan *spans, const QSpan *end, | - | ||||||||||||||||||||||||||||||
| 3542 | QSpan **outSpans, int available) | - | ||||||||||||||||||||||||||||||
| 3543 | { | - | ||||||||||||||||||||||||||||||
| 3544 | const_cast<QClipData *>(clip)->initialize(); | - | ||||||||||||||||||||||||||||||
| 3545 | - | |||||||||||||||||||||||||||||||
| 3546 | QSpan *out = *outSpans; | - | ||||||||||||||||||||||||||||||
| 3547 | - | |||||||||||||||||||||||||||||||
| 3548 | const QSpan *clipSpans = clip->m_spans + *currentClip; | - | ||||||||||||||||||||||||||||||
| 3549 | const QSpan *clipEnd = clip->m_spans + clip->count; | - | ||||||||||||||||||||||||||||||
| 3550 | - | |||||||||||||||||||||||||||||||
| 3551 | while (available
| 0 | ||||||||||||||||||||||||||||||
| 3552 | if (clipSpans >= clipEnd
| 0 | ||||||||||||||||||||||||||||||
| 3553 | spans = end; | - | ||||||||||||||||||||||||||||||
| 3554 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3555 | } | - | ||||||||||||||||||||||||||||||
| 3556 | if (clipSpans->y > spans->y
| 0 | ||||||||||||||||||||||||||||||
| 3557 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3558 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3559 | } | - | ||||||||||||||||||||||||||||||
| 3560 | if (spans->y != clipSpans->y
| 0 | ||||||||||||||||||||||||||||||
| 3561 | if (spans->y < clip->count
| 0 | ||||||||||||||||||||||||||||||
| 3562 | clipSpans = clip->m_clipLines[spans->y].spans; never executed: clipSpans = clip->m_clipLines[spans->y].spans; | 0 | ||||||||||||||||||||||||||||||
| 3563 | else | - | ||||||||||||||||||||||||||||||
| 3564 | ++ never executed: clipSpans;++clipSpans;never executed: ++clipSpans; | 0 | ||||||||||||||||||||||||||||||
| 3565 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3566 | } | - | ||||||||||||||||||||||||||||||
| 3567 | ((!(spans->y == clipSpans->y)) ? qt_assert("spans->y == clipSpans->y",__FILE__,3956) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3568 | - | |||||||||||||||||||||||||||||||
| 3569 | int sx1 = spans->x; | - | ||||||||||||||||||||||||||||||
| 3570 | int sx2 = sx1 + spans->len; | - | ||||||||||||||||||||||||||||||
| 3571 | int cx1 = clipSpans->x; | - | ||||||||||||||||||||||||||||||
| 3572 | int cx2 = cx1 + clipSpans->len; | - | ||||||||||||||||||||||||||||||
| 3573 | - | |||||||||||||||||||||||||||||||
| 3574 | if (cx1 < sx1
| 0 | ||||||||||||||||||||||||||||||
| 3575 | ++clipSpans; | - | ||||||||||||||||||||||||||||||
| 3576 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3577 | } else if (sx1 < cx1
| 0 | ||||||||||||||||||||||||||||||
| 3578 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3579 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3580 | } | - | ||||||||||||||||||||||||||||||
| 3581 | int x = qMax(sx1, cx1); | - | ||||||||||||||||||||||||||||||
| 3582 | int len = qMin(sx2, cx2) - x; | - | ||||||||||||||||||||||||||||||
| 3583 | if (len
| 0 | ||||||||||||||||||||||||||||||
| 3584 | out->x = qMax(sx1, cx1); | - | ||||||||||||||||||||||||||||||
| 3585 | out->len = qMin(sx2, cx2) - out->x; | - | ||||||||||||||||||||||||||||||
| 3586 | out->y = spans->y; | - | ||||||||||||||||||||||||||||||
| 3587 | out->coverage = qt_div_255(spans->coverage * clipSpans->coverage); | - | ||||||||||||||||||||||||||||||
| 3588 | ++out; | - | ||||||||||||||||||||||||||||||
| 3589 | --available; | - | ||||||||||||||||||||||||||||||
| 3590 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3591 | if (sx2 < cx2
| 0 | ||||||||||||||||||||||||||||||
| 3592 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3593 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3594 | ++clipSpans; | - | ||||||||||||||||||||||||||||||
| 3595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3596 | } | - | ||||||||||||||||||||||||||||||
| 3597 | - | |||||||||||||||||||||||||||||||
| 3598 | *outSpans = out; | - | ||||||||||||||||||||||||||||||
| 3599 | *currentClip = clipSpans - clip->m_spans; | - | ||||||||||||||||||||||||||||||
| 3600 | return never executed: spans;return spans;never executed: return spans; | 0 | ||||||||||||||||||||||||||||||
| 3601 | } | - | ||||||||||||||||||||||||||||||
| 3602 | - | |||||||||||||||||||||||||||||||
| 3603 | static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userData) | - | ||||||||||||||||||||||||||||||
| 3604 | { | - | ||||||||||||||||||||||||||||||
| 3605 | - | |||||||||||||||||||||||||||||||
| 3606 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3607 | - | |||||||||||||||||||||||||||||||
| 3608 | ((!(fillData->blend && fillData->unclipped_blend)) ? qt_assert("fillData->blend && fillData->unclipped_blend",__FILE__,3997) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3609 | - | |||||||||||||||||||||||||||||||
| 3610 | const int NSPANS = 256; | - | ||||||||||||||||||||||||||||||
| 3611 | QSpan cspans[NSPANS]; | - | ||||||||||||||||||||||||||||||
| 3612 | int currentClip = 0; | - | ||||||||||||||||||||||||||||||
| 3613 | const QSpan *end = spans + spanCount; | - | ||||||||||||||||||||||||||||||
| 3614 | while (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3615 | QSpan *clipped = cspans; | - | ||||||||||||||||||||||||||||||
| 3616 | spans = qt_intersect_spans(fillData->clip, ¤tClip, spans, end, &clipped, NSPANS); | - | ||||||||||||||||||||||||||||||
| 3617 | - | |||||||||||||||||||||||||||||||
| 3618 | - | |||||||||||||||||||||||||||||||
| 3619 | - | |||||||||||||||||||||||||||||||
| 3620 | if (clipped - cspans
| 0 | ||||||||||||||||||||||||||||||
| 3621 | fillData->unclipped_blend(clipped - cspans, cspans, fillData); never executed: fillData->unclipped_blend(clipped - cspans, cspans, fillData); | 0 | ||||||||||||||||||||||||||||||
| 3622 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3623 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3624 | - | |||||||||||||||||||||||||||||||
| 3625 | - | |||||||||||||||||||||||||||||||
| 3626 | - | |||||||||||||||||||||||||||||||
| 3627 | - | |||||||||||||||||||||||||||||||
| 3628 | - | |||||||||||||||||||||||||||||||
| 3629 | - | |||||||||||||||||||||||||||||||
| 3630 | static int qt_intersect_spans(QT_FT_Span *spans, int numSpans, | - | ||||||||||||||||||||||||||||||
| 3631 | const QRect &clip) | - | ||||||||||||||||||||||||||||||
| 3632 | { | - | ||||||||||||||||||||||||||||||
| 3633 | const short minx = clip.left(); | - | ||||||||||||||||||||||||||||||
| 3634 | const short miny = clip.top(); | - | ||||||||||||||||||||||||||||||
| 3635 | const short maxx = clip.right(); | - | ||||||||||||||||||||||||||||||
| 3636 | const short maxy = clip.bottom(); | - | ||||||||||||||||||||||||||||||
| 3637 | - | |||||||||||||||||||||||||||||||
| 3638 | int n = 0; | - | ||||||||||||||||||||||||||||||
| 3639 | for (int i = 0; i < numSpans
| 0 | ||||||||||||||||||||||||||||||
| 3640 | if (spans[i].y > maxy
| 0 | ||||||||||||||||||||||||||||||
| 3641 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3642 | if (spans[i].y < miny
| 0 | ||||||||||||||||||||||||||||||
| 3643 | || spans[i].x > maxx
| 0 | ||||||||||||||||||||||||||||||
| 3644 | || spans[i].x + spans[i].len <= minx
| 0 | ||||||||||||||||||||||||||||||
| 3645 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3646 | } | - | ||||||||||||||||||||||||||||||
| 3647 | if (spans[i].x < minx
| 0 | ||||||||||||||||||||||||||||||
| 3648 | spans[n].len = qMin(spans[i].len - (minx - spans[i].x), maxx - minx + 1); | - | ||||||||||||||||||||||||||||||
| 3649 | spans[n].x = minx; | - | ||||||||||||||||||||||||||||||
| 3650 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3651 | spans[n].x = spans[i].x; | - | ||||||||||||||||||||||||||||||
| 3652 | spans[n].len = qMin(spans[i].len, ushort(maxx - spans[n].x + 1)); | - | ||||||||||||||||||||||||||||||
| 3653 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3654 | if (spans[n].len == 0
| 0 | ||||||||||||||||||||||||||||||
| 3655 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3656 | spans[n].y = spans[i].y; | - | ||||||||||||||||||||||||||||||
| 3657 | spans[n].coverage = spans[i].coverage; | - | ||||||||||||||||||||||||||||||
| 3658 | ++n; | - | ||||||||||||||||||||||||||||||
| 3659 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3660 | return never executed: n;return n;never executed: return n; | 0 | ||||||||||||||||||||||||||||||
| 3661 | } | - | ||||||||||||||||||||||||||||||
| 3662 | - | |||||||||||||||||||||||||||||||
| 3663 | - | |||||||||||||||||||||||||||||||
| 3664 | static void qt_span_fill_clipRect(int count, const QSpan *spans, | - | ||||||||||||||||||||||||||||||
| 3665 | void *userData) | - | ||||||||||||||||||||||||||||||
| 3666 | { | - | ||||||||||||||||||||||||||||||
| 3667 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3668 | ((!(fillData->blend && fillData->unclipped_blend)) ? qt_assert("fillData->blend && fillData->unclipped_blend",__FILE__,4057) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3669 | - | |||||||||||||||||||||||||||||||
| 3670 | ((!(fillData->clip)) ? qt_assert("fillData->clip",__FILE__,4059) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3671 | ((!(!fillData->clip->clipRect.isEmpty())) ? qt_assert("!fillData->clip->clipRect.isEmpty()",__FILE__,4060) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3672 | - | |||||||||||||||||||||||||||||||
| 3673 | - | |||||||||||||||||||||||||||||||
| 3674 | count = qt_intersect_spans(const_cast<QSpan*>(spans), count, | - | ||||||||||||||||||||||||||||||
| 3675 | fillData->clip->clipRect); | - | ||||||||||||||||||||||||||||||
| 3676 | if (count > 0
| 0 | ||||||||||||||||||||||||||||||
| 3677 | fillData->unclipped_blend(count, spans, fillData); never executed: fillData->unclipped_blend(count, spans, fillData); | 0 | ||||||||||||||||||||||||||||||
| 3678 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3679 | - | |||||||||||||||||||||||||||||||
| 3680 | static void qt_span_clip(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||||||||||||||
| 3681 | { | - | ||||||||||||||||||||||||||||||
| 3682 | ClipData *clipData = reinterpret_cast<ClipData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3683 | - | |||||||||||||||||||||||||||||||
| 3684 | - | |||||||||||||||||||||||||||||||
| 3685 | - | |||||||||||||||||||||||||||||||
| 3686 | - | |||||||||||||||||||||||||||||||
| 3687 | - | |||||||||||||||||||||||||||||||
| 3688 | - | |||||||||||||||||||||||||||||||
| 3689 | switch (clipData->operation) { | - | ||||||||||||||||||||||||||||||
| 3690 | - | |||||||||||||||||||||||||||||||
| 3691 | case never executed: Qt::IntersectClip:case Qt::IntersectClip:never executed: case Qt::IntersectClip: | 0 | ||||||||||||||||||||||||||||||
| 3692 | { | - | ||||||||||||||||||||||||||||||
| 3693 | QClipData *newClip = clipData->newClip; | - | ||||||||||||||||||||||||||||||
| 3694 | newClip->initialize(); | - | ||||||||||||||||||||||||||||||
| 3695 | - | |||||||||||||||||||||||||||||||
| 3696 | int currentClip = 0; | - | ||||||||||||||||||||||||||||||
| 3697 | const QSpan *end = spans + count; | - | ||||||||||||||||||||||||||||||
| 3698 | while (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3699 | QSpan *newspans = newClip->m_spans + newClip->count; | - | ||||||||||||||||||||||||||||||
| 3700 | spans = qt_intersect_spans(clipData->oldClip, ¤tClip, spans, end, | - | ||||||||||||||||||||||||||||||
| 3701 | &newspans, newClip->allocated - newClip->count); | - | ||||||||||||||||||||||||||||||
| 3702 | newClip->count = newspans - newClip->m_spans; | - | ||||||||||||||||||||||||||||||
| 3703 | if (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3704 | newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan))); | - | ||||||||||||||||||||||||||||||
| 3705 | newClip->allocated *= 2; | - | ||||||||||||||||||||||||||||||
| 3706 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3707 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3708 | } | - | ||||||||||||||||||||||||||||||
| 3709 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3710 | - | |||||||||||||||||||||||||||||||
| 3711 | case never executed: Qt::ReplaceClip:case Qt::ReplaceClip:never executed: case Qt::ReplaceClip: | 0 | ||||||||||||||||||||||||||||||
| 3712 | clipData->newClip->appendSpans(spans, count); | - | ||||||||||||||||||||||||||||||
| 3713 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3714 | case never executed: Qt::NoClip:case Qt::NoClip:never executed: case Qt::NoClip: | 0 | ||||||||||||||||||||||||||||||
| 3715 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3716 | } | - | ||||||||||||||||||||||||||||||
| 3717 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3718 | - | |||||||||||||||||||||||||||||||
| 3719 | - | |||||||||||||||||||||||||||||||
| 3720 | QImage QRasterBuffer::bufferImage() const | - | ||||||||||||||||||||||||||||||
| 3721 | { | - | ||||||||||||||||||||||||||||||
| 3722 | QImage image(m_width, m_height, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||||||||
| 3723 | - | |||||||||||||||||||||||||||||||
| 3724 | for (int y = 0; y < m_height
| 0 | ||||||||||||||||||||||||||||||
| 3725 | uint *span = (uint *)const_cast<QRasterBuffer *>(this)->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3726 | - | |||||||||||||||||||||||||||||||
| 3727 | for (int x=0; x<m_width
| 0 | ||||||||||||||||||||||||||||||
| 3728 | uint argb = span[x]; | - | ||||||||||||||||||||||||||||||
| 3729 | image.setPixel(x, y, argb); | - | ||||||||||||||||||||||||||||||
| 3730 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3731 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3732 | return never executed: image;return image;never executed: return image; | 0 | ||||||||||||||||||||||||||||||
| 3733 | } | - | ||||||||||||||||||||||||||||||
| 3734 | - | |||||||||||||||||||||||||||||||
| 3735 | - | |||||||||||||||||||||||||||||||
| 3736 | - | |||||||||||||||||||||||||||||||
| 3737 | void QRasterBuffer::flushToARGBImage(QImage *target) const | - | ||||||||||||||||||||||||||||||
| 3738 | { | - | ||||||||||||||||||||||||||||||
| 3739 | int w = qMin(m_width, target->width()); | - | ||||||||||||||||||||||||||||||
| 3740 | int h = qMin(m_height, target->height()); | - | ||||||||||||||||||||||||||||||
| 3741 | - | |||||||||||||||||||||||||||||||
| 3742 | for (int y=0; y<h
| 0 | ||||||||||||||||||||||||||||||
| 3743 | uint *sourceLine = (uint *)const_cast<QRasterBuffer *>(this)->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3744 | QRgb *dest = (QRgb *) target->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3745 | for (int x=0; x<w
| 0 | ||||||||||||||||||||||||||||||
| 3746 | QRgb pixel = sourceLine[x]; | - | ||||||||||||||||||||||||||||||
| 3747 | int alpha = qAlpha(pixel); | - | ||||||||||||||||||||||||||||||
| 3748 | if (!alpha
| 0 | ||||||||||||||||||||||||||||||
| 3749 | dest[x] = 0; | - | ||||||||||||||||||||||||||||||
| 3750 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3751 | dest[x] = (alpha << 24) | - | ||||||||||||||||||||||||||||||
| 3752 | | ((255*qRed(pixel)/alpha) << 16) | - | ||||||||||||||||||||||||||||||
| 3753 | | ((255*qGreen(pixel)/alpha) << 8) | - | ||||||||||||||||||||||||||||||
| 3754 | | ((255*qBlue(pixel)/alpha) << 0); | - | ||||||||||||||||||||||||||||||
| 3755 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3756 | } | - | ||||||||||||||||||||||||||||||
| 3757 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3758 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3759 | - | |||||||||||||||||||||||||||||||
| 3760 | - | |||||||||||||||||||||||||||||||
| 3761 | class QGradientCache | - | ||||||||||||||||||||||||||||||
| 3762 | { | - | ||||||||||||||||||||||||||||||
| 3763 | public: | - | ||||||||||||||||||||||||||||||
| 3764 | struct CacheInfo : public QSharedData | - | ||||||||||||||||||||||||||||||
| 3765 | { | - | ||||||||||||||||||||||||||||||
| 3766 | inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) : | - | ||||||||||||||||||||||||||||||
| 3767 | stops(std::move(s)), opacity(op), interpolationMode(mode) {} never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3768 | QRgba64 buffer64[1024]; | - | ||||||||||||||||||||||||||||||
| 3769 | QRgb buffer32[1024]; | - | ||||||||||||||||||||||||||||||
| 3770 | QGradientStops stops; | - | ||||||||||||||||||||||||||||||
| 3771 | int opacity; | - | ||||||||||||||||||||||||||||||
| 3772 | QGradient::InterpolationMode interpolationMode; | - | ||||||||||||||||||||||||||||||
| 3773 | }; | - | ||||||||||||||||||||||||||||||
| 3774 | - | |||||||||||||||||||||||||||||||
| 3775 | typedef QMultiHash<quint64, QExplicitlySharedDataPointer<const CacheInfo> > QGradientColorTableHash; | - | ||||||||||||||||||||||||||||||
| 3776 | - | |||||||||||||||||||||||||||||||
| 3777 | inline QExplicitlySharedDataPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) { | - | ||||||||||||||||||||||||||||||
| 3778 | quint64 hash_val = 0; | - | ||||||||||||||||||||||||||||||
| 3779 | - | |||||||||||||||||||||||||||||||
| 3780 | const QGradientStops stops = gradient.stops(); | - | ||||||||||||||||||||||||||||||
| 3781 | for (int i = 0; i < stops.size()
| 0 | ||||||||||||||||||||||||||||||
| 3782 | hash_val += stops[i].second.rgba64(); never executed: hash_val += stops[i].second.rgba64(); | 0 | ||||||||||||||||||||||||||||||
| 3783 | - | |||||||||||||||||||||||||||||||
| 3784 | QMutexLocker lock(&mutex); | - | ||||||||||||||||||||||||||||||
| 3785 | QGradientColorTableHash::const_iterator it = cache.constFind(hash_val); | - | ||||||||||||||||||||||||||||||
| 3786 | - | |||||||||||||||||||||||||||||||
| 3787 | if (it == cache.constEnd()
| 0 | ||||||||||||||||||||||||||||||
| 3788 | return never executed: addCacheElement(hash_val, gradient, opacity);return addCacheElement(hash_val, gradient, opacity);never executed: return addCacheElement(hash_val, gradient, opacity); | 0 | ||||||||||||||||||||||||||||||
| 3789 | else { | - | ||||||||||||||||||||||||||||||
| 3790 | do { | - | ||||||||||||||||||||||||||||||
| 3791 | const QExplicitlySharedDataPointer<const CacheInfo> &cache_info = it.value(); | - | ||||||||||||||||||||||||||||||
| 3792 | if (cache_info->stops == stops
| 0 | ||||||||||||||||||||||||||||||
| 3793 | return never executed: cache_info;return cache_info;never executed: return cache_info; | 0 | ||||||||||||||||||||||||||||||
| 3794 | ++it; | - | ||||||||||||||||||||||||||||||
| 3795 | } never executed: while (it != cache.constEnd()end of block
| 0 | ||||||||||||||||||||||||||||||
| 3796 | - | |||||||||||||||||||||||||||||||
| 3797 | return never executed: addCacheElement(hash_val, gradient, opacity);return addCacheElement(hash_val, gradient, opacity);never executed: return addCacheElement(hash_val, gradient, opacity); | 0 | ||||||||||||||||||||||||||||||
| 3798 | } | - | ||||||||||||||||||||||||||||||
| 3799 | } | - | ||||||||||||||||||||||||||||||
| 3800 | - | |||||||||||||||||||||||||||||||
| 3801 | inline int paletteSize() const { return never executed: 1024;return 1024;never executed: }return 1024; | 0 | ||||||||||||||||||||||||||||||
| 3802 | protected: | - | ||||||||||||||||||||||||||||||
| 3803 | inline int maxCacheSize() const { return never executed: 60;return 60;never executed: }return 60; | 0 | ||||||||||||||||||||||||||||||
| 3804 | inline void generateGradientColorTable(const QGradient& g, | - | ||||||||||||||||||||||||||||||
| 3805 | QRgba64 *colorTable, | - | ||||||||||||||||||||||||||||||
| 3806 | int size, int opacity) const; | - | ||||||||||||||||||||||||||||||
| 3807 | QExplicitlySharedDataPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) { | - | ||||||||||||||||||||||||||||||
| 3808 | if (cache.size() == maxCacheSize()
| 0 | ||||||||||||||||||||||||||||||
| 3809 | - | |||||||||||||||||||||||||||||||
| 3810 | cache.erase(cache.begin() + (qrand() % maxCacheSize())); | - | ||||||||||||||||||||||||||||||
| 3811 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3812 | QExplicitlySharedDataPointer<CacheInfo> cache_entry(new CacheInfo (gradient.stops(), opacity, gradient.interpolationMode())); | - | ||||||||||||||||||||||||||||||
| 3813 | generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity); | - | ||||||||||||||||||||||||||||||
| 3814 | for (int i = 0; i < 1024
| 0 | ||||||||||||||||||||||||||||||
| 3815 | cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32(); never executed: cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32(); | 0 | ||||||||||||||||||||||||||||||
| 3816 | return never executed: cache.insert(hash_val, cache_entry).value();return cache.insert(hash_val, cache_entry).value();never executed: return cache.insert(hash_val, cache_entry).value(); | 0 | ||||||||||||||||||||||||||||||
| 3817 | } | - | ||||||||||||||||||||||||||||||
| 3818 | - | |||||||||||||||||||||||||||||||
| 3819 | QGradientColorTableHash cache; | - | ||||||||||||||||||||||||||||||
| 3820 | QMutex mutex; | - | ||||||||||||||||||||||||||||||
| 3821 | }; | - | ||||||||||||||||||||||||||||||
| 3822 | - | |||||||||||||||||||||||||||||||
| 3823 | void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const | - | ||||||||||||||||||||||||||||||
| 3824 | { | - | ||||||||||||||||||||||||||||||
| 3825 | const QGradientStops stops = gradient.stops(); | - | ||||||||||||||||||||||||||||||
| 3826 | int stopCount = stops.count(); | - | ||||||||||||||||||||||||||||||
| 3827 | ((!(stopCount > 0)) ? qt_assert("stopCount > 0",__FILE__,4216) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3828 | - | |||||||||||||||||||||||||||||||
| 3829 | bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); | - | ||||||||||||||||||||||||||||||
| 3830 | - | |||||||||||||||||||||||||||||||
| 3831 | if (stopCount == 2
| 0 | ||||||||||||||||||||||||||||||
| 3832 | QRgba64 first_color = combineAlpha256(stops[0].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3833 | QRgba64 second_color = combineAlpha256(stops[1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3834 | - | |||||||||||||||||||||||||||||||
| 3835 | qreal first_stop = stops[0].first; | - | ||||||||||||||||||||||||||||||
| 3836 | qreal second_stop = stops[1].first; | - | ||||||||||||||||||||||||||||||
| 3837 | - | |||||||||||||||||||||||||||||||
| 3838 | if (second_stop < first_stop
| 0 | ||||||||||||||||||||||||||||||
| 3839 | quint64 tmp = first_color; | - | ||||||||||||||||||||||||||||||
| 3840 | first_color = second_color; | - | ||||||||||||||||||||||||||||||
| 3841 | second_color = tmp; | - | ||||||||||||||||||||||||||||||
| 3842 | qSwap(first_stop, second_stop); | - | ||||||||||||||||||||||||||||||
| 3843 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3844 | - | |||||||||||||||||||||||||||||||
| 3845 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3846 | first_color = qPremultiply(first_color); | - | ||||||||||||||||||||||||||||||
| 3847 | second_color = qPremultiply(second_color); | - | ||||||||||||||||||||||||||||||
| 3848 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3849 | - | |||||||||||||||||||||||||||||||
| 3850 | int first_index = qRound(first_stop * (1024 -1)); | - | ||||||||||||||||||||||||||||||
| 3851 | int second_index = qRound(second_stop * (1024 -1)); | - | ||||||||||||||||||||||||||||||
| 3852 | - | |||||||||||||||||||||||||||||||
| 3853 | uint red_first = uint(first_color.red()) << 16; | - | ||||||||||||||||||||||||||||||
| 3854 | uint green_first = uint(first_color.green()) << 16; | - | ||||||||||||||||||||||||||||||
| 3855 | uint blue_first = uint(first_color.blue()) << 16; | - | ||||||||||||||||||||||||||||||
| 3856 | uint alpha_first = uint(first_color.alpha()) << 16; | - | ||||||||||||||||||||||||||||||
| 3857 | - | |||||||||||||||||||||||||||||||
| 3858 | uint red_second = uint(second_color.red()) << 16; | - | ||||||||||||||||||||||||||||||
| 3859 | uint green_second = uint(second_color.green()) << 16; | - | ||||||||||||||||||||||||||||||
| 3860 | uint blue_second = uint(second_color.blue()) << 16; | - | ||||||||||||||||||||||||||||||
| 3861 | uint alpha_second = uint(second_color.alpha()) << 16; | - | ||||||||||||||||||||||||||||||
| 3862 | - | |||||||||||||||||||||||||||||||
| 3863 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 3864 | for (; i <= qMin(1024, first_index)
| 0 | ||||||||||||||||||||||||||||||
| 3865 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3866 | colorTable[i] = first_color; never executed: colorTable[i] = first_color; | 0 | ||||||||||||||||||||||||||||||
| 3867 | else | - | ||||||||||||||||||||||||||||||
| 3868 | colorTable[i] = qPremultiply(first_color); never executed: colorTable[i] = qPremultiply(first_color); | 0 | ||||||||||||||||||||||||||||||
| 3869 | } | - | ||||||||||||||||||||||||||||||
| 3870 | - | |||||||||||||||||||||||||||||||
| 3871 | if (i < second_index
| 0 | ||||||||||||||||||||||||||||||
| 3872 | qreal reciprocal = qreal(1) / (second_index - first_index); | - | ||||||||||||||||||||||||||||||
| 3873 | - | |||||||||||||||||||||||||||||||
| 3874 | int red_delta = qRound((qreal(red_second) - red_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3875 | int green_delta = qRound((qreal(green_second) - green_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3876 | int blue_delta = qRound((qreal(blue_second) - blue_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3877 | int alpha_delta = qRound((qreal(alpha_second) - alpha_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3878 | - | |||||||||||||||||||||||||||||||
| 3879 | - | |||||||||||||||||||||||||||||||
| 3880 | red_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3881 | green_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3882 | blue_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3883 | alpha_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3884 | - | |||||||||||||||||||||||||||||||
| 3885 | for (; i < qMin(1024, second_index)
| 0 | ||||||||||||||||||||||||||||||
| 3886 | red_first += red_delta; | - | ||||||||||||||||||||||||||||||
| 3887 | green_first += green_delta; | - | ||||||||||||||||||||||||||||||
| 3888 | blue_first += blue_delta; | - | ||||||||||||||||||||||||||||||
| 3889 | alpha_first += alpha_delta; | - | ||||||||||||||||||||||||||||||
| 3890 | - | |||||||||||||||||||||||||||||||
| 3891 | const QRgba64 color = qRgba64(red_first >> 16, green_first >> 16, blue_first >> 16, alpha_first >> 16); | - | ||||||||||||||||||||||||||||||
| 3892 | - | |||||||||||||||||||||||||||||||
| 3893 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3894 | colorTable[i] = color; never executed: colorTable[i] = color; | 0 | ||||||||||||||||||||||||||||||
| 3895 | else | - | ||||||||||||||||||||||||||||||
| 3896 | colorTable[i] = qPremultiply(color); never executed: colorTable[i] = qPremultiply(color); | 0 | ||||||||||||||||||||||||||||||
| 3897 | } | - | ||||||||||||||||||||||||||||||
| 3898 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3899 | - | |||||||||||||||||||||||||||||||
| 3900 | for (; i < 1024
| 0 | ||||||||||||||||||||||||||||||
| 3901 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3902 | colorTable[i] = second_color; never executed: colorTable[i] = second_color; | 0 | ||||||||||||||||||||||||||||||
| 3903 | else | - | ||||||||||||||||||||||||||||||
| 3904 | colorTable[i] = qPremultiply(second_color); never executed: colorTable[i] = qPremultiply(second_color); | 0 | ||||||||||||||||||||||||||||||
| 3905 | } | - | ||||||||||||||||||||||||||||||
| 3906 | - | |||||||||||||||||||||||||||||||
| 3907 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3908 | } | - | ||||||||||||||||||||||||||||||
| 3909 | - | |||||||||||||||||||||||||||||||
| 3910 | QRgba64 current_color = combineAlpha256(stops[0].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3911 | if (stopCount == 1
| 0 | ||||||||||||||||||||||||||||||
| 3912 | current_color = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3913 | for (int i = 0; i < size
| 0 | ||||||||||||||||||||||||||||||
| 3914 | colorTable[i] = current_color; never executed: colorTable[i] = current_color; | 0 | ||||||||||||||||||||||||||||||
| 3915 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3916 | } | - | ||||||||||||||||||||||||||||||
| 3917 | - | |||||||||||||||||||||||||||||||
| 3918 | - | |||||||||||||||||||||||||||||||
| 3919 | qreal begin_pos = stops[0].first; | - | ||||||||||||||||||||||||||||||
| 3920 | qreal end_pos = stops[stopCount-1].first; | - | ||||||||||||||||||||||||||||||
| 3921 | - | |||||||||||||||||||||||||||||||
| 3922 | int pos = 0; | - | ||||||||||||||||||||||||||||||
| 3923 | QRgba64 next_color; | - | ||||||||||||||||||||||||||||||
| 3924 | - | |||||||||||||||||||||||||||||||
| 3925 | qreal incr = 1 / qreal(size); | - | ||||||||||||||||||||||||||||||
| 3926 | qreal dpos = 1.5 * incr; | - | ||||||||||||||||||||||||||||||
| 3927 | - | |||||||||||||||||||||||||||||||
| 3928 | - | |||||||||||||||||||||||||||||||
| 3929 | colorTable[pos++] = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3930 | while (dpos <= begin_pos
| 0 | ||||||||||||||||||||||||||||||
| 3931 | colorTable[pos] = colorTable[pos - 1]; | - | ||||||||||||||||||||||||||||||
| 3932 | ++pos; | - | ||||||||||||||||||||||||||||||
| 3933 | dpos += incr; | - | ||||||||||||||||||||||||||||||
| 3934 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3935 | - | |||||||||||||||||||||||||||||||
| 3936 | int current_stop = 0; | - | ||||||||||||||||||||||||||||||
| 3937 | - | |||||||||||||||||||||||||||||||
| 3938 | qreal t; | - | ||||||||||||||||||||||||||||||
| 3939 | qreal t_delta; | - | ||||||||||||||||||||||||||||||
| 3940 | - | |||||||||||||||||||||||||||||||
| 3941 | if (dpos < end_pos
| 0 | ||||||||||||||||||||||||||||||
| 3942 | - | |||||||||||||||||||||||||||||||
| 3943 | while (dpos > stops[current_stop+1].first
| 0 | ||||||||||||||||||||||||||||||
| 3944 | ++ never executed: current_stop;++current_stop;never executed: ++current_stop; | 0 | ||||||||||||||||||||||||||||||
| 3945 | - | |||||||||||||||||||||||||||||||
| 3946 | if (current_stop != 0
| 0 | ||||||||||||||||||||||||||||||
| 3947 | current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); never executed: current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); | 0 | ||||||||||||||||||||||||||||||
| 3948 | next_color = combineAlpha256(stops[current_stop+1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3949 | - | |||||||||||||||||||||||||||||||
| 3950 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3951 | current_color = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3952 | next_color = qPremultiply(next_color); | - | ||||||||||||||||||||||||||||||
| 3953 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3954 | - | |||||||||||||||||||||||||||||||
| 3955 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - | ||||||||||||||||||||||||||||||
| 3956 | qreal c = (
| 0 | ||||||||||||||||||||||||||||||
| 3957 | t = (dpos - stops[current_stop].first) * c; | - | ||||||||||||||||||||||||||||||
| 3958 | t_delta = incr * c; | - | ||||||||||||||||||||||||||||||
| 3959 | - | |||||||||||||||||||||||||||||||
| 3960 | while (true) { | - | ||||||||||||||||||||||||||||||
| 3961 | ((!(current_stop < stopCount)) ? qt_assert("current_stop < stopCount",__FILE__,4350) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3962 | - | |||||||||||||||||||||||||||||||
| 3963 | int dist = qRound(t); | - | ||||||||||||||||||||||||||||||
| 3964 | int idist = 256 - dist; | - | ||||||||||||||||||||||||||||||
| 3965 | - | |||||||||||||||||||||||||||||||
| 3966 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3967 | colorTable[pos] = interpolate256(current_color, idist, next_color, dist); never executed: colorTable[pos] = interpolate256(current_color, idist, next_color, dist); | 0 | ||||||||||||||||||||||||||||||
| 3968 | else | - | ||||||||||||||||||||||||||||||
| 3969 | colorTable[pos] = qPremultiply(interpolate256(current_color, idist, next_color, dist)); never executed: colorTable[pos] = qPremultiply(interpolate256(current_color, idist, next_color, dist)); | 0 | ||||||||||||||||||||||||||||||
| 3970 | - | |||||||||||||||||||||||||||||||
| 3971 | ++pos; | - | ||||||||||||||||||||||||||||||
| 3972 | dpos += incr; | - | ||||||||||||||||||||||||||||||
| 3973 | - | |||||||||||||||||||||||||||||||
| 3974 | if (dpos >= end_pos
| 0 | ||||||||||||||||||||||||||||||
| 3975 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3976 | - | |||||||||||||||||||||||||||||||
| 3977 | t += t_delta; | - | ||||||||||||||||||||||||||||||
| 3978 | - | |||||||||||||||||||||||||||||||
| 3979 | int skip = 0; | - | ||||||||||||||||||||||||||||||
| 3980 | while (dpos > stops[current_stop+skip+1].first
| 0 | ||||||||||||||||||||||||||||||
| 3981 | ++ never executed: skip;++skip;never executed: ++skip; | 0 | ||||||||||||||||||||||||||||||
| 3982 | - | |||||||||||||||||||||||||||||||
| 3983 | if (skip != 0
| 0 | ||||||||||||||||||||||||||||||
| 3984 | current_stop += skip; | - | ||||||||||||||||||||||||||||||
| 3985 | if (skip == 1
| 0 | ||||||||||||||||||||||||||||||
| 3986 | current_color = next_color; never executed: current_color = next_color; | 0 | ||||||||||||||||||||||||||||||
| 3987 | else | - | ||||||||||||||||||||||||||||||
| 3988 | current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); never executed: current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); | 0 | ||||||||||||||||||||||||||||||
| 3989 | next_color = combineAlpha256(stops[current_stop+1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3990 | - | |||||||||||||||||||||||||||||||
| 3991 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3992 | if (skip != 1
| 0 | ||||||||||||||||||||||||||||||
| 3993 | current_color = qPremultiply(current_color); never executed: current_color = qPremultiply(current_color); | 0 | ||||||||||||||||||||||||||||||
| 3994 | next_color = qPremultiply(next_color); | - | ||||||||||||||||||||||||||||||
| 3995 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3996 | - | |||||||||||||||||||||||||||||||
| 3997 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - | ||||||||||||||||||||||||||||||
| 3998 | qreal c = (
| 0 | ||||||||||||||||||||||||||||||
| 3999 | t = (dpos - stops[current_stop].first) * c; | - | ||||||||||||||||||||||||||||||
| 4000 | t_delta = incr * c; | - | ||||||||||||||||||||||||||||||
| 4001 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4002 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4003 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4004 | - | |||||||||||||||||||||||||||||||
| 4005 | - | |||||||||||||||||||||||||||||||
| 4006 | current_color = qPremultiply(combineAlpha256(stops[stopCount - 1].second.rgba64(), opacity)); | - | ||||||||||||||||||||||||||||||
| 4007 | while (pos < size - 1
| 0 | ||||||||||||||||||||||||||||||
| 4008 | colorTable[pos] = current_color; | - | ||||||||||||||||||||||||||||||
| 4009 | ++pos; | - | ||||||||||||||||||||||||||||||
| 4010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4011 | - | |||||||||||||||||||||||||||||||
| 4012 | - | |||||||||||||||||||||||||||||||
| 4013 | colorTable[size - 1] = current_color; | - | ||||||||||||||||||||||||||||||
| 4014 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4015 | - | |||||||||||||||||||||||||||||||
| 4016 | namespace { namespace Q_QGS_qt_gradient_cache { typedef QGradientCache Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
never executed: }guard.store(QtGlobalStatic::Destroyed);never executed: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blocknever executed: &holder.value;return &holder.value;never executed: } } } static QGlobalStatic<QGradientCache, Q_QGS_qt_gradient_cache::innerFunction, Q_QGS_qt_gradient_cache::guard> qt_gradient_cache;return &holder.value; | 0 | ||||||||||||||||||||||||||||||
| 4017 | - | |||||||||||||||||||||||||||||||
| 4018 | - | |||||||||||||||||||||||||||||||
| 4019 | void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) | - | ||||||||||||||||||||||||||||||
| 4020 | { | - | ||||||||||||||||||||||||||||||
| 4021 | rasterBuffer = rb; | - | ||||||||||||||||||||||||||||||
| 4022 | type = None; | - | ||||||||||||||||||||||||||||||
| 4023 | txop = 0; | - | ||||||||||||||||||||||||||||||
| 4024 | bilinear = false; | - | ||||||||||||||||||||||||||||||
| 4025 | m11 = m22 = m33 = 1.; | - | ||||||||||||||||||||||||||||||
| 4026 | m12 = m13 = m21 = m23 = dx = dy = 0.0; | - | ||||||||||||||||||||||||||||||
| 4027 | clip = pe
| 0 | ||||||||||||||||||||||||||||||
| 4028 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4029 | - | |||||||||||||||||||||||||||||||
| 4030 | __attribute__((visibility("default"))) extern QImage qt_imageForBrush(int brushStyle, bool invert); | - | ||||||||||||||||||||||||||||||
| 4031 | - | |||||||||||||||||||||||||||||||
| 4032 | void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) | - | ||||||||||||||||||||||||||||||
| 4033 | { | - | ||||||||||||||||||||||||||||||
| 4034 | Qt::BrushStyle brushStyle = qbrush_style(brush); | - | ||||||||||||||||||||||||||||||
| 4035 | cachedGradient.reset(); | - | ||||||||||||||||||||||||||||||
| 4036 | switch (brushStyle) { | - | ||||||||||||||||||||||||||||||
| 4037 | case never executed: Qt::SolidPattern:case Qt::SolidPattern:never executed: {case Qt::SolidPattern: | 0 | ||||||||||||||||||||||||||||||
| 4038 | type = Solid; | - | ||||||||||||||||||||||||||||||
| 4039 | QColor c = qbrush_color(brush); | - | ||||||||||||||||||||||||||||||
| 4040 | solid.color = qPremultiply(combineAlpha256(c.rgba64(), alpha)); | - | ||||||||||||||||||||||||||||||
| 4041 | if (solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 4042 | type = None; never executed: type = None; | 0 | ||||||||||||||||||||||||||||||
| 4043 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4044 | } | - | ||||||||||||||||||||||||||||||
| 4045 | - | |||||||||||||||||||||||||||||||
| 4046 | case never executed: Qt::LinearGradientPattern:case Qt::LinearGradientPattern:never executed: case Qt::LinearGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4047 | { | - | ||||||||||||||||||||||||||||||
| 4048 | type = LinearGradient; | - | ||||||||||||||||||||||||||||||
| 4049 | const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4050 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4051 | - | |||||||||||||||||||||||||||||||
| 4052 | QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4053 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4054 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4055 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4056 | - | |||||||||||||||||||||||||||||||
| 4057 | gradient.spread = g->spread(); | - | ||||||||||||||||||||||||||||||
| 4058 | - | |||||||||||||||||||||||||||||||
| 4059 | QLinearGradientData &linearData = gradient.linear; | - | ||||||||||||||||||||||||||||||
| 4060 | - | |||||||||||||||||||||||||||||||
| 4061 | linearData.origin.x = g->start().x(); | - | ||||||||||||||||||||||||||||||
| 4062 | linearData.origin.y = g->start().y(); | - | ||||||||||||||||||||||||||||||
| 4063 | linearData.end.x = g->finalStop().x(); | - | ||||||||||||||||||||||||||||||
| 4064 | linearData.end.y = g->finalStop().y(); | - | ||||||||||||||||||||||||||||||
| 4065 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4066 | } | - | ||||||||||||||||||||||||||||||
| 4067 | - | |||||||||||||||||||||||||||||||
| 4068 | case never executed: Qt::RadialGradientPattern:case Qt::RadialGradientPattern:never executed: case Qt::RadialGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4069 | { | - | ||||||||||||||||||||||||||||||
| 4070 | type = RadialGradient; | - | ||||||||||||||||||||||||||||||
| 4071 | const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4072 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4073 | - | |||||||||||||||||||||||||||||||
| 4074 | QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4075 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4076 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4077 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4078 | - | |||||||||||||||||||||||||||||||
| 4079 | gradient.spread = g->spread(); | - | ||||||||||||||||||||||||||||||
| 4080 | - | |||||||||||||||||||||||||||||||
| 4081 | QRadialGradientData &radialData = gradient.radial; | - | ||||||||||||||||||||||||||||||
| 4082 | - | |||||||||||||||||||||||||||||||
| 4083 | QPointF center = g->center(); | - | ||||||||||||||||||||||||||||||
| 4084 | radialData.center.x = center.x(); | - | ||||||||||||||||||||||||||||||
| 4085 | radialData.center.y = center.y(); | - | ||||||||||||||||||||||||||||||
| 4086 | radialData.center.radius = g->centerRadius(); | - | ||||||||||||||||||||||||||||||
| 4087 | QPointF focal = g->focalPoint(); | - | ||||||||||||||||||||||||||||||
| 4088 | radialData.focal.x = focal.x(); | - | ||||||||||||||||||||||||||||||
| 4089 | radialData.focal.y = focal.y(); | - | ||||||||||||||||||||||||||||||
| 4090 | radialData.focal.radius = g->focalRadius(); | - | ||||||||||||||||||||||||||||||
| 4091 | } | - | ||||||||||||||||||||||||||||||
| 4092 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4093 | - | |||||||||||||||||||||||||||||||
| 4094 | case never executed: Qt::ConicalGradientPattern:case Qt::ConicalGradientPattern:never executed: case Qt::ConicalGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4095 | { | - | ||||||||||||||||||||||||||||||
| 4096 | type = ConicalGradient; | - | ||||||||||||||||||||||||||||||
| 4097 | const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4098 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4099 | - | |||||||||||||||||||||||||||||||
| 4100 | QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4101 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4102 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4103 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4104 | - | |||||||||||||||||||||||||||||||
| 4105 | gradient.spread = QGradient::RepeatSpread; | - | ||||||||||||||||||||||||||||||
| 4106 | - | |||||||||||||||||||||||||||||||
| 4107 | QConicalGradientData &conicalData = gradient.conical; | - | ||||||||||||||||||||||||||||||
| 4108 | - | |||||||||||||||||||||||||||||||
| 4109 | QPointF center = g->center(); | - | ||||||||||||||||||||||||||||||
| 4110 | conicalData.center.x = center.x(); | - | ||||||||||||||||||||||||||||||
| 4111 | conicalData.center.y = center.y(); | - | ||||||||||||||||||||||||||||||
| 4112 | conicalData.angle = qDegreesToRadians(g->angle()); | - | ||||||||||||||||||||||||||||||
| 4113 | } | - | ||||||||||||||||||||||||||||||
| 4114 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4115 | - | |||||||||||||||||||||||||||||||
| 4116 | case never executed: Qt::Dense1Pattern:case Qt::Dense1Pattern:never executed: case Qt::Dense1Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4117 | case never executed: Qt::Dense2Pattern:case Qt::Dense2Pattern:never executed: case Qt::Dense2Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4118 | case never executed: Qt::Dense3Pattern:case Qt::Dense3Pattern:never executed: case Qt::Dense3Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4119 | case never executed: Qt::Dense4Pattern:case Qt::Dense4Pattern:never executed: case Qt::Dense4Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4120 | case never executed: Qt::Dense5Pattern:case Qt::Dense5Pattern:never executed: case Qt::Dense5Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4121 | case never executed: Qt::Dense6Pattern:case Qt::Dense6Pattern:never executed: case Qt::Dense6Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4122 | case never executed: Qt::Dense7Pattern:case Qt::Dense7Pattern:never executed: case Qt::Dense7Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4123 | case never executed: Qt::HorPattern:case Qt::HorPattern:never executed: case Qt::HorPattern: | 0 | ||||||||||||||||||||||||||||||
| 4124 | case never executed: Qt::VerPattern:case Qt::VerPattern:never executed: case Qt::VerPattern: | 0 | ||||||||||||||||||||||||||||||
| 4125 | case never executed: Qt::CrossPattern:case Qt::CrossPattern:never executed: case Qt::CrossPattern: | 0 | ||||||||||||||||||||||||||||||
| 4126 | case never executed: Qt::BDiagPattern:case Qt::BDiagPattern:never executed: case Qt::BDiagPattern: | 0 | ||||||||||||||||||||||||||||||
| 4127 | case never executed: Qt::FDiagPattern:case Qt::FDiagPattern:never executed: case Qt::FDiagPattern: | 0 | ||||||||||||||||||||||||||||||
| 4128 | case never executed: Qt::DiagCrossPattern:case Qt::DiagCrossPattern:never executed: case Qt::DiagCrossPattern: | 0 | ||||||||||||||||||||||||||||||
| 4129 | type = Texture; | - | ||||||||||||||||||||||||||||||
| 4130 | if (!tempImage
| 0 | ||||||||||||||||||||||||||||||
| 4131 | tempImage = new QImage(); never executed: tempImage = new QImage(); | 0 | ||||||||||||||||||||||||||||||
| 4132 | *tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color()); | - | ||||||||||||||||||||||||||||||
| 4133 | initTexture(tempImage, alpha, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 4134 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4135 | case never executed: Qt::TexturePattern:case Qt::TexturePattern:never executed: case Qt::TexturePattern: | 0 | ||||||||||||||||||||||||||||||
| 4136 | type = Texture; | - | ||||||||||||||||||||||||||||||
| 4137 | if (!tempImage
| 0 | ||||||||||||||||||||||||||||||
| 4138 | tempImage = new QImage(); never executed: tempImage = new QImage(); | 0 | ||||||||||||||||||||||||||||||
| 4139 | - | |||||||||||||||||||||||||||||||
| 4140 | if (qHasPixmapTexture(brush)
| 0 | ||||||||||||||||||||||||||||||
| 4141 | * never executed: tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color());*tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color());never executed: *tempImage = rasterBuffer->colorizeBitmap(brush.textureImage(), brush.color()); | 0 | ||||||||||||||||||||||||||||||
| 4142 | else | - | ||||||||||||||||||||||||||||||
| 4143 | * never executed: tempImage = brush.textureImage();*tempImage = brush.textureImage();never executed: *tempImage = brush.textureImage(); | 0 | ||||||||||||||||||||||||||||||
| 4144 | initTexture(tempImage, alpha, QTextureData::Tiled, tempImage->rect()); | - | ||||||||||||||||||||||||||||||
| 4145 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4146 | - | |||||||||||||||||||||||||||||||
| 4147 | case never executed: Qt::NoBrush:case Qt::NoBrush:never executed: case Qt::NoBrush: | 0 | ||||||||||||||||||||||||||||||
| 4148 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4149 | type = None; | - | ||||||||||||||||||||||||||||||
| 4150 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4151 | } | - | ||||||||||||||||||||||||||||||
| 4152 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4153 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4154 | - | |||||||||||||||||||||||||||||||
| 4155 | void QSpanData::adjustSpanMethods() | - | ||||||||||||||||||||||||||||||
| 4156 | { | - | ||||||||||||||||||||||||||||||
| 4157 | bitmapBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4158 | alphamapBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4159 | alphaRGBBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4160 | - | |||||||||||||||||||||||||||||||
| 4161 | fillRect = 0; | - | ||||||||||||||||||||||||||||||
| 4162 | - | |||||||||||||||||||||||||||||||
| 4163 | switch(type) { | - | ||||||||||||||||||||||||||||||
| 4164 | case never executed: None:case None:never executed: case None: | 0 | ||||||||||||||||||||||||||||||
| 4165 | unclipped_blend = 0; | - | ||||||||||||||||||||||||||||||
| 4166 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4167 | case never executed: Solid:case Solid:never executed: case Solid: | 0 | ||||||||||||||||||||||||||||||
| 4168 | unclipped_blend = rasterBuffer->drawHelper->blendColor; | - | ||||||||||||||||||||||||||||||
| 4169 | bitmapBlit = rasterBuffer->drawHelper->bitmapBlit; | - | ||||||||||||||||||||||||||||||
| 4170 | alphamapBlit = rasterBuffer->drawHelper->alphamapBlit; | - | ||||||||||||||||||||||||||||||
| 4171 | alphaRGBBlit = rasterBuffer->drawHelper->alphaRGBBlit; | - | ||||||||||||||||||||||||||||||
| 4172 | fillRect = rasterBuffer->drawHelper->fillRect; | - | ||||||||||||||||||||||||||||||
| 4173 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4174 | case never executed: LinearGradient:case LinearGradient:never executed: case LinearGradient: | 0 | ||||||||||||||||||||||||||||||
| 4175 | case never executed: RadialGradient:case RadialGradient:never executed: case RadialGradient: | 0 | ||||||||||||||||||||||||||||||
| 4176 | case never executed: ConicalGradient:case ConicalGradient:never executed: case ConicalGradient: | 0 | ||||||||||||||||||||||||||||||
| 4177 | unclipped_blend = rasterBuffer->drawHelper->blendGradient; | - | ||||||||||||||||||||||||||||||
| 4178 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4179 | case never executed: Texture:case Texture:never executed: case Texture: | 0 | ||||||||||||||||||||||||||||||
| 4180 | unclipped_blend = qBlendTexture; | - | ||||||||||||||||||||||||||||||
| 4181 | if (!texture.imageData
| 0 | ||||||||||||||||||||||||||||||
| 4182 | unclipped_blend = 0; never executed: unclipped_blend = 0; | 0 | ||||||||||||||||||||||||||||||
| 4183 | - | |||||||||||||||||||||||||||||||
| 4184 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4185 | } | - | ||||||||||||||||||||||||||||||
| 4186 | - | |||||||||||||||||||||||||||||||
| 4187 | if (!unclipped_blend
| 0 | ||||||||||||||||||||||||||||||
| 4188 | blend = 0; | - | ||||||||||||||||||||||||||||||
| 4189 | } never executed: else if (!clipend of block
| 0 | ||||||||||||||||||||||||||||||
| 4190 | blend = unclipped_blend; | - | ||||||||||||||||||||||||||||||
| 4191 | } never executed: else if (clip->hasRectClipend of block
| 0 | ||||||||||||||||||||||||||||||
| 4192 | blend = clip->clipRect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4193 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4194 | blend = qt_span_fill_clipped; | - | ||||||||||||||||||||||||||||||
| 4195 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4196 | } | - | ||||||||||||||||||||||||||||||
| 4197 | - | |||||||||||||||||||||||||||||||
| 4198 | void QSpanData::setupMatrix(const QTransform &matrix, int bilin) | - | ||||||||||||||||||||||||||||||
| 4199 | { | - | ||||||||||||||||||||||||||||||
| 4200 | QTransform delta; | - | ||||||||||||||||||||||||||||||
| 4201 | - | |||||||||||||||||||||||||||||||
| 4202 | delta.translate(1.0 / 65536, 1.0 / 65536); | - | ||||||||||||||||||||||||||||||
| 4203 | - | |||||||||||||||||||||||||||||||
| 4204 | QTransform inv = (delta * matrix).inverted(); | - | ||||||||||||||||||||||||||||||
| 4205 | m11 = inv.m11(); | - | ||||||||||||||||||||||||||||||
| 4206 | m12 = inv.m12(); | - | ||||||||||||||||||||||||||||||
| 4207 | m13 = inv.m13(); | - | ||||||||||||||||||||||||||||||
| 4208 | m21 = inv.m21(); | - | ||||||||||||||||||||||||||||||
| 4209 | m22 = inv.m22(); | - | ||||||||||||||||||||||||||||||
| 4210 | m23 = inv.m23(); | - | ||||||||||||||||||||||||||||||
| 4211 | m33 = inv.m33(); | - | ||||||||||||||||||||||||||||||
| 4212 | dx = inv.dx(); | - | ||||||||||||||||||||||||||||||
| 4213 | dy = inv.dy(); | - | ||||||||||||||||||||||||||||||
| 4214 | txop = inv.type(); | - | ||||||||||||||||||||||||||||||
| 4215 | bilinear = bilin; | - | ||||||||||||||||||||||||||||||
| 4216 | - | |||||||||||||||||||||||||||||||
| 4217 | const bool affine = inv.isAffine(); | - | ||||||||||||||||||||||||||||||
| 4218 | fast_matrix = affine
| 0 | ||||||||||||||||||||||||||||||
| 4219 | && m11 * m11 + m21 * m21 < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4220 | && m12 * m12 + m22 * m22 < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4221 | && qAbs(dx) < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4222 | && qAbs(dy) < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4223 | - | |||||||||||||||||||||||||||||||
| 4224 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4225 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4226 | - | |||||||||||||||||||||||||||||||
| 4227 | void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _type, const QRect &sourceRect) | - | ||||||||||||||||||||||||||||||
| 4228 | { | - | ||||||||||||||||||||||||||||||
| 4229 | const QImageData *d = const_cast<QImage *>(image)->data_ptr(); | - | ||||||||||||||||||||||||||||||
| 4230 | if (!d
| 0 | ||||||||||||||||||||||||||||||
| 4231 | texture.imageData = 0; | - | ||||||||||||||||||||||||||||||
| 4232 | texture.width = 0; | - | ||||||||||||||||||||||||||||||
| 4233 | texture.height = 0; | - | ||||||||||||||||||||||||||||||
| 4234 | texture.x1 = 0; | - | ||||||||||||||||||||||||||||||
| 4235 | texture.y1 = 0; | - | ||||||||||||||||||||||||||||||
| 4236 | texture.x2 = 0; | - | ||||||||||||||||||||||||||||||
| 4237 | texture.y2 = 0; | - | ||||||||||||||||||||||||||||||
| 4238 | texture.bytesPerLine = 0; | - | ||||||||||||||||||||||||||||||
| 4239 | texture.format = QImage::Format_Invalid; | - | ||||||||||||||||||||||||||||||
| 4240 | texture.colorTable = 0; | - | ||||||||||||||||||||||||||||||
| 4241 | texture.hasAlpha = alpha != 256; | - | ||||||||||||||||||||||||||||||
| 4242 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4243 | texture.imageData = d->data; | - | ||||||||||||||||||||||||||||||
| 4244 | texture.width = d->width; | - | ||||||||||||||||||||||||||||||
| 4245 | texture.height = d->height; | - | ||||||||||||||||||||||||||||||
| 4246 | - | |||||||||||||||||||||||||||||||
| 4247 | if (sourceRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 4248 | texture.x1 = 0; | - | ||||||||||||||||||||||||||||||
| 4249 | texture.y1 = 0; | - | ||||||||||||||||||||||||||||||
| 4250 | texture.x2 = texture.width; | - | ||||||||||||||||||||||||||||||
| 4251 | texture.y2 = texture.height; | - | ||||||||||||||||||||||||||||||
| 4252 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4253 | texture.x1 = sourceRect.x(); | - | ||||||||||||||||||||||||||||||
| 4254 | texture.y1 = sourceRect.y(); | - | ||||||||||||||||||||||||||||||
| 4255 | texture.x2 = qMin(texture.x1 + sourceRect.width(), d->width); | - | ||||||||||||||||||||||||||||||
| 4256 | texture.y2 = qMin(texture.y1 + sourceRect.height(), d->height); | - | ||||||||||||||||||||||||||||||
| 4257 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4258 | - | |||||||||||||||||||||||||||||||
| 4259 | texture.bytesPerLine = d->bytes_per_line; | - | ||||||||||||||||||||||||||||||
| 4260 | - | |||||||||||||||||||||||||||||||
| 4261 | texture.format = d->format; | - | ||||||||||||||||||||||||||||||
| 4262 | texture.colorTable = (d->format <= QImage::Format_Indexed8
| 0 | ||||||||||||||||||||||||||||||
| 4263 | texture.hasAlpha = image->hasAlphaChannel()
| 0 | ||||||||||||||||||||||||||||||
| 4264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4265 | texture.const_alpha = alpha; | - | ||||||||||||||||||||||||||||||
| 4266 | texture.type = _type; | - | ||||||||||||||||||||||||||||||
| 4267 | - | |||||||||||||||||||||||||||||||
| 4268 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4270 | - | |||||||||||||||||||||||||||||||
| 4271 | - | |||||||||||||||||||||||||||||||
| 4272 | - | |||||||||||||||||||||||||||||||
| 4273 | - | |||||||||||||||||||||||||||||||
| 4274 | - | |||||||||||||||||||||||||||||||
| 4275 | static inline void drawEllipsePoints(int x, int y, int length, | - | ||||||||||||||||||||||||||||||
| 4276 | const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 4277 | const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 4278 | ProcessSpans pen_func, ProcessSpans brush_func, | - | ||||||||||||||||||||||||||||||
| 4279 | QSpanData *pen_data, QSpanData *brush_data) | - | ||||||||||||||||||||||||||||||
| 4280 | { | - | ||||||||||||||||||||||||||||||
| 4281 | if (length == 0
| 0 | ||||||||||||||||||||||||||||||
| 4282 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4283 | - | |||||||||||||||||||||||||||||||
| 4284 | QT_FT_Span outline[4]; | - | ||||||||||||||||||||||||||||||
| 4285 | const int midx = rect.x() + (rect.width() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4286 | const int midy = rect.y() + (rect.height() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4287 | - | |||||||||||||||||||||||||||||||
| 4288 | x = x + midx; | - | ||||||||||||||||||||||||||||||
| 4289 | y = midy - y; | - | ||||||||||||||||||||||||||||||
| 4290 | - | |||||||||||||||||||||||||||||||
| 4291 | - | |||||||||||||||||||||||||||||||
| 4292 | outline[0].x = midx + (midx - x) - (length - 1) - (rect.width() & 0x1); | - | ||||||||||||||||||||||||||||||
| 4293 | outline[0].len = qMin(length, x - outline[0].x); | - | ||||||||||||||||||||||||||||||
| 4294 | outline[0].y = y; | - | ||||||||||||||||||||||||||||||
| 4295 | outline[0].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4296 | - | |||||||||||||||||||||||||||||||
| 4297 | - | |||||||||||||||||||||||||||||||
| 4298 | outline[1].x = x; | - | ||||||||||||||||||||||||||||||
| 4299 | outline[1].len = length; | - | ||||||||||||||||||||||||||||||
| 4300 | outline[1].y = y; | - | ||||||||||||||||||||||||||||||
| 4301 | outline[1].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4302 | - | |||||||||||||||||||||||||||||||
| 4303 | - | |||||||||||||||||||||||||||||||
| 4304 | outline[2].x = outline[0].x; | - | ||||||||||||||||||||||||||||||
| 4305 | outline[2].len = outline[0].len; | - | ||||||||||||||||||||||||||||||
| 4306 | outline[2].y = midy + (midy - y) - (rect.height() & 0x1); | - | ||||||||||||||||||||||||||||||
| 4307 | outline[2].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4308 | - | |||||||||||||||||||||||||||||||
| 4309 | - | |||||||||||||||||||||||||||||||
| 4310 | outline[3].x = x; | - | ||||||||||||||||||||||||||||||
| 4311 | outline[3].len = length; | - | ||||||||||||||||||||||||||||||
| 4312 | outline[3].y = outline[2].y; | - | ||||||||||||||||||||||||||||||
| 4313 | outline[3].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4314 | - | |||||||||||||||||||||||||||||||
| 4315 | if (brush_func
| 0 | ||||||||||||||||||||||||||||||
| 4316 | QT_FT_Span fill[2]; | - | ||||||||||||||||||||||||||||||
| 4317 | - | |||||||||||||||||||||||||||||||
| 4318 | - | |||||||||||||||||||||||||||||||
| 4319 | fill[0].x = outline[0].x + outline[0].len - 1; | - | ||||||||||||||||||||||||||||||
| 4320 | fill[0].len = qMax(0, outline[1].x - fill[0].x); | - | ||||||||||||||||||||||||||||||
| 4321 | fill[0].y = outline[1].y; | - | ||||||||||||||||||||||||||||||
| 4322 | fill[0].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4323 | - | |||||||||||||||||||||||||||||||
| 4324 | - | |||||||||||||||||||||||||||||||
| 4325 | fill[1].x = outline[2].x + outline[2].len - 1; | - | ||||||||||||||||||||||||||||||
| 4326 | fill[1].len = qMax(0, outline[3].x - fill[1].x); | - | ||||||||||||||||||||||||||||||
| 4327 | fill[1].y = outline[3].y; | - | ||||||||||||||||||||||||||||||
| 4328 | fill[1].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4329 | - | |||||||||||||||||||||||||||||||
| 4330 | int n = (fill[0].y >= fill[1].y
| 0 | ||||||||||||||||||||||||||||||
| 4331 | n = qt_intersect_spans(fill, n, clip); | - | ||||||||||||||||||||||||||||||
| 4332 | if (n > 0
| 0 | ||||||||||||||||||||||||||||||
| 4333 | brush_func(n, fill, brush_data); never executed: brush_func(n, fill, brush_data); | 0 | ||||||||||||||||||||||||||||||
| 4334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4335 | if (pen_func
| 0 | ||||||||||||||||||||||||||||||
| 4336 | int n = (outline[1].y >= outline[2].y
| 0 | ||||||||||||||||||||||||||||||
| 4337 | n = qt_intersect_spans(outline, n, clip); | - | ||||||||||||||||||||||||||||||
| 4338 | if (n > 0
| 0 | ||||||||||||||||||||||||||||||
| 4339 | pen_func(n, outline, pen_data); never executed: pen_func(n, outline, pen_data); | 0 | ||||||||||||||||||||||||||||||
| 4340 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4341 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4342 | - | |||||||||||||||||||||||||||||||
| 4343 | - | |||||||||||||||||||||||||||||||
| 4344 | - | |||||||||||||||||||||||||||||||
| 4345 | - | |||||||||||||||||||||||||||||||
| 4346 | - | |||||||||||||||||||||||||||||||
| 4347 | static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 4348 | ProcessSpans pen_func, ProcessSpans brush_func, | - | ||||||||||||||||||||||||||||||
| 4349 | QSpanData *pen_data, QSpanData *brush_data) | - | ||||||||||||||||||||||||||||||
| 4350 | { | - | ||||||||||||||||||||||||||||||
| 4351 | const qreal a = qreal(rect.width()) / 2; | - | ||||||||||||||||||||||||||||||
| 4352 | const qreal b = qreal(rect.height()) / 2; | - | ||||||||||||||||||||||||||||||
| 4353 | qreal d = b*b - (a*a*b) + 0.25*a*a; | - | ||||||||||||||||||||||||||||||
| 4354 | - | |||||||||||||||||||||||||||||||
| 4355 | int x = 0; | - | ||||||||||||||||||||||||||||||
| 4356 | int y = (rect.height() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4357 | int startx = x; | - | ||||||||||||||||||||||||||||||
| 4358 | - | |||||||||||||||||||||||||||||||
| 4359 | - | |||||||||||||||||||||||||||||||
| 4360 | while (a*a*(2*y - 1) > 2*b*b*(x + 1)
| 0 | ||||||||||||||||||||||||||||||
| 4361 | if (d < 0
| 0 | ||||||||||||||||||||||||||||||
| 4362 | d += b*b*(2*x + 3); | - | ||||||||||||||||||||||||||||||
| 4363 | ++x; | - | ||||||||||||||||||||||||||||||
| 4364 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4365 | d += b*b*(2*x + 3) + a*a*(-2*y + 2); | - | ||||||||||||||||||||||||||||||
| 4366 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4367 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4368 | startx = ++x; | - | ||||||||||||||||||||||||||||||
| 4369 | --y; | - | ||||||||||||||||||||||||||||||
| 4370 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4371 | } | - | ||||||||||||||||||||||||||||||
| 4372 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4373 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4374 | - | |||||||||||||||||||||||||||||||
| 4375 | - | |||||||||||||||||||||||||||||||
| 4376 | d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); | - | ||||||||||||||||||||||||||||||
| 4377 | const int miny = rect.height() & 0x1; | - | ||||||||||||||||||||||||||||||
| 4378 | while (y > miny
| 0 | ||||||||||||||||||||||||||||||
| 4379 | if (d < 0
| 0 | ||||||||||||||||||||||||||||||
| 4380 | d += b*b*(2*x + 2) + a*a*(-2*y + 3); | - | ||||||||||||||||||||||||||||||
| 4381 | ++x; | - | ||||||||||||||||||||||||||||||
| 4382 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4383 | d += a*a*(-2*y + 3); | - | ||||||||||||||||||||||||||||||
| 4384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4385 | --y; | - | ||||||||||||||||||||||||||||||
| 4386 | drawEllipsePoints(x, y, 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4387 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4388 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4389 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4390 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |