| 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__,358); | 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__, 393, __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__, 399, __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 | 447 | - | ||||||||||||||||||||||||||||||
| 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__,686) : 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__,959) : 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__,1258) : 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__,1318) : 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__,1428) : 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 deviceRect = s->matrix.mapRect(cpRect).toRect(); | - | ||||||||||||||||||||||||||||||
| 1384 | ProcessSpans blend = d->getBrushFunc(deviceRect, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1385 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1386 | d->rasterize(d->outlineMapper->convertPath(path), blend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1388 | - | |||||||||||||||||||||||||||||||
| 1389 | void QRasterPaintEngine::fillRect(const QRectF &r, QSpanData *data) | - | ||||||||||||||||||||||||||||||
| 1390 | { | - | ||||||||||||||||||||||||||||||
| 1391 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1392 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1393 | - | |||||||||||||||||||||||||||||||
| 1394 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 1395 | uint txop = s->matrix.type(); | - | ||||||||||||||||||||||||||||||
| 1396 | if (txop == QTransform::TxNone
| 0 | ||||||||||||||||||||||||||||||
| 1397 | fillRect_normalized(toNormalizedFillRect(r), data, d); | - | ||||||||||||||||||||||||||||||
| 1398 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1399 | } else if (txop == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1400 | const QRect rr = toNormalizedFillRect(r.translated(s->matrix.dx(), s->matrix.dy())); | - | ||||||||||||||||||||||||||||||
| 1401 | fillRect_normalized(rr, data, d); | - | ||||||||||||||||||||||||||||||
| 1402 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1403 | } else if (txop == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1404 | const QRect rr = toNormalizedFillRect(s->matrix.mapRect(r)); | - | ||||||||||||||||||||||||||||||
| 1405 | fillRect_normalized(rr, data, d); | - | ||||||||||||||||||||||||||||||
| 1406 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1407 | } | - | ||||||||||||||||||||||||||||||
| 1408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1409 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 1410 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 1411 | d->initializeRasterizer(data); | - | ||||||||||||||||||||||||||||||
| 1412 | QRectF nr = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 1413 | if (!nr.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1414 | const QPointF a = s->matrix.map((nr.topLeft() + nr.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1415 | const QPointF b = s->matrix.map((nr.topRight() + nr.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 1416 | d->rasterizer->rasterizeLine(a, b, nr.height() / nr.width()); | - | ||||||||||||||||||||||||||||||
| 1417 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1418 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1419 | } | - | ||||||||||||||||||||||||||||||
| 1420 | - | |||||||||||||||||||||||||||||||
| 1421 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 1422 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 1423 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1424 | fillPath(path, data); | - | ||||||||||||||||||||||||||||||
| 1425 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1426 | - | |||||||||||||||||||||||||||||||
| 1427 | - | |||||||||||||||||||||||||||||||
| 1428 | - | |||||||||||||||||||||||||||||||
| 1429 | - | |||||||||||||||||||||||||||||||
| 1430 | void QRasterPaintEngine::fillRect(const QRectF &r, const QBrush &brush) | - | ||||||||||||||||||||||||||||||
| 1431 | { | - | ||||||||||||||||||||||||||||||
| 1432 | - | |||||||||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||||||||
| 1434 | - | |||||||||||||||||||||||||||||||
| 1435 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||||||||
| 1437 | ensureBrush(brush); | - | ||||||||||||||||||||||||||||||
| 1438 | if (!s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1439 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||||||||
| 1441 | fillRect(r, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1442 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1443 | - | |||||||||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||||||||
| 1445 | - | |||||||||||||||||||||||||||||||
| 1446 | - | |||||||||||||||||||||||||||||||
| 1447 | void QRasterPaintEngine::fillRect(const QRectF &r, const QColor &color) | - | ||||||||||||||||||||||||||||||
| 1448 | { | - | ||||||||||||||||||||||||||||||
| 1449 | - | |||||||||||||||||||||||||||||||
| 1450 | - | |||||||||||||||||||||||||||||||
| 1451 | - | |||||||||||||||||||||||||||||||
| 1452 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1453 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1454 | - | |||||||||||||||||||||||||||||||
| 1455 | d->solid_color_filler.solid.color = qPremultiply(combineAlpha256(color.rgba64(), s->intOpacity)); | - | ||||||||||||||||||||||||||||||
| 1456 | - | |||||||||||||||||||||||||||||||
| 1457 | if (d->solid_color_filler.solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 1458 | && s->composition_mode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1459 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1460 | } | - | ||||||||||||||||||||||||||||||
| 1461 | d->solid_color_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1462 | d->solid_color_filler.adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 1463 | fillRect(r, &d->solid_color_filler); | - | ||||||||||||||||||||||||||||||
| 1464 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1465 | - | |||||||||||||||||||||||||||||||
| 1466 | static inline bool isAbove(const QPointF *a, const QPointF *b) | - | ||||||||||||||||||||||||||||||
| 1467 | { | - | ||||||||||||||||||||||||||||||
| 1468 | return never executed: a->y() < b->y();return a->y() < b->y();never executed: return a->y() < b->y(); | 0 | ||||||||||||||||||||||||||||||
| 1469 | } | - | ||||||||||||||||||||||||||||||
| 1470 | - | |||||||||||||||||||||||||||||||
| 1471 | static bool splitPolygon(const QPointF *points, int pointCount, QVector<QPointF> *upper, QVector<QPointF> *lower) | - | ||||||||||||||||||||||||||||||
| 1472 | { | - | ||||||||||||||||||||||||||||||
| 1473 | ((!(upper)) ? qt_assert("upper",__FILE__,1794) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1474 | ((!(lower)) ? qt_assert("lower",__FILE__,1795) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1475 | - | |||||||||||||||||||||||||||||||
| 1476 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1797) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1477 | - | |||||||||||||||||||||||||||||||
| 1478 | QVector<const QPointF *> sorted; | - | ||||||||||||||||||||||||||||||
| 1479 | sorted.reserve(pointCount); | - | ||||||||||||||||||||||||||||||
| 1480 | - | |||||||||||||||||||||||||||||||
| 1481 | upper->reserve(pointCount * 3 / 4); | - | ||||||||||||||||||||||||||||||
| 1482 | lower->reserve(pointCount * 3 / 4); | - | ||||||||||||||||||||||||||||||
| 1483 | - | |||||||||||||||||||||||||||||||
| 1484 | for (int i = 0; i < pointCount
| 0 | ||||||||||||||||||||||||||||||
| 1485 | sorted << points + i; never executed: sorted << points + i; | 0 | ||||||||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||||||||
| 1487 | std::sort(sorted.begin(), sorted.end(), isAbove); | - | ||||||||||||||||||||||||||||||
| 1488 | - | |||||||||||||||||||||||||||||||
| 1489 | qreal splitY = sorted.at(sorted.size() / 2)->y(); | - | ||||||||||||||||||||||||||||||
| 1490 | - | |||||||||||||||||||||||||||||||
| 1491 | const QPointF *end = points + pointCount; | - | ||||||||||||||||||||||||||||||
| 1492 | const QPointF *last = end - 1; | - | ||||||||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||||||||
| 1494 | QVector<QPointF> *bin[2] = { upper, lower }; | - | ||||||||||||||||||||||||||||||
| 1495 | - | |||||||||||||||||||||||||||||||
| 1496 | for (const QPointF *p = points; p < end
| 0 | ||||||||||||||||||||||||||||||
| 1497 | int side = p->y() < splitY; | - | ||||||||||||||||||||||||||||||
| 1498 | int lastSide = last->y() < splitY; | - | ||||||||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||||||||
| 1500 | if (side != lastSide
| 0 | ||||||||||||||||||||||||||||||
| 1501 | if (qFuzzyCompare(p->y(), splitY)
| 0 | ||||||||||||||||||||||||||||||
| 1502 | bin[!side]->append(*p); | - | ||||||||||||||||||||||||||||||
| 1503 | } never executed: else if (qFuzzyCompare(last->y(), splitY)end of block
| 0 | ||||||||||||||||||||||||||||||
| 1504 | bin[side]->append(*last); | - | ||||||||||||||||||||||||||||||
| 1505 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1506 | QPointF delta = *p - *last; | - | ||||||||||||||||||||||||||||||
| 1507 | QPointF intersection(p->x() + delta.x() * (splitY - p->y()) / delta.y(), splitY); | - | ||||||||||||||||||||||||||||||
| 1508 | - | |||||||||||||||||||||||||||||||
| 1509 | bin[0]->append(intersection); | - | ||||||||||||||||||||||||||||||
| 1510 | bin[1]->append(intersection); | - | ||||||||||||||||||||||||||||||
| 1511 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1512 | } | - | ||||||||||||||||||||||||||||||
| 1513 | - | |||||||||||||||||||||||||||||||
| 1514 | bin[side]->append(*p); | - | ||||||||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||||||||
| 1516 | last = p; | - | ||||||||||||||||||||||||||||||
| 1517 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1518 | - | |||||||||||||||||||||||||||||||
| 1519 | - | |||||||||||||||||||||||||||||||
| 1520 | return never executed: upper->size() < pointCountreturn upper->size() < pointCount && lower->size() < pointCount;
never executed: return upper->size() < pointCount && lower->size() < pointCount; | 0 | ||||||||||||||||||||||||||||||
| 1521 | } | - | ||||||||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||||||||
| 1523 | - | |||||||||||||||||||||||||||||||
| 1524 | - | |||||||||||||||||||||||||||||||
| 1525 | - | |||||||||||||||||||||||||||||||
| 1526 | void QRasterPaintEngine::fillPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1527 | { | - | ||||||||||||||||||||||||||||||
| 1528 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1529 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||||||||
| 1531 | const int maxPoints = 0xffff; | - | ||||||||||||||||||||||||||||||
| 1532 | - | |||||||||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||||||||
| 1534 | if (pointCount > maxPoints
| 0 | ||||||||||||||||||||||||||||||
| 1535 | QVector<QPointF> upper, lower; | - | ||||||||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||||||||
| 1537 | if (splitPolygon(points, pointCount, &upper, &lower)
| 0 | ||||||||||||||||||||||||||||||
| 1538 | fillPolygon(upper.constData(), upper.size(), mode); | - | ||||||||||||||||||||||||||||||
| 1539 | fillPolygon(lower.constData(), lower.size(), mode); | - | ||||||||||||||||||||||||||||||
| 1540 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||
| 1541 | QMessageLogger(__FILE__, 1862, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); never executed: QMessageLogger(__FILE__, 1862, __PRETTY_FUNCTION__).warning("Polygon too complex for filling."); | 0 | ||||||||||||||||||||||||||||||
| 1542 | - | |||||||||||||||||||||||||||||||
| 1543 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1544 | } | - | ||||||||||||||||||||||||||||||
| 1545 | - | |||||||||||||||||||||||||||||||
| 1546 | - | |||||||||||||||||||||||||||||||
| 1547 | QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1548 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1549 | QT_FT_Outline *outline = d->outlineMapper->convertPath(vp); | - | ||||||||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||||||||
| 1552 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - | ||||||||||||||||||||||||||||||
| 1553 | &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1554 | d->rasterize(outline, brushBlend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1555 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1556 | - | |||||||||||||||||||||||||||||||
| 1557 | - | |||||||||||||||||||||||||||||||
| 1558 | - | |||||||||||||||||||||||||||||||
| 1559 | - | |||||||||||||||||||||||||||||||
| 1560 | void QRasterPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1561 | { | - | ||||||||||||||||||||||||||||||
| 1562 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1563 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1564 | - | |||||||||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||||||||
| 1567 | - | |||||||||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||||||||
| 1570 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1891) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1571 | - | |||||||||||||||||||||||||||||||
| 1572 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1573 | QRectF r(points[0], points[2]); | - | ||||||||||||||||||||||||||||||
| 1574 | drawRects(&r, 1); | - | ||||||||||||||||||||||||||||||
| 1575 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1576 | } | - | ||||||||||||||||||||||||||||||
| 1577 | - | |||||||||||||||||||||||||||||||
| 1578 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1579 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1580 | - | |||||||||||||||||||||||||||||||
| 1581 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1582 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1583 | fillPolygon(points, pointCount, mode); never executed: fillPolygon(points, pointCount, mode); | 0 | ||||||||||||||||||||||||||||||
| 1584 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||||||||
| 1586 | - | |||||||||||||||||||||||||||||||
| 1587 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1588 | QVectorPath vp((const qreal *) points, pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1589 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1590 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1591 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1592 | stroker.drawPath(vp); | - | ||||||||||||||||||||||||||||||
| 1593 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1594 | QPaintEngineEx::stroke(vp, s->lastPen); | - | ||||||||||||||||||||||||||||||
| 1595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1596 | } | - | ||||||||||||||||||||||||||||||
| 1597 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1598 | - | |||||||||||||||||||||||||||||||
| 1599 | - | |||||||||||||||||||||||||||||||
| 1600 | - | |||||||||||||||||||||||||||||||
| 1601 | - | |||||||||||||||||||||||||||||||
| 1602 | void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) | - | ||||||||||||||||||||||||||||||
| 1603 | { | - | ||||||||||||||||||||||||||||||
| 1604 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1605 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1606 | - | |||||||||||||||||||||||||||||||
| 1607 | - | |||||||||||||||||||||||||||||||
| 1608 | - | |||||||||||||||||||||||||||||||
| 1609 | - | |||||||||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||||||||
| 1612 | ((!(pointCount >= 2)) ? qt_assert("pointCount >= 2",__FILE__,1933) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1613 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1614 | QRect r(points[0].x(), | - | ||||||||||||||||||||||||||||||
| 1615 | points[0].y(), | - | ||||||||||||||||||||||||||||||
| 1616 | points[2].x() - points[0].x(), | - | ||||||||||||||||||||||||||||||
| 1617 | points[2].y() - points[0].y()); | - | ||||||||||||||||||||||||||||||
| 1618 | drawRects(&r, 1); | - | ||||||||||||||||||||||||||||||
| 1619 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1620 | } | - | ||||||||||||||||||||||||||||||
| 1621 | - | |||||||||||||||||||||||||||||||
| 1622 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1623 | - | |||||||||||||||||||||||||||||||
| 1624 | - | |||||||||||||||||||||||||||||||
| 1625 | if (mode != PolylineMode
| 0 | ||||||||||||||||||||||||||||||
| 1626 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 1627 | if (s->brushData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||||||||
| 1629 | ensureOutlineMapper(); | - | ||||||||||||||||||||||||||||||
| 1630 | d->outlineMapper->beginOutline(mode == WindingMode ? Qt::WindingFill : Qt::OddEvenFill); | - | ||||||||||||||||||||||||||||||
| 1631 | d->outlineMapper->moveTo(*points); | - | ||||||||||||||||||||||||||||||
| 1632 | const QPoint *p = points; | - | ||||||||||||||||||||||||||||||
| 1633 | const QPoint *ep = points + pointCount - 1; | - | ||||||||||||||||||||||||||||||
| 1634 | do { | - | ||||||||||||||||||||||||||||||
| 1635 | d->outlineMapper->lineTo(*(++p)); | - | ||||||||||||||||||||||||||||||
| 1636 | } never executed: while (p < epend of block
| 0 | ||||||||||||||||||||||||||||||
| 1637 | d->outlineMapper->endOutline(); | - | ||||||||||||||||||||||||||||||
| 1638 | - | |||||||||||||||||||||||||||||||
| 1639 | - | |||||||||||||||||||||||||||||||
| 1640 | ProcessSpans brushBlend = d->getBrushFunc(d->outlineMapper->controlPointRect, | - | ||||||||||||||||||||||||||||||
| 1641 | &s->brushData); | - | ||||||||||||||||||||||||||||||
| 1642 | d->rasterize(d->outlineMapper->outline(), brushBlend, &s->brushData, d->rasterBuffer.data()); | - | ||||||||||||||||||||||||||||||
| 1643 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1644 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1645 | - | |||||||||||||||||||||||||||||||
| 1646 | - | |||||||||||||||||||||||||||||||
| 1647 | if (s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 1648 | int count = pointCount * 2; | - | ||||||||||||||||||||||||||||||
| 1649 | QVarLengthArray<qreal> fpoints(count); | - | ||||||||||||||||||||||||||||||
| 1650 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||||||||
| 1651 | fpoints[i] = ((const int *) points)[i]; never executed: fpoints[i] = ((const int *) points)[i]; | 0 | ||||||||||||||||||||||||||||||
| 1652 | QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); | - | ||||||||||||||||||||||||||||||
| 1653 | - | |||||||||||||||||||||||||||||||
| 1654 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 1655 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 1656 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 1657 | stroker.drawPath(vp); | - | ||||||||||||||||||||||||||||||
| 1658 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1659 | QPaintEngineEx::stroke(vp, s->lastPen); | - | ||||||||||||||||||||||||||||||
| 1660 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1661 | } | - | ||||||||||||||||||||||||||||||
| 1662 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||||||||
| 1664 | - | |||||||||||||||||||||||||||||||
| 1665 | - | |||||||||||||||||||||||||||||||
| 1666 | - | |||||||||||||||||||||||||||||||
| 1667 | void QRasterPaintEngine::drawPixmap(const QPointF &pos, const QPixmap &pixmap) | - | ||||||||||||||||||||||||||||||
| 1668 | { | - | ||||||||||||||||||||||||||||||
| 1669 | - | |||||||||||||||||||||||||||||||
| 1670 | - | |||||||||||||||||||||||||||||||
| 1671 | - | |||||||||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||||||||
| 1673 | QPlatformPixmap *pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 1674 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 1675 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 1676 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1677 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1678 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1679 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1680 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1681 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1682 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1683 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - | ||||||||||||||||||||||||||||||
| 1684 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1685 | } else { | - | ||||||||||||||||||||||||||||||
| 1686 | QRasterPaintEngine::drawImage(pos, image); | - | ||||||||||||||||||||||||||||||
| 1687 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1688 | } else { | - | ||||||||||||||||||||||||||||||
| 1689 | const QImage image = pixmap.toImage(); | - | ||||||||||||||||||||||||||||||
| 1690 | if (pixmap.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1691 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1692 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1693 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1694 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1695 | drawBitmap(pos + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1696 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1697 | drawImage(pos, d->rasterBuffer->colorizeBitmap(image, s->pen.color())); | - | ||||||||||||||||||||||||||||||
| 1698 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1699 | } else { | - | ||||||||||||||||||||||||||||||
| 1700 | QRasterPaintEngine::drawImage(pos, image); | - | ||||||||||||||||||||||||||||||
| 1701 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1702 | } | - | ||||||||||||||||||||||||||||||
| 1703 | } | - | ||||||||||||||||||||||||||||||
| 1704 | - | |||||||||||||||||||||||||||||||
| 1705 | - | |||||||||||||||||||||||||||||||
| 1706 | - | |||||||||||||||||||||||||||||||
| 1707 | - | |||||||||||||||||||||||||||||||
| 1708 | void QRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, const QRectF &sr) | - | ||||||||||||||||||||||||||||||
| 1709 | { | - | ||||||||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||||||||
| 1711 | - | |||||||||||||||||||||||||||||||
| 1712 | - | |||||||||||||||||||||||||||||||
| 1713 | - | |||||||||||||||||||||||||||||||
| 1714 | QPlatformPixmap* pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 1715 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 1716 | const QImage &image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 1717 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1718 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1719 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1720 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1721 | && r.size() == sr.size()
| 0 | ||||||||||||||||||||||||||||||
| 1722 | && r.size() == pixmap.size()
| 0 | ||||||||||||||||||||||||||||||
| 1723 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1724 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1725 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1726 | } else { | - | ||||||||||||||||||||||||||||||
| 1727 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), sr); | - | ||||||||||||||||||||||||||||||
| 1728 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1729 | } else { | - | ||||||||||||||||||||||||||||||
| 1730 | drawImage(r, image, sr); | - | ||||||||||||||||||||||||||||||
| 1731 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1732 | } else { | - | ||||||||||||||||||||||||||||||
| 1733 | QRect clippedSource = sr.toAlignedRect().intersected(pixmap.rect()); | - | ||||||||||||||||||||||||||||||
| 1734 | const QImage image = pd->toImage(clippedSource); | - | ||||||||||||||||||||||||||||||
| 1735 | QRectF translatedSource = sr.translated(-clippedSource.topLeft()); | - | ||||||||||||||||||||||||||||||
| 1736 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 1737 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1738 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1739 | if (s->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1740 | && r.size() == sr.size()
| 0 | ||||||||||||||||||||||||||||||
| 1741 | && r.size() == pixmap.size()
| 0 | ||||||||||||||||||||||||||||||
| 1742 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 1743 | drawBitmap(r.topLeft() + QPointF(s->matrix.dx(), s->matrix.dy()), image, &s->penData); | - | ||||||||||||||||||||||||||||||
| 1744 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1745 | } else { | - | ||||||||||||||||||||||||||||||
| 1746 | drawImage(r, d->rasterBuffer->colorizeBitmap(image, s->pen.color()), translatedSource); | - | ||||||||||||||||||||||||||||||
| 1747 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1748 | } else { | - | ||||||||||||||||||||||||||||||
| 1749 | drawImage(r, image, translatedSource); | - | ||||||||||||||||||||||||||||||
| 1750 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1751 | } | - | ||||||||||||||||||||||||||||||
| 1752 | } | - | ||||||||||||||||||||||||||||||
| 1753 | - | |||||||||||||||||||||||||||||||
| 1754 | static inline int fast_ceil_positive(const qreal &v) | - | ||||||||||||||||||||||||||||||
| 1755 | { | - | ||||||||||||||||||||||||||||||
| 1756 | const int iv = int(v); | - | ||||||||||||||||||||||||||||||
| 1757 | if (v - iv == 0
| 0 | ||||||||||||||||||||||||||||||
| 1758 | return never executed: iv;return iv;never executed: return iv; | 0 | ||||||||||||||||||||||||||||||
| 1759 | else | - | ||||||||||||||||||||||||||||||
| 1760 | return never executed: iv + 1;return iv + 1;never executed: return iv + 1; | 0 | ||||||||||||||||||||||||||||||
| 1761 | } | - | ||||||||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||||||||
| 1763 | static inline const QRect toAlignedRect_positive(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 1764 | { | - | ||||||||||||||||||||||||||||||
| 1765 | const int xmin = int(rect.x()); | - | ||||||||||||||||||||||||||||||
| 1766 | const int xmax = int(fast_ceil_positive(rect.right())); | - | ||||||||||||||||||||||||||||||
| 1767 | const int ymin = int(rect.y()); | - | ||||||||||||||||||||||||||||||
| 1768 | const int ymax = int(fast_ceil_positive(rect.bottom())); | - | ||||||||||||||||||||||||||||||
| 1769 | 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 | ||||||||||||||||||||||||||||||
| 1770 | } | - | ||||||||||||||||||||||||||||||
| 1771 | - | |||||||||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||||||||
| 1774 | - | |||||||||||||||||||||||||||||||
| 1775 | void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img) | - | ||||||||||||||||||||||||||||||
| 1776 | { | - | ||||||||||||||||||||||||||||||
| 1777 | - | |||||||||||||||||||||||||||||||
| 1778 | - | |||||||||||||||||||||||||||||||
| 1779 | - | |||||||||||||||||||||||||||||||
| 1780 | - | |||||||||||||||||||||||||||||||
| 1781 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1782 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1783 | qreal scale = img.devicePixelRatio(); | - | ||||||||||||||||||||||||||||||
| 1784 | - | |||||||||||||||||||||||||||||||
| 1785 | if (scale > 1.0
| 0 | ||||||||||||||||||||||||||||||
| 1786 | drawImage(QRectF(p.x(), p.y(), img.width() / scale, img.height() / scale), | - | ||||||||||||||||||||||||||||||
| 1787 | img, | - | ||||||||||||||||||||||||||||||
| 1788 | QRectF(0, 0, img.width(), img.height())); | - | ||||||||||||||||||||||||||||||
| 1789 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1790 | - | |||||||||||||||||||||||||||||||
| 1791 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1792 | QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 1793 | - | |||||||||||||||||||||||||||||||
| 1794 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)
| 0 | ||||||||||||||||||||||||||||||
| 1795 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 1796 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 1797 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 1798 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1799 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1800 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 1801 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1802 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1803 | } | - | ||||||||||||||||||||||||||||||
| 1804 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1805 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1806 | - | |||||||||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||||||||
| 1809 | d->image_filler.clip = clip; | - | ||||||||||||||||||||||||||||||
| 1810 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect()); | - | ||||||||||||||||||||||||||||||
| 1811 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 1812 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1813 | d->image_filler.dx = -pt.x(); | - | ||||||||||||||||||||||||||||||
| 1814 | d->image_filler.dy = -pt.y(); | - | ||||||||||||||||||||||||||||||
| 1815 | QRect rr = img.rect().translated(qRound(pt.x()), qRound(pt.y())); | - | ||||||||||||||||||||||||||||||
| 1816 | - | |||||||||||||||||||||||||||||||
| 1817 | fillRect_normalized(rr, &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 1818 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1819 | - | |||||||||||||||||||||||||||||||
| 1820 | } | - | ||||||||||||||||||||||||||||||
| 1821 | - | |||||||||||||||||||||||||||||||
| 1822 | QRectF qt_mapRect_non_normalizing(const QRectF &r, const QTransform &t) | - | ||||||||||||||||||||||||||||||
| 1823 | { | - | ||||||||||||||||||||||||||||||
| 1824 | 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 | ||||||||||||||||||||||||||||||
| 1825 | } | - | ||||||||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||||||||
| 1827 | namespace { | - | ||||||||||||||||||||||||||||||
| 1828 | enum RotationType { | - | ||||||||||||||||||||||||||||||
| 1829 | Rotation90, | - | ||||||||||||||||||||||||||||||
| 1830 | Rotation180, | - | ||||||||||||||||||||||||||||||
| 1831 | Rotation270, | - | ||||||||||||||||||||||||||||||
| 1832 | NoRotation | - | ||||||||||||||||||||||||||||||
| 1833 | }; | - | ||||||||||||||||||||||||||||||
| 1834 | - | |||||||||||||||||||||||||||||||
| 1835 | inline RotationType qRotationType(const QTransform &transform) | - | ||||||||||||||||||||||||||||||
| 1836 | { | - | ||||||||||||||||||||||||||||||
| 1837 | QTransform::TransformationType type = transform.type(); | - | ||||||||||||||||||||||||||||||
| 1838 | - | |||||||||||||||||||||||||||||||
| 1839 | if (type > QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1840 | return never executed: NoRotation;return NoRotation;never executed: return NoRotation; | 0 | ||||||||||||||||||||||||||||||
| 1841 | - | |||||||||||||||||||||||||||||||
| 1842 | if (type == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1843 | && qFuzzyCompare(transform.m21(), qreal(1))
| 0 | ||||||||||||||||||||||||||||||
| 1844 | return never executed: Rotation90;return Rotation90;never executed: return Rotation90; | 0 | ||||||||||||||||||||||||||||||
| 1845 | - | |||||||||||||||||||||||||||||||
| 1846 | if (type == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1847 | && qFuzzyIsNull(transform.m21())
| 0 | ||||||||||||||||||||||||||||||
| 1848 | return never executed: Rotation180;return Rotation180;never executed: return Rotation180; | 0 | ||||||||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||||||||
| 1850 | if (type == QTransform::TxRotate
| 0 | ||||||||||||||||||||||||||||||
| 1851 | && qFuzzyCompare(transform.m21(), qreal(-1))
| 0 | ||||||||||||||||||||||||||||||
| 1852 | return never executed: Rotation270;return Rotation270;never executed: return Rotation270; | 0 | ||||||||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||||||||
| 1854 | return never executed: NoRotation;return NoRotation;never executed: return NoRotation; | 0 | ||||||||||||||||||||||||||||||
| 1855 | } | - | ||||||||||||||||||||||||||||||
| 1856 | - | |||||||||||||||||||||||||||||||
| 1857 | inline bool isPixelAligned(const QRectF &rect) { | - | ||||||||||||||||||||||||||||||
| 1858 | return never executed: QRectF(rect.toRect()) == rect;return QRectF(rect.toRect()) == rect;never executed: return QRectF(rect.toRect()) == rect; | 0 | ||||||||||||||||||||||||||||||
| 1859 | } | - | ||||||||||||||||||||||||||||||
| 1860 | } | - | ||||||||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||||||||
| 1862 | - | |||||||||||||||||||||||||||||||
| 1863 | - | |||||||||||||||||||||||||||||||
| 1864 | - | |||||||||||||||||||||||||||||||
| 1865 | void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, | - | ||||||||||||||||||||||||||||||
| 1866 | Qt::ImageConversionFlags) | - | ||||||||||||||||||||||||||||||
| 1867 | { | - | ||||||||||||||||||||||||||||||
| 1868 | - | |||||||||||||||||||||||||||||||
| 1869 | - | |||||||||||||||||||||||||||||||
| 1870 | - | |||||||||||||||||||||||||||||||
| 1871 | - | |||||||||||||||||||||||||||||||
| 1872 | if (r.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 1873 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1874 | - | |||||||||||||||||||||||||||||||
| 1875 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 1876 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 1877 | ((!(s)) ? qt_assert("s",__FILE__,2198) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 1878 | int sr_l = qFloor(sr.left()); | - | ||||||||||||||||||||||||||||||
| 1879 | int sr_r = qCeil(sr.right()) - 1; | - | ||||||||||||||||||||||||||||||
| 1880 | int sr_t = qFloor(sr.top()); | - | ||||||||||||||||||||||||||||||
| 1881 | int sr_b = qCeil(sr.bottom()) - 1; | - | ||||||||||||||||||||||||||||||
| 1882 | - | |||||||||||||||||||||||||||||||
| 1883 | if (s->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1884 | - | |||||||||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||||||||
| 1886 | QTransform old = s->matrix; | - | ||||||||||||||||||||||||||||||
| 1887 | - | |||||||||||||||||||||||||||||||
| 1888 | if (s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 1889 | s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); never executed: s->matrix = s->matrix * QTransform::fromTranslate(-aliasedCoordinateDelta, -aliasedCoordinateDelta); | 0 | ||||||||||||||||||||||||||||||
| 1890 | - | |||||||||||||||||||||||||||||||
| 1891 | - | |||||||||||||||||||||||||||||||
| 1892 | QRgb color = img.pixel(sr_l, sr_t); | - | ||||||||||||||||||||||||||||||
| 1893 | switch (img.format()) { | - | ||||||||||||||||||||||||||||||
| 1894 | case never executed: QImage::Format_ARGB32_Premultiplied:case QImage::Format_ARGB32_Premultiplied:never executed: case QImage::Format_ARGB32_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1895 | case never executed: QImage::Format_ARGB8565_Premultiplied:case QImage::Format_ARGB8565_Premultiplied:never executed: case QImage::Format_ARGB8565_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1896 | case never executed: QImage::Format_ARGB6666_Premultiplied:case QImage::Format_ARGB6666_Premultiplied:never executed: case QImage::Format_ARGB6666_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1897 | case never executed: QImage::Format_ARGB8555_Premultiplied:case QImage::Format_ARGB8555_Premultiplied:never executed: case QImage::Format_ARGB8555_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1898 | case never executed: QImage::Format_ARGB4444_Premultiplied:case QImage::Format_ARGB4444_Premultiplied:never executed: case QImage::Format_ARGB4444_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1899 | case never executed: QImage::Format_RGBA8888_Premultiplied:case QImage::Format_RGBA8888_Premultiplied:never executed: case QImage::Format_RGBA8888_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1900 | case never executed: QImage::Format_A2BGR30_Premultiplied:case QImage::Format_A2BGR30_Premultiplied:never executed: case QImage::Format_A2BGR30_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1901 | case never executed: QImage::Format_A2RGB30_Premultiplied:case QImage::Format_A2RGB30_Premultiplied:never executed: case QImage::Format_A2RGB30_Premultiplied: | 0 | ||||||||||||||||||||||||||||||
| 1902 | - | |||||||||||||||||||||||||||||||
| 1903 | d->solid_color_filler.solid.color = multiplyAlpha256(QRgba64::fromArgb32(color), s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1904 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1905 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 1906 | d->solid_color_filler.solid.color = qPremultiply(combineAlpha256(QRgba64::fromArgb32(color), s->intOpacity)); | - | ||||||||||||||||||||||||||||||
| 1907 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 1908 | } | - | ||||||||||||||||||||||||||||||
| 1909 | - | |||||||||||||||||||||||||||||||
| 1910 | if (d->solid_color_filler.solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 1911 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1912 | - | |||||||||||||||||||||||||||||||
| 1913 | d->solid_color_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1914 | d->solid_color_filler.adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 1915 | fillRect(r, &d->solid_color_filler); | - | ||||||||||||||||||||||||||||||
| 1916 | - | |||||||||||||||||||||||||||||||
| 1917 | s->matrix = old; | - | ||||||||||||||||||||||||||||||
| 1918 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1919 | } | - | ||||||||||||||||||||||||||||||
| 1920 | - | |||||||||||||||||||||||||||||||
| 1921 | bool stretch_sr = r.width() != sr.width()
| 0 | ||||||||||||||||||||||||||||||
| 1922 | - | |||||||||||||||||||||||||||||||
| 1923 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||||||||
| 1925 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1926 | && !stretch_sr
| 0 | ||||||||||||||||||||||||||||||
| 1927 | && (!clip
| 0 | ||||||||||||||||||||||||||||||
| 1928 | && s->intOpacity == 256
| 0 | ||||||||||||||||||||||||||||||
| 1929 | && (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
| 0 | ||||||||||||||||||||||||||||||
| 1930 | || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1931 | && d->rasterBuffer->format == img.format()
| 0 | ||||||||||||||||||||||||||||||
| 1932 | && (d->rasterBuffer->format == QImage::Format_RGB16
| 0 | ||||||||||||||||||||||||||||||
| 1933 | || d->rasterBuffer->format == QImage::Format_RGB32
| 0 | ||||||||||||||||||||||||||||||
| 1934 | || (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
| 0 | ||||||||||||||||||||||||||||||
| 1935 | && d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source
| 0 | ||||||||||||||||||||||||||||||
| 1936 | { | - | ||||||||||||||||||||||||||||||
| 1937 | RotationType rotationType = qRotationType(s->matrix); | - | ||||||||||||||||||||||||||||||
| 1938 | - | |||||||||||||||||||||||||||||||
| 1939 | if (rotationType != NoRotation
| 0 | ||||||||||||||||||||||||||||||
| 1940 | QRectF transformedTargetRect = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 1941 | - | |||||||||||||||||||||||||||||||
| 1942 | if ((!(s->renderHints & QPainter::SmoothPixmapTransform)
| 0 | ||||||||||||||||||||||||||||||
| 1943 | || (isPixelAligned(transformedTargetRect)
| 0 | ||||||||||||||||||||||||||||||
| 1944 | { | - | ||||||||||||||||||||||||||||||
| 1945 | QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect); | - | ||||||||||||||||||||||||||||||
| 1946 | if (clippedTransformedTargetRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 1947 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1948 | - | |||||||||||||||||||||||||||||||
| 1949 | QRectF clippedTargetRect = s->matrix.inverted().mapRect(QRectF(clippedTransformedTargetRect)); | - | ||||||||||||||||||||||||||||||
| 1950 | - | |||||||||||||||||||||||||||||||
| 1951 | QRect clippedSourceRect | - | ||||||||||||||||||||||||||||||
| 1952 | = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(), | - | ||||||||||||||||||||||||||||||
| 1953 | clippedTargetRect.width(), clippedTargetRect.height()).toRect(); | - | ||||||||||||||||||||||||||||||
| 1954 | - | |||||||||||||||||||||||||||||||
| 1955 | clippedSourceRect = clippedSourceRect.intersected(img.rect()); | - | ||||||||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||||||||
| 1957 | uint dbpl = d->rasterBuffer->bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 1958 | uint sbpl = img.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 1959 | - | |||||||||||||||||||||||||||||||
| 1960 | uchar *dst = d->rasterBuffer->buffer(); | - | ||||||||||||||||||||||||||||||
| 1961 | uint bpp = img.depth() >> 3; | - | ||||||||||||||||||||||||||||||
| 1962 | - | |||||||||||||||||||||||||||||||
| 1963 | const uchar *srcBase = img.bits() + clippedSourceRect.y() * sbpl + clippedSourceRect.x() * bpp; | - | ||||||||||||||||||||||||||||||
| 1964 | uchar *dstBase = dst + clippedTransformedTargetRect.y() * dbpl + clippedTransformedTargetRect.x() * bpp; | - | ||||||||||||||||||||||||||||||
| 1965 | - | |||||||||||||||||||||||||||||||
| 1966 | uint cw = clippedSourceRect.width(); | - | ||||||||||||||||||||||||||||||
| 1967 | uint ch = clippedSourceRect.height(); | - | ||||||||||||||||||||||||||||||
| 1968 | - | |||||||||||||||||||||||||||||||
| 1969 | qMemRotateFunctions[d->rasterBuffer->format][rotationType](srcBase, cw, ch, sbpl, dstBase, dbpl); | - | ||||||||||||||||||||||||||||||
| 1970 | - | |||||||||||||||||||||||||||||||
| 1971 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1972 | } | - | ||||||||||||||||||||||||||||||
| 1973 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1974 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 1975 | - | |||||||||||||||||||||||||||||||
| 1976 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 1977 | - | |||||||||||||||||||||||||||||||
| 1978 | QRectF targetBounds = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 1979 | bool exceedsPrecision = targetBounds.width() > 0xffff
| 0 | ||||||||||||||||||||||||||||||
| 1980 | || targetBounds.height() > 0xffff
| 0 | ||||||||||||||||||||||||||||||
| 1981 | - | |||||||||||||||||||||||||||||||
| 1982 | if (!exceedsPrecision
| 0 | ||||||||||||||||||||||||||||||
| 1983 | if (s->matrix.type() > QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1984 | SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 1985 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 1986 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(), | - | ||||||||||||||||||||||||||||||
| 1987 | img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect, | - | ||||||||||||||||||||||||||||||
| 1988 | s->matrix, s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 1989 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 1990 | } | - | ||||||||||||||||||||||||||||||
| 1991 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 1992 | - | |||||||||||||||||||||||||||||||
| 1993 | bool sourceRect2x = r.width() * 2 == sr.width()
| 0 | ||||||||||||||||||||||||||||||
| 1994 | bool scale2x = (
| 0 | ||||||||||||||||||||||||||||||
| 1995 | if (s->matrix.type() == QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 1996 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 1997 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 1998 | QPointF pt(r.x() * 2 + s->matrix.dx(), r.y() * 2 + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 1999 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2000 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2001 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2002 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2003 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2004 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2005 | } | - | ||||||||||||||||||||||||||||||
| 2006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2007 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2008 | SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 2009 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 2010 | func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), | - | ||||||||||||||||||||||||||||||
| 2011 | img.bits(), img.bytesPerLine(), img.height(), | - | ||||||||||||||||||||||||||||||
| 2012 | qt_mapRect_non_normalizing(r, s->matrix), sr, | - | ||||||||||||||||||||||||||||||
| 2013 | !clip ? d->deviceRect : clip->clipRect, | - | ||||||||||||||||||||||||||||||
| 2014 | s->intOpacity); | - | ||||||||||||||||||||||||||||||
| 2015 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2016 | } | - | ||||||||||||||||||||||||||||||
| 2017 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2018 | } | - | ||||||||||||||||||||||||||||||
| 2019 | - | |||||||||||||||||||||||||||||||
| 2020 | QTransform copy = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2021 | copy.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||||||||
| 2022 | if (stretch_sr
| 0 | ||||||||||||||||||||||||||||||
| 2023 | copy.scale(r.width() / sr.width(), r.height() / sr.height()); never executed: copy.scale(r.width() / sr.width(), r.height() / sr.height()); | 0 | ||||||||||||||||||||||||||||||
| 2024 | copy.translate(-sr.x(), -sr.y()); | - | ||||||||||||||||||||||||||||||
| 2025 | - | |||||||||||||||||||||||||||||||
| 2026 | d->image_filler_xform.clip = clip; | - | ||||||||||||||||||||||||||||||
| 2027 | d->image_filler_xform.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - | ||||||||||||||||||||||||||||||
| 2028 | if (!d->image_filler_xform.blend
| 0 | ||||||||||||||||||||||||||||||
| 2029 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2030 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - | ||||||||||||||||||||||||||||||
| 2031 | - | |||||||||||||||||||||||||||||||
| 2032 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2033 | QRectF rr = s->matrix.mapRect(r); | - | ||||||||||||||||||||||||||||||
| 2034 | - | |||||||||||||||||||||||||||||||
| 2035 | const int x1 = qRound(rr.x()); | - | ||||||||||||||||||||||||||||||
| 2036 | const int y1 = qRound(rr.y()); | - | ||||||||||||||||||||||||||||||
| 2037 | const int x2 = qRound(rr.right()); | - | ||||||||||||||||||||||||||||||
| 2038 | const int y2 = qRound(rr.bottom()); | - | ||||||||||||||||||||||||||||||
| 2039 | - | |||||||||||||||||||||||||||||||
| 2040 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler_xform, d); | - | ||||||||||||||||||||||||||||||
| 2041 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2042 | } | - | ||||||||||||||||||||||||||||||
| 2043 | - | |||||||||||||||||||||||||||||||
| 2044 | - | |||||||||||||||||||||||||||||||
| 2045 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2046 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2047 | d->initializeRasterizer(&d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2048 | d->rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 2049 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2050 | - | |||||||||||||||||||||||||||||||
| 2051 | const QPointF offs = s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 2052 | - | |||||||||||||||||||||||||||||||
| 2053 | const QRectF &rect = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 2054 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f) - offs; | - | ||||||||||||||||||||||||||||||
| 2055 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f) - offs; | - | ||||||||||||||||||||||||||||||
| 2056 | - | |||||||||||||||||||||||||||||||
| 2057 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2058 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); never executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | 0 | ||||||||||||||||||||||||||||||
| 2059 | else | - | ||||||||||||||||||||||||||||||
| 2060 | 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 | ||||||||||||||||||||||||||||||
| 2061 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2062 | } | - | ||||||||||||||||||||||||||||||
| 2063 | - | |||||||||||||||||||||||||||||||
| 2064 | const qreal offs = s->flags.legacy_rounding
| 0 | ||||||||||||||||||||||||||||||
| 2065 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 2066 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 2067 | QTransform m = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2068 | s->matrix = QTransform(m.m11(), m.m12(), m.m13(), | - | ||||||||||||||||||||||||||||||
| 2069 | m.m21(), m.m22(), m.m23(), | - | ||||||||||||||||||||||||||||||
| 2070 | m.m31() - offs, m.m32() - offs, m.m33()); | - | ||||||||||||||||||||||||||||||
| 2071 | fillPath(path, &d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2072 | s->matrix = m; | - | ||||||||||||||||||||||||||||||
| 2073 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2074 | if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)
| 0 | ||||||||||||||||||||||||||||||
| 2075 | SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; | - | ||||||||||||||||||||||||||||||
| 2076 | if (func
| 0 | ||||||||||||||||||||||||||||||
| 2077 | QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2078 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2079 | d->drawImage(pt, img, func, d->deviceRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2080 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2081 | } else if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2082 | d->drawImage(pt, img, func, clip->clipRect, s->intOpacity, sr.toRect()); | - | ||||||||||||||||||||||||||||||
| 2083 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2084 | } | - | ||||||||||||||||||||||||||||||
| 2085 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2086 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2087 | - | |||||||||||||||||||||||||||||||
| 2088 | d->image_filler.clip = clip; | - | ||||||||||||||||||||||||||||||
| 2089 | d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, toAlignedRect_positive(sr)); | - | ||||||||||||||||||||||||||||||
| 2090 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 2091 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2092 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - | ||||||||||||||||||||||||||||||
| 2093 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - | ||||||||||||||||||||||||||||||
| 2094 | - | |||||||||||||||||||||||||||||||
| 2095 | QRectF rr = r; | - | ||||||||||||||||||||||||||||||
| 2096 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2097 | - | |||||||||||||||||||||||||||||||
| 2098 | const int x1 = qRound(rr.x()); | - | ||||||||||||||||||||||||||||||
| 2099 | const int y1 = qRound(rr.y()); | - | ||||||||||||||||||||||||||||||
| 2100 | const int x2 = qRound(rr.right()); | - | ||||||||||||||||||||||||||||||
| 2101 | const int y2 = qRound(rr.bottom()); | - | ||||||||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||||||||
| 2103 | fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 2104 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2105 | } | - | ||||||||||||||||||||||||||||||
| 2106 | - | |||||||||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||||||||
| 2108 | - | |||||||||||||||||||||||||||||||
| 2109 | - | |||||||||||||||||||||||||||||||
| 2110 | void QRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &sr) | - | ||||||||||||||||||||||||||||||
| 2111 | { | - | ||||||||||||||||||||||||||||||
| 2112 | - | |||||||||||||||||||||||||||||||
| 2113 | - | |||||||||||||||||||||||||||||||
| 2114 | - | |||||||||||||||||||||||||||||||
| 2115 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2116 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2117 | ((!(s)) ? qt_assert("s",__FILE__,2438) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2118 | - | |||||||||||||||||||||||||||||||
| 2119 | QImage image; | - | ||||||||||||||||||||||||||||||
| 2120 | - | |||||||||||||||||||||||||||||||
| 2121 | QPlatformPixmap *pd = pixmap.handle(); | - | ||||||||||||||||||||||||||||||
| 2122 | if (pd->classId() == QPlatformPixmap::RasterClass
| 0 | ||||||||||||||||||||||||||||||
| 2123 | image = static_cast<QRasterPlatformPixmap *>(pd)->image; | - | ||||||||||||||||||||||||||||||
| 2124 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2125 | image = pixmap.toImage(); | - | ||||||||||||||||||||||||||||||
| 2126 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||||||||
| 2128 | if (image.depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 2129 | image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); never executed: image = d->rasterBuffer->colorizeBitmap(image, s->pen.color()); | 0 | ||||||||||||||||||||||||||||||
| 2130 | - | |||||||||||||||||||||||||||||||
| 2131 | if (s->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||||||||
| 2132 | QTransform copy = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2133 | copy.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||||||||
| 2134 | copy.translate(-sr.x(), -sr.y()); | - | ||||||||||||||||||||||||||||||
| 2135 | d->image_filler_xform.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2136 | d->image_filler_xform.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 2137 | if (!d->image_filler_xform.blend
| 0 | ||||||||||||||||||||||||||||||
| 2138 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2139 | d->image_filler_xform.setupMatrix(copy, s->flags.bilinear); | - | ||||||||||||||||||||||||||||||
| 2140 | - | |||||||||||||||||||||||||||||||
| 2141 | - | |||||||||||||||||||||||||||||||
| 2142 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2143 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2144 | d->initializeRasterizer(&d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2145 | d->rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 2146 | d->rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2147 | - | |||||||||||||||||||||||||||||||
| 2148 | const QRectF &rect = r.normalized(); | - | ||||||||||||||||||||||||||||||
| 2149 | const QPointF a = s->matrix.map((rect.topLeft() + rect.bottomLeft()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 2150 | const QPointF b = s->matrix.map((rect.topRight() + rect.bottomRight()) * 0.5f); | - | ||||||||||||||||||||||||||||||
| 2151 | if (s->flags.tx_noshear
| 0 | ||||||||||||||||||||||||||||||
| 2152 | d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); never executed: d->rasterizer->rasterizeLine(a, b, rect.height() / rect.width()); | 0 | ||||||||||||||||||||||||||||||
| 2153 | else | - | ||||||||||||||||||||||||||||||
| 2154 | 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 | ||||||||||||||||||||||||||||||
| 2155 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2156 | } | - | ||||||||||||||||||||||||||||||
| 2157 | - | |||||||||||||||||||||||||||||||
| 2158 | QPainterPath path; | - | ||||||||||||||||||||||||||||||
| 2159 | path.addRect(r); | - | ||||||||||||||||||||||||||||||
| 2160 | fillPath(path, &d->image_filler_xform); | - | ||||||||||||||||||||||||||||||
| 2161 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2162 | d->image_filler.clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2163 | - | |||||||||||||||||||||||||||||||
| 2164 | d->image_filler.initTexture(&image, s->intOpacity, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 2165 | if (!d->image_filler.blend
| 0 | ||||||||||||||||||||||||||||||
| 2166 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2167 | d->image_filler.dx = -(r.x() + s->matrix.dx()) + sr.x(); | - | ||||||||||||||||||||||||||||||
| 2168 | d->image_filler.dy = -(r.y() + s->matrix.dy()) + sr.y(); | - | ||||||||||||||||||||||||||||||
| 2169 | - | |||||||||||||||||||||||||||||||
| 2170 | QRectF rr = r; | - | ||||||||||||||||||||||||||||||
| 2171 | rr.translate(s->matrix.dx(), s->matrix.dy()); | - | ||||||||||||||||||||||||||||||
| 2172 | fillRect_normalized(rr.toRect().normalized(), &d->image_filler, d); | - | ||||||||||||||||||||||||||||||
| 2173 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2174 | } | - | ||||||||||||||||||||||||||||||
| 2175 | - | |||||||||||||||||||||||||||||||
| 2176 | - | |||||||||||||||||||||||||||||||
| 2177 | - | |||||||||||||||||||||||||||||||
| 2178 | static inline bool monoVal(const uchar* s, int x) | - | ||||||||||||||||||||||||||||||
| 2179 | { | - | ||||||||||||||||||||||||||||||
| 2180 | 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 | ||||||||||||||||||||||||||||||
| 2181 | } | - | ||||||||||||||||||||||||||||||
| 2182 | - | |||||||||||||||||||||||||||||||
| 2183 | - | |||||||||||||||||||||||||||||||
| 2184 | - | |||||||||||||||||||||||||||||||
| 2185 | - | |||||||||||||||||||||||||||||||
| 2186 | QRasterBuffer *QRasterPaintEngine::rasterBuffer() | - | ||||||||||||||||||||||||||||||
| 2187 | { | - | ||||||||||||||||||||||||||||||
| 2188 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2189 | return never executed: d->rasterBuffer.data();return d->rasterBuffer.data();never executed: return d->rasterBuffer.data(); | 0 | ||||||||||||||||||||||||||||||
| 2190 | } | - | ||||||||||||||||||||||||||||||
| 2191 | - | |||||||||||||||||||||||||||||||
| 2192 | - | |||||||||||||||||||||||||||||||
| 2193 | - | |||||||||||||||||||||||||||||||
| 2194 | - | |||||||||||||||||||||||||||||||
| 2195 | void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx,int ry,int w,int h) | - | ||||||||||||||||||||||||||||||
| 2196 | { | - | ||||||||||||||||||||||||||||||
| 2197 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2198 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2199 | - | |||||||||||||||||||||||||||||||
| 2200 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2201 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2202 | - | |||||||||||||||||||||||||||||||
| 2203 | QRasterBuffer *rb = d->rasterBuffer.data(); | - | ||||||||||||||||||||||||||||||
| 2204 | - | |||||||||||||||||||||||||||||||
| 2205 | const QRect rect(rx, ry, w, h); | - | ||||||||||||||||||||||||||||||
| 2206 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 2207 | bool unclipped = false; | - | ||||||||||||||||||||||||||||||
| 2208 | if (clip
| 0 | ||||||||||||||||||||||||||||||
| 2209 | - | |||||||||||||||||||||||||||||||
| 2210 | const bool intersects = qMax(clip->xmin, rect.left()) <= qMin(clip->xmax - 1, rect.right())
| 0 | ||||||||||||||||||||||||||||||
| 2211 | && qMax(clip->ymin, rect.top()) <= qMin(clip->ymax - 1, rect.bottom())
| 0 | ||||||||||||||||||||||||||||||
| 2212 | - | |||||||||||||||||||||||||||||||
| 2213 | if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2214 | unclipped = rx > clip->xmin
| 0 | ||||||||||||||||||||||||||||||
| 2215 | && rx + w < clip->xmax
| 0 | ||||||||||||||||||||||||||||||
| 2216 | && ry > clip->ymin
| 0 | ||||||||||||||||||||||||||||||
| 2217 | && ry + h < clip->ymax
| 0 | ||||||||||||||||||||||||||||||
| 2218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2219 | - | |||||||||||||||||||||||||||||||
| 2220 | if (!intersects
| 0 | ||||||||||||||||||||||||||||||
| 2221 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2222 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2223 | - | |||||||||||||||||||||||||||||||
| 2224 | const bool intersects = qMax(0, rect.left()) <= qMin(rb->width() - 1, rect.right())
| 0 | ||||||||||||||||||||||||||||||
| 2225 | && qMax(0, rect.top()) <= qMin(rb->height() - 1, rect.bottom())
| 0 | ||||||||||||||||||||||||||||||
| 2226 | if (!intersects
| 0 | ||||||||||||||||||||||||||||||
| 2227 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2228 | - | |||||||||||||||||||||||||||||||
| 2229 | - | |||||||||||||||||||||||||||||||
| 2230 | const bool contains = rect.left() >= 0
| 0 | ||||||||||||||||||||||||||||||
| 2231 | && rect.top() >= 0
| 0 | ||||||||||||||||||||||||||||||
| 2232 | - | |||||||||||||||||||||||||||||||
| 2233 | unclipped = contains
| 0 | ||||||||||||||||||||||||||||||
| 2234 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2235 | - | |||||||||||||||||||||||||||||||
| 2236 | ProcessSpans blend = unclipped
| 0 | ||||||||||||||||||||||||||||||
| 2237 | const uchar * scanline = static_cast<const uchar *>(src); | - | ||||||||||||||||||||||||||||||
| 2238 | - | |||||||||||||||||||||||||||||||
| 2239 | if (s->flags.fast_text
| 0 | ||||||||||||||||||||||||||||||
| 2240 | if (unclipped
| 0 | ||||||||||||||||||||||||||||||
| 2241 | if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2242 | if (s->penData.bitmapBlit
| 0 | ||||||||||||||||||||||||||||||
| 2243 | s->penData.bitmapBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2244 | scanline, w, h, bpl); | - | ||||||||||||||||||||||||||||||
| 2245 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2246 | } | - | ||||||||||||||||||||||||||||||
| 2247 | } never executed: else if (depth == 8end of block
| 0 | ||||||||||||||||||||||||||||||
| 2248 | if (s->penData.alphamapBlit
| 0 | ||||||||||||||||||||||||||||||
| 2249 | s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2250 | scanline, w, h, bpl, 0); | - | ||||||||||||||||||||||||||||||
| 2251 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2252 | } | - | ||||||||||||||||||||||||||||||
| 2253 | } never executed: else if (depth == 32end of block
| 0 | ||||||||||||||||||||||||||||||
| 2254 | - | |||||||||||||||||||||||||||||||
| 2255 | if (s->penData.alphaRGBBlit
| 0 | ||||||||||||||||||||||||||||||
| 2256 | s->penData.alphaRGBBlit(rb, rx, ry, s->penData.solid.color, | - | ||||||||||||||||||||||||||||||
| 2257 | (const uint *) scanline, w, h, bpl / 4, 0); | - | ||||||||||||||||||||||||||||||
| 2258 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2259 | } | - | ||||||||||||||||||||||||||||||
| 2260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2261 | } never executed: else if (d->deviceDepth == 32end of block
| 0 | ||||||||||||||||||||||||||||||
| 2262 | - | |||||||||||||||||||||||||||||||
| 2263 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 2264 | int nx = qMax(0, rx); | - | ||||||||||||||||||||||||||||||
| 2265 | int ny = qMax(0, ry); | - | ||||||||||||||||||||||||||||||
| 2266 | - | |||||||||||||||||||||||||||||||
| 2267 | - | |||||||||||||||||||||||||||||||
| 2268 | int xdiff = nx - rx; | - | ||||||||||||||||||||||||||||||
| 2269 | int ydiff = ny - ry; | - | ||||||||||||||||||||||||||||||
| 2270 | scanline += ydiff * bpl; | - | ||||||||||||||||||||||||||||||
| 2271 | scanline += xdiff * (depth == 32 ? 4 : 1); | - | ||||||||||||||||||||||||||||||
| 2272 | - | |||||||||||||||||||||||||||||||
| 2273 | w -= xdiff; | - | ||||||||||||||||||||||||||||||
| 2274 | h -= ydiff; | - | ||||||||||||||||||||||||||||||
| 2275 | - | |||||||||||||||||||||||||||||||
| 2276 | if (nx + w > d->rasterBuffer->width()
| 0 | ||||||||||||||||||||||||||||||
| 2277 | w = d->rasterBuffer->width() - nx; never executed: w = d->rasterBuffer->width() - nx; | 0 | ||||||||||||||||||||||||||||||
| 2278 | if (ny + h > d->rasterBuffer->height()
| 0 | ||||||||||||||||||||||||||||||
| 2279 | h = d->rasterBuffer->height() - ny; never executed: h = d->rasterBuffer->height() - ny; | 0 | ||||||||||||||||||||||||||||||
| 2280 | - | |||||||||||||||||||||||||||||||
| 2281 | rx = nx; | - | ||||||||||||||||||||||||||||||
| 2282 | ry = ny; | - | ||||||||||||||||||||||||||||||
| 2283 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2284 | if (depth == 8
| 0 | ||||||||||||||||||||||||||||||
| 2285 | 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 | ||||||||||||||||||||||||||||||
| 2286 | scanline, w, h, bpl, clip); never executed: s->penData.alphamapBlit(rb, rx, ry, s->penData.solid.color, scanline, w, h, bpl, clip); | 0 | ||||||||||||||||||||||||||||||
| 2287 | else if (depth == 32
| 0 | ||||||||||||||||||||||||||||||
| 2288 | 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 | ||||||||||||||||||||||||||||||
| 2289 | (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 | ||||||||||||||||||||||||||||||
| 2290 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2291 | } | - | ||||||||||||||||||||||||||||||
| 2292 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2293 | - | |||||||||||||||||||||||||||||||
| 2294 | int x0 = 0; | - | ||||||||||||||||||||||||||||||
| 2295 | if (rx < 0
| 0 | ||||||||||||||||||||||||||||||
| 2296 | x0 = -rx; | - | ||||||||||||||||||||||||||||||
| 2297 | w -= x0; | - | ||||||||||||||||||||||||||||||
| 2298 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2299 | - | |||||||||||||||||||||||||||||||
| 2300 | int y0 = 0; | - | ||||||||||||||||||||||||||||||
| 2301 | if (ry < 0
| 0 | ||||||||||||||||||||||||||||||
| 2302 | y0 = -ry; | - | ||||||||||||||||||||||||||||||
| 2303 | scanline += bpl * y0; | - | ||||||||||||||||||||||||||||||
| 2304 | h -= y0; | - | ||||||||||||||||||||||||||||||
| 2305 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2306 | - | |||||||||||||||||||||||||||||||
| 2307 | w = qMin(w, rb->width() - qMax(0, rx)); | - | ||||||||||||||||||||||||||||||
| 2308 | h = qMin(h, rb->height() - qMax(0, ry)); | - | ||||||||||||||||||||||||||||||
| 2309 | - | |||||||||||||||||||||||||||||||
| 2310 | if (w <= 0
| 0 | ||||||||||||||||||||||||||||||
| 2311 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2312 | - | |||||||||||||||||||||||||||||||
| 2313 | const int NSPANS = 256; | - | ||||||||||||||||||||||||||||||
| 2314 | QSpan spans[NSPANS]; | - | ||||||||||||||||||||||||||||||
| 2315 | int current = 0; | - | ||||||||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||||||||
| 2317 | const int x1 = x0 + w; | - | ||||||||||||||||||||||||||||||
| 2318 | const int y1 = y0 + h; | - | ||||||||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||||||||
| 2320 | if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2321 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2322 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2323 | if (!monoVal(scanline, x)
| 0 | ||||||||||||||||||||||||||||||
| 2324 | ++x; | - | ||||||||||||||||||||||||||||||
| 2325 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2326 | } | - | ||||||||||||||||||||||||||||||
| 2327 | - | |||||||||||||||||||||||||||||||
| 2328 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2329 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2330 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2331 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2332 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2333 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2334 | spans[current].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 2335 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2336 | ++x; | - | ||||||||||||||||||||||||||||||
| 2337 | - | |||||||||||||||||||||||||||||||
| 2338 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2339 | ++x; | - | ||||||||||||||||||||||||||||||
| 2340 | ++len; | - | ||||||||||||||||||||||||||||||
| 2341 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2342 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2343 | ++current; | - | ||||||||||||||||||||||||||||||
| 2344 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2345 | scanline += bpl; | - | ||||||||||||||||||||||||||||||
| 2346 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2347 | } never executed: else if (depth == 8end of block
| 0 | ||||||||||||||||||||||||||||||
| 2348 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2349 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2350 | - | |||||||||||||||||||||||||||||||
| 2351 | if (scanline[x] == 0
| 0 | ||||||||||||||||||||||||||||||
| 2352 | ++x; | - | ||||||||||||||||||||||||||||||
| 2353 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2354 | } | - | ||||||||||||||||||||||||||||||
| 2355 | - | |||||||||||||||||||||||||||||||
| 2356 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2357 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2358 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2360 | int coverage = scanline[x]; | - | ||||||||||||||||||||||||||||||
| 2361 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2362 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2363 | spans[current].coverage = coverage; | - | ||||||||||||||||||||||||||||||
| 2364 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2365 | ++x; | - | ||||||||||||||||||||||||||||||
| 2366 | - | |||||||||||||||||||||||||||||||
| 2367 | - | |||||||||||||||||||||||||||||||
| 2368 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2369 | ++x; | - | ||||||||||||||||||||||||||||||
| 2370 | ++len; | - | ||||||||||||||||||||||||||||||
| 2371 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2372 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2373 | ++current; | - | ||||||||||||||||||||||||||||||
| 2374 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2375 | scanline += bpl; | - | ||||||||||||||||||||||||||||||
| 2376 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2377 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2378 | const uint *sl = (const uint *) scanline; | - | ||||||||||||||||||||||||||||||
| 2379 | for (int y = y0; y < y1
| 0 | ||||||||||||||||||||||||||||||
| 2380 | for (int x = x0; x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||||||||
| 2382 | if ((
| 0 | ||||||||||||||||||||||||||||||
| 2383 | ++x; | - | ||||||||||||||||||||||||||||||
| 2384 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2385 | } | - | ||||||||||||||||||||||||||||||
| 2386 | - | |||||||||||||||||||||||||||||||
| 2387 | if (current == NSPANS
| 0 | ||||||||||||||||||||||||||||||
| 2388 | blend(current, spans, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2389 | current = 0; | - | ||||||||||||||||||||||||||||||
| 2390 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2391 | uint rgbCoverage = sl[x]; | - | ||||||||||||||||||||||||||||||
| 2392 | int coverage = qGreen(rgbCoverage); | - | ||||||||||||||||||||||||||||||
| 2393 | spans[current].x = x + rx; | - | ||||||||||||||||||||||||||||||
| 2394 | spans[current].y = y + ry; | - | ||||||||||||||||||||||||||||||
| 2395 | spans[current].coverage = coverage; | - | ||||||||||||||||||||||||||||||
| 2396 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2397 | ++x; | - | ||||||||||||||||||||||||||||||
| 2398 | - | |||||||||||||||||||||||||||||||
| 2399 | - | |||||||||||||||||||||||||||||||
| 2400 | while (x < x1
| 0 | ||||||||||||||||||||||||||||||
| 2401 | ++x; | - | ||||||||||||||||||||||||||||||
| 2402 | ++len; | - | ||||||||||||||||||||||||||||||
| 2403 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2404 | spans[current].len = len; | - | ||||||||||||||||||||||||||||||
| 2405 | ++current; | - | ||||||||||||||||||||||||||||||
| 2406 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2407 | sl += bpl / sizeof(uint); | - | ||||||||||||||||||||||||||||||
| 2408 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2409 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2410 | - | |||||||||||||||||||||||||||||||
| 2411 | - | |||||||||||||||||||||||||||||||
| 2412 | - | |||||||||||||||||||||||||||||||
| 2413 | if (current != 0
| 0 | ||||||||||||||||||||||||||||||
| 2414 | blend(current, spans, &s->penData); never executed: blend(current, spans, &s->penData); | 0 | ||||||||||||||||||||||||||||||
| 2415 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2416 | - | |||||||||||||||||||||||||||||||
| 2417 | - | |||||||||||||||||||||||||||||||
| 2418 | - | |||||||||||||||||||||||||||||||
| 2419 | - | |||||||||||||||||||||||||||||||
| 2420 | bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, | - | ||||||||||||||||||||||||||||||
| 2421 | const QFixedPoint *positions, QFontEngine *fontEngine) | - | ||||||||||||||||||||||||||||||
| 2422 | { | - | ||||||||||||||||||||||||||||||
| 2423 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2424 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2425 | - | |||||||||||||||||||||||||||||||
| 2426 | if (fontEngine->hasInternalCaching()
| 0 | ||||||||||||||||||||||||||||||
| 2427 | QFontEngine::GlyphFormat neededFormat = | - | ||||||||||||||||||||||||||||||
| 2428 | painter()->device()->devType() == QInternal::Widget
| 0 | ||||||||||||||||||||||||||||||
| 2429 | ? QFontEngine::Format_None | - | ||||||||||||||||||||||||||||||
| 2430 | : QFontEngine::Format_A8; | - | ||||||||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||||||||
| 2432 | if (d_func()->mono_surface
| 0 | ||||||||||||||||||||||||||||||
| 2433 | neededFormat = QFontEngine::Format_Mono; never executed: neededFormat = QFontEngine::Format_Mono; | 0 | ||||||||||||||||||||||||||||||
| 2434 | - | |||||||||||||||||||||||||||||||
| 2435 | for (int i = 0; i < numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2436 | QFixed spp = fontEngine->subPixelPositionForX(positions[i].x); | - | ||||||||||||||||||||||||||||||
| 2437 | - | |||||||||||||||||||||||||||||||
| 2438 | QPoint offset; | - | ||||||||||||||||||||||||||||||
| 2439 | const QImage *alphaMap = fontEngine->lockedAlphaMapForGlyph(glyphs[i], spp, neededFormat, s->matrix, | - | ||||||||||||||||||||||||||||||
| 2440 | &offset); | - | ||||||||||||||||||||||||||||||
| 2441 | if (alphaMap == 0
| 0 | ||||||||||||||||||||||||||||||
| 2442 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2443 | - | |||||||||||||||||||||||||||||||
| 2444 | alphaPenBlt(alphaMap->constBits(), alphaMap->bytesPerLine(), alphaMap->depth(), | - | ||||||||||||||||||||||||||||||
| 2445 | qFloor(positions[i].x) + offset.x(), | - | ||||||||||||||||||||||||||||||
| 2446 | qRound(positions[i].y) + offset.y(), | - | ||||||||||||||||||||||||||||||
| 2447 | alphaMap->width(), alphaMap->height()); | - | ||||||||||||||||||||||||||||||
| 2448 | - | |||||||||||||||||||||||||||||||
| 2449 | fontEngine->unlockAlphaMapForGlyph(); | - | ||||||||||||||||||||||||||||||
| 2450 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2451 | - | |||||||||||||||||||||||||||||||
| 2452 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2453 | QFontEngine::GlyphFormat glyphFormat = fontEngine->glyphFormat != QFontEngine::Format_None
| 0 | ||||||||||||||||||||||||||||||
| 2454 | - | |||||||||||||||||||||||||||||||
| 2455 | QImageTextureGlyphCache *cache = | - | ||||||||||||||||||||||||||||||
| 2456 | static_cast<QImageTextureGlyphCache *>(fontEngine->glyphCache(0, glyphFormat, s->matrix)); | - | ||||||||||||||||||||||||||||||
| 2457 | if (!cache
| 0 | ||||||||||||||||||||||||||||||
| 2458 | cache = new QImageTextureGlyphCache(glyphFormat, s->matrix); | - | ||||||||||||||||||||||||||||||
| 2459 | fontEngine->setGlyphCache(0, cache); | - | ||||||||||||||||||||||||||||||
| 2460 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2461 | - | |||||||||||||||||||||||||||||||
| 2462 | cache->populate(fontEngine, numGlyphs, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2463 | cache->fillInPendingGlyphs(); | - | ||||||||||||||||||||||||||||||
| 2464 | - | |||||||||||||||||||||||||||||||
| 2465 | const QImage &image = cache->image(); | - | ||||||||||||||||||||||||||||||
| 2466 | int bpl = image.bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 2467 | - | |||||||||||||||||||||||||||||||
| 2468 | int depth = image.depth(); | - | ||||||||||||||||||||||||||||||
| 2469 | int rightShift = 0; | - | ||||||||||||||||||||||||||||||
| 2470 | int leftShift = 0; | - | ||||||||||||||||||||||||||||||
| 2471 | if (depth == 32
| 0 | ||||||||||||||||||||||||||||||
| 2472 | leftShift = 2; never executed: leftShift = 2; | 0 | ||||||||||||||||||||||||||||||
| 2473 | else if (depth == 1
| 0 | ||||||||||||||||||||||||||||||
| 2474 | rightShift = 3; never executed: rightShift = 3; | 0 | ||||||||||||||||||||||||||||||
| 2475 | - | |||||||||||||||||||||||||||||||
| 2476 | int margin = fontEngine->glyphMargin(glyphFormat); | - | ||||||||||||||||||||||||||||||
| 2477 | const uchar *bits = image.bits(); | - | ||||||||||||||||||||||||||||||
| 2478 | for (int i=0; i<numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2479 | - | |||||||||||||||||||||||||||||||
| 2480 | QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x); | - | ||||||||||||||||||||||||||||||
| 2481 | QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition); | - | ||||||||||||||||||||||||||||||
| 2482 | const QTextureGlyphCache::Coord &c = cache->coords[glyph]; | - | ||||||||||||||||||||||||||||||
| 2483 | if (c.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 2484 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2485 | - | |||||||||||||||||||||||||||||||
| 2486 | int x = qFloor(positions[i].x) + c.baseLineX - margin; | - | ||||||||||||||||||||||||||||||
| 2487 | int y = qRound(positions[i].y) - c.baseLineY - margin; | - | ||||||||||||||||||||||||||||||
| 2488 | const uchar *glyphBits = bits + ((c.x << leftShift) >> rightShift) + c.y * bpl; | - | ||||||||||||||||||||||||||||||
| 2489 | - | |||||||||||||||||||||||||||||||
| 2490 | if (glyphFormat == QFontEngine::Format_ARGB
| 0 | ||||||||||||||||||||||||||||||
| 2491 | - | |||||||||||||||||||||||||||||||
| 2492 | - | |||||||||||||||||||||||||||||||
| 2493 | - | |||||||||||||||||||||||||||||||
| 2494 | QTransform originalTransform = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2495 | s->matrix = QTransform(); | - | ||||||||||||||||||||||||||||||
| 2496 | drawImage(QPoint(x, y), QImage(glyphBits, c.w, c.h, bpl, image.format())); | - | ||||||||||||||||||||||||||||||
| 2497 | s->matrix = originalTransform; | - | ||||||||||||||||||||||||||||||
| 2498 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2499 | alphaPenBlt(glyphBits, bpl, depth, x, y, c.w, c.h); | - | ||||||||||||||||||||||||||||||
| 2500 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2501 | } | - | ||||||||||||||||||||||||||||||
| 2502 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2503 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2504 | } | - | ||||||||||||||||||||||||||||||
| 2505 | - | |||||||||||||||||||||||||||||||
| 2506 | - | |||||||||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||||||||
| 2508 | - | |||||||||||||||||||||||||||||||
| 2509 | - | |||||||||||||||||||||||||||||||
| 2510 | - | |||||||||||||||||||||||||||||||
| 2511 | bool QRasterPaintEnginePrivate::isUnclipped_normalized(const QRect &r) const | - | ||||||||||||||||||||||||||||||
| 2512 | { | - | ||||||||||||||||||||||||||||||
| 2513 | const QClipData *cl = clip(); | - | ||||||||||||||||||||||||||||||
| 2514 | if (!cl
| 0 | ||||||||||||||||||||||||||||||
| 2515 | - | |||||||||||||||||||||||||||||||
| 2516 | const QRect &r1 = deviceRect; | - | ||||||||||||||||||||||||||||||
| 2517 | return never executed: (r.left() >= r1.left()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 | ||||||||||||||||||||||||||||||
| 2518 | && r.top() >= r1.top()
never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2519 | } | - | ||||||||||||||||||||||||||||||
| 2520 | - | |||||||||||||||||||||||||||||||
| 2521 | - | |||||||||||||||||||||||||||||||
| 2522 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2523 | - | |||||||||||||||||||||||||||||||
| 2524 | if (cl->clipRect == deviceRect
| 0 | ||||||||||||||||||||||||||||||
| 2525 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2526 | - | |||||||||||||||||||||||||||||||
| 2527 | - | |||||||||||||||||||||||||||||||
| 2528 | const QRect &r1 = cl->clipRect; | - | ||||||||||||||||||||||||||||||
| 2529 | return never executed: (r.left() >= r1.left()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 | ||||||||||||||||||||||||||||||
| 2530 | && r.top() >= r1.top()
never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2531 | } else { | - | ||||||||||||||||||||||||||||||
| 2532 | 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 | ||||||||||||||||||||||||||||||
| 2533 | } | - | ||||||||||||||||||||||||||||||
| 2534 | } | - | ||||||||||||||||||||||||||||||
| 2535 | - | |||||||||||||||||||||||||||||||
| 2536 | bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 2537 | int penWidth) const | - | ||||||||||||||||||||||||||||||
| 2538 | { | - | ||||||||||||||||||||||||||||||
| 2539 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2540 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2541 | const QClipData *cl = clip(); | - | ||||||||||||||||||||||||||||||
| 2542 | if (!cl
| 0 | ||||||||||||||||||||||||||||||
| 2543 | QRect r = rect.normalized(); | - | ||||||||||||||||||||||||||||||
| 2544 | - | |||||||||||||||||||||||||||||||
| 2545 | const QRect &r1 = deviceRect; | - | ||||||||||||||||||||||||||||||
| 2546 | return never executed: (r.left() >= r1.left()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 | ||||||||||||||||||||||||||||||
| 2547 | && r.top() >= r1.top()
never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2548 | } | - | ||||||||||||||||||||||||||||||
| 2549 | - | |||||||||||||||||||||||||||||||
| 2550 | - | |||||||||||||||||||||||||||||||
| 2551 | - | |||||||||||||||||||||||||||||||
| 2552 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2553 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2554 | - | |||||||||||||||||||||||||||||||
| 2555 | if (s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2556 | ++ never executed: penWidth;++penWidth;never executed: ++penWidth; | 0 | ||||||||||||||||||||||||||||||
| 2557 | - | |||||||||||||||||||||||||||||||
| 2558 | QRect r = rect.normalized(); | - | ||||||||||||||||||||||||||||||
| 2559 | if (penWidth > 0
| 0 | ||||||||||||||||||||||||||||||
| 2560 | r.setX(r.x() - penWidth); | - | ||||||||||||||||||||||||||||||
| 2561 | r.setY(r.y() - penWidth); | - | ||||||||||||||||||||||||||||||
| 2562 | r.setWidth(r.width() + 2 * penWidth); | - | ||||||||||||||||||||||||||||||
| 2563 | r.setHeight(r.height() + 2 * penWidth); | - | ||||||||||||||||||||||||||||||
| 2564 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2565 | - | |||||||||||||||||||||||||||||||
| 2566 | if (cl->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 2567 | - | |||||||||||||||||||||||||||||||
| 2568 | const QRect &r1 = cl->clipRect; | - | ||||||||||||||||||||||||||||||
| 2569 | return never executed: (r.left() >= r1.left()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 | ||||||||||||||||||||||||||||||
| 2570 | && r.top() >= r1.top()
never executed: return (r.left() >= r1.left() && r.right() <= r1.right() && r.top() >= r1.top() && r.bottom() <= r1.bottom()); | 0 | ||||||||||||||||||||||||||||||
| 2571 | } else { | - | ||||||||||||||||||||||||||||||
| 2572 | 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 | ||||||||||||||||||||||||||||||
| 2573 | } | - | ||||||||||||||||||||||||||||||
| 2574 | } | - | ||||||||||||||||||||||||||||||
| 2575 | - | |||||||||||||||||||||||||||||||
| 2576 | inline bool QRasterPaintEnginePrivate::isUnclipped(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2577 | int penWidth) const | - | ||||||||||||||||||||||||||||||
| 2578 | { | - | ||||||||||||||||||||||||||||||
| 2579 | return never executed: isUnclipped(rect.normalized().toAlignedRect(), penWidth);return isUnclipped(rect.normalized().toAlignedRect(), penWidth);never executed: return isUnclipped(rect.normalized().toAlignedRect(), penWidth); | 0 | ||||||||||||||||||||||||||||||
| 2580 | } | - | ||||||||||||||||||||||||||||||
| 2581 | - | |||||||||||||||||||||||||||||||
| 2582 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2583 | QRasterPaintEnginePrivate::getBrushFunc(const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 2584 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2585 | { | - | ||||||||||||||||||||||||||||||
| 2586 | return never executed: isUnclipped(rect, 0)return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;
never executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2587 | } | - | ||||||||||||||||||||||||||||||
| 2588 | - | |||||||||||||||||||||||||||||||
| 2589 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2590 | QRasterPaintEnginePrivate::getBrushFunc(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2591 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2592 | { | - | ||||||||||||||||||||||||||||||
| 2593 | return never executed: isUnclipped(rect, 0)return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend;
never executed: return isUnclipped(rect, 0) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2594 | } | - | ||||||||||||||||||||||||||||||
| 2595 | - | |||||||||||||||||||||||||||||||
| 2596 | inline ProcessSpans | - | ||||||||||||||||||||||||||||||
| 2597 | QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect, | - | ||||||||||||||||||||||||||||||
| 2598 | const QSpanData *data) const | - | ||||||||||||||||||||||||||||||
| 2599 | { | - | ||||||||||||||||||||||||||||||
| 2600 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2601 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2602 | - | |||||||||||||||||||||||||||||||
| 2603 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2604 | return never executed: data->blend;return data->blend;never executed: return data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2605 | const int penWidth = s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2606 | return never executed: isUnclipped(rect, penWidth)return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend;
never executed: return isUnclipped(rect, penWidth) ? data->unclipped_blend : data->blend; | 0 | ||||||||||||||||||||||||||||||
| 2607 | } | - | ||||||||||||||||||||||||||||||
| 2608 | - | |||||||||||||||||||||||||||||||
| 2609 | static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine, | - | ||||||||||||||||||||||||||||||
| 2610 | glyph_t *glyphs, QFixedPoint *positions, int numGlyphs) | - | ||||||||||||||||||||||||||||||
| 2611 | { | - | ||||||||||||||||||||||||||||||
| 2612 | QFixed clipLeft = QFixed::fromReal(clip.left()); | - | ||||||||||||||||||||||||||||||
| 2613 | QFixed clipRight = QFixed::fromReal(clip.right()); | - | ||||||||||||||||||||||||||||||
| 2614 | QFixed clipTop = QFixed::fromReal(clip.top()); | - | ||||||||||||||||||||||||||||||
| 2615 | QFixed clipBottom = QFixed::fromReal(clip.bottom()); | - | ||||||||||||||||||||||||||||||
| 2616 | - | |||||||||||||||||||||||||||||||
| 2617 | int first = 0; | - | ||||||||||||||||||||||||||||||
| 2618 | while (first < numGlyphs
| 0 | ||||||||||||||||||||||||||||||
| 2619 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[first]); | - | ||||||||||||||||||||||||||||||
| 2620 | QFixed left = metrics.x + positions[first].x; | - | ||||||||||||||||||||||||||||||
| 2621 | QFixed top = metrics.y + positions[first].y; | - | ||||||||||||||||||||||||||||||
| 2622 | QFixed right = left + metrics.width; | - | ||||||||||||||||||||||||||||||
| 2623 | QFixed bottom = top + metrics.height; | - | ||||||||||||||||||||||||||||||
| 2624 | if (left < clipRight
| 0 | ||||||||||||||||||||||||||||||
| 2625 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2626 | ++first; | - | ||||||||||||||||||||||||||||||
| 2627 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2628 | int last = numGlyphs - 1; | - | ||||||||||||||||||||||||||||||
| 2629 | while (last > first
| 0 | ||||||||||||||||||||||||||||||
| 2630 | glyph_metrics_t metrics = fontEngine->boundingBox(glyphs[last]); | - | ||||||||||||||||||||||||||||||
| 2631 | QFixed left = metrics.x + positions[last].x; | - | ||||||||||||||||||||||||||||||
| 2632 | QFixed top = metrics.y + positions[last].y; | - | ||||||||||||||||||||||||||||||
| 2633 | QFixed right = left + metrics.width; | - | ||||||||||||||||||||||||||||||
| 2634 | QFixed bottom = top + metrics.height; | - | ||||||||||||||||||||||||||||||
| 2635 | if (left < clipRight
| 0 | ||||||||||||||||||||||||||||||
| 2636 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 2637 | --last; | - | ||||||||||||||||||||||||||||||
| 2638 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2639 | 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 | ||||||||||||||||||||||||||||||
| 2640 | } | - | ||||||||||||||||||||||||||||||
| 2641 | - | |||||||||||||||||||||||||||||||
| 2642 | - | |||||||||||||||||||||||||||||||
| 2643 | - | |||||||||||||||||||||||||||||||
| 2644 | - | |||||||||||||||||||||||||||||||
| 2645 | void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem) | - | ||||||||||||||||||||||||||||||
| 2646 | { | - | ||||||||||||||||||||||||||||||
| 2647 | if (textItem->numGlyphs == 0
| 0 | ||||||||||||||||||||||||||||||
| 2648 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2649 | - | |||||||||||||||||||||||||||||||
| 2650 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2651 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2652 | - | |||||||||||||||||||||||||||||||
| 2653 | QTransform matrix = state()->matrix; | - | ||||||||||||||||||||||||||||||
| 2654 | - | |||||||||||||||||||||||||||||||
| 2655 | QFontEngine *fontEngine = textItem->fontEngine(); | - | ||||||||||||||||||||||||||||||
| 2656 | if (shouldDrawCachedGlyphs(fontEngine, matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2657 | drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions, | - | ||||||||||||||||||||||||||||||
| 2658 | fontEngine); | - | ||||||||||||||||||||||||||||||
| 2659 | } never executed: else if (matrix.type() < QTransform::TxProjectend of block
| 0 | ||||||||||||||||||||||||||||||
| 2660 | bool invertible; | - | ||||||||||||||||||||||||||||||
| 2661 | QTransform invMat = matrix.inverted(&invertible); | - | ||||||||||||||||||||||||||||||
| 2662 | if (!invertible
| 0 | ||||||||||||||||||||||||||||||
| 2663 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2664 | - | |||||||||||||||||||||||||||||||
| 2665 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - | ||||||||||||||||||||||||||||||
| 2666 | textItem->fontEngine(), textItem->glyphs, | - | ||||||||||||||||||||||||||||||
| 2667 | textItem->glyphPositions, textItem->numGlyphs); | - | ||||||||||||||||||||||||||||||
| 2668 | QStaticTextItem copy = *textItem; | - | ||||||||||||||||||||||||||||||
| 2669 | copy.glyphs += range.first; | - | ||||||||||||||||||||||||||||||
| 2670 | copy.glyphPositions += range.first; | - | ||||||||||||||||||||||||||||||
| 2671 | copy.numGlyphs = range.second - range.first; | - | ||||||||||||||||||||||||||||||
| 2672 | QPaintEngineEx::drawStaticTextItem(©); | - | ||||||||||||||||||||||||||||||
| 2673 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2674 | QPaintEngineEx::drawStaticTextItem(textItem); | - | ||||||||||||||||||||||||||||||
| 2675 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2676 | } | - | ||||||||||||||||||||||||||||||
| 2677 | - | |||||||||||||||||||||||||||||||
| 2678 | - | |||||||||||||||||||||||||||||||
| 2679 | - | |||||||||||||||||||||||||||||||
| 2680 | - | |||||||||||||||||||||||||||||||
| 2681 | void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - | ||||||||||||||||||||||||||||||
| 2682 | { | - | ||||||||||||||||||||||||||||||
| 2683 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||||||||||||||||||||
| 2684 | if (ti.glyphs.numGlyphs == 0
| 0 | ||||||||||||||||||||||||||||||
| 2685 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2686 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2687 | ensureRasterState(); | - | ||||||||||||||||||||||||||||||
| 2688 | - | |||||||||||||||||||||||||||||||
| 2689 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2690 | QTransform matrix = s->matrix; | - | ||||||||||||||||||||||||||||||
| 2691 | - | |||||||||||||||||||||||||||||||
| 2692 | if (shouldDrawCachedGlyphs(ti.fontEngine, matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2693 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
| 2694 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
| 2695 | - | |||||||||||||||||||||||||||||||
| 2696 | matrix.translate(p.x(), p.y()); | - | ||||||||||||||||||||||||||||||
| 2697 | ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2698 | - | |||||||||||||||||||||||||||||||
| 2699 | drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine); | - | ||||||||||||||||||||||||||||||
| 2700 | } never executed: else if (matrix.type() < QTransform::TxProjectend of block
| 0 | ||||||||||||||||||||||||||||||
| 2701 | && ti.fontEngine->supportsTransformation(matrix)
| 0 | ||||||||||||||||||||||||||||||
| 2702 | bool invertible; | - | ||||||||||||||||||||||||||||||
| 2703 | QTransform invMat = matrix.inverted(&invertible); | - | ||||||||||||||||||||||||||||||
| 2704 | if (!invertible
| 0 | ||||||||||||||||||||||||||||||
| 2705 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2706 | - | |||||||||||||||||||||||||||||||
| 2707 | QVarLengthArray<QFixedPoint> positions; | - | ||||||||||||||||||||||||||||||
| 2708 | QVarLengthArray<glyph_t> glyphs; | - | ||||||||||||||||||||||||||||||
| 2709 | - | |||||||||||||||||||||||||||||||
| 2710 | ti.fontEngine->getGlyphPositions(ti.glyphs, QTransform::fromTranslate(p.x(), p.y()), | - | ||||||||||||||||||||||||||||||
| 2711 | ti.flags, glyphs, positions); | - | ||||||||||||||||||||||||||||||
| 2712 | QPair<int, int> range = visibleGlyphRange(invMat.mapRect(clipBoundingRect()), | - | ||||||||||||||||||||||||||||||
| 2713 | ti.fontEngine, glyphs.data(), positions.data(), | - | ||||||||||||||||||||||||||||||
| 2714 | glyphs.size()); | - | ||||||||||||||||||||||||||||||
| 2715 | - | |||||||||||||||||||||||||||||||
| 2716 | if (range.first >= range.second
| 0 | ||||||||||||||||||||||||||||||
| 2717 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2718 | - | |||||||||||||||||||||||||||||||
| 2719 | QStaticTextItem staticTextItem; | - | ||||||||||||||||||||||||||||||
| 2720 | staticTextItem.color = s->pen.color(); | - | ||||||||||||||||||||||||||||||
| 2721 | staticTextItem.font = s->font; | - | ||||||||||||||||||||||||||||||
| 2722 | staticTextItem.setFontEngine(ti.fontEngine); | - | ||||||||||||||||||||||||||||||
| 2723 | staticTextItem.numGlyphs = range.second - range.first; | - | ||||||||||||||||||||||||||||||
| 2724 | staticTextItem.glyphs = glyphs.data() + range.first; | - | ||||||||||||||||||||||||||||||
| 2725 | staticTextItem.glyphPositions = positions.data() + range.first; | - | ||||||||||||||||||||||||||||||
| 2726 | QPaintEngineEx::drawStaticTextItem(&staticTextItem); | - | ||||||||||||||||||||||||||||||
| 2727 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2728 | QPaintEngineEx::drawTextItem(p, ti); | - | ||||||||||||||||||||||||||||||
| 2729 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2730 | } | - | ||||||||||||||||||||||||||||||
| 2731 | - | |||||||||||||||||||||||||||||||
| 2732 | - | |||||||||||||||||||||||||||||||
| 2733 | - | |||||||||||||||||||||||||||||||
| 2734 | - | |||||||||||||||||||||||||||||||
| 2735 | void QRasterPaintEngine::drawPoints(const QPointF *points, int pointCount) | - | ||||||||||||||||||||||||||||||
| 2736 | { | - | ||||||||||||||||||||||||||||||
| 2737 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2738 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2739 | - | |||||||||||||||||||||||||||||||
| 2740 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2741 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2742 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2743 | - | |||||||||||||||||||||||||||||||
| 2744 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2745 | QPaintEngineEx::drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2746 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2747 | } | - | ||||||||||||||||||||||||||||||
| 2748 | - | |||||||||||||||||||||||||||||||
| 2749 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2750 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2751 | stroker.drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2752 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2753 | - | |||||||||||||||||||||||||||||||
| 2754 | - | |||||||||||||||||||||||||||||||
| 2755 | void QRasterPaintEngine::drawPoints(const QPoint *points, int pointCount) | - | ||||||||||||||||||||||||||||||
| 2756 | { | - | ||||||||||||||||||||||||||||||
| 2757 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2758 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2759 | - | |||||||||||||||||||||||||||||||
| 2760 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2761 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2762 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2763 | - | |||||||||||||||||||||||||||||||
| 2764 | if (!s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2765 | QPaintEngineEx::drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2766 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2767 | } | - | ||||||||||||||||||||||||||||||
| 2768 | - | |||||||||||||||||||||||||||||||
| 2769 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2770 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2771 | stroker.drawPoints(points, pointCount); | - | ||||||||||||||||||||||||||||||
| 2772 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2773 | - | |||||||||||||||||||||||||||||||
| 2774 | - | |||||||||||||||||||||||||||||||
| 2775 | - | |||||||||||||||||||||||||||||||
| 2776 | - | |||||||||||||||||||||||||||||||
| 2777 | void QRasterPaintEngine::drawLines(const QLine *lines, int lineCount) | - | ||||||||||||||||||||||||||||||
| 2778 | { | - | ||||||||||||||||||||||||||||||
| 2779 | - | |||||||||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||||||||
| 2781 | - | |||||||||||||||||||||||||||||||
| 2782 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2783 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2784 | - | |||||||||||||||||||||||||||||||
| 2785 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2786 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2787 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2788 | - | |||||||||||||||||||||||||||||||
| 2789 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2790 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2791 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2792 | for (int i=0; i<lineCount
| 0 | ||||||||||||||||||||||||||||||
| 2793 | const QLine &l = lines[i]; | - | ||||||||||||||||||||||||||||||
| 2794 | stroker.drawLine(l.p1(), l.p2()); | - | ||||||||||||||||||||||||||||||
| 2795 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2796 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2797 | QPaintEngineEx::drawLines(lines, lineCount); | - | ||||||||||||||||||||||||||||||
| 2798 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2799 | } | - | ||||||||||||||||||||||||||||||
| 2800 | - | |||||||||||||||||||||||||||||||
| 2801 | void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, | - | ||||||||||||||||||||||||||||||
| 2802 | qreal width, | - | ||||||||||||||||||||||||||||||
| 2803 | int *dashIndex, | - | ||||||||||||||||||||||||||||||
| 2804 | qreal *dashOffset, | - | ||||||||||||||||||||||||||||||
| 2805 | bool *inDash) | - | ||||||||||||||||||||||||||||||
| 2806 | { | - | ||||||||||||||||||||||||||||||
| 2807 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 2808 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 2809 | - | |||||||||||||||||||||||||||||||
| 2810 | const QPen &pen = s->lastPen; | - | ||||||||||||||||||||||||||||||
| 2811 | const bool squareCap = (pen.capStyle() == Qt::SquareCap); | - | ||||||||||||||||||||||||||||||
| 2812 | const QVector<qreal> pattern = pen.dashPattern(); | - | ||||||||||||||||||||||||||||||
| 2813 | - | |||||||||||||||||||||||||||||||
| 2814 | qreal patternLength = 0; | - | ||||||||||||||||||||||||||||||
| 2815 | for (int i = 0; i < pattern.size()
| 0 | ||||||||||||||||||||||||||||||
| 2816 | patternLength += pattern.at(i); never executed: patternLength += pattern.at(i); | 0 | ||||||||||||||||||||||||||||||
| 2817 | - | |||||||||||||||||||||||||||||||
| 2818 | if (patternLength <= 0
| 0 | ||||||||||||||||||||||||||||||
| 2819 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2820 | - | |||||||||||||||||||||||||||||||
| 2821 | qreal length = line.length(); | - | ||||||||||||||||||||||||||||||
| 2822 | ((!(length > 0)) ? qt_assert("length > 0",__FILE__,3160) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2823 | while (length > 0
| 0 | ||||||||||||||||||||||||||||||
| 2824 | const bool rasterize = *inDash; | - | ||||||||||||||||||||||||||||||
| 2825 | qreal dash = (pattern.at(*dashIndex) - *dashOffset) * width; | - | ||||||||||||||||||||||||||||||
| 2826 | QLineF l = line; | - | ||||||||||||||||||||||||||||||
| 2827 | - | |||||||||||||||||||||||||||||||
| 2828 | if (dash >= length
| 0 | ||||||||||||||||||||||||||||||
| 2829 | dash = line.length(); | - | ||||||||||||||||||||||||||||||
| 2830 | *dashOffset += dash / width; | - | ||||||||||||||||||||||||||||||
| 2831 | length = 0; | - | ||||||||||||||||||||||||||||||
| 2832 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2833 | *dashOffset = 0; | - | ||||||||||||||||||||||||||||||
| 2834 | *inDash = !(*inDash); | - | ||||||||||||||||||||||||||||||
| 2835 | if (++*
| 0 | ||||||||||||||||||||||||||||||
| 2836 | * never executed: dashIndex = 0;*dashIndex = 0;never executed: *dashIndex = 0; | 0 | ||||||||||||||||||||||||||||||
| 2837 | length -= dash; | - | ||||||||||||||||||||||||||||||
| 2838 | l.setLength(dash); | - | ||||||||||||||||||||||||||||||
| 2839 | line.setP1(l.p2()); | - | ||||||||||||||||||||||||||||||
| 2840 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2841 | - | |||||||||||||||||||||||||||||||
| 2842 | if (rasterize
| 0 | ||||||||||||||||||||||||||||||
| 2843 | rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); never executed: rasterizer->rasterizeLine(l.p1(), l.p2(), width / dash, squareCap); | 0 | ||||||||||||||||||||||||||||||
| 2844 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2845 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2846 | - | |||||||||||||||||||||||||||||||
| 2847 | - | |||||||||||||||||||||||||||||||
| 2848 | - | |||||||||||||||||||||||||||||||
| 2849 | - | |||||||||||||||||||||||||||||||
| 2850 | void QRasterPaintEngine::drawLines(const QLineF *lines, int lineCount) | - | ||||||||||||||||||||||||||||||
| 2851 | { | - | ||||||||||||||||||||||||||||||
| 2852 | - | |||||||||||||||||||||||||||||||
| 2853 | - | |||||||||||||||||||||||||||||||
| 2854 | - | |||||||||||||||||||||||||||||||
| 2855 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2856 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2857 | - | |||||||||||||||||||||||||||||||
| 2858 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2859 | if (!s->penData.blend
| 0 | ||||||||||||||||||||||||||||||
| 2860 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2861 | if (s->flags.fast_pen
| 0 | ||||||||||||||||||||||||||||||
| 2862 | QCosmeticStroker stroker(s, d->deviceRect, d->deviceRectUnclipped); | - | ||||||||||||||||||||||||||||||
| 2863 | stroker.setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 2864 | for (int i=0; i<lineCount
| 0 | ||||||||||||||||||||||||||||||
| 2865 | QLineF line = lines[i]; | - | ||||||||||||||||||||||||||||||
| 2866 | stroker.drawLine(line.p1(), line.p2()); | - | ||||||||||||||||||||||||||||||
| 2867 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2868 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2869 | QPaintEngineEx::drawLines(lines, lineCount); | - | ||||||||||||||||||||||||||||||
| 2870 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2871 | } | - | ||||||||||||||||||||||||||||||
| 2872 | - | |||||||||||||||||||||||||||||||
| 2873 | - | |||||||||||||||||||||||||||||||
| 2874 | - | |||||||||||||||||||||||||||||||
| 2875 | - | |||||||||||||||||||||||||||||||
| 2876 | - | |||||||||||||||||||||||||||||||
| 2877 | void QRasterPaintEngine::drawEllipse(const QRectF &rect) | - | ||||||||||||||||||||||||||||||
| 2878 | { | - | ||||||||||||||||||||||||||||||
| 2879 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2880 | QRasterPaintEngineState *s = state(); | - | ||||||||||||||||||||||||||||||
| 2881 | - | |||||||||||||||||||||||||||||||
| 2882 | ensurePen(); | - | ||||||||||||||||||||||||||||||
| 2883 | if (((qpen_style(s->lastPen) == Qt::SolidLine
| 0 | ||||||||||||||||||||||||||||||
| 2884 | || (
| 0 | ||||||||||||||||||||||||||||||
| 2885 | && !s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 2886 | && qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
| 0 | ||||||||||||||||||||||||||||||
| 2887 | && !rect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 2888 | && s->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||||||||
| 2889 | { | - | ||||||||||||||||||||||||||||||
| 2890 | ensureBrush(); | - | ||||||||||||||||||||||||||||||
| 2891 | const QRectF r = s->matrix.mapRect(rect); | - | ||||||||||||||||||||||||||||||
| 2892 | ProcessSpans penBlend = d->getPenFunc(r, &s->penData); | - | ||||||||||||||||||||||||||||||
| 2893 | ProcessSpans brushBlend = d->getBrushFunc(r, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 2894 | const QRect brect = QRect(int(r.x()), int(r.y()), | - | ||||||||||||||||||||||||||||||
| 2895 | (int(r.x()+r.width()) - int(r.x())), | - | ||||||||||||||||||||||||||||||
| 2896 | (int(r.y()+r.height()) - int(r.y()))); | - | ||||||||||||||||||||||||||||||
| 2897 | if (brect == r
| 0 | ||||||||||||||||||||||||||||||
| 2898 | drawEllipse_midpoint_i(brect, d->deviceRect, penBlend, brushBlend, | - | ||||||||||||||||||||||||||||||
| 2899 | &s->penData, &s->brushData); | - | ||||||||||||||||||||||||||||||
| 2900 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2901 | } | - | ||||||||||||||||||||||||||||||
| 2902 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2903 | QPaintEngineEx::drawEllipse(rect); | - | ||||||||||||||||||||||||||||||
| 2904 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2905 | bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontEngine, const QTransform &m) const | - | ||||||||||||||||||||||||||||||
| 2906 | { | - | ||||||||||||||||||||||||||||||
| 2907 | - | |||||||||||||||||||||||||||||||
| 2908 | if (shouldDrawCachedGlyphs(fontEngine, m)
| 0 | ||||||||||||||||||||||||||||||
| 2909 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||
| 2910 | - | |||||||||||||||||||||||||||||||
| 2911 | - | |||||||||||||||||||||||||||||||
| 2912 | return never executed: QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);never executed: return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m); | 0 | ||||||||||||||||||||||||||||||
| 2913 | } | - | ||||||||||||||||||||||||||||||
| 2914 | - | |||||||||||||||||||||||||||||||
| 2915 | - | |||||||||||||||||||||||||||||||
| 2916 | - | |||||||||||||||||||||||||||||||
| 2917 | - | |||||||||||||||||||||||||||||||
| 2918 | - | |||||||||||||||||||||||||||||||
| 2919 | bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const | - | ||||||||||||||||||||||||||||||
| 2920 | { | - | ||||||||||||||||||||||||||||||
| 2921 | - | |||||||||||||||||||||||||||||||
| 2922 | if (m.type() >= QTransform::TxProject
| 0 | ||||||||||||||||||||||||||||||
| 2923 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2924 | - | |||||||||||||||||||||||||||||||
| 2925 | - | |||||||||||||||||||||||||||||||
| 2926 | - | |||||||||||||||||||||||||||||||
| 2927 | - | |||||||||||||||||||||||||||||||
| 2928 | - | |||||||||||||||||||||||||||||||
| 2929 | - | |||||||||||||||||||||||||||||||
| 2930 | if (!fontEngine->hasInternalCaching()
| 0 | ||||||||||||||||||||||||||||||
| 2931 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||||||||
| 2932 | - | |||||||||||||||||||||||||||||||
| 2933 | return never executed: QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m);return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m);never executed: return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m); | 0 | ||||||||||||||||||||||||||||||
| 2934 | } | - | ||||||||||||||||||||||||||||||
| 2935 | - | |||||||||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||||||||
| 2937 | - | |||||||||||||||||||||||||||||||
| 2938 | - | |||||||||||||||||||||||||||||||
| 2939 | QPoint QRasterPaintEngine::coordinateOffset() const | - | ||||||||||||||||||||||||||||||
| 2940 | { | - | ||||||||||||||||||||||||||||||
| 2941 | return never executed: QPoint(0, 0);return QPoint(0, 0);never executed: return QPoint(0, 0); | 0 | ||||||||||||||||||||||||||||||
| 2942 | } | - | ||||||||||||||||||||||||||||||
| 2943 | - | |||||||||||||||||||||||||||||||
| 2944 | void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg) | - | ||||||||||||||||||||||||||||||
| 2945 | { | - | ||||||||||||||||||||||||||||||
| 2946 | ((!(fg)) ? qt_assert("fg",__FILE__,3316) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2947 | if (!fg->blend
| 0 | ||||||||||||||||||||||||||||||
| 2948 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 2949 | QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 2950 | - | |||||||||||||||||||||||||||||||
| 2951 | ((!(image.depth() == 1)) ? qt_assert("image.depth() == 1",__FILE__,3321) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 2952 | - | |||||||||||||||||||||||||||||||
| 2953 | const int spanCount = 256; | - | ||||||||||||||||||||||||||||||
| 2954 | QT_FT_Span spans[spanCount]; | - | ||||||||||||||||||||||||||||||
| 2955 | int n = 0; | - | ||||||||||||||||||||||||||||||
| 2956 | - | |||||||||||||||||||||||||||||||
| 2957 | - | |||||||||||||||||||||||||||||||
| 2958 | int w = image.width(); | - | ||||||||||||||||||||||||||||||
| 2959 | int h = image.height(); | - | ||||||||||||||||||||||||||||||
| 2960 | int ymax = qMin(qRound(pos.y() + h), d->rasterBuffer->height()); | - | ||||||||||||||||||||||||||||||
| 2961 | int ymin = qMax(qRound(pos.y()), 0); | - | ||||||||||||||||||||||||||||||
| 2962 | int xmax = qMin(qRound(pos.x() + w), d->rasterBuffer->width()); | - | ||||||||||||||||||||||||||||||
| 2963 | int xmin = qMax(qRound(pos.x()), 0); | - | ||||||||||||||||||||||||||||||
| 2964 | - | |||||||||||||||||||||||||||||||
| 2965 | int x_offset = xmin - qRound(pos.x()); | - | ||||||||||||||||||||||||||||||
| 2966 | - | |||||||||||||||||||||||||||||||
| 2967 | QImage::Format format = image.format(); | - | ||||||||||||||||||||||||||||||
| 2968 | for (int y = ymin; y < ymax
| 0 | ||||||||||||||||||||||||||||||
| 2969 | const uchar *src = image.scanLine(y - qRound(pos.y())); | - | ||||||||||||||||||||||||||||||
| 2970 | if (format == QImage::Format_MonoLSB
| 0 | ||||||||||||||||||||||||||||||
| 2971 | for (int x = 0; x < xmax - xmin
| 0 | ||||||||||||||||||||||||||||||
| 2972 | int src_x = x + x_offset; | - | ||||||||||||||||||||||||||||||
| 2973 | uchar pixel = src[src_x >> 3]; | - | ||||||||||||||||||||||||||||||
| 2974 | if (!pixel
| 0 | ||||||||||||||||||||||||||||||
| 2975 | x += 7 - (src_x%8); | - | ||||||||||||||||||||||||||||||
| 2976 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 2977 | } | - | ||||||||||||||||||||||||||||||
| 2978 | if (pixel & (0x1 << (src_x & 7))
| 0 | ||||||||||||||||||||||||||||||
| 2979 | spans[n].x = xmin + x; | - | ||||||||||||||||||||||||||||||
| 2980 | spans[n].y = y; | - | ||||||||||||||||||||||||||||||
| 2981 | spans[n].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 2982 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 2983 | while (src_x+1 < w
| 0 | ||||||||||||||||||||||||||||||
| 2984 | ++src_x; | - | ||||||||||||||||||||||||||||||
| 2985 | ++len; | - | ||||||||||||||||||||||||||||||
| 2986 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2987 | spans[n].len = ((
| 0 | ||||||||||||||||||||||||||||||
| 2988 | x += len; | - | ||||||||||||||||||||||||||||||
| 2989 | ++n; | - | ||||||||||||||||||||||||||||||
| 2990 | if (n == spanCount
| 0 | ||||||||||||||||||||||||||||||
| 2991 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 2992 | n = 0; | - | ||||||||||||||||||||||||||||||
| 2993 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2994 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2995 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 2996 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 2997 | for (int x = 0; x < xmax - xmin
| 0 | ||||||||||||||||||||||||||||||
| 2998 | int src_x = x + x_offset; | - | ||||||||||||||||||||||||||||||
| 2999 | uchar pixel = src[src_x >> 3]; | - | ||||||||||||||||||||||||||||||
| 3000 | if (!pixel
| 0 | ||||||||||||||||||||||||||||||
| 3001 | x += 7 - (src_x%8); | - | ||||||||||||||||||||||||||||||
| 3002 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3003 | } | - | ||||||||||||||||||||||||||||||
| 3004 | if (pixel & (0x80 >> (x & 7))
| 0 | ||||||||||||||||||||||||||||||
| 3005 | spans[n].x = xmin + x; | - | ||||||||||||||||||||||||||||||
| 3006 | spans[n].y = y; | - | ||||||||||||||||||||||||||||||
| 3007 | spans[n].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3008 | int len = 1; | - | ||||||||||||||||||||||||||||||
| 3009 | while (src_x+1 < w
| 0 | ||||||||||||||||||||||||||||||
| 3010 | ++src_x; | - | ||||||||||||||||||||||||||||||
| 3011 | ++len; | - | ||||||||||||||||||||||||||||||
| 3012 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3013 | spans[n].len = ((
| 0 | ||||||||||||||||||||||||||||||
| 3014 | x += len; | - | ||||||||||||||||||||||||||||||
| 3015 | ++n; | - | ||||||||||||||||||||||||||||||
| 3016 | if (n == spanCount
| 0 | ||||||||||||||||||||||||||||||
| 3017 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 3018 | n = 0; | - | ||||||||||||||||||||||||||||||
| 3019 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3020 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3021 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3022 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3023 | } | - | ||||||||||||||||||||||||||||||
| 3024 | if (n
| 0 | ||||||||||||||||||||||||||||||
| 3025 | fg->blend(n, spans, fg); | - | ||||||||||||||||||||||||||||||
| 3026 | n = 0; | - | ||||||||||||||||||||||||||||||
| 3027 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3028 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3029 | QRasterPaintEngine::ClipType QRasterPaintEngine::clipType() const | - | ||||||||||||||||||||||||||||||
| 3030 | { | - | ||||||||||||||||||||||||||||||
| 3031 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3032 | - | |||||||||||||||||||||||||||||||
| 3033 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 3034 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 3035 | return never executed: RectClip;return RectClip;never executed: return RectClip; | 0 | ||||||||||||||||||||||||||||||
| 3036 | else | - | ||||||||||||||||||||||||||||||
| 3037 | return never executed: ComplexClip;return ComplexClip;never executed: return ComplexClip; | 0 | ||||||||||||||||||||||||||||||
| 3038 | } | - | ||||||||||||||||||||||||||||||
| 3039 | - | |||||||||||||||||||||||||||||||
| 3040 | - | |||||||||||||||||||||||||||||||
| 3041 | - | |||||||||||||||||||||||||||||||
| 3042 | - | |||||||||||||||||||||||||||||||
| 3043 | - | |||||||||||||||||||||||||||||||
| 3044 | QRect QRasterPaintEngine::clipBoundingRect() const | - | ||||||||||||||||||||||||||||||
| 3045 | { | - | ||||||||||||||||||||||||||||||
| 3046 | const QRasterPaintEnginePrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
| 3047 | - | |||||||||||||||||||||||||||||||
| 3048 | const QClipData *clip = d->clip(); | - | ||||||||||||||||||||||||||||||
| 3049 | - | |||||||||||||||||||||||||||||||
| 3050 | if (!clip
| 0 | ||||||||||||||||||||||||||||||
| 3051 | return never executed: d->deviceRect;return d->deviceRect;never executed: return d->deviceRect; | 0 | ||||||||||||||||||||||||||||||
| 3052 | - | |||||||||||||||||||||||||||||||
| 3053 | if (clip->hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3054 | return never executed: clip->clipRect;return clip->clipRect;never executed: return clip->clipRect; | 0 | ||||||||||||||||||||||||||||||
| 3055 | - | |||||||||||||||||||||||||||||||
| 3056 | 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 | ||||||||||||||||||||||||||||||
| 3057 | } | - | ||||||||||||||||||||||||||||||
| 3058 | - | |||||||||||||||||||||||||||||||
| 3059 | void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) | - | ||||||||||||||||||||||||||||||
| 3060 | { | - | ||||||||||||||||||||||||||||||
| 3061 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3062 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3063 | - | |||||||||||||||||||||||||||||||
| 3064 | rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 3065 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 3066 | - | |||||||||||||||||||||||||||||||
| 3067 | QRect clipRect(deviceRect); | - | ||||||||||||||||||||||||||||||
| 3068 | ProcessSpans blend; | - | ||||||||||||||||||||||||||||||
| 3069 | - | |||||||||||||||||||||||||||||||
| 3070 | - | |||||||||||||||||||||||||||||||
| 3071 | const QClipData *c = clip(); | - | ||||||||||||||||||||||||||||||
| 3072 | if (c
| 0 | ||||||||||||||||||||||||||||||
| 3073 | const QRect r(QPoint(c->xmin, c->ymin), | - | ||||||||||||||||||||||||||||||
| 3074 | QSize(c->xmax - c->xmin, c->ymax - c->ymin)); | - | ||||||||||||||||||||||||||||||
| 3075 | clipRect = clipRect.intersected(r); | - | ||||||||||||||||||||||||||||||
| 3076 | blend = data->blend; | - | ||||||||||||||||||||||||||||||
| 3077 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3078 | blend = data->unclipped_blend; | - | ||||||||||||||||||||||||||||||
| 3079 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3080 | - | |||||||||||||||||||||||||||||||
| 3081 | rasterizer->setClipRect(clipRect); | - | ||||||||||||||||||||||||||||||
| 3082 | rasterizer->initialize(blend, data); | - | ||||||||||||||||||||||||||||||
| 3083 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||||||||
| 3085 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - | ||||||||||||||||||||||||||||||
| 3086 | ProcessSpans callback, | - | ||||||||||||||||||||||||||||||
| 3087 | QSpanData *spanData, QRasterBuffer *rasterBuffer) | - | ||||||||||||||||||||||||||||||
| 3088 | { | - | ||||||||||||||||||||||||||||||
| 3089 | if (!callback
| 0 | ||||||||||||||||||||||||||||||
| 3090 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3091 | - | |||||||||||||||||||||||||||||||
| 3092 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3093 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3094 | - | |||||||||||||||||||||||||||||||
| 3095 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 3096 | initializeRasterizer(spanData); | - | ||||||||||||||||||||||||||||||
| 3097 | - | |||||||||||||||||||||||||||||||
| 3098 | const Qt::FillRule fillRule = outline->flags == 0x0
| 0 | ||||||||||||||||||||||||||||||
| 3099 | ? Qt::WindingFill | - | ||||||||||||||||||||||||||||||
| 3100 | : Qt::OddEvenFill; | - | ||||||||||||||||||||||||||||||
| 3101 | - | |||||||||||||||||||||||||||||||
| 3102 | rasterizer->rasterize(outline, fillRule); | - | ||||||||||||||||||||||||||||||
| 3103 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3104 | } | - | ||||||||||||||||||||||||||||||
| 3105 | - | |||||||||||||||||||||||||||||||
| 3106 | rasterize(outline, callback, (void *)spanData, rasterBuffer); | - | ||||||||||||||||||||||||||||||
| 3107 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3108 | - | |||||||||||||||||||||||||||||||
| 3109 | extern "C" { | - | ||||||||||||||||||||||||||||||
| 3110 | int q_gray_rendered_spans(QT_FT_Raster raster); | - | ||||||||||||||||||||||||||||||
| 3111 | } | - | ||||||||||||||||||||||||||||||
| 3112 | - | |||||||||||||||||||||||||||||||
| 3113 | static inline uchar *alignAddress(uchar *address, quintptr alignmentMask) | - | ||||||||||||||||||||||||||||||
| 3114 | { | - | ||||||||||||||||||||||||||||||
| 3115 | return never executed: (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask);return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask);never executed: return (uchar *)(((quintptr)address + alignmentMask) & ~alignmentMask); | 0 | ||||||||||||||||||||||||||||||
| 3116 | } | - | ||||||||||||||||||||||||||||||
| 3117 | - | |||||||||||||||||||||||||||||||
| 3118 | void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline, | - | ||||||||||||||||||||||||||||||
| 3119 | ProcessSpans callback, | - | ||||||||||||||||||||||||||||||
| 3120 | void *userData, QRasterBuffer *) | - | ||||||||||||||||||||||||||||||
| 3121 | { | - | ||||||||||||||||||||||||||||||
| 3122 | if (!callback
| 0 | ||||||||||||||||||||||||||||||
| 3123 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3124 | - | |||||||||||||||||||||||||||||||
| 3125 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3126 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3127 | - | |||||||||||||||||||||||||||||||
| 3128 | if (!s->flags.antialiased
| 0 | ||||||||||||||||||||||||||||||
| 3129 | rasterizer->setAntialiased(s->flags.antialiased); | - | ||||||||||||||||||||||||||||||
| 3130 | rasterizer->setLegacyRoundingEnabled(s->flags.legacy_rounding); | - | ||||||||||||||||||||||||||||||
| 3131 | rasterizer->setClipRect(deviceRect); | - | ||||||||||||||||||||||||||||||
| 3132 | rasterizer->initialize(callback, userData); | - | ||||||||||||||||||||||||||||||
| 3133 | - | |||||||||||||||||||||||||||||||
| 3134 | const Qt::FillRule fillRule = outline->flags == 0x0
| 0 | ||||||||||||||||||||||||||||||
| 3135 | ? Qt::WindingFill | - | ||||||||||||||||||||||||||||||
| 3136 | : Qt::OddEvenFill; | - | ||||||||||||||||||||||||||||||
| 3137 | - | |||||||||||||||||||||||||||||||
| 3138 | rasterizer->rasterize(outline, fillRule); | - | ||||||||||||||||||||||||||||||
| 3139 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3140 | } | - | ||||||||||||||||||||||||||||||
| 3141 | - | |||||||||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||||||||
| 3143 | - | |||||||||||||||||||||||||||||||
| 3144 | - | |||||||||||||||||||||||||||||||
| 3145 | - | |||||||||||||||||||||||||||||||
| 3146 | int rasterPoolSize = 8192; | - | ||||||||||||||||||||||||||||||
| 3147 | uchar rasterPoolOnStack[8192 + 0xf]; | - | ||||||||||||||||||||||||||||||
| 3148 | uchar *rasterPoolBase = alignAddress(rasterPoolOnStack, 0xf); | - | ||||||||||||||||||||||||||||||
| 3149 | uchar *rasterPoolOnHeap = 0; | - | ||||||||||||||||||||||||||||||
| 3150 | - | |||||||||||||||||||||||||||||||
| 3151 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - | ||||||||||||||||||||||||||||||
| 3152 | - | |||||||||||||||||||||||||||||||
| 3153 | void *data = userData; | - | ||||||||||||||||||||||||||||||
| 3154 | - | |||||||||||||||||||||||||||||||
| 3155 | QT_FT_BBox clip_box = { deviceRect.x(), | - | ||||||||||||||||||||||||||||||
| 3156 | deviceRect.y(), | - | ||||||||||||||||||||||||||||||
| 3157 | deviceRect.x() + deviceRect.width(), | - | ||||||||||||||||||||||||||||||
| 3158 | deviceRect.y() + deviceRect.height() }; | - | ||||||||||||||||||||||||||||||
| 3159 | - | |||||||||||||||||||||||||||||||
| 3160 | QT_FT_Raster_Params rasterParams; | - | ||||||||||||||||||||||||||||||
| 3161 | rasterParams.target = 0; | - | ||||||||||||||||||||||||||||||
| 3162 | rasterParams.source = outline; | - | ||||||||||||||||||||||||||||||
| 3163 | rasterParams.flags = 0x4; | - | ||||||||||||||||||||||||||||||
| 3164 | rasterParams.gray_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3165 | rasterParams.black_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3166 | rasterParams.bit_test = 0; | - | ||||||||||||||||||||||||||||||
| 3167 | rasterParams.bit_set = 0; | - | ||||||||||||||||||||||||||||||
| 3168 | rasterParams.user = data; | - | ||||||||||||||||||||||||||||||
| 3169 | rasterParams.clip_box = clip_box; | - | ||||||||||||||||||||||||||||||
| 3170 | - | |||||||||||||||||||||||||||||||
| 3171 | bool done = false; | - | ||||||||||||||||||||||||||||||
| 3172 | int error; | - | ||||||||||||||||||||||||||||||
| 3173 | - | |||||||||||||||||||||||||||||||
| 3174 | int rendered_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3175 | - | |||||||||||||||||||||||||||||||
| 3176 | while (!done
| 0 | ||||||||||||||||||||||||||||||
| 3177 | - | |||||||||||||||||||||||||||||||
| 3178 | rasterParams.flags |= (0x1 | 0x2); | - | ||||||||||||||||||||||||||||||
| 3179 | rasterParams.gray_spans = callback; | - | ||||||||||||||||||||||||||||||
| 3180 | rasterParams.skip_spans = rendered_spans; | - | ||||||||||||||||||||||||||||||
| 3181 | error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams); | - | ||||||||||||||||||||||||||||||
| 3182 | - | |||||||||||||||||||||||||||||||
| 3183 | - | |||||||||||||||||||||||||||||||
| 3184 | if (error == -6
| 0 | ||||||||||||||||||||||||||||||
| 3185 | rasterPoolSize *= 2; | - | ||||||||||||||||||||||||||||||
| 3186 | if (rasterPoolSize > 1024 * 1024
| 0 | ||||||||||||||||||||||||||||||
| 3187 | QMessageLogger(__FILE__, 3570, __PRETTY_FUNCTION__).warning("QPainter: Rasterization of primitive failed"); | - | ||||||||||||||||||||||||||||||
| 3188 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3189 | } | - | ||||||||||||||||||||||||||||||
| 3190 | - | |||||||||||||||||||||||||||||||
| 3191 | rendered_spans += q_gray_rendered_spans(*grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3192 | - | |||||||||||||||||||||||||||||||
| 3193 | free(rasterPoolOnHeap); | - | ||||||||||||||||||||||||||||||
| 3194 | rasterPoolOnHeap = (uchar *)malloc(rasterPoolSize + 0xf); | - | ||||||||||||||||||||||||||||||
| 3195 | - | |||||||||||||||||||||||||||||||
| 3196 | do {if(!(rasterPoolOnHeap)
never executed: } while (0);qt_check_pointer(__FILE__,3579); | 0 | ||||||||||||||||||||||||||||||
| 3197 | - | |||||||||||||||||||||||||||||||
| 3198 | rasterPoolBase = alignAddress(rasterPoolOnHeap, 0xf); | - | ||||||||||||||||||||||||||||||
| 3199 | - | |||||||||||||||||||||||||||||||
| 3200 | qt_ft_grays_raster.raster_done(*grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3201 | qt_ft_grays_raster.raster_new(grayRaster.data()); | - | ||||||||||||||||||||||||||||||
| 3202 | qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize); | - | ||||||||||||||||||||||||||||||
| 3203 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3204 | done = true; | - | ||||||||||||||||||||||||||||||
| 3205 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3206 | } | - | ||||||||||||||||||||||||||||||
| 3207 | - | |||||||||||||||||||||||||||||||
| 3208 | free(rasterPoolOnHeap); | - | ||||||||||||||||||||||||||||||
| 3209 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3210 | - | |||||||||||||||||||||||||||||||
| 3211 | void QRasterPaintEnginePrivate::recalculateFastImages() | - | ||||||||||||||||||||||||||||||
| 3212 | { | - | ||||||||||||||||||||||||||||||
| 3213 | QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3214 | QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3215 | - | |||||||||||||||||||||||||||||||
| 3216 | s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform)
| 0 | ||||||||||||||||||||||||||||||
| 3217 | && s->matrix.type() <= QTransform::TxShear
| 0 | ||||||||||||||||||||||||||||||
| 3218 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3219 | - | |||||||||||||||||||||||||||||||
| 3220 | bool QRasterPaintEnginePrivate::canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const | - | ||||||||||||||||||||||||||||||
| 3221 | { | - | ||||||||||||||||||||||||||||||
| 3222 | const QRasterPaintEngine * const q = q_func(); | - | ||||||||||||||||||||||||||||||
| 3223 | const QRasterPaintEngineState *s = q->state(); | - | ||||||||||||||||||||||||||||||
| 3224 | - | |||||||||||||||||||||||||||||||
| 3225 | 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 | ||||||||||||||||||||||||||||||
| 3226 | && (mode == QPainter::CompositionMode_SourceOver
never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3227 | || (mode == QPainter::CompositionMode_Source
never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3228 | && !image.hasAlphaChannel()
never executed: return s->flags.fast_images && (mode == QPainter::CompositionMode_SourceOver || (mode == QPainter::CompositionMode_Source && !image.hasAlphaChannel())); | 0 | ||||||||||||||||||||||||||||||
| 3229 | } | - | ||||||||||||||||||||||||||||||
| 3230 | - | |||||||||||||||||||||||||||||||
| 3231 | QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color) | - | ||||||||||||||||||||||||||||||
| 3232 | { | - | ||||||||||||||||||||||||||||||
| 3233 | ((!(image.depth() == 1)) ? qt_assert("image.depth() == 1",__FILE__,3616) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3234 | - | |||||||||||||||||||||||||||||||
| 3235 | const QImage sourceImage = image.convertToFormat(QImage::Format_MonoLSB); | - | ||||||||||||||||||||||||||||||
| 3236 | QImage dest = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||||||||
| 3237 | - | |||||||||||||||||||||||||||||||
| 3238 | QRgb fg = qPremultiply(color.rgba()); | - | ||||||||||||||||||||||||||||||
| 3239 | QRgb bg = 0; | - | ||||||||||||||||||||||||||||||
| 3240 | - | |||||||||||||||||||||||||||||||
| 3241 | int height = sourceImage.height(); | - | ||||||||||||||||||||||||||||||
| 3242 | int width = sourceImage.width(); | - | ||||||||||||||||||||||||||||||
| 3243 | for (int y=0; y<height
| 0 | ||||||||||||||||||||||||||||||
| 3244 | const uchar *source = sourceImage.constScanLine(y); | - | ||||||||||||||||||||||||||||||
| 3245 | QRgb *target = reinterpret_cast<QRgb *>(dest.scanLine(y)); | - | ||||||||||||||||||||||||||||||
| 3246 | if (!source
| 0 | ||||||||||||||||||||||||||||||
| 3247 | qt_noop(); never executed: qt_noop(); | 0 | ||||||||||||||||||||||||||||||
| 3248 | for (int x=0; x < width
| 0 | ||||||||||||||||||||||||||||||
| 3249 | target[x] = (
never executed: target[x] = (source[x>>3] >> (x&7)) & 1 ? fg : bg; | 0 | ||||||||||||||||||||||||||||||
| 3250 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3251 | return never executed: dest;return dest;never executed: return dest; | 0 | ||||||||||||||||||||||||||||||
| 3252 | } | - | ||||||||||||||||||||||||||||||
| 3253 | - | |||||||||||||||||||||||||||||||
| 3254 | QRasterBuffer::~QRasterBuffer() | - | ||||||||||||||||||||||||||||||
| 3255 | { | - | ||||||||||||||||||||||||||||||
| 3256 | } | - | ||||||||||||||||||||||||||||||
| 3257 | - | |||||||||||||||||||||||||||||||
| 3258 | void QRasterBuffer::init() | - | ||||||||||||||||||||||||||||||
| 3259 | { | - | ||||||||||||||||||||||||||||||
| 3260 | compositionMode = QPainter::CompositionMode_SourceOver; | - | ||||||||||||||||||||||||||||||
| 3261 | monoDestinationWithClut = false; | - | ||||||||||||||||||||||||||||||
| 3262 | destColor0 = 0; | - | ||||||||||||||||||||||||||||||
| 3263 | destColor1 = 0; | - | ||||||||||||||||||||||||||||||
| 3264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3265 | - | |||||||||||||||||||||||||||||||
| 3266 | QImage::Format QRasterBuffer::prepare(QImage *image) | - | ||||||||||||||||||||||||||||||
| 3267 | { | - | ||||||||||||||||||||||||||||||
| 3268 | m_buffer = (uchar *)image->bits(); | - | ||||||||||||||||||||||||||||||
| 3269 | m_width = qMin(QT_RASTER_COORD_LIMIT, image->width()); | - | ||||||||||||||||||||||||||||||
| 3270 | m_height = qMin(QT_RASTER_COORD_LIMIT, image->height()); | - | ||||||||||||||||||||||||||||||
| 3271 | bytes_per_pixel = image->depth()/8; | - | ||||||||||||||||||||||||||||||
| 3272 | bytes_per_line = image->bytesPerLine(); | - | ||||||||||||||||||||||||||||||
| 3273 | - | |||||||||||||||||||||||||||||||
| 3274 | format = image->format(); | - | ||||||||||||||||||||||||||||||
| 3275 | drawHelper = qDrawHelper + format; | - | ||||||||||||||||||||||||||||||
| 3276 | if (image->depth() == 1
| 0 | ||||||||||||||||||||||||||||||
| 3277 | monoDestinationWithClut = true; | - | ||||||||||||||||||||||||||||||
| 3278 | const QVector<QRgb> colorTable = image->colorTable(); | - | ||||||||||||||||||||||||||||||
| 3279 | destColor0 = qPremultiply(colorTable[0]); | - | ||||||||||||||||||||||||||||||
| 3280 | destColor1 = qPremultiply(colorTable[1]); | - | ||||||||||||||||||||||||||||||
| 3281 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3282 | - | |||||||||||||||||||||||||||||||
| 3283 | return never executed: format;return format;never executed: return format; | 0 | ||||||||||||||||||||||||||||||
| 3284 | } | - | ||||||||||||||||||||||||||||||
| 3285 | - | |||||||||||||||||||||||||||||||
| 3286 | void QRasterBuffer::resetBuffer(int val) | - | ||||||||||||||||||||||||||||||
| 3287 | { | - | ||||||||||||||||||||||||||||||
| 3288 | memset(m_buffer, val, m_height*bytes_per_line); | - | ||||||||||||||||||||||||||||||
| 3289 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3290 | - | |||||||||||||||||||||||||||||||
| 3291 | QClipData::QClipData(int height) | - | ||||||||||||||||||||||||||||||
| 3292 | { | - | ||||||||||||||||||||||||||||||
| 3293 | clipSpanHeight = height; | - | ||||||||||||||||||||||||||||||
| 3294 | m_clipLines = 0; | - | ||||||||||||||||||||||||||||||
| 3295 | - | |||||||||||||||||||||||||||||||
| 3296 | allocated = 0; | - | ||||||||||||||||||||||||||||||
| 3297 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3298 | xmin = xmax = ymin = ymax = 0; | - | ||||||||||||||||||||||||||||||
| 3299 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3300 | - | |||||||||||||||||||||||||||||||
| 3301 | enabled = true; | - | ||||||||||||||||||||||||||||||
| 3302 | hasRectClip = hasRegionClip = false; | - | ||||||||||||||||||||||||||||||
| 3303 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3304 | - | |||||||||||||||||||||||||||||||
| 3305 | QClipData::~QClipData() | - | ||||||||||||||||||||||||||||||
| 3306 | { | - | ||||||||||||||||||||||||||||||
| 3307 | if (m_clipLines
| 0 | ||||||||||||||||||||||||||||||
| 3308 | free(m_clipLines); never executed: free(m_clipLines); | 0 | ||||||||||||||||||||||||||||||
| 3309 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3310 | free(m_spans); never executed: free(m_spans); | 0 | ||||||||||||||||||||||||||||||
| 3311 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3312 | - | |||||||||||||||||||||||||||||||
| 3313 | void QClipData::initialize() | - | ||||||||||||||||||||||||||||||
| 3314 | { | - | ||||||||||||||||||||||||||||||
| 3315 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3316 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3317 | - | |||||||||||||||||||||||||||||||
| 3318 | if (!m_clipLines
| 0 | ||||||||||||||||||||||||||||||
| 3319 | m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); never executed: m_clipLines = (ClipLine *)calloc(sizeof(ClipLine), clipSpanHeight); | 0 | ||||||||||||||||||||||||||||||
| 3320 | - | |||||||||||||||||||||||||||||||
| 3321 | do {if(!(m_clipLines)
never executed: } while (0);qt_check_pointer(__FILE__,3704); | 0 | ||||||||||||||||||||||||||||||
| 3322 | if (true) { | - | ||||||||||||||||||||||||||||||
| 3323 | m_spans = (QSpan *)malloc(clipSpanHeight*sizeof(QSpan)); | - | ||||||||||||||||||||||||||||||
| 3324 | allocated = clipSpanHeight; | - | ||||||||||||||||||||||||||||||
| 3325 | do {if(!(m_spans)
never executed: } while (0);qt_check_pointer(__FILE__,3708); | 0 | ||||||||||||||||||||||||||||||
| 3326 | - | |||||||||||||||||||||||||||||||
| 3327 | if (true) { | - | ||||||||||||||||||||||||||||||
| 3328 | if (hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3329 | int y = 0; | - | ||||||||||||||||||||||||||||||
| 3330 | while (y < ymin
| 0 | ||||||||||||||||||||||||||||||
| 3331 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3332 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3333 | ++y; | - | ||||||||||||||||||||||||||||||
| 3334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3335 | - | |||||||||||||||||||||||||||||||
| 3336 | const int len = clipRect.width(); | - | ||||||||||||||||||||||||||||||
| 3337 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3338 | while (y < ymax
| 0 | ||||||||||||||||||||||||||||||
| 3339 | QSpan *span = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3340 | span->x = xmin; | - | ||||||||||||||||||||||||||||||
| 3341 | span->len = len; | - | ||||||||||||||||||||||||||||||
| 3342 | span->y = y; | - | ||||||||||||||||||||||||||||||
| 3343 | span->coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3344 | ++count; | - | ||||||||||||||||||||||||||||||
| 3345 | - | |||||||||||||||||||||||||||||||
| 3346 | m_clipLines[y].spans = span; | - | ||||||||||||||||||||||||||||||
| 3347 | m_clipLines[y].count = 1; | - | ||||||||||||||||||||||||||||||
| 3348 | ++y; | - | ||||||||||||||||||||||||||||||
| 3349 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3350 | - | |||||||||||||||||||||||||||||||
| 3351 | while (y < clipSpanHeight
| 0 | ||||||||||||||||||||||||||||||
| 3352 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3353 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3354 | ++y; | - | ||||||||||||||||||||||||||||||
| 3355 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3356 | } never executed: else if (hasRegionClipend of block
| 0 | ||||||||||||||||||||||||||||||
| 3357 | - | |||||||||||||||||||||||||||||||
| 3358 | const QVector<QRect> rects = clipRegion.rects(); | - | ||||||||||||||||||||||||||||||
| 3359 | const int numRects = rects.size(); | - | ||||||||||||||||||||||||||||||
| 3360 | - | |||||||||||||||||||||||||||||||
| 3361 | { | - | ||||||||||||||||||||||||||||||
| 3362 | const int maxSpans = (ymax - ymin) * numRects; | - | ||||||||||||||||||||||||||||||
| 3363 | if (maxSpans > allocated
| 0 | ||||||||||||||||||||||||||||||
| 3364 | m_spans = q_check_ptr((QSpan *)realloc(m_spans, maxSpans * sizeof(QSpan))); | - | ||||||||||||||||||||||||||||||
| 3365 | allocated = maxSpans; | - | ||||||||||||||||||||||||||||||
| 3366 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3367 | } | - | ||||||||||||||||||||||||||||||
| 3368 | - | |||||||||||||||||||||||||||||||
| 3369 | int y = 0; | - | ||||||||||||||||||||||||||||||
| 3370 | int firstInBand = 0; | - | ||||||||||||||||||||||||||||||
| 3371 | count = 0; | - | ||||||||||||||||||||||||||||||
| 3372 | while (firstInBand < numRects
| 0 | ||||||||||||||||||||||||||||||
| 3373 | const int currMinY = rects.at(firstInBand).y(); | - | ||||||||||||||||||||||||||||||
| 3374 | const int currMaxY = currMinY + rects.at(firstInBand).height(); | - | ||||||||||||||||||||||||||||||
| 3375 | - | |||||||||||||||||||||||||||||||
| 3376 | while (y < currMinY
| 0 | ||||||||||||||||||||||||||||||
| 3377 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3378 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3379 | ++y; | - | ||||||||||||||||||||||||||||||
| 3380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3381 | - | |||||||||||||||||||||||||||||||
| 3382 | int lastInBand = firstInBand; | - | ||||||||||||||||||||||||||||||
| 3383 | while (lastInBand + 1 < numRects
| 0 | ||||||||||||||||||||||||||||||
| 3384 | ++ never executed: lastInBand;++lastInBand;never executed: ++lastInBand; | 0 | ||||||||||||||||||||||||||||||
| 3385 | - | |||||||||||||||||||||||||||||||
| 3386 | while (y < currMaxY
| 0 | ||||||||||||||||||||||||||||||
| 3387 | - | |||||||||||||||||||||||||||||||
| 3388 | m_clipLines[y].spans = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3389 | m_clipLines[y].count = lastInBand - firstInBand + 1; | - | ||||||||||||||||||||||||||||||
| 3390 | - | |||||||||||||||||||||||||||||||
| 3391 | for (int r = firstInBand; r <= lastInBand
| 0 | ||||||||||||||||||||||||||||||
| 3392 | const QRect &currRect = rects.at(r); | - | ||||||||||||||||||||||||||||||
| 3393 | QSpan *span = m_spans + count; | - | ||||||||||||||||||||||||||||||
| 3394 | span->x = currRect.x(); | - | ||||||||||||||||||||||||||||||
| 3395 | span->len = currRect.width(); | - | ||||||||||||||||||||||||||||||
| 3396 | span->y = y; | - | ||||||||||||||||||||||||||||||
| 3397 | span->coverage = 255; | - | ||||||||||||||||||||||||||||||
| 3398 | ++count; | - | ||||||||||||||||||||||||||||||
| 3399 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3400 | ++y; | - | ||||||||||||||||||||||||||||||
| 3401 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3402 | - | |||||||||||||||||||||||||||||||
| 3403 | firstInBand = lastInBand + 1; | - | ||||||||||||||||||||||||||||||
| 3404 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3405 | - | |||||||||||||||||||||||||||||||
| 3406 | ((!(count <= allocated)) ? qt_assert("count <= allocated",__FILE__,3789) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3407 | - | |||||||||||||||||||||||||||||||
| 3408 | while (y < clipSpanHeight
| 0 | ||||||||||||||||||||||||||||||
| 3409 | m_clipLines[y].spans = 0; | - | ||||||||||||||||||||||||||||||
| 3410 | m_clipLines[y].count = 0; | - | ||||||||||||||||||||||||||||||
| 3411 | ++y; | - | ||||||||||||||||||||||||||||||
| 3412 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3413 | - | |||||||||||||||||||||||||||||||
| 3414 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3415 | } never executed: else {end of blockdead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3416 | free(m_spans); dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3417 | m_spans = 0; dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3418 | qt_noop(); dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3419 | } dead code: { free(m_spans); m_spans = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3420 | } else { dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3421 | free(m_clipLines); dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3422 | m_clipLines = 0; dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3423 | qt_noop(); dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3424 | } dead code: { free(m_clipLines); m_clipLines = 0; qt_noop(); } | - | ||||||||||||||||||||||||||||||
| 3425 | } | - | ||||||||||||||||||||||||||||||
| 3426 | - | |||||||||||||||||||||||||||||||
| 3427 | void QClipData::fixup() | - | ||||||||||||||||||||||||||||||
| 3428 | { | - | ||||||||||||||||||||||||||||||
| 3429 | ((!(m_spans)) ? qt_assert("m_spans",__FILE__,3812) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3430 | - | |||||||||||||||||||||||||||||||
| 3431 | if (count == 0
| 0 | ||||||||||||||||||||||||||||||
| 3432 | ymin = ymax = xmin = xmax = 0; | - | ||||||||||||||||||||||||||||||
| 3433 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3434 | } | - | ||||||||||||||||||||||||||||||
| 3435 | - | |||||||||||||||||||||||||||||||
| 3436 | int y = -1; | - | ||||||||||||||||||||||||||||||
| 3437 | ymin = m_spans[0].y; | - | ||||||||||||||||||||||||||||||
| 3438 | ymax = m_spans[count-1].y + 1; | - | ||||||||||||||||||||||||||||||
| 3439 | xmin = 2147483647; | - | ||||||||||||||||||||||||||||||
| 3440 | xmax = 0; | - | ||||||||||||||||||||||||||||||
| 3441 | - | |||||||||||||||||||||||||||||||
| 3442 | const int firstLeft = m_spans[0].x; | - | ||||||||||||||||||||||||||||||
| 3443 | const int firstRight = m_spans[0].x + m_spans[0].len; | - | ||||||||||||||||||||||||||||||
| 3444 | bool isRect = true; | - | ||||||||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||||||||
| 3446 | for (int i = 0; i < count
| 0 | ||||||||||||||||||||||||||||||
| 3447 | QT_FT_Span_& span = m_spans[i]; | - | ||||||||||||||||||||||||||||||
| 3448 | - | |||||||||||||||||||||||||||||||
| 3449 | if (span.y != y
| 0 | ||||||||||||||||||||||||||||||
| 3450 | if (span.y != y + 1
| 0 | ||||||||||||||||||||||||||||||
| 3451 | isRect = false; never executed: isRect = false; | 0 | ||||||||||||||||||||||||||||||
| 3452 | y = span.y; | - | ||||||||||||||||||||||||||||||
| 3453 | m_clipLines[y].spans = &span; | - | ||||||||||||||||||||||||||||||
| 3454 | m_clipLines[y].count = 1; | - | ||||||||||||||||||||||||||||||
| 3455 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||||||||
| 3456 | ++ never executed: m_clipLines[y].count;++m_clipLines[y].count;never executed: ++m_clipLines[y].count; | 0 | ||||||||||||||||||||||||||||||
| 3457 | - | |||||||||||||||||||||||||||||||
| 3458 | const int spanLeft = span.x; | - | ||||||||||||||||||||||||||||||
| 3459 | const int spanRight = spanLeft + span.len; | - | ||||||||||||||||||||||||||||||
| 3460 | - | |||||||||||||||||||||||||||||||
| 3461 | if (spanLeft < xmin
| 0 | ||||||||||||||||||||||||||||||
| 3462 | xmin = spanLeft; never executed: xmin = spanLeft; | 0 | ||||||||||||||||||||||||||||||
| 3463 | - | |||||||||||||||||||||||||||||||
| 3464 | if (spanRight > xmax
| 0 | ||||||||||||||||||||||||||||||
| 3465 | xmax = spanRight; never executed: xmax = spanRight; | 0 | ||||||||||||||||||||||||||||||
| 3466 | - | |||||||||||||||||||||||||||||||
| 3467 | if (spanLeft != firstLeft
| 0 | ||||||||||||||||||||||||||||||
| 3468 | isRect = false; never executed: isRect = false; | 0 | ||||||||||||||||||||||||||||||
| 3469 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3470 | - | |||||||||||||||||||||||||||||||
| 3471 | if (isRect
| 0 | ||||||||||||||||||||||||||||||
| 3472 | hasRectClip = true; | - | ||||||||||||||||||||||||||||||
| 3473 | clipRect.setRect(xmin, ymin, xmax - xmin, ymax - ymin); | - | ||||||||||||||||||||||||||||||
| 3474 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3475 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3476 | - | |||||||||||||||||||||||||||||||
| 3477 | - | |||||||||||||||||||||||||||||||
| 3478 | - | |||||||||||||||||||||||||||||||
| 3479 | - | |||||||||||||||||||||||||||||||
| 3480 | void QClipData::setClipRect(const QRect &rect) | - | ||||||||||||||||||||||||||||||
| 3481 | { | - | ||||||||||||||||||||||||||||||
| 3482 | if (hasRectClip
| 0 | ||||||||||||||||||||||||||||||
| 3483 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3484 | - | |||||||||||||||||||||||||||||||
| 3485 | - | |||||||||||||||||||||||||||||||
| 3486 | hasRectClip = true; | - | ||||||||||||||||||||||||||||||
| 3487 | hasRegionClip = false; | - | ||||||||||||||||||||||||||||||
| 3488 | clipRect = rect; | - | ||||||||||||||||||||||||||||||
| 3489 | - | |||||||||||||||||||||||||||||||
| 3490 | xmin = rect.x(); | - | ||||||||||||||||||||||||||||||
| 3491 | xmax = rect.x() + rect.width(); | - | ||||||||||||||||||||||||||||||
| 3492 | ymin = qMin(rect.y(), clipSpanHeight); | - | ||||||||||||||||||||||||||||||
| 3493 | ymax = qMin(rect.y() + rect.height(), clipSpanHeight); | - | ||||||||||||||||||||||||||||||
| 3494 | - | |||||||||||||||||||||||||||||||
| 3495 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3496 | free(m_spans); | - | ||||||||||||||||||||||||||||||
| 3497 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3498 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3499 | - | |||||||||||||||||||||||||||||||
| 3500 | - | |||||||||||||||||||||||||||||||
| 3501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3502 | - | |||||||||||||||||||||||||||||||
| 3503 | - | |||||||||||||||||||||||||||||||
| 3504 | - | |||||||||||||||||||||||||||||||
| 3505 | - | |||||||||||||||||||||||||||||||
| 3506 | void QClipData::setClipRegion(const QRegion ®ion) | - | ||||||||||||||||||||||||||||||
| 3507 | { | - | ||||||||||||||||||||||||||||||
| 3508 | if (region.rectCount() == 1
| 0 | ||||||||||||||||||||||||||||||
| 3509 | setClipRect(region.boundingRect()); | - | ||||||||||||||||||||||||||||||
| 3510 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3511 | } | - | ||||||||||||||||||||||||||||||
| 3512 | - | |||||||||||||||||||||||||||||||
| 3513 | hasRegionClip = true; | - | ||||||||||||||||||||||||||||||
| 3514 | hasRectClip = false; | - | ||||||||||||||||||||||||||||||
| 3515 | clipRegion = region; | - | ||||||||||||||||||||||||||||||
| 3516 | - | |||||||||||||||||||||||||||||||
| 3517 | { | - | ||||||||||||||||||||||||||||||
| 3518 | const QRect rect = region.boundingRect(); | - | ||||||||||||||||||||||||||||||
| 3519 | xmin = rect.x(); | - | ||||||||||||||||||||||||||||||
| 3520 | xmax = rect.x() + rect.width(); | - | ||||||||||||||||||||||||||||||
| 3521 | ymin = rect.y(); | - | ||||||||||||||||||||||||||||||
| 3522 | ymax = rect.y() + rect.height(); | - | ||||||||||||||||||||||||||||||
| 3523 | } | - | ||||||||||||||||||||||||||||||
| 3524 | - | |||||||||||||||||||||||||||||||
| 3525 | if (m_spans
| 0 | ||||||||||||||||||||||||||||||
| 3526 | free(m_spans); | - | ||||||||||||||||||||||||||||||
| 3527 | m_spans = 0; | - | ||||||||||||||||||||||||||||||
| 3528 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3529 | - | |||||||||||||||||||||||||||||||
| 3530 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3531 | - | |||||||||||||||||||||||||||||||
| 3532 | - | |||||||||||||||||||||||||||||||
| 3533 | - | |||||||||||||||||||||||||||||||
| 3534 | - | |||||||||||||||||||||||||||||||
| 3535 | - | |||||||||||||||||||||||||||||||
| 3536 | static const QSpan *qt_intersect_spans(const QClipData *clip, int *currentClip, | - | ||||||||||||||||||||||||||||||
| 3537 | const QSpan *spans, const QSpan *end, | - | ||||||||||||||||||||||||||||||
| 3538 | QSpan **outSpans, int available) | - | ||||||||||||||||||||||||||||||
| 3539 | { | - | ||||||||||||||||||||||||||||||
| 3540 | const_cast<QClipData *>(clip)->initialize(); | - | ||||||||||||||||||||||||||||||
| 3541 | - | |||||||||||||||||||||||||||||||
| 3542 | QSpan *out = *outSpans; | - | ||||||||||||||||||||||||||||||
| 3543 | - | |||||||||||||||||||||||||||||||
| 3544 | const QSpan *clipSpans = clip->m_spans + *currentClip; | - | ||||||||||||||||||||||||||||||
| 3545 | const QSpan *clipEnd = clip->m_spans + clip->count; | - | ||||||||||||||||||||||||||||||
| 3546 | - | |||||||||||||||||||||||||||||||
| 3547 | while (available
| 0 | ||||||||||||||||||||||||||||||
| 3548 | if (clipSpans >= clipEnd
| 0 | ||||||||||||||||||||||||||||||
| 3549 | spans = end; | - | ||||||||||||||||||||||||||||||
| 3550 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3551 | } | - | ||||||||||||||||||||||||||||||
| 3552 | if (clipSpans->y > spans->y
| 0 | ||||||||||||||||||||||||||||||
| 3553 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3554 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3555 | } | - | ||||||||||||||||||||||||||||||
| 3556 | if (spans->y != clipSpans->y
| 0 | ||||||||||||||||||||||||||||||
| 3557 | if (spans->y < clip->count
| 0 | ||||||||||||||||||||||||||||||
| 3558 | clipSpans = clip->m_clipLines[spans->y].spans; never executed: clipSpans = clip->m_clipLines[spans->y].spans; | 0 | ||||||||||||||||||||||||||||||
| 3559 | else | - | ||||||||||||||||||||||||||||||
| 3560 | ++ never executed: clipSpans;++clipSpans;never executed: ++clipSpans; | 0 | ||||||||||||||||||||||||||||||
| 3561 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3562 | } | - | ||||||||||||||||||||||||||||||
| 3563 | ((!(spans->y == clipSpans->y)) ? qt_assert("spans->y == clipSpans->y",__FILE__,3946) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3564 | - | |||||||||||||||||||||||||||||||
| 3565 | int sx1 = spans->x; | - | ||||||||||||||||||||||||||||||
| 3566 | int sx2 = sx1 + spans->len; | - | ||||||||||||||||||||||||||||||
| 3567 | int cx1 = clipSpans->x; | - | ||||||||||||||||||||||||||||||
| 3568 | int cx2 = cx1 + clipSpans->len; | - | ||||||||||||||||||||||||||||||
| 3569 | - | |||||||||||||||||||||||||||||||
| 3570 | if (cx1 < sx1
| 0 | ||||||||||||||||||||||||||||||
| 3571 | ++clipSpans; | - | ||||||||||||||||||||||||||||||
| 3572 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3573 | } else if (sx1 < cx1
| 0 | ||||||||||||||||||||||||||||||
| 3574 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3575 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3576 | } | - | ||||||||||||||||||||||||||||||
| 3577 | int x = qMax(sx1, cx1); | - | ||||||||||||||||||||||||||||||
| 3578 | int len = qMin(sx2, cx2) - x; | - | ||||||||||||||||||||||||||||||
| 3579 | if (len
| 0 | ||||||||||||||||||||||||||||||
| 3580 | out->x = qMax(sx1, cx1); | - | ||||||||||||||||||||||||||||||
| 3581 | out->len = qMin(sx2, cx2) - out->x; | - | ||||||||||||||||||||||||||||||
| 3582 | out->y = spans->y; | - | ||||||||||||||||||||||||||||||
| 3583 | out->coverage = qt_div_255(spans->coverage * clipSpans->coverage); | - | ||||||||||||||||||||||||||||||
| 3584 | ++out; | - | ||||||||||||||||||||||||||||||
| 3585 | --available; | - | ||||||||||||||||||||||||||||||
| 3586 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3587 | if (sx2 < cx2
| 0 | ||||||||||||||||||||||||||||||
| 3588 | ++spans; | - | ||||||||||||||||||||||||||||||
| 3589 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3590 | ++clipSpans; | - | ||||||||||||||||||||||||||||||
| 3591 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3592 | } | - | ||||||||||||||||||||||||||||||
| 3593 | - | |||||||||||||||||||||||||||||||
| 3594 | *outSpans = out; | - | ||||||||||||||||||||||||||||||
| 3595 | *currentClip = clipSpans - clip->m_spans; | - | ||||||||||||||||||||||||||||||
| 3596 | return never executed: spans;return spans;never executed: return spans; | 0 | ||||||||||||||||||||||||||||||
| 3597 | } | - | ||||||||||||||||||||||||||||||
| 3598 | - | |||||||||||||||||||||||||||||||
| 3599 | static void qt_span_fill_clipped(int spanCount, const QSpan *spans, void *userData) | - | ||||||||||||||||||||||||||||||
| 3600 | { | - | ||||||||||||||||||||||||||||||
| 3601 | - | |||||||||||||||||||||||||||||||
| 3602 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3603 | - | |||||||||||||||||||||||||||||||
| 3604 | ((!(fillData->blend && fillData->unclipped_blend)) ? qt_assert("fillData->blend && fillData->unclipped_blend",__FILE__,3987) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3605 | - | |||||||||||||||||||||||||||||||
| 3606 | const int NSPANS = 256; | - | ||||||||||||||||||||||||||||||
| 3607 | QSpan cspans[NSPANS]; | - | ||||||||||||||||||||||||||||||
| 3608 | int currentClip = 0; | - | ||||||||||||||||||||||||||||||
| 3609 | const QSpan *end = spans + spanCount; | - | ||||||||||||||||||||||||||||||
| 3610 | while (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3611 | QSpan *clipped = cspans; | - | ||||||||||||||||||||||||||||||
| 3612 | spans = qt_intersect_spans(fillData->clip, ¤tClip, spans, end, &clipped, NSPANS); | - | ||||||||||||||||||||||||||||||
| 3613 | - | |||||||||||||||||||||||||||||||
| 3614 | - | |||||||||||||||||||||||||||||||
| 3615 | - | |||||||||||||||||||||||||||||||
| 3616 | if (clipped - cspans
| 0 | ||||||||||||||||||||||||||||||
| 3617 | fillData->unclipped_blend(clipped - cspans, cspans, fillData); never executed: fillData->unclipped_blend(clipped - cspans, cspans, fillData); | 0 | ||||||||||||||||||||||||||||||
| 3618 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3619 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3620 | - | |||||||||||||||||||||||||||||||
| 3621 | - | |||||||||||||||||||||||||||||||
| 3622 | - | |||||||||||||||||||||||||||||||
| 3623 | - | |||||||||||||||||||||||||||||||
| 3624 | - | |||||||||||||||||||||||||||||||
| 3625 | - | |||||||||||||||||||||||||||||||
| 3626 | static int qt_intersect_spans(QT_FT_Span *spans, int numSpans, | - | ||||||||||||||||||||||||||||||
| 3627 | const QRect &clip) | - | ||||||||||||||||||||||||||||||
| 3628 | { | - | ||||||||||||||||||||||||||||||
| 3629 | const short minx = clip.left(); | - | ||||||||||||||||||||||||||||||
| 3630 | const short miny = clip.top(); | - | ||||||||||||||||||||||||||||||
| 3631 | const short maxx = clip.right(); | - | ||||||||||||||||||||||||||||||
| 3632 | const short maxy = clip.bottom(); | - | ||||||||||||||||||||||||||||||
| 3633 | - | |||||||||||||||||||||||||||||||
| 3634 | int n = 0; | - | ||||||||||||||||||||||||||||||
| 3635 | for (int i = 0; i < numSpans
| 0 | ||||||||||||||||||||||||||||||
| 3636 | if (spans[i].y > maxy
| 0 | ||||||||||||||||||||||||||||||
| 3637 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3638 | if (spans[i].y < miny
| 0 | ||||||||||||||||||||||||||||||
| 3639 | || spans[i].x > maxx
| 0 | ||||||||||||||||||||||||||||||
| 3640 | || spans[i].x + spans[i].len <= minx
| 0 | ||||||||||||||||||||||||||||||
| 3641 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3642 | } | - | ||||||||||||||||||||||||||||||
| 3643 | if (spans[i].x < minx
| 0 | ||||||||||||||||||||||||||||||
| 3644 | spans[n].len = qMin(spans[i].len - (minx - spans[i].x), maxx - minx + 1); | - | ||||||||||||||||||||||||||||||
| 3645 | spans[n].x = minx; | - | ||||||||||||||||||||||||||||||
| 3646 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3647 | spans[n].x = spans[i].x; | - | ||||||||||||||||||||||||||||||
| 3648 | spans[n].len = qMin(spans[i].len, ushort(maxx - spans[n].x + 1)); | - | ||||||||||||||||||||||||||||||
| 3649 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3650 | if (spans[n].len == 0
| 0 | ||||||||||||||||||||||||||||||
| 3651 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||
| 3652 | spans[n].y = spans[i].y; | - | ||||||||||||||||||||||||||||||
| 3653 | spans[n].coverage = spans[i].coverage; | - | ||||||||||||||||||||||||||||||
| 3654 | ++n; | - | ||||||||||||||||||||||||||||||
| 3655 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3656 | return never executed: n;return n;never executed: return n; | 0 | ||||||||||||||||||||||||||||||
| 3657 | } | - | ||||||||||||||||||||||||||||||
| 3658 | - | |||||||||||||||||||||||||||||||
| 3659 | - | |||||||||||||||||||||||||||||||
| 3660 | static void qt_span_fill_clipRect(int count, const QSpan *spans, | - | ||||||||||||||||||||||||||||||
| 3661 | void *userData) | - | ||||||||||||||||||||||||||||||
| 3662 | { | - | ||||||||||||||||||||||||||||||
| 3663 | QSpanData *fillData = reinterpret_cast<QSpanData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3664 | ((!(fillData->blend && fillData->unclipped_blend)) ? qt_assert("fillData->blend && fillData->unclipped_blend",__FILE__,4047) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3665 | - | |||||||||||||||||||||||||||||||
| 3666 | ((!(fillData->clip)) ? qt_assert("fillData->clip",__FILE__,4049) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3667 | ((!(!fillData->clip->clipRect.isEmpty())) ? qt_assert("!fillData->clip->clipRect.isEmpty()",__FILE__,4050) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3668 | - | |||||||||||||||||||||||||||||||
| 3669 | - | |||||||||||||||||||||||||||||||
| 3670 | count = qt_intersect_spans(const_cast<QSpan*>(spans), count, | - | ||||||||||||||||||||||||||||||
| 3671 | fillData->clip->clipRect); | - | ||||||||||||||||||||||||||||||
| 3672 | if (count > 0
| 0 | ||||||||||||||||||||||||||||||
| 3673 | fillData->unclipped_blend(count, spans, fillData); never executed: fillData->unclipped_blend(count, spans, fillData); | 0 | ||||||||||||||||||||||||||||||
| 3674 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3675 | - | |||||||||||||||||||||||||||||||
| 3676 | static void qt_span_clip(int count, const QSpan *spans, void *userData) | - | ||||||||||||||||||||||||||||||
| 3677 | { | - | ||||||||||||||||||||||||||||||
| 3678 | ClipData *clipData = reinterpret_cast<ClipData *>(userData); | - | ||||||||||||||||||||||||||||||
| 3679 | - | |||||||||||||||||||||||||||||||
| 3680 | - | |||||||||||||||||||||||||||||||
| 3681 | - | |||||||||||||||||||||||||||||||
| 3682 | - | |||||||||||||||||||||||||||||||
| 3683 | - | |||||||||||||||||||||||||||||||
| 3684 | - | |||||||||||||||||||||||||||||||
| 3685 | switch (clipData->operation) { | - | ||||||||||||||||||||||||||||||
| 3686 | - | |||||||||||||||||||||||||||||||
| 3687 | case never executed: Qt::IntersectClip:case Qt::IntersectClip:never executed: case Qt::IntersectClip: | 0 | ||||||||||||||||||||||||||||||
| 3688 | { | - | ||||||||||||||||||||||||||||||
| 3689 | QClipData *newClip = clipData->newClip; | - | ||||||||||||||||||||||||||||||
| 3690 | newClip->initialize(); | - | ||||||||||||||||||||||||||||||
| 3691 | - | |||||||||||||||||||||||||||||||
| 3692 | int currentClip = 0; | - | ||||||||||||||||||||||||||||||
| 3693 | const QSpan *end = spans + count; | - | ||||||||||||||||||||||||||||||
| 3694 | while (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3695 | QSpan *newspans = newClip->m_spans + newClip->count; | - | ||||||||||||||||||||||||||||||
| 3696 | spans = qt_intersect_spans(clipData->oldClip, ¤tClip, spans, end, | - | ||||||||||||||||||||||||||||||
| 3697 | &newspans, newClip->allocated - newClip->count); | - | ||||||||||||||||||||||||||||||
| 3698 | newClip->count = newspans - newClip->m_spans; | - | ||||||||||||||||||||||||||||||
| 3699 | if (spans < end
| 0 | ||||||||||||||||||||||||||||||
| 3700 | newClip->m_spans = q_check_ptr((QSpan *)realloc(newClip->m_spans, newClip->allocated*2*sizeof(QSpan))); | - | ||||||||||||||||||||||||||||||
| 3701 | newClip->allocated *= 2; | - | ||||||||||||||||||||||||||||||
| 3702 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3703 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3704 | } | - | ||||||||||||||||||||||||||||||
| 3705 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3706 | - | |||||||||||||||||||||||||||||||
| 3707 | case never executed: Qt::ReplaceClip:case Qt::ReplaceClip:never executed: case Qt::ReplaceClip: | 0 | ||||||||||||||||||||||||||||||
| 3708 | clipData->newClip->appendSpans(spans, count); | - | ||||||||||||||||||||||||||||||
| 3709 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3710 | case never executed: Qt::NoClip:case Qt::NoClip:never executed: case Qt::NoClip: | 0 | ||||||||||||||||||||||||||||||
| 3711 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3712 | } | - | ||||||||||||||||||||||||||||||
| 3713 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3714 | - | |||||||||||||||||||||||||||||||
| 3715 | - | |||||||||||||||||||||||||||||||
| 3716 | QImage QRasterBuffer::bufferImage() const | - | ||||||||||||||||||||||||||||||
| 3717 | { | - | ||||||||||||||||||||||||||||||
| 3718 | QImage image(m_width, m_height, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||||||||
| 3719 | - | |||||||||||||||||||||||||||||||
| 3720 | for (int y = 0; y < m_height
| 0 | ||||||||||||||||||||||||||||||
| 3721 | uint *span = (uint *)const_cast<QRasterBuffer *>(this)->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3722 | - | |||||||||||||||||||||||||||||||
| 3723 | for (int x=0; x<m_width
| 0 | ||||||||||||||||||||||||||||||
| 3724 | uint argb = span[x]; | - | ||||||||||||||||||||||||||||||
| 3725 | image.setPixel(x, y, argb); | - | ||||||||||||||||||||||||||||||
| 3726 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3727 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3728 | return never executed: image;return image;never executed: return image; | 0 | ||||||||||||||||||||||||||||||
| 3729 | } | - | ||||||||||||||||||||||||||||||
| 3730 | - | |||||||||||||||||||||||||||||||
| 3731 | - | |||||||||||||||||||||||||||||||
| 3732 | - | |||||||||||||||||||||||||||||||
| 3733 | void QRasterBuffer::flushToARGBImage(QImage *target) const | - | ||||||||||||||||||||||||||||||
| 3734 | { | - | ||||||||||||||||||||||||||||||
| 3735 | int w = qMin(m_width, target->width()); | - | ||||||||||||||||||||||||||||||
| 3736 | int h = qMin(m_height, target->height()); | - | ||||||||||||||||||||||||||||||
| 3737 | - | |||||||||||||||||||||||||||||||
| 3738 | for (int y=0; y<h
| 0 | ||||||||||||||||||||||||||||||
| 3739 | uint *sourceLine = (uint *)const_cast<QRasterBuffer *>(this)->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3740 | QRgb *dest = (QRgb *) target->scanLine(y); | - | ||||||||||||||||||||||||||||||
| 3741 | for (int x=0; x<w
| 0 | ||||||||||||||||||||||||||||||
| 3742 | QRgb pixel = sourceLine[x]; | - | ||||||||||||||||||||||||||||||
| 3743 | int alpha = qAlpha(pixel); | - | ||||||||||||||||||||||||||||||
| 3744 | if (!alpha
| 0 | ||||||||||||||||||||||||||||||
| 3745 | dest[x] = 0; | - | ||||||||||||||||||||||||||||||
| 3746 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 3747 | dest[x] = (alpha << 24) | - | ||||||||||||||||||||||||||||||
| 3748 | | ((255*qRed(pixel)/alpha) << 16) | - | ||||||||||||||||||||||||||||||
| 3749 | | ((255*qGreen(pixel)/alpha) << 8) | - | ||||||||||||||||||||||||||||||
| 3750 | | ((255*qBlue(pixel)/alpha) << 0); | - | ||||||||||||||||||||||||||||||
| 3751 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3752 | } | - | ||||||||||||||||||||||||||||||
| 3753 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3754 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3755 | - | |||||||||||||||||||||||||||||||
| 3756 | - | |||||||||||||||||||||||||||||||
| 3757 | class QGradientCache | - | ||||||||||||||||||||||||||||||
| 3758 | { | - | ||||||||||||||||||||||||||||||
| 3759 | public: | - | ||||||||||||||||||||||||||||||
| 3760 | struct CacheInfo : QSpanData::Pinnable | - | ||||||||||||||||||||||||||||||
| 3761 | { | - | ||||||||||||||||||||||||||||||
| 3762 | inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) : | - | ||||||||||||||||||||||||||||||
| 3763 | stops(std::move(s)), opacity(op), interpolationMode(mode) {} never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3764 | QRgba64 buffer64[1024]; | - | ||||||||||||||||||||||||||||||
| 3765 | QRgb buffer32[1024]; | - | ||||||||||||||||||||||||||||||
| 3766 | QGradientStops stops; | - | ||||||||||||||||||||||||||||||
| 3767 | int opacity; | - | ||||||||||||||||||||||||||||||
| 3768 | QGradient::InterpolationMode interpolationMode; | - | ||||||||||||||||||||||||||||||
| 3769 | }; | - | ||||||||||||||||||||||||||||||
| 3770 | - | |||||||||||||||||||||||||||||||
| 3771 | typedef QMultiHash<quint64, QSharedPointer<const CacheInfo> > QGradientColorTableHash; | - | ||||||||||||||||||||||||||||||
| 3772 | - | |||||||||||||||||||||||||||||||
| 3773 | inline QSharedPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) { | - | ||||||||||||||||||||||||||||||
| 3774 | quint64 hash_val = 0; | - | ||||||||||||||||||||||||||||||
| 3775 | - | |||||||||||||||||||||||||||||||
| 3776 | const QGradientStops stops = gradient.stops(); | - | ||||||||||||||||||||||||||||||
| 3777 | for (int i = 0; i < stops.size()
| 0 | ||||||||||||||||||||||||||||||
| 3778 | hash_val += stops[i].second.rgba64(); never executed: hash_val += stops[i].second.rgba64(); | 0 | ||||||||||||||||||||||||||||||
| 3779 | - | |||||||||||||||||||||||||||||||
| 3780 | QMutexLocker lock(&mutex); | - | ||||||||||||||||||||||||||||||
| 3781 | QGradientColorTableHash::const_iterator it = cache.constFind(hash_val); | - | ||||||||||||||||||||||||||||||
| 3782 | - | |||||||||||||||||||||||||||||||
| 3783 | if (it == cache.constEnd()
| 0 | ||||||||||||||||||||||||||||||
| 3784 | return never executed: addCacheElement(hash_val, gradient, opacity);return addCacheElement(hash_val, gradient, opacity);never executed: return addCacheElement(hash_val, gradient, opacity); | 0 | ||||||||||||||||||||||||||||||
| 3785 | else { | - | ||||||||||||||||||||||||||||||
| 3786 | do { | - | ||||||||||||||||||||||||||||||
| 3787 | const QSharedPointer<const CacheInfo> &cache_info = it.value(); | - | ||||||||||||||||||||||||||||||
| 3788 | if (cache_info->stops == stops
| 0 | ||||||||||||||||||||||||||||||
| 3789 | return never executed: cache_info;return cache_info;never executed: return cache_info; | 0 | ||||||||||||||||||||||||||||||
| 3790 | ++it; | - | ||||||||||||||||||||||||||||||
| 3791 | } never executed: while (it != cache.constEnd()end of block
| 0 | ||||||||||||||||||||||||||||||
| 3792 | - | |||||||||||||||||||||||||||||||
| 3793 | return never executed: addCacheElement(hash_val, gradient, opacity);return addCacheElement(hash_val, gradient, opacity);never executed: return addCacheElement(hash_val, gradient, opacity); | 0 | ||||||||||||||||||||||||||||||
| 3794 | } | - | ||||||||||||||||||||||||||||||
| 3795 | } | - | ||||||||||||||||||||||||||||||
| 3796 | - | |||||||||||||||||||||||||||||||
| 3797 | inline int paletteSize() const { return never executed: 1024;return 1024;never executed: }return 1024; | 0 | ||||||||||||||||||||||||||||||
| 3798 | protected: | - | ||||||||||||||||||||||||||||||
| 3799 | inline int maxCacheSize() const { return never executed: 60;return 60;never executed: }return 60; | 0 | ||||||||||||||||||||||||||||||
| 3800 | inline void generateGradientColorTable(const QGradient& g, | - | ||||||||||||||||||||||||||||||
| 3801 | QRgba64 *colorTable, | - | ||||||||||||||||||||||||||||||
| 3802 | int size, int opacity) const; | - | ||||||||||||||||||||||||||||||
| 3803 | QSharedPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) { | - | ||||||||||||||||||||||||||||||
| 3804 | if (cache.size() == maxCacheSize()
| 0 | ||||||||||||||||||||||||||||||
| 3805 | - | |||||||||||||||||||||||||||||||
| 3806 | cache.erase(cache.begin() + (qrand() % maxCacheSize())); | - | ||||||||||||||||||||||||||||||
| 3807 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3808 | QSharedPointer<CacheInfo> cache_entry(new CacheInfo(gradient.stops(), opacity, gradient.interpolationMode())); | - | ||||||||||||||||||||||||||||||
| 3809 | generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity); | - | ||||||||||||||||||||||||||||||
| 3810 | for (int i = 0; i < 1024
| 0 | ||||||||||||||||||||||||||||||
| 3811 | cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32(); never executed: cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32(); | 0 | ||||||||||||||||||||||||||||||
| 3812 | 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 | ||||||||||||||||||||||||||||||
| 3813 | } | - | ||||||||||||||||||||||||||||||
| 3814 | - | |||||||||||||||||||||||||||||||
| 3815 | QGradientColorTableHash cache; | - | ||||||||||||||||||||||||||||||
| 3816 | QMutex mutex; | - | ||||||||||||||||||||||||||||||
| 3817 | }; | - | ||||||||||||||||||||||||||||||
| 3818 | - | |||||||||||||||||||||||||||||||
| 3819 | void QGradientCache::generateGradientColorTable(const QGradient& gradient, QRgba64 *colorTable, int size, int opacity) const | - | ||||||||||||||||||||||||||||||
| 3820 | { | - | ||||||||||||||||||||||||||||||
| 3821 | const QGradientStops stops = gradient.stops(); | - | ||||||||||||||||||||||||||||||
| 3822 | int stopCount = stops.count(); | - | ||||||||||||||||||||||||||||||
| 3823 | ((!(stopCount > 0)) ? qt_assert("stopCount > 0",__FILE__,4206) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3824 | - | |||||||||||||||||||||||||||||||
| 3825 | bool colorInterpolation = (gradient.interpolationMode() == QGradient::ColorInterpolation); | - | ||||||||||||||||||||||||||||||
| 3826 | - | |||||||||||||||||||||||||||||||
| 3827 | if (stopCount == 2
| 0 | ||||||||||||||||||||||||||||||
| 3828 | QRgba64 first_color = combineAlpha256(stops[0].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3829 | QRgba64 second_color = combineAlpha256(stops[1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3830 | - | |||||||||||||||||||||||||||||||
| 3831 | qreal first_stop = stops[0].first; | - | ||||||||||||||||||||||||||||||
| 3832 | qreal second_stop = stops[1].first; | - | ||||||||||||||||||||||||||||||
| 3833 | - | |||||||||||||||||||||||||||||||
| 3834 | if (second_stop < first_stop
| 0 | ||||||||||||||||||||||||||||||
| 3835 | quint64 tmp = first_color; | - | ||||||||||||||||||||||||||||||
| 3836 | first_color = second_color; | - | ||||||||||||||||||||||||||||||
| 3837 | second_color = tmp; | - | ||||||||||||||||||||||||||||||
| 3838 | qSwap(first_stop, second_stop); | - | ||||||||||||||||||||||||||||||
| 3839 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3840 | - | |||||||||||||||||||||||||||||||
| 3841 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3842 | first_color = qPremultiply(first_color); | - | ||||||||||||||||||||||||||||||
| 3843 | second_color = qPremultiply(second_color); | - | ||||||||||||||||||||||||||||||
| 3844 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3845 | - | |||||||||||||||||||||||||||||||
| 3846 | int first_index = qRound(first_stop * (1024 -1)); | - | ||||||||||||||||||||||||||||||
| 3847 | int second_index = qRound(second_stop * (1024 -1)); | - | ||||||||||||||||||||||||||||||
| 3848 | - | |||||||||||||||||||||||||||||||
| 3849 | uint red_first = uint(first_color.red()) << 16; | - | ||||||||||||||||||||||||||||||
| 3850 | uint green_first = uint(first_color.green()) << 16; | - | ||||||||||||||||||||||||||||||
| 3851 | uint blue_first = uint(first_color.blue()) << 16; | - | ||||||||||||||||||||||||||||||
| 3852 | uint alpha_first = uint(first_color.alpha()) << 16; | - | ||||||||||||||||||||||||||||||
| 3853 | - | |||||||||||||||||||||||||||||||
| 3854 | uint red_second = uint(second_color.red()) << 16; | - | ||||||||||||||||||||||||||||||
| 3855 | uint green_second = uint(second_color.green()) << 16; | - | ||||||||||||||||||||||||||||||
| 3856 | uint blue_second = uint(second_color.blue()) << 16; | - | ||||||||||||||||||||||||||||||
| 3857 | uint alpha_second = uint(second_color.alpha()) << 16; | - | ||||||||||||||||||||||||||||||
| 3858 | - | |||||||||||||||||||||||||||||||
| 3859 | int i = 0; | - | ||||||||||||||||||||||||||||||
| 3860 | for (; i <= qMin(1024, first_index)
| 0 | ||||||||||||||||||||||||||||||
| 3861 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3862 | colorTable[i] = first_color; never executed: colorTable[i] = first_color; | 0 | ||||||||||||||||||||||||||||||
| 3863 | else | - | ||||||||||||||||||||||||||||||
| 3864 | colorTable[i] = qPremultiply(first_color); never executed: colorTable[i] = qPremultiply(first_color); | 0 | ||||||||||||||||||||||||||||||
| 3865 | } | - | ||||||||||||||||||||||||||||||
| 3866 | - | |||||||||||||||||||||||||||||||
| 3867 | if (i < second_index
| 0 | ||||||||||||||||||||||||||||||
| 3868 | qreal reciprocal = qreal(1) / (second_index - first_index); | - | ||||||||||||||||||||||||||||||
| 3869 | - | |||||||||||||||||||||||||||||||
| 3870 | int red_delta = qRound((qreal(red_second) - red_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3871 | int green_delta = qRound((qreal(green_second) - green_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3872 | int blue_delta = qRound((qreal(blue_second) - blue_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3873 | int alpha_delta = qRound((qreal(alpha_second) - alpha_first) * reciprocal); | - | ||||||||||||||||||||||||||||||
| 3874 | - | |||||||||||||||||||||||||||||||
| 3875 | - | |||||||||||||||||||||||||||||||
| 3876 | red_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3877 | green_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3878 | blue_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3879 | alpha_first += 1 << 15; | - | ||||||||||||||||||||||||||||||
| 3880 | - | |||||||||||||||||||||||||||||||
| 3881 | for (; i < qMin(1024, second_index)
| 0 | ||||||||||||||||||||||||||||||
| 3882 | red_first += red_delta; | - | ||||||||||||||||||||||||||||||
| 3883 | green_first += green_delta; | - | ||||||||||||||||||||||||||||||
| 3884 | blue_first += blue_delta; | - | ||||||||||||||||||||||||||||||
| 3885 | alpha_first += alpha_delta; | - | ||||||||||||||||||||||||||||||
| 3886 | - | |||||||||||||||||||||||||||||||
| 3887 | const QRgba64 color = qRgba64(red_first >> 16, green_first >> 16, blue_first >> 16, alpha_first >> 16); | - | ||||||||||||||||||||||||||||||
| 3888 | - | |||||||||||||||||||||||||||||||
| 3889 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3890 | colorTable[i] = color; never executed: colorTable[i] = color; | 0 | ||||||||||||||||||||||||||||||
| 3891 | else | - | ||||||||||||||||||||||||||||||
| 3892 | colorTable[i] = qPremultiply(color); never executed: colorTable[i] = qPremultiply(color); | 0 | ||||||||||||||||||||||||||||||
| 3893 | } | - | ||||||||||||||||||||||||||||||
| 3894 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3895 | - | |||||||||||||||||||||||||||||||
| 3896 | for (; i < 1024
| 0 | ||||||||||||||||||||||||||||||
| 3897 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3898 | colorTable[i] = second_color; never executed: colorTable[i] = second_color; | 0 | ||||||||||||||||||||||||||||||
| 3899 | else | - | ||||||||||||||||||||||||||||||
| 3900 | colorTable[i] = qPremultiply(second_color); never executed: colorTable[i] = qPremultiply(second_color); | 0 | ||||||||||||||||||||||||||||||
| 3901 | } | - | ||||||||||||||||||||||||||||||
| 3902 | - | |||||||||||||||||||||||||||||||
| 3903 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3904 | } | - | ||||||||||||||||||||||||||||||
| 3905 | - | |||||||||||||||||||||||||||||||
| 3906 | QRgba64 current_color = combineAlpha256(stops[0].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3907 | if (stopCount == 1
| 0 | ||||||||||||||||||||||||||||||
| 3908 | current_color = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3909 | for (int i = 0; i < size
| 0 | ||||||||||||||||||||||||||||||
| 3910 | colorTable[i] = current_color; never executed: colorTable[i] = current_color; | 0 | ||||||||||||||||||||||||||||||
| 3911 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 3912 | } | - | ||||||||||||||||||||||||||||||
| 3913 | - | |||||||||||||||||||||||||||||||
| 3914 | - | |||||||||||||||||||||||||||||||
| 3915 | qreal begin_pos = stops[0].first; | - | ||||||||||||||||||||||||||||||
| 3916 | qreal end_pos = stops[stopCount-1].first; | - | ||||||||||||||||||||||||||||||
| 3917 | - | |||||||||||||||||||||||||||||||
| 3918 | int pos = 0; | - | ||||||||||||||||||||||||||||||
| 3919 | QRgba64 next_color; | - | ||||||||||||||||||||||||||||||
| 3920 | - | |||||||||||||||||||||||||||||||
| 3921 | qreal incr = 1 / qreal(size); | - | ||||||||||||||||||||||||||||||
| 3922 | qreal dpos = 1.5 * incr; | - | ||||||||||||||||||||||||||||||
| 3923 | - | |||||||||||||||||||||||||||||||
| 3924 | - | |||||||||||||||||||||||||||||||
| 3925 | colorTable[pos++] = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3926 | while (dpos <= begin_pos
| 0 | ||||||||||||||||||||||||||||||
| 3927 | colorTable[pos] = colorTable[pos - 1]; | - | ||||||||||||||||||||||||||||||
| 3928 | ++pos; | - | ||||||||||||||||||||||||||||||
| 3929 | dpos += incr; | - | ||||||||||||||||||||||||||||||
| 3930 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3931 | - | |||||||||||||||||||||||||||||||
| 3932 | int current_stop = 0; | - | ||||||||||||||||||||||||||||||
| 3933 | - | |||||||||||||||||||||||||||||||
| 3934 | qreal t; | - | ||||||||||||||||||||||||||||||
| 3935 | qreal t_delta; | - | ||||||||||||||||||||||||||||||
| 3936 | - | |||||||||||||||||||||||||||||||
| 3937 | if (dpos < end_pos
| 0 | ||||||||||||||||||||||||||||||
| 3938 | - | |||||||||||||||||||||||||||||||
| 3939 | while (dpos > stops[current_stop+1].first
| 0 | ||||||||||||||||||||||||||||||
| 3940 | ++ never executed: current_stop;++current_stop;never executed: ++current_stop; | 0 | ||||||||||||||||||||||||||||||
| 3941 | - | |||||||||||||||||||||||||||||||
| 3942 | if (current_stop != 0
| 0 | ||||||||||||||||||||||||||||||
| 3943 | current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); never executed: current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); | 0 | ||||||||||||||||||||||||||||||
| 3944 | next_color = combineAlpha256(stops[current_stop+1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3945 | - | |||||||||||||||||||||||||||||||
| 3946 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3947 | current_color = qPremultiply(current_color); | - | ||||||||||||||||||||||||||||||
| 3948 | next_color = qPremultiply(next_color); | - | ||||||||||||||||||||||||||||||
| 3949 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3950 | - | |||||||||||||||||||||||||||||||
| 3951 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - | ||||||||||||||||||||||||||||||
| 3952 | qreal c = (
| 0 | ||||||||||||||||||||||||||||||
| 3953 | t = (dpos - stops[current_stop].first) * c; | - | ||||||||||||||||||||||||||||||
| 3954 | t_delta = incr * c; | - | ||||||||||||||||||||||||||||||
| 3955 | - | |||||||||||||||||||||||||||||||
| 3956 | while (true) { | - | ||||||||||||||||||||||||||||||
| 3957 | ((!(current_stop < stopCount)) ? qt_assert("current_stop < stopCount",__FILE__,4340) : qt_noop()); | - | ||||||||||||||||||||||||||||||
| 3958 | - | |||||||||||||||||||||||||||||||
| 3959 | int dist = qRound(t); | - | ||||||||||||||||||||||||||||||
| 3960 | int idist = 256 - dist; | - | ||||||||||||||||||||||||||||||
| 3961 | - | |||||||||||||||||||||||||||||||
| 3962 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3963 | colorTable[pos] = interpolate256(current_color, idist, next_color, dist); never executed: colorTable[pos] = interpolate256(current_color, idist, next_color, dist); | 0 | ||||||||||||||||||||||||||||||
| 3964 | else | - | ||||||||||||||||||||||||||||||
| 3965 | colorTable[pos] = qPremultiply(interpolate256(current_color, idist, next_color, dist)); never executed: colorTable[pos] = qPremultiply(interpolate256(current_color, idist, next_color, dist)); | 0 | ||||||||||||||||||||||||||||||
| 3966 | - | |||||||||||||||||||||||||||||||
| 3967 | ++pos; | - | ||||||||||||||||||||||||||||||
| 3968 | dpos += incr; | - | ||||||||||||||||||||||||||||||
| 3969 | - | |||||||||||||||||||||||||||||||
| 3970 | if (dpos >= end_pos
| 0 | ||||||||||||||||||||||||||||||
| 3971 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 3972 | - | |||||||||||||||||||||||||||||||
| 3973 | t += t_delta; | - | ||||||||||||||||||||||||||||||
| 3974 | - | |||||||||||||||||||||||||||||||
| 3975 | int skip = 0; | - | ||||||||||||||||||||||||||||||
| 3976 | while (dpos > stops[current_stop+skip+1].first
| 0 | ||||||||||||||||||||||||||||||
| 3977 | ++ never executed: skip;++skip;never executed: ++skip; | 0 | ||||||||||||||||||||||||||||||
| 3978 | - | |||||||||||||||||||||||||||||||
| 3979 | if (skip != 0
| 0 | ||||||||||||||||||||||||||||||
| 3980 | current_stop += skip; | - | ||||||||||||||||||||||||||||||
| 3981 | if (skip == 1
| 0 | ||||||||||||||||||||||||||||||
| 3982 | current_color = next_color; never executed: current_color = next_color; | 0 | ||||||||||||||||||||||||||||||
| 3983 | else | - | ||||||||||||||||||||||||||||||
| 3984 | current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); never executed: current_color = combineAlpha256(stops[current_stop].second.rgba64(), opacity); | 0 | ||||||||||||||||||||||||||||||
| 3985 | next_color = combineAlpha256(stops[current_stop+1].second.rgba64(), opacity); | - | ||||||||||||||||||||||||||||||
| 3986 | - | |||||||||||||||||||||||||||||||
| 3987 | if (colorInterpolation
| 0 | ||||||||||||||||||||||||||||||
| 3988 | if (skip != 1
| 0 | ||||||||||||||||||||||||||||||
| 3989 | current_color = qPremultiply(current_color); never executed: current_color = qPremultiply(current_color); | 0 | ||||||||||||||||||||||||||||||
| 3990 | next_color = qPremultiply(next_color); | - | ||||||||||||||||||||||||||||||
| 3991 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3992 | - | |||||||||||||||||||||||||||||||
| 3993 | qreal diff = stops[current_stop+1].first - stops[current_stop].first; | - | ||||||||||||||||||||||||||||||
| 3994 | qreal c = (
| 0 | ||||||||||||||||||||||||||||||
| 3995 | t = (dpos - stops[current_stop].first) * c; | - | ||||||||||||||||||||||||||||||
| 3996 | t_delta = incr * c; | - | ||||||||||||||||||||||||||||||
| 3997 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3998 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 3999 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4000 | - | |||||||||||||||||||||||||||||||
| 4001 | - | |||||||||||||||||||||||||||||||
| 4002 | current_color = qPremultiply(combineAlpha256(stops[stopCount - 1].second.rgba64(), opacity)); | - | ||||||||||||||||||||||||||||||
| 4003 | while (pos < size - 1
| 0 | ||||||||||||||||||||||||||||||
| 4004 | colorTable[pos] = current_color; | - | ||||||||||||||||||||||||||||||
| 4005 | ++pos; | - | ||||||||||||||||||||||||||||||
| 4006 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4007 | - | |||||||||||||||||||||||||||||||
| 4008 | - | |||||||||||||||||||||||||||||||
| 4009 | colorTable[size - 1] = current_color; | - | ||||||||||||||||||||||||||||||
| 4010 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4011 | - | |||||||||||||||||||||||||||||||
| 4012 | 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 | ||||||||||||||||||||||||||||||
| 4013 | - | |||||||||||||||||||||||||||||||
| 4014 | - | |||||||||||||||||||||||||||||||
| 4015 | void QSpanData::init(QRasterBuffer *rb, const QRasterPaintEngine *pe) | - | ||||||||||||||||||||||||||||||
| 4016 | { | - | ||||||||||||||||||||||||||||||
| 4017 | rasterBuffer = rb; | - | ||||||||||||||||||||||||||||||
| 4018 | type = None; | - | ||||||||||||||||||||||||||||||
| 4019 | txop = 0; | - | ||||||||||||||||||||||||||||||
| 4020 | bilinear = false; | - | ||||||||||||||||||||||||||||||
| 4021 | m11 = m22 = m33 = 1.; | - | ||||||||||||||||||||||||||||||
| 4022 | m12 = m13 = m21 = m23 = dx = dy = 0.0; | - | ||||||||||||||||||||||||||||||
| 4023 | clip = pe
| 0 | ||||||||||||||||||||||||||||||
| 4024 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4025 | - | |||||||||||||||||||||||||||||||
| 4026 | __attribute__((visibility("default"))) extern QImage qt_imageForBrush(int brushStyle, bool invert); | - | ||||||||||||||||||||||||||||||
| 4027 | - | |||||||||||||||||||||||||||||||
| 4028 | void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode compositionMode) | - | ||||||||||||||||||||||||||||||
| 4029 | { | - | ||||||||||||||||||||||||||||||
| 4030 | Qt::BrushStyle brushStyle = qbrush_style(brush); | - | ||||||||||||||||||||||||||||||
| 4031 | cachedGradient.reset(); | - | ||||||||||||||||||||||||||||||
| 4032 | switch (brushStyle) { | - | ||||||||||||||||||||||||||||||
| 4033 | case never executed: Qt::SolidPattern:case Qt::SolidPattern:never executed: {case Qt::SolidPattern: | 0 | ||||||||||||||||||||||||||||||
| 4034 | type = Solid; | - | ||||||||||||||||||||||||||||||
| 4035 | QColor c = qbrush_color(brush); | - | ||||||||||||||||||||||||||||||
| 4036 | solid.color = qPremultiply(combineAlpha256(c.rgba64(), alpha)); | - | ||||||||||||||||||||||||||||||
| 4037 | if (solid.color.isTransparent()
| 0 | ||||||||||||||||||||||||||||||
| 4038 | type = None; never executed: type = None; | 0 | ||||||||||||||||||||||||||||||
| 4039 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4040 | } | - | ||||||||||||||||||||||||||||||
| 4041 | - | |||||||||||||||||||||||||||||||
| 4042 | case never executed: Qt::LinearGradientPattern:case Qt::LinearGradientPattern:never executed: case Qt::LinearGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4043 | { | - | ||||||||||||||||||||||||||||||
| 4044 | type = LinearGradient; | - | ||||||||||||||||||||||||||||||
| 4045 | const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4046 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4047 | - | |||||||||||||||||||||||||||||||
| 4048 | QSharedPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4049 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4050 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4051 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4052 | - | |||||||||||||||||||||||||||||||
| 4053 | gradient.spread = g->spread(); | - | ||||||||||||||||||||||||||||||
| 4054 | - | |||||||||||||||||||||||||||||||
| 4055 | QLinearGradientData &linearData = gradient.linear; | - | ||||||||||||||||||||||||||||||
| 4056 | - | |||||||||||||||||||||||||||||||
| 4057 | linearData.origin.x = g->start().x(); | - | ||||||||||||||||||||||||||||||
| 4058 | linearData.origin.y = g->start().y(); | - | ||||||||||||||||||||||||||||||
| 4059 | linearData.end.x = g->finalStop().x(); | - | ||||||||||||||||||||||||||||||
| 4060 | linearData.end.y = g->finalStop().y(); | - | ||||||||||||||||||||||||||||||
| 4061 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4062 | } | - | ||||||||||||||||||||||||||||||
| 4063 | - | |||||||||||||||||||||||||||||||
| 4064 | case never executed: Qt::RadialGradientPattern:case Qt::RadialGradientPattern:never executed: case Qt::RadialGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4065 | { | - | ||||||||||||||||||||||||||||||
| 4066 | type = RadialGradient; | - | ||||||||||||||||||||||||||||||
| 4067 | const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4068 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4069 | - | |||||||||||||||||||||||||||||||
| 4070 | QSharedPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4071 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4072 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4073 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4074 | - | |||||||||||||||||||||||||||||||
| 4075 | gradient.spread = g->spread(); | - | ||||||||||||||||||||||||||||||
| 4076 | - | |||||||||||||||||||||||||||||||
| 4077 | QRadialGradientData &radialData = gradient.radial; | - | ||||||||||||||||||||||||||||||
| 4078 | - | |||||||||||||||||||||||||||||||
| 4079 | QPointF center = g->center(); | - | ||||||||||||||||||||||||||||||
| 4080 | radialData.center.x = center.x(); | - | ||||||||||||||||||||||||||||||
| 4081 | radialData.center.y = center.y(); | - | ||||||||||||||||||||||||||||||
| 4082 | radialData.center.radius = g->centerRadius(); | - | ||||||||||||||||||||||||||||||
| 4083 | QPointF focal = g->focalPoint(); | - | ||||||||||||||||||||||||||||||
| 4084 | radialData.focal.x = focal.x(); | - | ||||||||||||||||||||||||||||||
| 4085 | radialData.focal.y = focal.y(); | - | ||||||||||||||||||||||||||||||
| 4086 | radialData.focal.radius = g->focalRadius(); | - | ||||||||||||||||||||||||||||||
| 4087 | } | - | ||||||||||||||||||||||||||||||
| 4088 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4089 | - | |||||||||||||||||||||||||||||||
| 4090 | case never executed: Qt::ConicalGradientPattern:case Qt::ConicalGradientPattern:never executed: case Qt::ConicalGradientPattern: | 0 | ||||||||||||||||||||||||||||||
| 4091 | { | - | ||||||||||||||||||||||||||||||
| 4092 | type = ConicalGradient; | - | ||||||||||||||||||||||||||||||
| 4093 | const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient()); | - | ||||||||||||||||||||||||||||||
| 4094 | gradient.alphaColor = !brush.isOpaque()
| 0 | ||||||||||||||||||||||||||||||
| 4095 | - | |||||||||||||||||||||||||||||||
| 4096 | QSharedPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha); | - | ||||||||||||||||||||||||||||||
| 4097 | cachedGradient = cacheInfo; | - | ||||||||||||||||||||||||||||||
| 4098 | gradient.colorTable32 = cacheInfo->buffer32; | - | ||||||||||||||||||||||||||||||
| 4099 | gradient.colorTable64 = cacheInfo->buffer64; | - | ||||||||||||||||||||||||||||||
| 4100 | - | |||||||||||||||||||||||||||||||
| 4101 | gradient.spread = QGradient::RepeatSpread; | - | ||||||||||||||||||||||||||||||
| 4102 | - | |||||||||||||||||||||||||||||||
| 4103 | QConicalGradientData &conicalData = gradient.conical; | - | ||||||||||||||||||||||||||||||
| 4104 | - | |||||||||||||||||||||||||||||||
| 4105 | QPointF center = g->center(); | - | ||||||||||||||||||||||||||||||
| 4106 | conicalData.center.x = center.x(); | - | ||||||||||||||||||||||||||||||
| 4107 | conicalData.center.y = center.y(); | - | ||||||||||||||||||||||||||||||
| 4108 | conicalData.angle = qDegreesToRadians(g->angle()); | - | ||||||||||||||||||||||||||||||
| 4109 | } | - | ||||||||||||||||||||||||||||||
| 4110 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4111 | - | |||||||||||||||||||||||||||||||
| 4112 | case never executed: Qt::Dense1Pattern:case Qt::Dense1Pattern:never executed: case Qt::Dense1Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4113 | case never executed: Qt::Dense2Pattern:case Qt::Dense2Pattern:never executed: case Qt::Dense2Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4114 | case never executed: Qt::Dense3Pattern:case Qt::Dense3Pattern:never executed: case Qt::Dense3Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4115 | case never executed: Qt::Dense4Pattern:case Qt::Dense4Pattern:never executed: case Qt::Dense4Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4116 | case never executed: Qt::Dense5Pattern:case Qt::Dense5Pattern:never executed: case Qt::Dense5Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4117 | case never executed: Qt::Dense6Pattern:case Qt::Dense6Pattern:never executed: case Qt::Dense6Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4118 | case never executed: Qt::Dense7Pattern:case Qt::Dense7Pattern:never executed: case Qt::Dense7Pattern: | 0 | ||||||||||||||||||||||||||||||
| 4119 | case never executed: Qt::HorPattern:case Qt::HorPattern:never executed: case Qt::HorPattern: | 0 | ||||||||||||||||||||||||||||||
| 4120 | case never executed: Qt::VerPattern:case Qt::VerPattern:never executed: case Qt::VerPattern: | 0 | ||||||||||||||||||||||||||||||
| 4121 | case never executed: Qt::CrossPattern:case Qt::CrossPattern:never executed: case Qt::CrossPattern: | 0 | ||||||||||||||||||||||||||||||
| 4122 | case never executed: Qt::BDiagPattern:case Qt::BDiagPattern:never executed: case Qt::BDiagPattern: | 0 | ||||||||||||||||||||||||||||||
| 4123 | case never executed: Qt::FDiagPattern:case Qt::FDiagPattern:never executed: case Qt::FDiagPattern: | 0 | ||||||||||||||||||||||||||||||
| 4124 | case never executed: Qt::DiagCrossPattern:case Qt::DiagCrossPattern:never executed: case Qt::DiagCrossPattern: | 0 | ||||||||||||||||||||||||||||||
| 4125 | type = Texture; | - | ||||||||||||||||||||||||||||||
| 4126 | if (!tempImage
| 0 | ||||||||||||||||||||||||||||||
| 4127 | tempImage = new QImage(); never executed: tempImage = new QImage(); | 0 | ||||||||||||||||||||||||||||||
| 4128 | *tempImage = rasterBuffer->colorizeBitmap(qt_imageForBrush(brushStyle, true), brush.color()); | - | ||||||||||||||||||||||||||||||
| 4129 | initTexture(tempImage, alpha, QTextureData::Tiled); | - | ||||||||||||||||||||||||||||||
| 4130 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4131 | case never executed: Qt::TexturePattern:case Qt::TexturePattern:never executed: case Qt::TexturePattern: | 0 | ||||||||||||||||||||||||||||||
| 4132 | type = Texture; | - | ||||||||||||||||||||||||||||||
| 4133 | if (!tempImage
| 0 | ||||||||||||||||||||||||||||||
| 4134 | tempImage = new QImage(); never executed: tempImage = new QImage(); | 0 | ||||||||||||||||||||||||||||||
| 4135 | - | |||||||||||||||||||||||||||||||
| 4136 | if (qHasPixmapTexture(brush)
| 0 | ||||||||||||||||||||||||||||||
| 4137 | * 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 | ||||||||||||||||||||||||||||||
| 4138 | else | - | ||||||||||||||||||||||||||||||
| 4139 | * never executed: tempImage = brush.textureImage();*tempImage = brush.textureImage();never executed: *tempImage = brush.textureImage(); | 0 | ||||||||||||||||||||||||||||||
| 4140 | initTexture(tempImage, alpha, QTextureData::Tiled, tempImage->rect()); | - | ||||||||||||||||||||||||||||||
| 4141 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4142 | - | |||||||||||||||||||||||||||||||
| 4143 | case never executed: Qt::NoBrush:case Qt::NoBrush:never executed: case Qt::NoBrush: | 0 | ||||||||||||||||||||||||||||||
| 4144 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||
| 4145 | type = None; | - | ||||||||||||||||||||||||||||||
| 4146 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4147 | } | - | ||||||||||||||||||||||||||||||
| 4148 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4149 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4150 | - | |||||||||||||||||||||||||||||||
| 4151 | void QSpanData::adjustSpanMethods() | - | ||||||||||||||||||||||||||||||
| 4152 | { | - | ||||||||||||||||||||||||||||||
| 4153 | bitmapBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4154 | alphamapBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4155 | alphaRGBBlit = 0; | - | ||||||||||||||||||||||||||||||
| 4156 | - | |||||||||||||||||||||||||||||||
| 4157 | fillRect = 0; | - | ||||||||||||||||||||||||||||||
| 4158 | - | |||||||||||||||||||||||||||||||
| 4159 | switch(type) { | - | ||||||||||||||||||||||||||||||
| 4160 | case never executed: None:case None:never executed: case None: | 0 | ||||||||||||||||||||||||||||||
| 4161 | unclipped_blend = 0; | - | ||||||||||||||||||||||||||||||
| 4162 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4163 | case never executed: Solid:case Solid:never executed: case Solid: | 0 | ||||||||||||||||||||||||||||||
| 4164 | unclipped_blend = rasterBuffer->drawHelper->blendColor; | - | ||||||||||||||||||||||||||||||
| 4165 | bitmapBlit = rasterBuffer->drawHelper->bitmapBlit; | - | ||||||||||||||||||||||||||||||
| 4166 | alphamapBlit = rasterBuffer->drawHelper->alphamapBlit; | - | ||||||||||||||||||||||||||||||
| 4167 | alphaRGBBlit = rasterBuffer->drawHelper->alphaRGBBlit; | - | ||||||||||||||||||||||||||||||
| 4168 | fillRect = rasterBuffer->drawHelper->fillRect; | - | ||||||||||||||||||||||||||||||
| 4169 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4170 | case never executed: LinearGradient:case LinearGradient:never executed: case LinearGradient: | 0 | ||||||||||||||||||||||||||||||
| 4171 | case never executed: RadialGradient:case RadialGradient:never executed: case RadialGradient: | 0 | ||||||||||||||||||||||||||||||
| 4172 | case never executed: ConicalGradient:case ConicalGradient:never executed: case ConicalGradient: | 0 | ||||||||||||||||||||||||||||||
| 4173 | unclipped_blend = rasterBuffer->drawHelper->blendGradient; | - | ||||||||||||||||||||||||||||||
| 4174 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4175 | case never executed: Texture:case Texture:never executed: case Texture: | 0 | ||||||||||||||||||||||||||||||
| 4176 | unclipped_blend = qBlendTexture; | - | ||||||||||||||||||||||||||||||
| 4177 | if (!texture.imageData
| 0 | ||||||||||||||||||||||||||||||
| 4178 | unclipped_blend = 0; never executed: unclipped_blend = 0; | 0 | ||||||||||||||||||||||||||||||
| 4179 | - | |||||||||||||||||||||||||||||||
| 4180 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
| 4181 | } | - | ||||||||||||||||||||||||||||||
| 4182 | - | |||||||||||||||||||||||||||||||
| 4183 | if (!unclipped_blend
| 0 | ||||||||||||||||||||||||||||||
| 4184 | blend = 0; | - | ||||||||||||||||||||||||||||||
| 4185 | } never executed: else if (!clipend of block
| 0 | ||||||||||||||||||||||||||||||
| 4186 | blend = unclipped_blend; | - | ||||||||||||||||||||||||||||||
| 4187 | } never executed: else if (clip->hasRectClipend of block
| 0 | ||||||||||||||||||||||||||||||
| 4188 | blend = clip->clipRect.isEmpty()
| 0 | ||||||||||||||||||||||||||||||
| 4189 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4190 | blend = qt_span_fill_clipped; | - | ||||||||||||||||||||||||||||||
| 4191 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4192 | } | - | ||||||||||||||||||||||||||||||
| 4193 | - | |||||||||||||||||||||||||||||||
| 4194 | void QSpanData::setupMatrix(const QTransform &matrix, int bilin) | - | ||||||||||||||||||||||||||||||
| 4195 | { | - | ||||||||||||||||||||||||||||||
| 4196 | QTransform delta; | - | ||||||||||||||||||||||||||||||
| 4197 | - | |||||||||||||||||||||||||||||||
| 4198 | delta.translate(1.0 / 65536, 1.0 / 65536); | - | ||||||||||||||||||||||||||||||
| 4199 | - | |||||||||||||||||||||||||||||||
| 4200 | QTransform inv = (delta * matrix).inverted(); | - | ||||||||||||||||||||||||||||||
| 4201 | m11 = inv.m11(); | - | ||||||||||||||||||||||||||||||
| 4202 | m12 = inv.m12(); | - | ||||||||||||||||||||||||||||||
| 4203 | m13 = inv.m13(); | - | ||||||||||||||||||||||||||||||
| 4204 | m21 = inv.m21(); | - | ||||||||||||||||||||||||||||||
| 4205 | m22 = inv.m22(); | - | ||||||||||||||||||||||||||||||
| 4206 | m23 = inv.m23(); | - | ||||||||||||||||||||||||||||||
| 4207 | m33 = inv.m33(); | - | ||||||||||||||||||||||||||||||
| 4208 | dx = inv.dx(); | - | ||||||||||||||||||||||||||||||
| 4209 | dy = inv.dy(); | - | ||||||||||||||||||||||||||||||
| 4210 | txop = inv.type(); | - | ||||||||||||||||||||||||||||||
| 4211 | bilinear = bilin; | - | ||||||||||||||||||||||||||||||
| 4212 | - | |||||||||||||||||||||||||||||||
| 4213 | const bool affine = inv.isAffine(); | - | ||||||||||||||||||||||||||||||
| 4214 | fast_matrix = affine
| 0 | ||||||||||||||||||||||||||||||
| 4215 | && m11 * m11 + m21 * m21 < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4216 | && m12 * m12 + m22 * m22 < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4217 | && qAbs(dx) < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4218 | && qAbs(dy) < 1e4
| 0 | ||||||||||||||||||||||||||||||
| 4219 | - | |||||||||||||||||||||||||||||||
| 4220 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4221 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4222 | - | |||||||||||||||||||||||||||||||
| 4223 | void QSpanData::initTexture(const QImage *image, int alpha, QTextureData::Type _type, const QRect &sourceRect) | - | ||||||||||||||||||||||||||||||
| 4224 | { | - | ||||||||||||||||||||||||||||||
| 4225 | const QImageData *d = const_cast<QImage *>(image)->data_ptr(); | - | ||||||||||||||||||||||||||||||
| 4226 | if (!d
| 0 | ||||||||||||||||||||||||||||||
| 4227 | texture.imageData = 0; | - | ||||||||||||||||||||||||||||||
| 4228 | texture.width = 0; | - | ||||||||||||||||||||||||||||||
| 4229 | texture.height = 0; | - | ||||||||||||||||||||||||||||||
| 4230 | texture.x1 = 0; | - | ||||||||||||||||||||||||||||||
| 4231 | texture.y1 = 0; | - | ||||||||||||||||||||||||||||||
| 4232 | texture.x2 = 0; | - | ||||||||||||||||||||||||||||||
| 4233 | texture.y2 = 0; | - | ||||||||||||||||||||||||||||||
| 4234 | texture.bytesPerLine = 0; | - | ||||||||||||||||||||||||||||||
| 4235 | texture.format = QImage::Format_Invalid; | - | ||||||||||||||||||||||||||||||
| 4236 | texture.colorTable = 0; | - | ||||||||||||||||||||||||||||||
| 4237 | texture.hasAlpha = alpha != 256; | - | ||||||||||||||||||||||||||||||
| 4238 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4239 | texture.imageData = d->data; | - | ||||||||||||||||||||||||||||||
| 4240 | texture.width = d->width; | - | ||||||||||||||||||||||||||||||
| 4241 | texture.height = d->height; | - | ||||||||||||||||||||||||||||||
| 4242 | - | |||||||||||||||||||||||||||||||
| 4243 | if (sourceRect.isNull()
| 0 | ||||||||||||||||||||||||||||||
| 4244 | texture.x1 = 0; | - | ||||||||||||||||||||||||||||||
| 4245 | texture.y1 = 0; | - | ||||||||||||||||||||||||||||||
| 4246 | texture.x2 = texture.width; | - | ||||||||||||||||||||||||||||||
| 4247 | texture.y2 = texture.height; | - | ||||||||||||||||||||||||||||||
| 4248 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4249 | texture.x1 = sourceRect.x(); | - | ||||||||||||||||||||||||||||||
| 4250 | texture.y1 = sourceRect.y(); | - | ||||||||||||||||||||||||||||||
| 4251 | texture.x2 = qMin(texture.x1 + sourceRect.width(), d->width); | - | ||||||||||||||||||||||||||||||
| 4252 | texture.y2 = qMin(texture.y1 + sourceRect.height(), d->height); | - | ||||||||||||||||||||||||||||||
| 4253 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4254 | - | |||||||||||||||||||||||||||||||
| 4255 | texture.bytesPerLine = d->bytes_per_line; | - | ||||||||||||||||||||||||||||||
| 4256 | - | |||||||||||||||||||||||||||||||
| 4257 | texture.format = d->format; | - | ||||||||||||||||||||||||||||||
| 4258 | texture.colorTable = (d->format <= QImage::Format_Indexed8
| 0 | ||||||||||||||||||||||||||||||
| 4259 | texture.hasAlpha = image->hasAlphaChannel()
| 0 | ||||||||||||||||||||||||||||||
| 4260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4261 | texture.const_alpha = alpha; | - | ||||||||||||||||||||||||||||||
| 4262 | texture.type = _type; | - | ||||||||||||||||||||||||||||||
| 4263 | - | |||||||||||||||||||||||||||||||
| 4264 | adjustSpanMethods(); | - | ||||||||||||||||||||||||||||||
| 4265 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4266 | - | |||||||||||||||||||||||||||||||
| 4267 | - | |||||||||||||||||||||||||||||||
| 4268 | - | |||||||||||||||||||||||||||||||
| 4269 | - | |||||||||||||||||||||||||||||||
| 4270 | - | |||||||||||||||||||||||||||||||
| 4271 | static inline void drawEllipsePoints(int x, int y, int length, | - | ||||||||||||||||||||||||||||||
| 4272 | const QRect &rect, | - | ||||||||||||||||||||||||||||||
| 4273 | const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 4274 | ProcessSpans pen_func, ProcessSpans brush_func, | - | ||||||||||||||||||||||||||||||
| 4275 | QSpanData *pen_data, QSpanData *brush_data) | - | ||||||||||||||||||||||||||||||
| 4276 | { | - | ||||||||||||||||||||||||||||||
| 4277 | if (length == 0
| 0 | ||||||||||||||||||||||||||||||
| 4278 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 4279 | - | |||||||||||||||||||||||||||||||
| 4280 | QT_FT_Span outline[4]; | - | ||||||||||||||||||||||||||||||
| 4281 | const int midx = rect.x() + (rect.width() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4282 | const int midy = rect.y() + (rect.height() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4283 | - | |||||||||||||||||||||||||||||||
| 4284 | x = x + midx; | - | ||||||||||||||||||||||||||||||
| 4285 | y = midy - y; | - | ||||||||||||||||||||||||||||||
| 4286 | - | |||||||||||||||||||||||||||||||
| 4287 | - | |||||||||||||||||||||||||||||||
| 4288 | outline[0].x = midx + (midx - x) - (length - 1) - (rect.width() & 0x1); | - | ||||||||||||||||||||||||||||||
| 4289 | outline[0].len = qMin(length, x - outline[0].x); | - | ||||||||||||||||||||||||||||||
| 4290 | outline[0].y = y; | - | ||||||||||||||||||||||||||||||
| 4291 | outline[0].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4292 | - | |||||||||||||||||||||||||||||||
| 4293 | - | |||||||||||||||||||||||||||||||
| 4294 | outline[1].x = x; | - | ||||||||||||||||||||||||||||||
| 4295 | outline[1].len = length; | - | ||||||||||||||||||||||||||||||
| 4296 | outline[1].y = y; | - | ||||||||||||||||||||||||||||||
| 4297 | outline[1].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4298 | - | |||||||||||||||||||||||||||||||
| 4299 | - | |||||||||||||||||||||||||||||||
| 4300 | outline[2].x = outline[0].x; | - | ||||||||||||||||||||||||||||||
| 4301 | outline[2].len = outline[0].len; | - | ||||||||||||||||||||||||||||||
| 4302 | outline[2].y = midy + (midy - y) - (rect.height() & 0x1); | - | ||||||||||||||||||||||||||||||
| 4303 | outline[2].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4304 | - | |||||||||||||||||||||||||||||||
| 4305 | - | |||||||||||||||||||||||||||||||
| 4306 | outline[3].x = x; | - | ||||||||||||||||||||||||||||||
| 4307 | outline[3].len = length; | - | ||||||||||||||||||||||||||||||
| 4308 | outline[3].y = outline[2].y; | - | ||||||||||||||||||||||||||||||
| 4309 | outline[3].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4310 | - | |||||||||||||||||||||||||||||||
| 4311 | if (brush_func
| 0 | ||||||||||||||||||||||||||||||
| 4312 | QT_FT_Span fill[2]; | - | ||||||||||||||||||||||||||||||
| 4313 | - | |||||||||||||||||||||||||||||||
| 4314 | - | |||||||||||||||||||||||||||||||
| 4315 | fill[0].x = outline[0].x + outline[0].len - 1; | - | ||||||||||||||||||||||||||||||
| 4316 | fill[0].len = qMax(0, outline[1].x - fill[0].x); | - | ||||||||||||||||||||||||||||||
| 4317 | fill[0].y = outline[1].y; | - | ||||||||||||||||||||||||||||||
| 4318 | fill[0].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4319 | - | |||||||||||||||||||||||||||||||
| 4320 | - | |||||||||||||||||||||||||||||||
| 4321 | fill[1].x = outline[2].x + outline[2].len - 1; | - | ||||||||||||||||||||||||||||||
| 4322 | fill[1].len = qMax(0, outline[3].x - fill[1].x); | - | ||||||||||||||||||||||||||||||
| 4323 | fill[1].y = outline[3].y; | - | ||||||||||||||||||||||||||||||
| 4324 | fill[1].coverage = 255; | - | ||||||||||||||||||||||||||||||
| 4325 | - | |||||||||||||||||||||||||||||||
| 4326 | int n = (fill[0].y >= fill[1].y
| 0 | ||||||||||||||||||||||||||||||
| 4327 | n = qt_intersect_spans(fill, n, clip); | - | ||||||||||||||||||||||||||||||
| 4328 | if (n > 0
| 0 | ||||||||||||||||||||||||||||||
| 4329 | brush_func(n, fill, brush_data); never executed: brush_func(n, fill, brush_data); | 0 | ||||||||||||||||||||||||||||||
| 4330 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4331 | if (pen_func
| 0 | ||||||||||||||||||||||||||||||
| 4332 | int n = (outline[1].y >= outline[2].y
| 0 | ||||||||||||||||||||||||||||||
| 4333 | n = qt_intersect_spans(outline, n, clip); | - | ||||||||||||||||||||||||||||||
| 4334 | if (n > 0
| 0 | ||||||||||||||||||||||||||||||
| 4335 | pen_func(n, outline, pen_data); never executed: pen_func(n, outline, pen_data); | 0 | ||||||||||||||||||||||||||||||
| 4336 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4337 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4338 | - | |||||||||||||||||||||||||||||||
| 4339 | - | |||||||||||||||||||||||||||||||
| 4340 | - | |||||||||||||||||||||||||||||||
| 4341 | - | |||||||||||||||||||||||||||||||
| 4342 | - | |||||||||||||||||||||||||||||||
| 4343 | static void drawEllipse_midpoint_i(const QRect &rect, const QRect &clip, | - | ||||||||||||||||||||||||||||||
| 4344 | ProcessSpans pen_func, ProcessSpans brush_func, | - | ||||||||||||||||||||||||||||||
| 4345 | QSpanData *pen_data, QSpanData *brush_data) | - | ||||||||||||||||||||||||||||||
| 4346 | { | - | ||||||||||||||||||||||||||||||
| 4347 | const qreal a = qreal(rect.width()) / 2; | - | ||||||||||||||||||||||||||||||
| 4348 | const qreal b = qreal(rect.height()) / 2; | - | ||||||||||||||||||||||||||||||
| 4349 | qreal d = b*b - (a*a*b) + 0.25*a*a; | - | ||||||||||||||||||||||||||||||
| 4350 | - | |||||||||||||||||||||||||||||||
| 4351 | int x = 0; | - | ||||||||||||||||||||||||||||||
| 4352 | int y = (rect.height() + 1) / 2; | - | ||||||||||||||||||||||||||||||
| 4353 | int startx = x; | - | ||||||||||||||||||||||||||||||
| 4354 | - | |||||||||||||||||||||||||||||||
| 4355 | - | |||||||||||||||||||||||||||||||
| 4356 | while (a*a*(2*y - 1) > 2*b*b*(x + 1)
| 0 | ||||||||||||||||||||||||||||||
| 4357 | if (d < 0
| 0 | ||||||||||||||||||||||||||||||
| 4358 | d += b*b*(2*x + 3); | - | ||||||||||||||||||||||||||||||
| 4359 | ++x; | - | ||||||||||||||||||||||||||||||
| 4360 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4361 | d += b*b*(2*x + 3) + a*a*(-2*y + 2); | - | ||||||||||||||||||||||||||||||
| 4362 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4363 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4364 | startx = ++x; | - | ||||||||||||||||||||||||||||||
| 4365 | --y; | - | ||||||||||||||||||||||||||||||
| 4366 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4367 | } | - | ||||||||||||||||||||||||||||||
| 4368 | drawEllipsePoints(startx, y, x - startx + 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4369 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4370 | - | |||||||||||||||||||||||||||||||
| 4371 | - | |||||||||||||||||||||||||||||||
| 4372 | d = b*b*(x + 0.5)*(x + 0.5) + a*a*((y - 1)*(y - 1) - b*b); | - | ||||||||||||||||||||||||||||||
| 4373 | const int miny = rect.height() & 0x1; | - | ||||||||||||||||||||||||||||||
| 4374 | while (y > miny
| 0 | ||||||||||||||||||||||||||||||
| 4375 | if (d < 0
| 0 | ||||||||||||||||||||||||||||||
| 4376 | d += b*b*(2*x + 2) + a*a*(-2*y + 3); | - | ||||||||||||||||||||||||||||||
| 4377 | ++x; | - | ||||||||||||||||||||||||||||||
| 4378 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||
| 4379 | d += a*a*(-2*y + 3); | - | ||||||||||||||||||||||||||||||
| 4380 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4381 | --y; | - | ||||||||||||||||||||||||||||||
| 4382 | drawEllipsePoints(x, y, 1, rect, clip, | - | ||||||||||||||||||||||||||||||
| 4383 | pen_func, brush_func, pen_data, brush_data); | - | ||||||||||||||||||||||||||||||
| 4384 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4385 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 4386 | - | |||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |