| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qpainter.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | extern QPixmap qt_pixmapForBrush(int style, bool invert); | - | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | void qt_format_text(const QFont &font, | - | ||||||||||||||||||||||||
| 10 | const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, | - | ||||||||||||||||||||||||
| 11 | int tabstops, int* tabarray, int tabarraylen, | - | ||||||||||||||||||||||||
| 12 | QPainter *painter); | - | ||||||||||||||||||||||||
| 13 | static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextEngine *textEngine, | - | ||||||||||||||||||||||||
| 14 | QTextCharFormat::UnderlineStyle underlineStyle, | - | ||||||||||||||||||||||||
| 15 | QTextItem::RenderFlags flags, qreal width, | - | ||||||||||||||||||||||||
| 16 | const QTextCharFormat &charFormat); | - | ||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | __attribute__((visibility("default"))) void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray, | - | ||||||||||||||||||||||||
| 19 | const QFixedPoint *positions, int glyphCount, | - | ||||||||||||||||||||||||
| 20 | QFontEngine *fontEngine, const QFont &font, | - | ||||||||||||||||||||||||
| 21 | const QTextCharFormat &charFormat); | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | static inline QGradient::CoordinateMode coordinateMode(const QBrush &brush) | - | ||||||||||||||||||||||||
| 24 | { | - | ||||||||||||||||||||||||
| 25 | switch (brush.style()) { | - | ||||||||||||||||||||||||
| 26 | case never executed: Qt::LinearGradientPattern:case Qt::LinearGradientPattern:never executed: case Qt::LinearGradientPattern: | 0 | ||||||||||||||||||||||||
| 27 | case never executed: Qt::RadialGradientPattern:case Qt::RadialGradientPattern:never executed: case Qt::RadialGradientPattern: | 0 | ||||||||||||||||||||||||
| 28 | case never executed: Qt::ConicalGradientPattern:case Qt::ConicalGradientPattern:never executed: case Qt::ConicalGradientPattern: | 0 | ||||||||||||||||||||||||
| 29 | return never executed: brush.gradient()->coordinateMode();return brush.gradient()->coordinateMode();never executed: return brush.gradient()->coordinateMode(); | 0 | ||||||||||||||||||||||||
| 30 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 31 | ; | - | ||||||||||||||||||||||||
| 32 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 33 | return never executed: QGradient::LogicalMode;return QGradient::LogicalMode;never executed: return QGradient::LogicalMode; | 0 | ||||||||||||||||||||||||
| 34 | } | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | extern bool qHasPixmapTexture(const QBrush &); | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | static inline bool is_brush_transparent(const QBrush &brush) { | - | ||||||||||||||||||||||||
| 39 | Qt::BrushStyle s = brush.style(); | - | ||||||||||||||||||||||||
| 40 | if (s != Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 41 | return never executed: s >= Qt::Dense1Patternreturn s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern;
never executed: return s >= Qt::Dense1Pattern && s <= Qt::DiagCrossPattern; | 0 | ||||||||||||||||||||||||
| 42 | if (qHasPixmapTexture(brush)
| 0 | ||||||||||||||||||||||||
| 43 | return never executed: brush.texture().isQBitmap()return brush.texture().isQBitmap() || brush.texture().hasAlphaChannel();
never executed: return brush.texture().isQBitmap() || brush.texture().hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 44 | else { | - | ||||||||||||||||||||||||
| 45 | const QImage texture = brush.textureImage(); | - | ||||||||||||||||||||||||
| 46 | return never executed: texture.hasAlphaChannel()return texture.hasAlphaChannel() || (texture.depth() == 1 && texture.colorCount() == 0);
never executed: return texture.hasAlphaChannel() || (texture.depth() == 1 && texture.colorCount() == 0); | 0 | ||||||||||||||||||||||||
| 47 | } | - | ||||||||||||||||||||||||
| 48 | } | - | ||||||||||||||||||||||||
| 49 | - | |||||||||||||||||||||||||
| 50 | static inline bool is_pen_transparent(const QPen &pen) { | - | ||||||||||||||||||||||||
| 51 | return never executed: pen.style() > Qt::SolidLinereturn pen.style() > Qt::SolidLine || is_brush_transparent(pen.brush());
never executed: return pen.style() > Qt::SolidLine || is_brush_transparent(pen.brush()); | 0 | ||||||||||||||||||||||||
| 52 | } | - | ||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | static inline uint line_emulation(uint emulation) | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | return never executed: emulation & (QPaintEngine::PrimitiveTransformreturn emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000);never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 60 | | QPaintEngine::AlphaBlend never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 61 | | QPaintEngine::Antialiasing never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 62 | | QPaintEngine::BrushStroke never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 63 | | QPaintEngine::ConstantOpacity never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 64 | | 0x10000000 never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 65 | | QPaintEngine::ObjectBoundingModeGradients never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 66 | | 0x40000000); never executed: return emulation & (QPaintEngine::PrimitiveTransform | QPaintEngine::AlphaBlend | QPaintEngine::Antialiasing | QPaintEngine::BrushStroke | QPaintEngine::ConstantOpacity | 0x10000000 | QPaintEngine::ObjectBoundingModeGradients | 0x40000000); | 0 | ||||||||||||||||||||||||
| 67 | } | - | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | static bool qt_painter_thread_test(int devType, int engineType, const char *what) | - | ||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||
| 72 | const QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); | - | ||||||||||||||||||||||||
| 73 | switch (devType) { | - | ||||||||||||||||||||||||
| 74 | case never executed: QInternal::Image:case QInternal::Image:never executed: case QInternal::Image: | 0 | ||||||||||||||||||||||||
| 75 | case never executed: QInternal::Printer:case QInternal::Printer:never executed: case QInternal::Printer: | 0 | ||||||||||||||||||||||||
| 76 | case never executed: QInternal::Picture:case QInternal::Picture:never executed: case QInternal::Picture: | 0 | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 79 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 80 | if (QThread::currentThread() != (static_cast<QGuiApplication *>(QCoreApplication::instance()))->thread()
| 0 | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | && (devType != QInternal::Pixmap
| 0 | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | && (devType != QInternal::OpenGL
| 0 | ||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | && (devType != QInternal::Widget
| 0 | ||||||||||||||||||||||||
| 87 | || (engineType != QPaintEngine::OpenGL
| 0 | ||||||||||||||||||||||||
| 88 | QMessageLogger(__FILE__, 163, __PRETTY_FUNCTION__).warning("QPainter: It is not safe to use %s outside the GUI thread", what); | - | ||||||||||||||||||||||||
| 89 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 90 | } | - | ||||||||||||||||||||||||
| 91 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 92 | } | - | ||||||||||||||||||||||||
| 93 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 94 | } | - | ||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | void QPainterPrivate::checkEmulation() | - | ||||||||||||||||||||||||
| 98 | { | - | ||||||||||||||||||||||||
| 99 | ((!(extended)) ? qt_assert("extended",__FILE__,174) : qt_noop()); | - | ||||||||||||||||||||||||
| 100 | bool doEmulation = false; | - | ||||||||||||||||||||||||
| 101 | if (state->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 102 | doEmulation = true; never executed: doEmulation = true; | 0 | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | const QGradient *bg = state->brush.gradient(); | - | ||||||||||||||||||||||||
| 105 | if (bg
| 0 | ||||||||||||||||||||||||
| 106 | doEmulation = true; never executed: doEmulation = true; | 0 | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | const QGradient *pg = qpen_brush(state->pen).gradient(); | - | ||||||||||||||||||||||||
| 109 | if (pg
| 0 | ||||||||||||||||||||||||
| 110 | doEmulation = true; never executed: doEmulation = true; | 0 | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | if (doEmulation
| 0 | ||||||||||||||||||||||||
| 113 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | if (doEmulation
| 0 | ||||||||||||||||||||||||
| 116 | if (extended != emulationEngine
| 0 | ||||||||||||||||||||||||
| 117 | if (!emulationEngine
| 0 | ||||||||||||||||||||||||
| 118 | emulationEngine = new QEmulationPaintEngine(extended); never executed: emulationEngine = new QEmulationPaintEngine(extended); | 0 | ||||||||||||||||||||||||
| 119 | extended = emulationEngine; | - | ||||||||||||||||||||||||
| 120 | extended->setState(state); | - | ||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 122 | } never executed: else if (emulationEngine == extendedend of block
| 0 | ||||||||||||||||||||||||
| 123 | extended = emulationEngine->real_engine; | - | ||||||||||||||||||||||||
| 124 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 125 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 126 | - | |||||||||||||||||||||||||
| 127 | - | |||||||||||||||||||||||||
| 128 | QPainterPrivate::~QPainterPrivate() | - | ||||||||||||||||||||||||
| 129 | { | - | ||||||||||||||||||||||||
| 130 | delete emulationEngine; | - | ||||||||||||||||||||||||
| 131 | qDeleteAll(states); | - | ||||||||||||||||||||||||
| 132 | delete dummyState; | - | ||||||||||||||||||||||||
| 133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | QTransform QPainterPrivate::viewTransform() const | - | ||||||||||||||||||||||||
| 137 | { | - | ||||||||||||||||||||||||
| 138 | if (state->VxF
| 0 | ||||||||||||||||||||||||
| 139 | qreal scaleW = qreal(state->vw)/qreal(state->ww); | - | ||||||||||||||||||||||||
| 140 | qreal scaleH = qreal(state->vh)/qreal(state->wh); | - | ||||||||||||||||||||||||
| 141 | return never executed: QTransform(scaleW, 0, 0, scaleH,return QTransform(scaleW, 0, 0, scaleH, state->vx - state->wx*scaleW, state->vy - state->wy*scaleH);never executed: return QTransform(scaleW, 0, 0, scaleH, state->vx - state->wx*scaleW, state->vy - state->wy*scaleH); | 0 | ||||||||||||||||||||||||
| 142 | state->vx - state->wx*scaleW, state->vy - state->wy*scaleH); never executed: return QTransform(scaleW, 0, 0, scaleH, state->vx - state->wx*scaleW, state->vy - state->wy*scaleH); | 0 | ||||||||||||||||||||||||
| 143 | } | - | ||||||||||||||||||||||||
| 144 | return never executed: QTransform();return QTransform();never executed: return QTransform(); | 0 | ||||||||||||||||||||||||
| 145 | } | - | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | qreal QPainterPrivate::effectiveDevicePixelRatio() const | - | ||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||
| 150 | if (device->devType() == QInternal::Printer
| 0 | ||||||||||||||||||||||||
| 151 | return never executed: qreal(1);return qreal(1);never executed: return qreal(1); | 0 | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | return never executed: qMax(qreal(1), device->devicePixelRatioF());return qMax(qreal(1), device->devicePixelRatioF());never executed: return qMax(qreal(1), device->devicePixelRatioF()); | 0 | ||||||||||||||||||||||||
| 154 | } | - | ||||||||||||||||||||||||
| 155 | - | |||||||||||||||||||||||||
| 156 | QTransform QPainterPrivate::hidpiScaleTransform() const | - | ||||||||||||||||||||||||
| 157 | { | - | ||||||||||||||||||||||||
| 158 | const qreal devicePixelRatio = effectiveDevicePixelRatio(); | - | ||||||||||||||||||||||||
| 159 | return never executed: QTransform::fromScale(devicePixelRatio, devicePixelRatio);return QTransform::fromScale(devicePixelRatio, devicePixelRatio);never executed: return QTransform::fromScale(devicePixelRatio, devicePixelRatio); | 0 | ||||||||||||||||||||||||
| 160 | } | - | ||||||||||||||||||||||||
| 161 | - | |||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||
| 164 | - | |||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) | - | ||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||
| 168 | ((!(q)) ? qt_assert("q",__FILE__,243) : qt_noop()); | - | ||||||||||||||||||||||||
| 169 | ((!(pdev)) ? qt_assert("pdev",__FILE__,244) : qt_noop()); | - | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | QPainter *sp = pdev->sharedPainter(); | - | ||||||||||||||||||||||||
| 172 | if (!sp
| 0 | ||||||||||||||||||||||||
| 173 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | sp->save(); | - | ||||||||||||||||||||||||
| 178 | if (!sp->d_ptr->d_ptrs
| 0 | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | - | |||||||||||||||||||||||||
| 181 | - | |||||||||||||||||||||||||
| 182 | sp->d_ptr->d_ptrs_size = 4; | - | ||||||||||||||||||||||||
| 183 | sp->d_ptr->d_ptrs = (QPainterPrivate **)malloc(4 * sizeof(QPainterPrivate *)); | - | ||||||||||||||||||||||||
| 184 | do {if(!(sp->d_ptr->d_ptrs)
never executed: } while (0);qt_check_pointer(__FILE__,259); | 0 | ||||||||||||||||||||||||
| 185 | } never executed: else if (sp->d_ptr->refcount - 1 == sp->d_ptr->d_ptrs_sizeend of block
| 0 | ||||||||||||||||||||||||
| 186 | - | |||||||||||||||||||||||||
| 187 | sp->d_ptr->d_ptrs_size <<= 1; | - | ||||||||||||||||||||||||
| 188 | const int newSize = sp->d_ptr->d_ptrs_size * sizeof(QPainterPrivate *); | - | ||||||||||||||||||||||||
| 189 | sp->d_ptr->d_ptrs = q_check_ptr((QPainterPrivate **)realloc(sp->d_ptr->d_ptrs, newSize)); | - | ||||||||||||||||||||||||
| 190 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 191 | sp->d_ptr->d_ptrs[++sp->d_ptr->refcount - 2] = q->d_ptr.data(); | - | ||||||||||||||||||||||||
| 192 | q->d_ptr.take(); | - | ||||||||||||||||||||||||
| 193 | q->d_ptr.reset(sp->d_ptr.data()); | - | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | ((!(q->d_ptr->state)) ? qt_assert("q->d_ptr->state",__FILE__,270) : qt_noop()); | - | ||||||||||||||||||||||||
| 196 | - | |||||||||||||||||||||||||
| 197 | - | |||||||||||||||||||||||||
| 198 | q->initFrom(pdev); | - | ||||||||||||||||||||||||
| 199 | QPoint offset; | - | ||||||||||||||||||||||||
| 200 | pdev->redirected(&offset); | - | ||||||||||||||||||||||||
| 201 | offset += q->d_ptr->engine->coordinateOffset(); | - | ||||||||||||||||||||||||
| 202 | - | |||||||||||||||||||||||||
| 203 | - | |||||||||||||||||||||||||
| 204 | q->d_ptr->state->ww = q->d_ptr->state->vw = pdev->width(); | - | ||||||||||||||||||||||||
| 205 | q->d_ptr->state->wh = q->d_ptr->state->vh = pdev->height(); | - | ||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | if (q->d_ptr->state->WxF
| 0 | ||||||||||||||||||||||||
| 209 | q->d_ptr->state->redirectionMatrix = q->d_ptr->state->matrix; | - | ||||||||||||||||||||||||
| 210 | q->d_ptr->state->redirectionMatrix *= q->d_ptr->hidpiScaleTransform().inverted(); | - | ||||||||||||||||||||||||
| 211 | q->d_ptr->state->redirectionMatrix.translate(-offset.x(), -offset.y()); | - | ||||||||||||||||||||||||
| 212 | q->d_ptr->state->worldMatrix = QTransform(); | - | ||||||||||||||||||||||||
| 213 | q->d_ptr->state->WxF = false; | - | ||||||||||||||||||||||||
| 214 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 215 | q->d_ptr->state->redirectionMatrix = QTransform::fromTranslate(-offset.x(), -offset.y()); | - | ||||||||||||||||||||||||
| 216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 217 | q->d_ptr->updateMatrix(); | - | ||||||||||||||||||||||||
| 218 | - | |||||||||||||||||||||||||
| 219 | QPaintEnginePrivate *enginePrivate = q->d_ptr->engine->d_func(); | - | ||||||||||||||||||||||||
| 220 | if (enginePrivate->currentClipDevice == pdev
| 0 | ||||||||||||||||||||||||
| 221 | enginePrivate->systemStateChanged(); | - | ||||||||||||||||||||||||
| 222 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 223 | } | - | ||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | enginePrivate->currentClipDevice = pdev; | - | ||||||||||||||||||||||||
| 227 | enginePrivate->setSystemTransform(q->d_ptr->state->matrix); | - | ||||||||||||||||||||||||
| 228 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 229 | } | - | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | void QPainterPrivate::detachPainterPrivate(QPainter *q) | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | ((!(refcount > 1)) ? qt_assert("refcount > 1",__FILE__,308) : qt_noop()); | - | ||||||||||||||||||||||||
| 234 | ((!(q)) ? qt_assert("q",__FILE__,309) : qt_noop()); | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | QPainterPrivate *original = d_ptrs[--refcount - 1]; | - | ||||||||||||||||||||||||
| 237 | if (inDestructor
| 0 | ||||||||||||||||||||||||
| 238 | inDestructor = false; | - | ||||||||||||||||||||||||
| 239 | if (original
| 0 | ||||||||||||||||||||||||
| 240 | original->inDestructor = true; never executed: original->inDestructor = true; | 0 | ||||||||||||||||||||||||
| 241 | } never executed: else if (!originalend of block
| 0 | ||||||||||||||||||||||||
| 242 | original = new QPainterPrivate(q); | - | ||||||||||||||||||||||||
| 243 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | d_ptrs[refcount - 1] = 0; | - | ||||||||||||||||||||||||
| 246 | q->restore(); | - | ||||||||||||||||||||||||
| 247 | q->d_ptr.take(); | - | ||||||||||||||||||||||||
| 248 | q->d_ptr.reset(original); | - | ||||||||||||||||||||||||
| 249 | - | |||||||||||||||||||||||||
| 250 | if (emulationEngine
| 0 | ||||||||||||||||||||||||
| 251 | extended = emulationEngine->real_engine; | - | ||||||||||||||||||||||||
| 252 | delete emulationEngine; | - | ||||||||||||||||||||||||
| 253 | emulationEngine = 0; | - | ||||||||||||||||||||||||
| 254 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 255 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | - | |||||||||||||||||||||||||
| 258 | void QPainterPrivate::draw_helper(const QPainterPath &originalPath, DrawOperation op) | - | ||||||||||||||||||||||||
| 259 | { | - | ||||||||||||||||||||||||
| 260 | - | |||||||||||||||||||||||||
| 261 | - | |||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | if (originalPath.isEmpty()
| 0 | ||||||||||||||||||||||||
| 267 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||
| 269 | QPaintEngine::PaintEngineFeatures gradientStretch = | - | ||||||||||||||||||||||||
| 270 | QPaintEngine::PaintEngineFeatures(0x10000000 | - | ||||||||||||||||||||||||
| 271 | | QPaintEngine::ObjectBoundingModeGradients); | - | ||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||
| 273 | const bool mustEmulateObjectBoundingModeGradients = extended
| 0 | ||||||||||||||||||||||||
| 274 | || ((
| 0 | ||||||||||||||||||||||||
| 275 | && !engine->hasFeature(QPaintEngine::PatternTransform)
| 0 | ||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||
| 277 | if (!(state->emulationSpecifier & ~gradientStretch)
| 0 | ||||||||||||||||||||||||
| 278 | && !mustEmulateObjectBoundingModeGradients
| 0 | ||||||||||||||||||||||||
| 279 | drawStretchedGradient(originalPath, op); | - | ||||||||||||||||||||||||
| 280 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 281 | } else if (state->emulationSpecifier & 0x40000000
| 0 | ||||||||||||||||||||||||
| 282 | drawOpaqueBackground(originalPath, op); | - | ||||||||||||||||||||||||
| 283 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 284 | } | - | ||||||||||||||||||||||||
| 285 | - | |||||||||||||||||||||||||
| 286 | QPainter * const q = q_func(); | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 | qreal strokeOffsetX = 0, strokeOffsetY = 0; | - | ||||||||||||||||||||||||
| 289 | - | |||||||||||||||||||||||||
| 290 | QPainterPath path = originalPath * state->matrix; | - | ||||||||||||||||||||||||
| 291 | QRectF pathBounds = path.boundingRect(); | - | ||||||||||||||||||||||||
| 292 | QRectF strokeBounds; | - | ||||||||||||||||||||||||
| 293 | bool doStroke = (
| 0 | ||||||||||||||||||||||||
| 294 | if (doStroke
| 0 | ||||||||||||||||||||||||
| 295 | qreal penWidth = state->pen.widthF(); | - | ||||||||||||||||||||||||
| 296 | if (penWidth == 0
| 0 | ||||||||||||||||||||||||
| 297 | strokeOffsetX = 1; | - | ||||||||||||||||||||||||
| 298 | strokeOffsetY = 1; | - | ||||||||||||||||||||||||
| 299 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 | if (state->matrix.type() > QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 302 | QPainterPathStroker stroker; | - | ||||||||||||||||||||||||
| 303 | stroker.setWidth(penWidth); | - | ||||||||||||||||||||||||
| 304 | stroker.setJoinStyle(state->pen.joinStyle()); | - | ||||||||||||||||||||||||
| 305 | stroker.setCapStyle(state->pen.capStyle()); | - | ||||||||||||||||||||||||
| 306 | QPainterPath stroke = stroker.createStroke(originalPath); | - | ||||||||||||||||||||||||
| 307 | strokeBounds = (stroke * state->matrix).boundingRect(); | - | ||||||||||||||||||||||||
| 308 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 309 | strokeOffsetX = qAbs(penWidth * state->matrix.m11() / 2.0); | - | ||||||||||||||||||||||||
| 310 | strokeOffsetY = qAbs(penWidth * state->matrix.m22() / 2.0); | - | ||||||||||||||||||||||||
| 311 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 312 | } | - | ||||||||||||||||||||||||
| 313 | } | - | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | QRect absPathRect; | - | ||||||||||||||||||||||||
| 316 | if (!strokeBounds.isEmpty()
| 0 | ||||||||||||||||||||||||
| 317 | absPathRect = strokeBounds.intersected(QRectF(0, 0, device->width(), device->height())).toAlignedRect(); | - | ||||||||||||||||||||||||
| 318 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 319 | absPathRect = pathBounds.adjusted(-strokeOffsetX, -strokeOffsetY, strokeOffsetX, strokeOffsetY) | - | ||||||||||||||||||||||||
| 320 | .intersected(QRectF(0, 0, device->width(), device->height())).toAlignedRect(); | - | ||||||||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 322 | - | |||||||||||||||||||||||||
| 323 | if (q->hasClipping()
| 0 | ||||||||||||||||||||||||
| 324 | bool hasPerspectiveTransform = false; | - | ||||||||||||||||||||||||
| 325 | for (int i = 0; i < state->clipInfo.size()
| 0 | ||||||||||||||||||||||||
| 326 | const QPainterClipInfo &info = state->clipInfo.at(i); | - | ||||||||||||||||||||||||
| 327 | if (info.matrix.type() == QTransform::TxProject
| 0 | ||||||||||||||||||||||||
| 328 | hasPerspectiveTransform = true; | - | ||||||||||||||||||||||||
| 329 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 330 | } | - | ||||||||||||||||||||||||
| 331 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||
| 333 | if (!hasPerspectiveTransform
| 0 | ||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | - | |||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | - | |||||||||||||||||||||||||
| 339 | - | |||||||||||||||||||||||||
| 340 | bool old_txinv = txinv; | - | ||||||||||||||||||||||||
| 341 | QTransform old_invMatrix = invMatrix; | - | ||||||||||||||||||||||||
| 342 | txinv = true; | - | ||||||||||||||||||||||||
| 343 | invMatrix = QTransform(); | - | ||||||||||||||||||||||||
| 344 | QPainterPath clipPath = q->clipPath(); | - | ||||||||||||||||||||||||
| 345 | QRectF r = clipPath.boundingRect().intersected(absPathRect); | - | ||||||||||||||||||||||||
| 346 | absPathRect = r.toAlignedRect(); | - | ||||||||||||||||||||||||
| 347 | txinv = old_txinv; | - | ||||||||||||||||||||||||
| 348 | invMatrix = old_invMatrix; | - | ||||||||||||||||||||||||
| 349 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 350 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | - | |||||||||||||||||||||||||
| 354 | - | |||||||||||||||||||||||||
| 355 | - | |||||||||||||||||||||||||
| 356 | - | |||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | if (absPathRect.width() <= 0
| 0 | ||||||||||||||||||||||||
| 359 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | QImage image(absPathRect.width(), absPathRect.height(), QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 362 | image.fill(0); | - | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | QPainter p(&image); | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | p.d_ptr->helper_device = helper_device; | - | ||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | p.setOpacity(state->opacity); | - | ||||||||||||||||||||||||
| 369 | p.translate(-absPathRect.x(), -absPathRect.y()); | - | ||||||||||||||||||||||||
| 370 | p.setTransform(state->matrix, true); | - | ||||||||||||||||||||||||
| 371 | p.setPen(doStroke ? state->pen : QPen(Qt::NoPen)); | - | ||||||||||||||||||||||||
| 372 | p.setBrush((op & FillDraw) ? state->brush : QBrush(Qt::NoBrush)); | - | ||||||||||||||||||||||||
| 373 | p.setBackground(state->bgBrush); | - | ||||||||||||||||||||||||
| 374 | p.setBackgroundMode(state->bgMode); | - | ||||||||||||||||||||||||
| 375 | p.setBrushOrigin(state->brushOrigin); | - | ||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | p.setRenderHint(QPainter::Antialiasing, state->renderHints & QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 378 | p.setRenderHint(QPainter::SmoothPixmapTransform, | - | ||||||||||||||||||||||||
| 379 | state->renderHints & QPainter::SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | p.drawPath(originalPath); | - | ||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | static bool do_fallback_overlay = !qEnvironmentVariableIsEmpty("QT_PAINT_FALLBACK_OVERLAY"); | - | ||||||||||||||||||||||||
| 385 | if (do_fallback_overlay
| 0 | ||||||||||||||||||||||||
| 386 | QImage block(8, 8, QImage::Format_ARGB32_Premultiplied); | - | ||||||||||||||||||||||||
| 387 | QPainter pt(&block); | - | ||||||||||||||||||||||||
| 388 | pt.fillRect(0, 0, 8, 8, QColor(196, 0, 196)); | - | ||||||||||||||||||||||||
| 389 | pt.drawLine(0, 0, 8, 8); | - | ||||||||||||||||||||||||
| 390 | pt.end(); | - | ||||||||||||||||||||||||
| 391 | p.resetTransform(); | - | ||||||||||||||||||||||||
| 392 | p.setCompositionMode(QPainter::CompositionMode_SourceAtop); | - | ||||||||||||||||||||||||
| 393 | p.setOpacity(0.5); | - | ||||||||||||||||||||||||
| 394 | p.fillRect(0, 0, image.width(), image.height(), QBrush(block)); | - | ||||||||||||||||||||||||
| 395 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||
| 398 | p.end(); | - | ||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | q->save(); | - | ||||||||||||||||||||||||
| 401 | state->matrix = QTransform(); | - | ||||||||||||||||||||||||
| 402 | if (extended
| 0 | ||||||||||||||||||||||||
| 403 | extended->transformChanged(); | - | ||||||||||||||||||||||||
| 404 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 405 | state->dirtyFlags |= QPaintEngine::DirtyTransform; | - | ||||||||||||||||||||||||
| 406 | updateState(state); | - | ||||||||||||||||||||||||
| 407 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 408 | engine->drawImage(absPathRect, | - | ||||||||||||||||||||||||
| 409 | image, | - | ||||||||||||||||||||||||
| 410 | QRectF(0, 0, absPathRect.width(), absPathRect.height()), | - | ||||||||||||||||||||||||
| 411 | Qt::OrderedDither | Qt::OrderedAlphaDither); | - | ||||||||||||||||||||||||
| 412 | q->restore(); | - | ||||||||||||||||||||||||
| 413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 414 | - | |||||||||||||||||||||||||
| 415 | void QPainterPrivate::drawOpaqueBackground(const QPainterPath &path, DrawOperation op) | - | ||||||||||||||||||||||||
| 416 | { | - | ||||||||||||||||||||||||
| 417 | QPainter * const q = q_func(); | - | ||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||
| 419 | q->setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | if (op & FillDraw
| 0 | ||||||||||||||||||||||||
| 422 | q->fillPath(path, state->bgBrush.color()); | - | ||||||||||||||||||||||||
| 423 | q->fillPath(path, state->brush); | - | ||||||||||||||||||||||||
| 424 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | if (op & StrokeDraw
| 0 | ||||||||||||||||||||||||
| 427 | q->strokePath(path, QPen(state->bgBrush.color(), state->pen.width())); | - | ||||||||||||||||||||||||
| 428 | q->strokePath(path, state->pen); | - | ||||||||||||||||||||||||
| 429 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||
| 431 | q->setBackgroundMode(Qt::OpaqueMode); | - | ||||||||||||||||||||||||
| 432 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | static inline QBrush stretchGradientToUserSpace(const QBrush &brush, const QRectF &boundingRect) | - | ||||||||||||||||||||||||
| 435 | { | - | ||||||||||||||||||||||||
| 436 | ((!(brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern)) ? qt_assert("brush.style() >= Qt::LinearGradientPattern && brush.style() <= Qt::ConicalGradientPattern", | - | ||||||||||||||||||||||||
| 437 | __FILE__ | - | ||||||||||||||||||||||||
| 438 | , | - | ||||||||||||||||||||||||
| 439 | 512 | - | ||||||||||||||||||||||||
| 440 | ) : qt_noop()) | - | ||||||||||||||||||||||||
| 441 | ; | - | ||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | QTransform gradientToUser(boundingRect.width(), 0, 0, boundingRect.height(), | - | ||||||||||||||||||||||||
| 444 | boundingRect.x(), boundingRect.y()); | - | ||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||
| 446 | QGradient g = *brush.gradient(); | - | ||||||||||||||||||||||||
| 447 | g.setCoordinateMode(QGradient::LogicalMode); | - | ||||||||||||||||||||||||
| 448 | - | |||||||||||||||||||||||||
| 449 | QBrush b(g); | - | ||||||||||||||||||||||||
| 450 | b.setTransform(gradientToUser * b.transform()); | - | ||||||||||||||||||||||||
| 451 | return never executed: b;return b;never executed: return b; | 0 | ||||||||||||||||||||||||
| 452 | } | - | ||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | void QPainterPrivate::drawStretchedGradient(const QPainterPath &path, DrawOperation op) | - | ||||||||||||||||||||||||
| 455 | { | - | ||||||||||||||||||||||||
| 456 | QPainter * const q = q_func(); | - | ||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | const qreal sw = helper_device->width(); | - | ||||||||||||||||||||||||
| 459 | const qreal sh = helper_device->height(); | - | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | bool changedPen = false; | - | ||||||||||||||||||||||||
| 462 | bool changedBrush = false; | - | ||||||||||||||||||||||||
| 463 | bool needsFill = false; | - | ||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | const QPen pen = state->pen; | - | ||||||||||||||||||||||||
| 466 | const QBrush brush = state->brush; | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | const QGradient::CoordinateMode penMode = coordinateMode(pen.brush()); | - | ||||||||||||||||||||||||
| 469 | const QGradient::CoordinateMode brushMode = coordinateMode(brush); | - | ||||||||||||||||||||||||
| 470 | - | |||||||||||||||||||||||||
| 471 | QRectF boundingRect; | - | ||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||
| 474 | if ((
| 0 | ||||||||||||||||||||||||
| 475 | if (brushMode == QGradient::StretchToDeviceMode
| 0 | ||||||||||||||||||||||||
| 476 | q->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 477 | changedPen = pen.style() != Qt::NoPen; | - | ||||||||||||||||||||||||
| 478 | q->scale(sw, sh); | - | ||||||||||||||||||||||||
| 479 | updateState(state); | - | ||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | const qreal isw = 1.0 / sw; | - | ||||||||||||||||||||||||
| 482 | const qreal ish = 1.0 / sh; | - | ||||||||||||||||||||||||
| 483 | QTransform inv(isw, 0, 0, ish, 0, 0); | - | ||||||||||||||||||||||||
| 484 | engine->drawPath(path * inv); | - | ||||||||||||||||||||||||
| 485 | q->scale(isw, ish); | - | ||||||||||||||||||||||||
| 486 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 487 | needsFill = true; | - | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | if (brushMode == QGradient::ObjectBoundingMode
| 0 | ||||||||||||||||||||||||
| 490 | ((!(engine->hasFeature(QPaintEngine::PatternTransform))) ? qt_assert("engine->hasFeature(QPaintEngine::PatternTransform)",__FILE__,561) : qt_noop()); | - | ||||||||||||||||||||||||
| 491 | boundingRect = path.boundingRect(); | - | ||||||||||||||||||||||||
| 492 | q->setBrush(stretchGradientToUserSpace(brush, boundingRect)); | - | ||||||||||||||||||||||||
| 493 | changedBrush = true; | - | ||||||||||||||||||||||||
| 494 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 495 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 496 | } | - | ||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | if ((
| 0 | ||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | if (penMode == QGradient::StretchToDeviceMode
| 0 | ||||||||||||||||||||||||
| 501 | q->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 502 | changedPen = true; | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | if (needsFill
| 0 | ||||||||||||||||||||||||
| 505 | updateState(state); | - | ||||||||||||||||||||||||
| 506 | engine->drawPath(path); | - | ||||||||||||||||||||||||
| 507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | q->scale(sw, sh); | - | ||||||||||||||||||||||||
| 510 | q->setBrush(pen.brush()); | - | ||||||||||||||||||||||||
| 511 | changedBrush = true; | - | ||||||||||||||||||||||||
| 512 | updateState(state); | - | ||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | QPainterPathStroker stroker; | - | ||||||||||||||||||||||||
| 515 | stroker.setDashPattern(pen.style()); | - | ||||||||||||||||||||||||
| 516 | stroker.setWidth(pen.widthF()); | - | ||||||||||||||||||||||||
| 517 | stroker.setJoinStyle(pen.joinStyle()); | - | ||||||||||||||||||||||||
| 518 | stroker.setCapStyle(pen.capStyle()); | - | ||||||||||||||||||||||||
| 519 | stroker.setMiterLimit(pen.miterLimit()); | - | ||||||||||||||||||||||||
| 520 | QPainterPath stroke = stroker.createStroke(path); | - | ||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | const qreal isw = 1.0 / sw; | - | ||||||||||||||||||||||||
| 523 | const qreal ish = 1.0 / sh; | - | ||||||||||||||||||||||||
| 524 | QTransform inv(isw, 0, 0, ish, 0, 0); | - | ||||||||||||||||||||||||
| 525 | engine->drawPath(stroke * inv); | - | ||||||||||||||||||||||||
| 526 | q->scale(isw, ish); | - | ||||||||||||||||||||||||
| 527 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 528 | if (!needsFill
| 0 | ||||||||||||||||||||||||
| 529 | q->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 530 | changedBrush = true; | - | ||||||||||||||||||||||||
| 531 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 532 | - | |||||||||||||||||||||||||
| 533 | if (penMode == QGradient::ObjectBoundingMode
| 0 | ||||||||||||||||||||||||
| 534 | ((!(engine->hasFeature(QPaintEngine::PatternTransform))) ? qt_assert("engine->hasFeature(QPaintEngine::PatternTransform)",__FILE__,605) : qt_noop()); | - | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | if (!needsFill
| 0 | ||||||||||||||||||||||||
| 538 | boundingRect = path.boundingRect(); never executed: boundingRect = path.boundingRect(); | 0 | ||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||
| 540 | QPen p = pen; | - | ||||||||||||||||||||||||
| 541 | p.setBrush(stretchGradientToUserSpace(pen.brush(), boundingRect)); | - | ||||||||||||||||||||||||
| 542 | q->setPen(p); | - | ||||||||||||||||||||||||
| 543 | changedPen = true; | - | ||||||||||||||||||||||||
| 544 | } never executed: else if (changedPenend of block
| 0 | ||||||||||||||||||||||||
| 545 | q->setPen(pen); | - | ||||||||||||||||||||||||
| 546 | changedPen = false; | - | ||||||||||||||||||||||||
| 547 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||
| 549 | updateState(state); | - | ||||||||||||||||||||||||
| 550 | engine->drawPath(path); | - | ||||||||||||||||||||||||
| 551 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 552 | } else if (needsFill
| 0 | ||||||||||||||||||||||||
| 553 | if (pen.style() != Qt::NoPen
| 0 | ||||||||||||||||||||||||
| 554 | q->setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 555 | changedPen = true; | - | ||||||||||||||||||||||||
| 556 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | updateState(state); | - | ||||||||||||||||||||||||
| 559 | engine->drawPath(path); | - | ||||||||||||||||||||||||
| 560 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||
| 562 | if (changedPen
| 0 | ||||||||||||||||||||||||
| 563 | q->setPen(pen); never executed: q->setPen(pen); | 0 | ||||||||||||||||||||||||
| 564 | if (changedBrush
| 0 | ||||||||||||||||||||||||
| 565 | q->setBrush(brush); never executed: q->setBrush(brush); | 0 | ||||||||||||||||||||||||
| 566 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||
| 569 | void QPainterPrivate::updateMatrix() | - | ||||||||||||||||||||||||
| 570 | { | - | ||||||||||||||||||||||||
| 571 | state->matrix = state->WxF
| 0 | ||||||||||||||||||||||||
| 572 | if (state->VxF
| 0 | ||||||||||||||||||||||||
| 573 | state->matrix *= viewTransform(); never executed: state->matrix *= viewTransform(); | 0 | ||||||||||||||||||||||||
| 574 | - | |||||||||||||||||||||||||
| 575 | txinv = false; | - | ||||||||||||||||||||||||
| 576 | state->matrix *= state->redirectionMatrix; | - | ||||||||||||||||||||||||
| 577 | if (extended
| 0 | ||||||||||||||||||||||||
| 578 | extended->transformChanged(); never executed: extended->transformChanged(); | 0 | ||||||||||||||||||||||||
| 579 | else | - | ||||||||||||||||||||||||
| 580 | state->dirtyFlags |= QPaintEngine::DirtyTransform; never executed: state->dirtyFlags |= QPaintEngine::DirtyTransform; | 0 | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | state->matrix *= hidpiScaleTransform(); | - | ||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 | void QPainterPrivate::updateInvMatrix() | - | ||||||||||||||||||||||||
| 590 | { | - | ||||||||||||||||||||||||
| 591 | ((!(txinv == false)) ? qt_assert("txinv == false",__FILE__,662) : qt_noop()); | - | ||||||||||||||||||||||||
| 592 | txinv = true; | - | ||||||||||||||||||||||||
| 593 | invMatrix = state->matrix.inverted(); | - | ||||||||||||||||||||||||
| 594 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 595 | - | |||||||||||||||||||||||||
| 596 | extern bool qt_isExtendedRadialGradient(const QBrush &brush); | - | ||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||
| 598 | void QPainterPrivate::updateEmulationSpecifier(QPainterState *s) | - | ||||||||||||||||||||||||
| 599 | { | - | ||||||||||||||||||||||||
| 600 | bool alpha = false; | - | ||||||||||||||||||||||||
| 601 | bool linearGradient = false; | - | ||||||||||||||||||||||||
| 602 | bool radialGradient = false; | - | ||||||||||||||||||||||||
| 603 | bool extendedRadialGradient = false; | - | ||||||||||||||||||||||||
| 604 | bool conicalGradient = false; | - | ||||||||||||||||||||||||
| 605 | bool patternBrush = false; | - | ||||||||||||||||||||||||
| 606 | bool xform = false; | - | ||||||||||||||||||||||||
| 607 | bool complexXform = false; | - | ||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||
| 609 | bool skip = true; | - | ||||||||||||||||||||||||
| 610 | - | |||||||||||||||||||||||||
| 611 | - | |||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | if (s->state() & (QPaintEngine::DirtyPen | QPaintEngine::DirtyBrush | QPaintEngine::DirtyHints)
| 0 | ||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||
| 615 | if (!s->pen.isSolid()
| 0 | ||||||||||||||||||||||||
| 616 | s->emulationSpecifier |= QPaintEngine::BrushStroke; never executed: s->emulationSpecifier |= QPaintEngine::BrushStroke; | 0 | ||||||||||||||||||||||||
| 617 | else | - | ||||||||||||||||||||||||
| 618 | s->emulationSpecifier &= ~QPaintEngine::BrushStroke; never executed: s->emulationSpecifier &= ~QPaintEngine::BrushStroke; | 0 | ||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||
| 620 | skip = false; | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | QBrush penBrush = (
| 0 | ||||||||||||||||||||||||
| 623 | Qt::BrushStyle brushStyle = qbrush_style(s->brush); | - | ||||||||||||||||||||||||
| 624 | Qt::BrushStyle penBrushStyle = qbrush_style(penBrush); | - | ||||||||||||||||||||||||
| 625 | alpha = (penBrushStyle != Qt::NoBrush
| 0 | ||||||||||||||||||||||||
| 626 | && (penBrushStyle < Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 627 | && !penBrush.isOpaque()
| 0 | ||||||||||||||||||||||||
| 628 | || (brushStyle != Qt::NoBrush
| 0 | ||||||||||||||||||||||||
| 629 | && (brushStyle < Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 630 | && !s->brush.isOpaque()
| 0 | ||||||||||||||||||||||||
| 631 | linearGradient = ((
| 0 | ||||||||||||||||||||||||
| 632 | (
| 0 | ||||||||||||||||||||||||
| 633 | radialGradient = ((
| 0 | ||||||||||||||||||||||||
| 634 | (
| 0 | ||||||||||||||||||||||||
| 635 | extendedRadialGradient = radialGradient
| 0 | ||||||||||||||||||||||||
| 636 | conicalGradient = ((
| 0 | ||||||||||||||||||||||||
| 637 | (
| 0 | ||||||||||||||||||||||||
| 638 | patternBrush = (((penBrushStyle > Qt::SolidPattern
| 0 | ||||||||||||||||||||||||
| 639 | && penBrushStyle < Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 640 | || penBrushStyle == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 641 | ((brushStyle > Qt::SolidPattern
| 0 | ||||||||||||||||||||||||
| 642 | && brushStyle < Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 643 | || brushStyle == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 644 | - | |||||||||||||||||||||||||
| 645 | bool penTextureAlpha = false; | - | ||||||||||||||||||||||||
| 646 | if (penBrush.style() == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 647 | penTextureAlpha = qHasPixmapTexture(penBrush)
never executed: penTextureAlpha = qHasPixmapTexture(penBrush) ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() : penBrush.textureImage().hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 648 | ? (
never executed: penTextureAlpha = qHasPixmapTexture(penBrush) ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() : penBrush.textureImage().hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 649 | : penBrush.textureImage().hasAlphaChannel(); never executed: penTextureAlpha = qHasPixmapTexture(penBrush) ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha() : penBrush.textureImage().hasAlphaChannel(); | 0 | ||||||||||||||||||||||||
| 650 | bool brushTextureAlpha = false; | - | ||||||||||||||||||||||||
| 651 | if (s->brush.style() == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 652 | brushTextureAlpha = qHasPixmapTexture(s->brush)
| 0 | ||||||||||||||||||||||||
| 653 | ? (
| 0 | ||||||||||||||||||||||||
| 654 | : s->brush.textureImage().hasAlphaChannel(); | - | ||||||||||||||||||||||||
| 655 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 656 | if (((penBrush.style() == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 657 | || (s->brush.style() == Qt::TexturePattern
| 0 | ||||||||||||||||||||||||
| 658 | && !engine->hasFeature(QPaintEngine::MaskedBrush)
| 0 | ||||||||||||||||||||||||
| 659 | s->emulationSpecifier |= QPaintEngine::MaskedBrush; never executed: s->emulationSpecifier |= QPaintEngine::MaskedBrush; | 0 | ||||||||||||||||||||||||
| 660 | else | - | ||||||||||||||||||||||||
| 661 | s->emulationSpecifier &= ~QPaintEngine::MaskedBrush; never executed: s->emulationSpecifier &= ~QPaintEngine::MaskedBrush; | 0 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 | - | |||||||||||||||||||||||||
| 664 | if (s->state() & (QPaintEngine::DirtyHints
| 0 | ||||||||||||||||||||||||
| 665 | | QPaintEngine::DirtyOpacity
| 0 | ||||||||||||||||||||||||
| 666 | | QPaintEngine::DirtyBackgroundMode)
| 0 | ||||||||||||||||||||||||
| 667 | skip = false; | - | ||||||||||||||||||||||||
| 668 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | if (skip
| 0 | ||||||||||||||||||||||||
| 671 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 672 | if (s->state() & QPaintEngine::DirtyTransform
| 0 | ||||||||||||||||||||||||
| 673 | xform = !s->matrix.isIdentity(); | - | ||||||||||||||||||||||||
| 674 | complexXform = !s->matrix.isAffine(); | - | ||||||||||||||||||||||||
| 675 | } never executed: else if (s->matrix.type() >= QTransform::TxTranslateend of block
| 0 | ||||||||||||||||||||||||
| 676 | xform = true; | - | ||||||||||||||||||||||||
| 677 | complexXform = !s->matrix.isAffine(); | - | ||||||||||||||||||||||||
| 678 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 679 | - | |||||||||||||||||||||||||
| 680 | const bool brushXform = (s->brush.transform().type() != QTransform::TxNone); | - | ||||||||||||||||||||||||
| 681 | const bool penXform = (s->pen.brush().transform().type() != QTransform::TxNone); | - | ||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | const bool patternXform = patternBrush
| 0 | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | if (alpha
| 0 | ||||||||||||||||||||||||
| 687 | s->emulationSpecifier |= QPaintEngine::AlphaBlend; never executed: s->emulationSpecifier |= QPaintEngine::AlphaBlend; | 0 | ||||||||||||||||||||||||
| 688 | else | - | ||||||||||||||||||||||||
| 689 | s->emulationSpecifier &= ~QPaintEngine::AlphaBlend; never executed: s->emulationSpecifier &= ~QPaintEngine::AlphaBlend; | 0 | ||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | if (linearGradient
| 0 | ||||||||||||||||||||||||
| 693 | s->emulationSpecifier |= QPaintEngine::LinearGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::LinearGradientFill; | 0 | ||||||||||||||||||||||||
| 694 | else | - | ||||||||||||||||||||||||
| 695 | s->emulationSpecifier &= ~QPaintEngine::LinearGradientFill; never executed: s->emulationSpecifier &= ~QPaintEngine::LinearGradientFill; | 0 | ||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||
| 698 | if (extendedRadialGradient
| 0 | ||||||||||||||||||||||||
| 699 | s->emulationSpecifier |= QPaintEngine::RadialGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::RadialGradientFill; | 0 | ||||||||||||||||||||||||
| 700 | else | - | ||||||||||||||||||||||||
| 701 | s->emulationSpecifier &= ~QPaintEngine::RadialGradientFill; never executed: s->emulationSpecifier &= ~QPaintEngine::RadialGradientFill; | 0 | ||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||
| 704 | if (conicalGradient
| 0 | ||||||||||||||||||||||||
| 705 | s->emulationSpecifier |= QPaintEngine::ConicalGradientFill; never executed: s->emulationSpecifier |= QPaintEngine::ConicalGradientFill; | 0 | ||||||||||||||||||||||||
| 706 | else | - | ||||||||||||||||||||||||
| 707 | s->emulationSpecifier &= ~QPaintEngine::ConicalGradientFill; never executed: s->emulationSpecifier &= ~QPaintEngine::ConicalGradientFill; | 0 | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | if (patternBrush
| 0 | ||||||||||||||||||||||||
| 711 | s->emulationSpecifier |= QPaintEngine::PatternBrush; never executed: s->emulationSpecifier |= QPaintEngine::PatternBrush; | 0 | ||||||||||||||||||||||||
| 712 | else | - | ||||||||||||||||||||||||
| 713 | s->emulationSpecifier &= ~QPaintEngine::PatternBrush; never executed: s->emulationSpecifier &= ~QPaintEngine::PatternBrush; | 0 | ||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||
| 716 | if (patternXform
| 0 | ||||||||||||||||||||||||
| 717 | s->emulationSpecifier |= QPaintEngine::PatternTransform; never executed: s->emulationSpecifier |= QPaintEngine::PatternTransform; | 0 | ||||||||||||||||||||||||
| 718 | else | - | ||||||||||||||||||||||||
| 719 | s->emulationSpecifier &= ~QPaintEngine::PatternTransform; never executed: s->emulationSpecifier &= ~QPaintEngine::PatternTransform; | 0 | ||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | if (xform
| 0 | ||||||||||||||||||||||||
| 723 | s->emulationSpecifier |= QPaintEngine::PrimitiveTransform; never executed: s->emulationSpecifier |= QPaintEngine::PrimitiveTransform; | 0 | ||||||||||||||||||||||||
| 724 | else | - | ||||||||||||||||||||||||
| 725 | s->emulationSpecifier &= ~QPaintEngine::PrimitiveTransform; never executed: s->emulationSpecifier &= ~QPaintEngine::PrimitiveTransform; | 0 | ||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | if (complexXform
| 0 | ||||||||||||||||||||||||
| 729 | s->emulationSpecifier |= QPaintEngine::PerspectiveTransform; never executed: s->emulationSpecifier |= QPaintEngine::PerspectiveTransform; | 0 | ||||||||||||||||||||||||
| 730 | else | - | ||||||||||||||||||||||||
| 731 | s->emulationSpecifier &= ~QPaintEngine::PerspectiveTransform; never executed: s->emulationSpecifier &= ~QPaintEngine::PerspectiveTransform; | 0 | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||
| 734 | if (state->opacity != 1
| 0 | ||||||||||||||||||||||||
| 735 | s->emulationSpecifier |= QPaintEngine::ConstantOpacity; never executed: s->emulationSpecifier |= QPaintEngine::ConstantOpacity; | 0 | ||||||||||||||||||||||||
| 736 | else | - | ||||||||||||||||||||||||
| 737 | s->emulationSpecifier &= ~QPaintEngine::ConstantOpacity; never executed: s->emulationSpecifier &= ~QPaintEngine::ConstantOpacity; | 0 | ||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | bool gradientStretch = false; | - | ||||||||||||||||||||||||
| 740 | bool objectBoundingMode = false; | - | ||||||||||||||||||||||||
| 741 | if (linearGradient
| 0 | ||||||||||||||||||||||||
| 742 | QGradient::CoordinateMode brushMode = coordinateMode(s->brush); | - | ||||||||||||||||||||||||
| 743 | QGradient::CoordinateMode penMode = coordinateMode(s->pen.brush()); | - | ||||||||||||||||||||||||
| 744 | - | |||||||||||||||||||||||||
| 745 | gradientStretch |= (brushMode == QGradient::StretchToDeviceMode); | - | ||||||||||||||||||||||||
| 746 | gradientStretch |= (penMode == QGradient::StretchToDeviceMode); | - | ||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | objectBoundingMode |= (brushMode == QGradient::ObjectBoundingMode); | - | ||||||||||||||||||||||||
| 749 | objectBoundingMode |= (penMode == QGradient::ObjectBoundingMode); | - | ||||||||||||||||||||||||
| 750 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 751 | if (gradientStretch
| 0 | ||||||||||||||||||||||||
| 752 | s->emulationSpecifier |= 0x10000000; never executed: s->emulationSpecifier |= 0x10000000; | 0 | ||||||||||||||||||||||||
| 753 | else | - | ||||||||||||||||||||||||
| 754 | s->emulationSpecifier &= ~0x10000000; never executed: s->emulationSpecifier &= ~0x10000000; | 0 | ||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | if (objectBoundingMode
| 0 | ||||||||||||||||||||||||
| 757 | s->emulationSpecifier |= QPaintEngine::ObjectBoundingModeGradients; never executed: s->emulationSpecifier |= QPaintEngine::ObjectBoundingModeGradients; | 0 | ||||||||||||||||||||||||
| 758 | else | - | ||||||||||||||||||||||||
| 759 | s->emulationSpecifier &= ~QPaintEngine::ObjectBoundingModeGradients; never executed: s->emulationSpecifier &= ~QPaintEngine::ObjectBoundingModeGradients; | 0 | ||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | - | |||||||||||||||||||||||||
| 762 | if (s->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 763 | (is_pen_transparent(s->pen)
| 0 | ||||||||||||||||||||||||
| 764 | s->emulationSpecifier |= 0x40000000; never executed: s->emulationSpecifier |= 0x40000000; | 0 | ||||||||||||||||||||||||
| 765 | else | - | ||||||||||||||||||||||||
| 766 | s->emulationSpecifier &= ~0x40000000; never executed: s->emulationSpecifier &= ~0x40000000; | 0 | ||||||||||||||||||||||||
| 767 | } | - | ||||||||||||||||||||||||
| 768 | - | |||||||||||||||||||||||||
| 769 | void QPainterPrivate::updateStateImpl(QPainterState *newState) | - | ||||||||||||||||||||||||
| 770 | { | - | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | if (!engine->state
| 0 | ||||||||||||||||||||||||
| 773 | engine->state = newState; | - | ||||||||||||||||||||||||
| 774 | engine->setDirty(QPaintEngine::AllDirty); | - | ||||||||||||||||||||||||
| 775 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | if (engine->state->painter() != newState->painter
| 0 | ||||||||||||||||||||||||
| 778 | - | |||||||||||||||||||||||||
| 779 | engine->setDirty(QPaintEngine::AllDirty); never executed: engine->setDirty(QPaintEngine::AllDirty); | 0 | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | else if (engine->state != newState
| 0 | ||||||||||||||||||||||||
| 783 | newState->dirtyFlags |= QPaintEngine::DirtyFlags(static_cast<QPainterState *>(engine->state)->changeFlags); never executed: newState->dirtyFlags |= QPaintEngine::DirtyFlags(static_cast<QPainterState *>(engine->state)->changeFlags); | 0 | ||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | else | - | ||||||||||||||||||||||||
| 787 | newState->changeFlags |= newState->dirtyFlags; never executed: newState->changeFlags |= newState->dirtyFlags; | 0 | ||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||
| 789 | updateEmulationSpecifier(newState); | - | ||||||||||||||||||||||||
| 790 | - | |||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | newState->dirtyFlags &= ~(QPaintEngine::DirtyBackgroundMode | - | ||||||||||||||||||||||||
| 793 | | QPaintEngine::DirtyBackground); | - | ||||||||||||||||||||||||
| 794 | - | |||||||||||||||||||||||||
| 795 | engine->state = newState; | - | ||||||||||||||||||||||||
| 796 | engine->updateState(*newState); | - | ||||||||||||||||||||||||
| 797 | engine->clearDirty(QPaintEngine::AllDirty); | - | ||||||||||||||||||||||||
| 798 | - | |||||||||||||||||||||||||
| 799 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 800 | - | |||||||||||||||||||||||||
| 801 | void QPainterPrivate::updateState(QPainterState *newState) | - | ||||||||||||||||||||||||
| 802 | { | - | ||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||
| 804 | if (!newState
| 0 | ||||||||||||||||||||||||
| 805 | engine->state = newState; | - | ||||||||||||||||||||||||
| 806 | } never executed: else if (newState->state()end of block
| 0 | ||||||||||||||||||||||||
| 807 | updateStateImpl(newState); | - | ||||||||||||||||||||||||
| 808 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 809 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 810 | QPainter::QPainter() | - | ||||||||||||||||||||||||
| 811 | : d_ptr(new QPainterPrivate(this)) | - | ||||||||||||||||||||||||
| 812 | { | - | ||||||||||||||||||||||||
| 813 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 814 | QPainter::QPainter(QPaintDevice *pd) | - | ||||||||||||||||||||||||
| 815 | : d_ptr(0) | - | ||||||||||||||||||||||||
| 816 | { | - | ||||||||||||||||||||||||
| 817 | ((!(pd != 0)) ? qt_assert("pd != 0",__FILE__,1468) : qt_noop()); | - | ||||||||||||||||||||||||
| 818 | if (!QPainterPrivate::attachPainterPrivate(this, pd)
| 0 | ||||||||||||||||||||||||
| 819 | d_ptr.reset(new QPainterPrivate(this)); | - | ||||||||||||||||||||||||
| 820 | begin(pd); | - | ||||||||||||||||||||||||
| 821 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 822 | ((!(d_ptr)) ? qt_assert("d_ptr",__FILE__,1473) : qt_noop()); | - | ||||||||||||||||||||||||
| 823 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||
| 826 | - | |||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||
| 828 | QPainter::~QPainter() | - | ||||||||||||||||||||||||
| 829 | { | - | ||||||||||||||||||||||||
| 830 | d_ptr->inDestructor = true; | - | ||||||||||||||||||||||||
| 831 | if (true) { | - | ||||||||||||||||||||||||
| 832 | if (isActive()
| 0 | ||||||||||||||||||||||||
| 833 | end(); never executed: end(); | 0 | ||||||||||||||||||||||||
| 834 | else if (d_ptr->refcount > 1
| 0 | ||||||||||||||||||||||||
| 835 | d_ptr->detachPainterPrivate(this); never executed: d_ptr->detachPainterPrivate(this); | 0 | ||||||||||||||||||||||||
| 836 | } never executed: else {end of blockdead code: { } | - | ||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | } dead code: { } | - | ||||||||||||||||||||||||
| 839 | if (d_ptr
| 0 | ||||||||||||||||||||||||
| 840 | - | |||||||||||||||||||||||||
| 841 | ((!(d_ptr->inDestructor)) ? qt_assert("d_ptr->inDestructor",__FILE__,1492) : qt_noop()); | - | ||||||||||||||||||||||||
| 842 | d_ptr->inDestructor = false; | - | ||||||||||||||||||||||||
| 843 | ((!(d_ptr->refcount == 1)) ? qt_assert("d_ptr->refcount == 1",__FILE__,1494) : qt_noop()); | - | ||||||||||||||||||||||||
| 844 | if (d_ptr->d_ptrs
| 0 | ||||||||||||||||||||||||
| 845 | free(d_ptr->d_ptrs); never executed: free(d_ptr->d_ptrs); | 0 | ||||||||||||||||||||||||
| 846 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 848 | QPaintDevice *QPainter::device() const | - | ||||||||||||||||||||||||
| 849 | { | - | ||||||||||||||||||||||||
| 850 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 851 | if (isActive()
| 0 | ||||||||||||||||||||||||
| 852 | return never executed: d->engine->d_func()->currentClipDevice;return d->engine->d_func()->currentClipDevice;never executed: return d->engine->d_func()->currentClipDevice; | 0 | ||||||||||||||||||||||||
| 853 | return never executed: d->original_device;return d->original_device;never executed: return d->original_device; | 0 | ||||||||||||||||||||||||
| 854 | } | - | ||||||||||||||||||||||||
| 855 | bool QPainter::isActive() const | - | ||||||||||||||||||||||||
| 856 | { | - | ||||||||||||||||||||||||
| 857 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 858 | return never executed: d->engine;return d->engine;never executed: return d->engine; | 0 | ||||||||||||||||||||||||
| 859 | } | - | ||||||||||||||||||||||||
| 860 | void QPainter::initFrom(const QPaintDevice *device) | - | ||||||||||||||||||||||||
| 861 | { | - | ||||||||||||||||||||||||
| 862 | ((!(device)) ? qt_assert_x("QPainter::initFrom(const QPaintDevice *device)", "QPaintDevice cannot be 0",__FILE__,1538) : qt_noop()); | - | ||||||||||||||||||||||||
| 863 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 864 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 865 | QMessageLogger(__FILE__, 1541, __PRETTY_FUNCTION__).warning("QPainter::initFrom: Painter not active, aborted"); | - | ||||||||||||||||||||||||
| 866 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 867 | } | - | ||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||
| 869 | device->initPainter(this); | - | ||||||||||||||||||||||||
| 870 | - | |||||||||||||||||||||||||
| 871 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 872 | d->extended->penChanged(); | - | ||||||||||||||||||||||||
| 873 | } never executed: else if (d->engineend of block
| 0 | ||||||||||||||||||||||||
| 874 | d->engine->setDirty(QPaintEngine::DirtyPen); | - | ||||||||||||||||||||||||
| 875 | d->engine->setDirty(QPaintEngine::DirtyBrush); | - | ||||||||||||||||||||||||
| 876 | d->engine->setDirty(QPaintEngine::DirtyFont); | - | ||||||||||||||||||||||||
| 877 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 878 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 879 | void QPainter::save() | - | ||||||||||||||||||||||||
| 880 | { | - | ||||||||||||||||||||||||
| 881 | - | |||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | - | |||||||||||||||||||||||||
| 884 | - | |||||||||||||||||||||||||
| 885 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 886 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 887 | QMessageLogger(__FILE__, 1573, __PRETTY_FUNCTION__).warning("QPainter::save: Painter not active"); | - | ||||||||||||||||||||||||
| 888 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 889 | } | - | ||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||
| 891 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 892 | d->state = d->extended->createState(d->states.back()); | - | ||||||||||||||||||||||||
| 893 | d->extended->setState(d->state); | - | ||||||||||||||||||||||||
| 894 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 895 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 896 | d->state = new QPainterState(d->states.back()); | - | ||||||||||||||||||||||||
| 897 | d->engine->state = d->state; | - | ||||||||||||||||||||||||
| 898 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 899 | d->states.push_back(d->state); | - | ||||||||||||||||||||||||
| 900 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 901 | void QPainter::restore() | - | ||||||||||||||||||||||||
| 902 | { | - | ||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||
| 904 | - | |||||||||||||||||||||||||
| 905 | - | |||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 908 | if (d->states.size()<=1
| 0 | ||||||||||||||||||||||||
| 909 | QMessageLogger(__FILE__, 1603, __PRETTY_FUNCTION__).warning("QPainter::restore: Unbalanced save/restore"); | - | ||||||||||||||||||||||||
| 910 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 911 | } else if (!d->engine
| 0 | ||||||||||||||||||||||||
| 912 | QMessageLogger(__FILE__, 1606, __PRETTY_FUNCTION__).warning("QPainter::restore: Painter not active"); | - | ||||||||||||||||||||||||
| 913 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 914 | } | - | ||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||
| 916 | QPainterState *tmp = d->state; | - | ||||||||||||||||||||||||
| 917 | d->states.pop_back(); | - | ||||||||||||||||||||||||
| 918 | d->state = d->states.back(); | - | ||||||||||||||||||||||||
| 919 | d->txinv = false; | - | ||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 922 | d->checkEmulation(); | - | ||||||||||||||||||||||||
| 923 | d->extended->setState(d->state); | - | ||||||||||||||||||||||||
| 924 | delete tmp; | - | ||||||||||||||||||||||||
| 925 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 926 | } | - | ||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||
| 930 | if (!d->state->clipInfo.isEmpty()
| 0 | ||||||||||||||||||||||||
| 931 | && (
| 0 | ||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||
| 933 | tmp->dirtyFlags = QPaintEngine::DirtyClipPath; | - | ||||||||||||||||||||||||
| 934 | tmp->clipOperation = Qt::NoClip; | - | ||||||||||||||||||||||||
| 935 | tmp->clipPath = QPainterPath(); | - | ||||||||||||||||||||||||
| 936 | d->engine->updateState(*tmp); | - | ||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | for (int i=0; i<d->state->clipInfo.size()
| 0 | ||||||||||||||||||||||||
| 939 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - | ||||||||||||||||||||||||
| 940 | tmp->matrix = info.matrix; | - | ||||||||||||||||||||||||
| 941 | tmp->matrix *= d->state->redirectionMatrix; | - | ||||||||||||||||||||||||
| 942 | tmp->clipOperation = info.operation; | - | ||||||||||||||||||||||||
| 943 | if (info.clipType == QPainterClipInfo::RectClip
| 0 | ||||||||||||||||||||||||
| 944 | tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform; | - | ||||||||||||||||||||||||
| 945 | tmp->clipRegion = info.rect; | - | ||||||||||||||||||||||||
| 946 | } never executed: else if (info.clipType == QPainterClipInfo::RegionClipend of block
| 0 | ||||||||||||||||||||||||
| 947 | tmp->dirtyFlags = QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyTransform; | - | ||||||||||||||||||||||||
| 948 | tmp->clipRegion = info.region; | - | ||||||||||||||||||||||||
| 949 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 950 | tmp->dirtyFlags = QPaintEngine::DirtyClipPath | QPaintEngine::DirtyTransform; | - | ||||||||||||||||||||||||
| 951 | tmp->clipPath = info.path; | - | ||||||||||||||||||||||||
| 952 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 953 | d->engine->updateState(*tmp); | - | ||||||||||||||||||||||||
| 954 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | d->state->dirtyFlags &= ~(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion); | - | ||||||||||||||||||||||||
| 959 | tmp->changeFlags &= ~uint(QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipRegion); | - | ||||||||||||||||||||||||
| 960 | tmp->changeFlags |= QPaintEngine::DirtyTransform; | - | ||||||||||||||||||||||||
| 961 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 962 | - | |||||||||||||||||||||||||
| 963 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 964 | delete tmp; | - | ||||||||||||||||||||||||
| 965 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 966 | static inline void qt_cleanup_painter_state(QPainterPrivate *d) | - | ||||||||||||||||||||||||
| 967 | { | - | ||||||||||||||||||||||||
| 968 | d->states.clear(); | - | ||||||||||||||||||||||||
| 969 | delete d->state; | - | ||||||||||||||||||||||||
| 970 | d->state = 0; | - | ||||||||||||||||||||||||
| 971 | d->engine = 0; | - | ||||||||||||||||||||||||
| 972 | d->device = 0; | - | ||||||||||||||||||||||||
| 973 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 974 | - | |||||||||||||||||||||||||
| 975 | bool QPainter::begin(QPaintDevice *pd) | - | ||||||||||||||||||||||||
| 976 | { | - | ||||||||||||||||||||||||
| 977 | ((!(pd)) ? qt_assert("pd",__FILE__,1700) : qt_noop()); | - | ||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||
| 979 | if (pd->painters > 0
| 0 | ||||||||||||||||||||||||
| 980 | QMessageLogger(__FILE__, 1703, __PRETTY_FUNCTION__).warning("QPainter::begin: A paint device can only be painted by one painter at a time."); | - | ||||||||||||||||||||||||
| 981 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 982 | } | - | ||||||||||||||||||||||||
| 983 | - | |||||||||||||||||||||||||
| 984 | if (d_ptr->engine
| 0 | ||||||||||||||||||||||||
| 985 | QMessageLogger(__FILE__, 1708, __PRETTY_FUNCTION__).warning("QPainter::begin: Painter already active"); | - | ||||||||||||||||||||||||
| 986 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 987 | } | - | ||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||
| 989 | if (QPainterPrivate::attachPainterPrivate(this, pd)
| 0 | ||||||||||||||||||||||||
| 990 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 991 | - | |||||||||||||||||||||||||
| 992 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 993 | - | |||||||||||||||||||||||||
| 994 | d->helper_device = pd; | - | ||||||||||||||||||||||||
| 995 | d->original_device = pd; | - | ||||||||||||||||||||||||
| 996 | - | |||||||||||||||||||||||||
| 997 | QPoint redirectionOffset; | - | ||||||||||||||||||||||||
| 998 | QPaintDevice *rpd = pd->redirected(&redirectionOffset); | - | ||||||||||||||||||||||||
| 999 | if (rpd
| 0 | ||||||||||||||||||||||||
| 1000 | pd = rpd; never executed: pd = rpd; | 0 | ||||||||||||||||||||||||
| 1001 | - | |||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | - | |||||||||||||||||||||||||
| 1004 | - | |||||||||||||||||||||||||
| 1005 | - | |||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||
| 1007 | if (pd->devType() == QInternal::Pixmap
| 0 | ||||||||||||||||||||||||
| 1008 | static_cast< never executed: QPixmap *>(pd)->detach();static_cast<QPixmap *>(pd)->detach();never executed: static_cast<QPixmap *>(pd)->detach(); | 0 | ||||||||||||||||||||||||
| 1009 | else if (pd->devType() == QInternal::Image
| 0 | ||||||||||||||||||||||||
| 1010 | static_cast< never executed: QImage *>(pd)->detach();static_cast<QImage *>(pd)->detach();never executed: static_cast<QImage *>(pd)->detach(); | 0 | ||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||
| 1012 | d->engine = pd->paintEngine(); | - | ||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||
| 1014 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1015 | QMessageLogger(__FILE__, 1738, __PRETTY_FUNCTION__).warning("QPainter::begin: Paint device returned engine == 0, type: %d", pd->devType()); | - | ||||||||||||||||||||||||
| 1016 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1017 | } | - | ||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | d->device = pd; | - | ||||||||||||||||||||||||
| 1020 | - | |||||||||||||||||||||||||
| 1021 | d->extended = d->engine->isExtended()
| 0 | ||||||||||||||||||||||||
| 1022 | if (d->emulationEngine
| 0 | ||||||||||||||||||||||||
| 1023 | d->emulationEngine->real_engine = d->extended; never executed: d->emulationEngine->real_engine = d->extended; | 0 | ||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | ((!(!d->state)) ? qt_assert("!d->state",__FILE__,1749) : qt_noop()); | - | ||||||||||||||||||||||||
| 1027 | d->state = d->extended
| 0 | ||||||||||||||||||||||||
| 1028 | d->state->painter = this; | - | ||||||||||||||||||||||||
| 1029 | d->states.push_back(d->state); | - | ||||||||||||||||||||||||
| 1030 | - | |||||||||||||||||||||||||
| 1031 | d->state->redirectionMatrix.translate(-redirectionOffset.x(), -redirectionOffset.y()); | - | ||||||||||||||||||||||||
| 1032 | d->state->brushOrigin = QPointF(); | - | ||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | - | |||||||||||||||||||||||||
| 1035 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1036 | d->extended->setState(d->state); never executed: d->extended->setState(d->state); | 0 | ||||||||||||||||||||||||
| 1037 | else | - | ||||||||||||||||||||||||
| 1038 | d->engine->state = d->state; never executed: d->engine->state = d->state; | 0 | ||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | switch (pd->devType()) { | - | ||||||||||||||||||||||||
| 1041 | case never executed: QInternal::Pixmap:case QInternal::Pixmap:never executed: case QInternal::Pixmap: | 0 | ||||||||||||||||||||||||
| 1042 | { | - | ||||||||||||||||||||||||
| 1043 | QPixmap *pm = static_cast<QPixmap *>(pd); | - | ||||||||||||||||||||||||
| 1044 | ((!(pm)) ? qt_assert("pm",__FILE__,1767) : qt_noop()); | - | ||||||||||||||||||||||||
| 1045 | if (pm->isNull()
| 0 | ||||||||||||||||||||||||
| 1046 | QMessageLogger(__FILE__, 1769, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on a null pixmap"); | - | ||||||||||||||||||||||||
| 1047 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1048 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1049 | } | - | ||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||
| 1051 | if (pm->depth() == 1
| 0 | ||||||||||||||||||||||||
| 1052 | d->state->pen = QPen(Qt::color1); | - | ||||||||||||||||||||||||
| 1053 | d->state->brush = QBrush(Qt::color0); | - | ||||||||||||||||||||||||
| 1054 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1055 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1056 | } | - | ||||||||||||||||||||||||
| 1057 | case never executed: QInternal::Image:case QInternal::Image:never executed: case QInternal::Image: | 0 | ||||||||||||||||||||||||
| 1058 | { | - | ||||||||||||||||||||||||
| 1059 | QImage *img = static_cast<QImage *>(pd); | - | ||||||||||||||||||||||||
| 1060 | ((!(img)) ? qt_assert("img",__FILE__,1783) : qt_noop()); | - | ||||||||||||||||||||||||
| 1061 | if (img->isNull()
| 0 | ||||||||||||||||||||||||
| 1062 | QMessageLogger(__FILE__, 1785, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on a null image"); | - | ||||||||||||||||||||||||
| 1063 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1064 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1065 | } else if (img->format() == QImage::Format_Indexed8
| 0 | ||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||
| 1067 | QMessageLogger(__FILE__, 1790, __PRETTY_FUNCTION__).warning("QPainter::begin: Cannot paint on an image with the QImage::Format_Indexed8 format"); | - | ||||||||||||||||||||||||
| 1068 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1069 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1070 | } | - | ||||||||||||||||||||||||
| 1071 | if (img->depth() == 1
| 0 | ||||||||||||||||||||||||
| 1072 | d->state->pen = QPen(Qt::color1); | - | ||||||||||||||||||||||||
| 1073 | d->state->brush = QBrush(Qt::color0); | - | ||||||||||||||||||||||||
| 1074 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1075 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1076 | } | - | ||||||||||||||||||||||||
| 1077 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1078 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1079 | } | - | ||||||||||||||||||||||||
| 1080 | if (d->state->ww == 0
| 0 | ||||||||||||||||||||||||
| 1081 | d->state->ww = d->state->wh = d->state->vw = d->state->vh = 1024; never executed: d->state->ww = d->state->wh = d->state->vw = d->state->vh = 1024; | 0 | ||||||||||||||||||||||||
| 1082 | - | |||||||||||||||||||||||||
| 1083 | d->engine->setPaintDevice(pd); | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | bool begun = d->engine->begin(pd); | - | ||||||||||||||||||||||||
| 1086 | if (!begun
| 0 | ||||||||||||||||||||||||
| 1087 | QMessageLogger(__FILE__, 1810, __PRETTY_FUNCTION__).warning("QPainter::begin(): Returned false"); | - | ||||||||||||||||||||||||
| 1088 | if (d->engine->isActive()
| 0 | ||||||||||||||||||||||||
| 1089 | end(); | - | ||||||||||||||||||||||||
| 1090 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1091 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1092 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1093 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1094 | } else { | - | ||||||||||||||||||||||||
| 1095 | d->engine->setActive(begun); | - | ||||||||||||||||||||||||
| 1096 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1097 | - | |||||||||||||||||||||||||
| 1098 | - | |||||||||||||||||||||||||
| 1099 | - | |||||||||||||||||||||||||
| 1100 | if (d->original_device->devType() == QInternal::Widget
| 0 | ||||||||||||||||||||||||
| 1101 | initFrom(d->original_device); | - | ||||||||||||||||||||||||
| 1102 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1103 | d->state->layoutDirection = Qt::LayoutDirectionAuto; | - | ||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||
| 1105 | d->state->deviceFont = d->state->font = QFont(d->state->deviceFont, device()); | - | ||||||||||||||||||||||||
| 1106 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||
| 1108 | QRect systemRect = d->engine->systemRect(); | - | ||||||||||||||||||||||||
| 1109 | if (!systemRect.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1110 | d->state->ww = d->state->vw = systemRect.width(); | - | ||||||||||||||||||||||||
| 1111 | d->state->wh = d->state->vh = systemRect.height(); | - | ||||||||||||||||||||||||
| 1112 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1113 | d->state->ww = d->state->vw = pd->metric(QPaintDevice::PdmWidth); | - | ||||||||||||||||||||||||
| 1114 | d->state->wh = d->state->vh = pd->metric(QPaintDevice::PdmHeight); | - | ||||||||||||||||||||||||
| 1115 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | const QPoint coordinateOffset = d->engine->coordinateOffset(); | - | ||||||||||||||||||||||||
| 1118 | d->state->redirectionMatrix.translate(-coordinateOffset.x(), -coordinateOffset.y()); | - | ||||||||||||||||||||||||
| 1119 | - | |||||||||||||||||||||||||
| 1120 | ((!(d->engine->isActive())) ? qt_assert("d->engine->isActive()",__FILE__,1843) : qt_noop()); | - | ||||||||||||||||||||||||
| 1121 | - | |||||||||||||||||||||||||
| 1122 | if (!d->state->redirectionMatrix.isIdentity()
| 0 | ||||||||||||||||||||||||
| 1123 | d->updateMatrix(); never executed: d->updateMatrix(); | 0 | ||||||||||||||||||||||||
| 1124 | - | |||||||||||||||||||||||||
| 1125 | ((!(d->engine->isActive())) ? qt_assert("d->engine->isActive()",__FILE__,1848) : qt_noop()); | - | ||||||||||||||||||||||||
| 1126 | d->state->renderHints = QPainter::TextAntialiasing; | - | ||||||||||||||||||||||||
| 1127 | ++d->device->painters; | - | ||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||
| 1129 | d->state->emulationSpecifier = 0; | - | ||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1132 | } | - | ||||||||||||||||||||||||
| 1133 | bool QPainter::end() | - | ||||||||||||||||||||||||
| 1134 | { | - | ||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||
| 1139 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1142 | QMessageLogger(__FILE__, 1876, __PRETTY_FUNCTION__).warning("QPainter::end: Painter not active, aborted"); | - | ||||||||||||||||||||||||
| 1143 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1144 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1145 | } | - | ||||||||||||||||||||||||
| 1146 | - | |||||||||||||||||||||||||
| 1147 | if (d->refcount > 1
| 0 | ||||||||||||||||||||||||
| 1148 | d->detachPainterPrivate(this); | - | ||||||||||||||||||||||||
| 1149 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1150 | } | - | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | bool ended = true; | - | ||||||||||||||||||||||||
| 1153 | - | |||||||||||||||||||||||||
| 1154 | if (d->engine->isActive()
| 0 | ||||||||||||||||||||||||
| 1155 | ended = d->engine->end(); | - | ||||||||||||||||||||||||
| 1156 | d->updateState(0); | - | ||||||||||||||||||||||||
| 1157 | - | |||||||||||||||||||||||||
| 1158 | --d->device->painters; | - | ||||||||||||||||||||||||
| 1159 | if (d->device->painters == 0
| 0 | ||||||||||||||||||||||||
| 1160 | d->engine->setPaintDevice(0); | - | ||||||||||||||||||||||||
| 1161 | d->engine->setActive(false); | - | ||||||||||||||||||||||||
| 1162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1163 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1164 | - | |||||||||||||||||||||||||
| 1165 | if (d->states.size() > 1
| 0 | ||||||||||||||||||||||||
| 1166 | QMessageLogger(__FILE__, 1900, __PRETTY_FUNCTION__).warning("QPainter::end: Painter ended with %d saved states", | - | ||||||||||||||||||||||||
| 1167 | d->states.size()); | - | ||||||||||||||||||||||||
| 1168 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | if (d->engine->autoDestruct()
| 0 | ||||||||||||||||||||||||
| 1171 | delete d->engine; | - | ||||||||||||||||||||||||
| 1172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1173 | - | |||||||||||||||||||||||||
| 1174 | if (d->emulationEngine
| 0 | ||||||||||||||||||||||||
| 1175 | delete d->emulationEngine; | - | ||||||||||||||||||||||||
| 1176 | d->emulationEngine = 0; | - | ||||||||||||||||||||||||
| 1177 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1178 | - | |||||||||||||||||||||||||
| 1179 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1180 | d->extended = 0; | - | ||||||||||||||||||||||||
| 1181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1182 | - | |||||||||||||||||||||||||
| 1183 | qt_cleanup_painter_state(d); | - | ||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | return never executed: ended;return ended;never executed: return ended; | 0 | ||||||||||||||||||||||||
| 1186 | } | - | ||||||||||||||||||||||||
| 1187 | QPaintEngine *QPainter::paintEngine() const | - | ||||||||||||||||||||||||
| 1188 | { | - | ||||||||||||||||||||||||
| 1189 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1190 | return never executed: d->engine;return d->engine;never executed: return d->engine; | 0 | ||||||||||||||||||||||||
| 1191 | } | - | ||||||||||||||||||||||||
| 1192 | void QPainter::beginNativePainting() | - | ||||||||||||||||||||||||
| 1193 | { | - | ||||||||||||||||||||||||
| 1194 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1195 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1196 | QMessageLogger(__FILE__, 1971, __PRETTY_FUNCTION__).warning("QPainter::beginNativePainting: Painter not active"); | - | ||||||||||||||||||||||||
| 1197 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1198 | } | - | ||||||||||||||||||||||||
| 1199 | - | |||||||||||||||||||||||||
| 1200 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1201 | d->extended->beginNativePainting(); never executed: d->extended->beginNativePainting(); | 0 | ||||||||||||||||||||||||
| 1202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1203 | void QPainter::endNativePainting() | - | ||||||||||||||||||||||||
| 1204 | { | - | ||||||||||||||||||||||||
| 1205 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1206 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1207 | QMessageLogger(__FILE__, 1992, __PRETTY_FUNCTION__).warning("QPainter::beginNativePainting: Painter not active"); | - | ||||||||||||||||||||||||
| 1208 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1209 | } | - | ||||||||||||||||||||||||
| 1210 | - | |||||||||||||||||||||||||
| 1211 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1212 | d->extended->endNativePainting(); never executed: d->extended->endNativePainting(); | 0 | ||||||||||||||||||||||||
| 1213 | else | - | ||||||||||||||||||||||||
| 1214 | d->engine->syncState(); never executed: d->engine->syncState(); | 0 | ||||||||||||||||||||||||
| 1215 | } | - | ||||||||||||||||||||||||
| 1216 | QFontMetrics QPainter::fontMetrics() const | - | ||||||||||||||||||||||||
| 1217 | { | - | ||||||||||||||||||||||||
| 1218 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1219 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1220 | QMessageLogger(__FILE__, 2013, __PRETTY_FUNCTION__).warning("QPainter::fontMetrics: Painter not active"); | - | ||||||||||||||||||||||||
| 1221 | return never executed: QFontMetrics(QFont());return QFontMetrics(QFont());never executed: return QFontMetrics(QFont()); | 0 | ||||||||||||||||||||||||
| 1222 | } | - | ||||||||||||||||||||||||
| 1223 | return never executed: QFontMetrics(d->state->font);return QFontMetrics(d->state->font);never executed: return QFontMetrics(d->state->font); | 0 | ||||||||||||||||||||||||
| 1224 | } | - | ||||||||||||||||||||||||
| 1225 | QFontInfo QPainter::fontInfo() const | - | ||||||||||||||||||||||||
| 1226 | { | - | ||||||||||||||||||||||||
| 1227 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1228 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1229 | QMessageLogger(__FILE__, 2031, __PRETTY_FUNCTION__).warning("QPainter::fontInfo: Painter not active"); | - | ||||||||||||||||||||||||
| 1230 | return never executed: QFontInfo(QFont());return QFontInfo(QFont());never executed: return QFontInfo(QFont()); | 0 | ||||||||||||||||||||||||
| 1231 | } | - | ||||||||||||||||||||||||
| 1232 | return never executed: QFontInfo(d->state->font);return QFontInfo(d->state->font);never executed: return QFontInfo(d->state->font); | 0 | ||||||||||||||||||||||||
| 1233 | } | - | ||||||||||||||||||||||||
| 1234 | qreal QPainter::opacity() const | - | ||||||||||||||||||||||||
| 1235 | { | - | ||||||||||||||||||||||||
| 1236 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1237 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1238 | QMessageLogger(__FILE__, 2048, __PRETTY_FUNCTION__).warning("QPainter::opacity: Painter not active"); | - | ||||||||||||||||||||||||
| 1239 | return never executed: 1.0;return 1.0;never executed: return 1.0; | 0 | ||||||||||||||||||||||||
| 1240 | } | - | ||||||||||||||||||||||||
| 1241 | return never executed: d->state->opacity;return d->state->opacity;never executed: return d->state->opacity; | 0 | ||||||||||||||||||||||||
| 1242 | } | - | ||||||||||||||||||||||||
| 1243 | void QPainter::setOpacity(qreal opacity) | - | ||||||||||||||||||||||||
| 1244 | { | - | ||||||||||||||||||||||||
| 1245 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||
| 1247 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1248 | QMessageLogger(__FILE__, 2070, __PRETTY_FUNCTION__).warning("QPainter::setOpacity: Painter not active"); | - | ||||||||||||||||||||||||
| 1249 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1250 | } | - | ||||||||||||||||||||||||
| 1251 | - | |||||||||||||||||||||||||
| 1252 | opacity = qMin(qreal(1), qMax(qreal(0), opacity)); | - | ||||||||||||||||||||||||
| 1253 | - | |||||||||||||||||||||||||
| 1254 | if (opacity == d->state->opacity
| 0 | ||||||||||||||||||||||||
| 1255 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1256 | - | |||||||||||||||||||||||||
| 1257 | d->state->opacity = opacity; | - | ||||||||||||||||||||||||
| 1258 | - | |||||||||||||||||||||||||
| 1259 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1260 | d->extended->opacityChanged(); never executed: d->extended->opacityChanged(); | 0 | ||||||||||||||||||||||||
| 1261 | else | - | ||||||||||||||||||||||||
| 1262 | d->state->dirtyFlags |= QPaintEngine::DirtyOpacity; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyOpacity; | 0 | ||||||||||||||||||||||||
| 1263 | } | - | ||||||||||||||||||||||||
| 1264 | QPoint QPainter::brushOrigin() const | - | ||||||||||||||||||||||||
| 1265 | { | - | ||||||||||||||||||||||||
| 1266 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1267 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1268 | QMessageLogger(__FILE__, 2098, __PRETTY_FUNCTION__).warning("QPainter::brushOrigin: Painter not active"); | - | ||||||||||||||||||||||||
| 1269 | return never executed: QPoint();return QPoint();never executed: return QPoint(); | 0 | ||||||||||||||||||||||||
| 1270 | } | - | ||||||||||||||||||||||||
| 1271 | return never executed: QPointF(d->state->brushOrigin).toPoint();return QPointF(d->state->brushOrigin).toPoint();never executed: return QPointF(d->state->brushOrigin).toPoint(); | 0 | ||||||||||||||||||||||||
| 1272 | } | - | ||||||||||||||||||||||||
| 1273 | void QPainter::setBrushOrigin(const QPointF &p) | - | ||||||||||||||||||||||||
| 1274 | { | - | ||||||||||||||||||||||||
| 1275 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1276 | - | |||||||||||||||||||||||||
| 1277 | - | |||||||||||||||||||||||||
| 1278 | - | |||||||||||||||||||||||||
| 1279 | - | |||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1282 | QMessageLogger(__FILE__, 2131, __PRETTY_FUNCTION__).warning("QPainter::setBrushOrigin: Painter not active"); | - | ||||||||||||||||||||||||
| 1283 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1284 | } | - | ||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||
| 1286 | d->state->brushOrigin = p; | - | ||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||
| 1288 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1289 | d->extended->brushOriginChanged(); | - | ||||||||||||||||||||||||
| 1290 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1291 | } | - | ||||||||||||||||||||||||
| 1292 | - | |||||||||||||||||||||||||
| 1293 | d->state->dirtyFlags |= QPaintEngine::DirtyBrushOrigin; | - | ||||||||||||||||||||||||
| 1294 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1295 | void QPainter::setCompositionMode(CompositionMode mode) | - | ||||||||||||||||||||||||
| 1296 | { | - | ||||||||||||||||||||||||
| 1297 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1298 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1299 | QMessageLogger(__FILE__, 2357, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: Painter not active"); | - | ||||||||||||||||||||||||
| 1300 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1301 | } | - | ||||||||||||||||||||||||
| 1302 | if (d->state->composition_mode == mode
| 0 | ||||||||||||||||||||||||
| 1303 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1304 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1305 | d->state->composition_mode = mode; | - | ||||||||||||||||||||||||
| 1306 | d->extended->compositionModeChanged(); | - | ||||||||||||||||||||||||
| 1307 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1308 | } | - | ||||||||||||||||||||||||
| 1309 | - | |||||||||||||||||||||||||
| 1310 | if (mode >= QPainter::RasterOp_SourceOrDestination
| 0 | ||||||||||||||||||||||||
| 1311 | if (!d->engine->hasFeature(QPaintEngine::RasterOpModes)
| 0 | ||||||||||||||||||||||||
| 1312 | QMessageLogger(__FILE__, 2370, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - | ||||||||||||||||||||||||
| 1313 | "Raster operation modes not supported on device"); | - | ||||||||||||||||||||||||
| 1314 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1315 | } | - | ||||||||||||||||||||||||
| 1316 | } never executed: else if (mode >= QPainter::CompositionMode_Plusend of block
| 0 | ||||||||||||||||||||||||
| 1317 | if (!d->engine->hasFeature(QPaintEngine::BlendModes)
| 0 | ||||||||||||||||||||||||
| 1318 | QMessageLogger(__FILE__, 2376, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - | ||||||||||||||||||||||||
| 1319 | "Blend modes not supported on device"); | - | ||||||||||||||||||||||||
| 1320 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1321 | } | - | ||||||||||||||||||||||||
| 1322 | } never executed: else if (!d->engine->hasFeature(QPaintEngine::PorterDuff)end of block
| 0 | ||||||||||||||||||||||||
| 1323 | if (mode != CompositionMode_Source
| 0 | ||||||||||||||||||||||||
| 1324 | QMessageLogger(__FILE__, 2382, __PRETTY_FUNCTION__).warning("QPainter::setCompositionMode: " | - | ||||||||||||||||||||||||
| 1325 | "PorterDuff modes not supported on device"); | - | ||||||||||||||||||||||||
| 1326 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1327 | } | - | ||||||||||||||||||||||||
| 1328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1329 | - | |||||||||||||||||||||||||
| 1330 | d->state->composition_mode = mode; | - | ||||||||||||||||||||||||
| 1331 | d->state->dirtyFlags |= QPaintEngine::DirtyCompositionMode; | - | ||||||||||||||||||||||||
| 1332 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1333 | - | |||||||||||||||||||||||||
| 1334 | - | |||||||||||||||||||||||||
| 1335 | - | |||||||||||||||||||||||||
| 1336 | - | |||||||||||||||||||||||||
| 1337 | - | |||||||||||||||||||||||||
| 1338 | - | |||||||||||||||||||||||||
| 1339 | QPainter::CompositionMode QPainter::compositionMode() const | - | ||||||||||||||||||||||||
| 1340 | { | - | ||||||||||||||||||||||||
| 1341 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1342 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1343 | QMessageLogger(__FILE__, 2401, __PRETTY_FUNCTION__).warning("QPainter::compositionMode: Painter not active"); | - | ||||||||||||||||||||||||
| 1344 | return never executed: QPainter::CompositionMode_SourceOver;return QPainter::CompositionMode_SourceOver;never executed: return QPainter::CompositionMode_SourceOver; | 0 | ||||||||||||||||||||||||
| 1345 | } | - | ||||||||||||||||||||||||
| 1346 | return never executed: d->state->composition_mode;return d->state->composition_mode;never executed: return d->state->composition_mode; | 0 | ||||||||||||||||||||||||
| 1347 | } | - | ||||||||||||||||||||||||
| 1348 | - | |||||||||||||||||||||||||
| 1349 | - | |||||||||||||||||||||||||
| 1350 | - | |||||||||||||||||||||||||
| 1351 | - | |||||||||||||||||||||||||
| 1352 | - | |||||||||||||||||||||||||
| 1353 | - | |||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | const QBrush &QPainter::background() const | - | ||||||||||||||||||||||||
| 1356 | { | - | ||||||||||||||||||||||||
| 1357 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1358 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1359 | QMessageLogger(__FILE__, 2417, __PRETTY_FUNCTION__).warning("QPainter::background: Painter not active"); | - | ||||||||||||||||||||||||
| 1360 | return never executed: d->fakeState()->brush;return d->fakeState()->brush;never executed: return d->fakeState()->brush; | 0 | ||||||||||||||||||||||||
| 1361 | } | - | ||||||||||||||||||||||||
| 1362 | return never executed: d->state->bgBrush;return d->state->bgBrush;never executed: return d->state->bgBrush; | 0 | ||||||||||||||||||||||||
| 1363 | } | - | ||||||||||||||||||||||||
| 1364 | bool QPainter::hasClipping() const | - | ||||||||||||||||||||||||
| 1365 | { | - | ||||||||||||||||||||||||
| 1366 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1367 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1368 | QMessageLogger(__FILE__, 2434, __PRETTY_FUNCTION__).warning("QPainter::hasClipping: Painter not active"); | - | ||||||||||||||||||||||||
| 1369 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1370 | } | - | ||||||||||||||||||||||||
| 1371 | return never executed: d->state->clipEnabledreturn d->state->clipEnabled && d->state->clipOperation != Qt::NoClip;
never executed: return d->state->clipEnabled && d->state->clipOperation != Qt::NoClip; | 0 | ||||||||||||||||||||||||
| 1372 | } | - | ||||||||||||||||||||||||
| 1373 | void QPainter::setClipping(bool enable) | - | ||||||||||||||||||||||||
| 1374 | { | - | ||||||||||||||||||||||||
| 1375 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1376 | - | |||||||||||||||||||||||||
| 1377 | - | |||||||||||||||||||||||||
| 1378 | - | |||||||||||||||||||||||||
| 1379 | - | |||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||
| 1382 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1383 | QMessageLogger(__FILE__, 2458, __PRETTY_FUNCTION__).warning("QPainter::setClipping: Painter not active, state will be reset by begin"); | - | ||||||||||||||||||||||||
| 1384 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1385 | } | - | ||||||||||||||||||||||||
| 1386 | - | |||||||||||||||||||||||||
| 1387 | if (hasClipping() == enable
| 0 | ||||||||||||||||||||||||
| 1388 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1389 | - | |||||||||||||||||||||||||
| 1390 | - | |||||||||||||||||||||||||
| 1391 | if (enable
| 0 | ||||||||||||||||||||||||
| 1392 | && (d->state->clipInfo.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1393 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1394 | d->state->clipEnabled = enable; | - | ||||||||||||||||||||||||
| 1395 | - | |||||||||||||||||||||||||
| 1396 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1397 | d->extended->clipEnabledChanged(); | - | ||||||||||||||||||||||||
| 1398 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1399 | } | - | ||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||
| 1401 | d->state->dirtyFlags |= QPaintEngine::DirtyClipEnabled; | - | ||||||||||||||||||||||||
| 1402 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 1403 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1404 | QRegion QPainter::clipRegion() const | - | ||||||||||||||||||||||||
| 1405 | { | - | ||||||||||||||||||||||||
| 1406 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1407 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1408 | QMessageLogger(__FILE__, 2497, __PRETTY_FUNCTION__).warning("QPainter::clipRegion: Painter not active"); | - | ||||||||||||||||||||||||
| 1409 | return never executed: QRegion();return QRegion();never executed: return QRegion(); | 0 | ||||||||||||||||||||||||
| 1410 | } | - | ||||||||||||||||||||||||
| 1411 | - | |||||||||||||||||||||||||
| 1412 | QRegion region; | - | ||||||||||||||||||||||||
| 1413 | bool lastWasNothing = true; | - | ||||||||||||||||||||||||
| 1414 | - | |||||||||||||||||||||||||
| 1415 | if (!d->txinv
| 0 | ||||||||||||||||||||||||
| 1416 | const_cast< never executed: QPainter *>(this)->d_ptr->updateInvMatrix();const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();never executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); | 0 | ||||||||||||||||||||||||
| 1417 | - | |||||||||||||||||||||||||
| 1418 | - | |||||||||||||||||||||||||
| 1419 | for (int i=0; i<d->state->clipInfo.size()
| 0 | ||||||||||||||||||||||||
| 1420 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - | ||||||||||||||||||||||||
| 1421 | switch (info.clipType) { | - | ||||||||||||||||||||||||
| 1422 | - | |||||||||||||||||||||||||
| 1423 | case never executed: QPainterClipInfo::RegionClip:case QPainterClipInfo::RegionClip:never executed: {case QPainterClipInfo::RegionClip: | 0 | ||||||||||||||||||||||||
| 1424 | QTransform matrix = (info.matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1425 | if (lastWasNothing
| 0 | ||||||||||||||||||||||||
| 1426 | region = info.region * matrix; | - | ||||||||||||||||||||||||
| 1427 | lastWasNothing = false; | - | ||||||||||||||||||||||||
| 1428 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1429 | } | - | ||||||||||||||||||||||||
| 1430 | if (info.operation == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||
| 1431 | region &= info.region * matrix; never executed: region &= info.region * matrix; | 0 | ||||||||||||||||||||||||
| 1432 | else if (info.operation == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1433 | lastWasNothing = true; | - | ||||||||||||||||||||||||
| 1434 | region = QRegion(); | - | ||||||||||||||||||||||||
| 1435 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 1436 | region = info.region * matrix; never executed: region = info.region * matrix; | 0 | ||||||||||||||||||||||||
| 1437 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1438 | } | - | ||||||||||||||||||||||||
| 1439 | - | |||||||||||||||||||||||||
| 1440 | case never executed: QPainterClipInfo::PathClip:case QPainterClipInfo::PathClip:never executed: {case QPainterClipInfo::PathClip: | 0 | ||||||||||||||||||||||||
| 1441 | QTransform matrix = (info.matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1442 | if (lastWasNothing
| 0 | ||||||||||||||||||||||||
| 1443 | region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - | ||||||||||||||||||||||||
| 1444 | info.path.fillRule()); | - | ||||||||||||||||||||||||
| 1445 | lastWasNothing = false; | - | ||||||||||||||||||||||||
| 1446 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1447 | } | - | ||||||||||||||||||||||||
| 1448 | if (info.operation == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||
| 1449 | region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - | ||||||||||||||||||||||||
| 1450 | info.path.fillRule()); | - | ||||||||||||||||||||||||
| 1451 | } never executed: else if (info.operation == Qt::NoClipend of block
| 0 | ||||||||||||||||||||||||
| 1452 | lastWasNothing = true; | - | ||||||||||||||||||||||||
| 1453 | region = QRegion(); | - | ||||||||||||||||||||||||
| 1454 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1455 | region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), | - | ||||||||||||||||||||||||
| 1456 | info.path.fillRule()); | - | ||||||||||||||||||||||||
| 1457 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1458 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1459 | } | - | ||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||
| 1461 | case never executed: QPainterClipInfo::RectClip:case QPainterClipInfo::RectClip:never executed: {case QPainterClipInfo::RectClip: | 0 | ||||||||||||||||||||||||
| 1462 | QTransform matrix = (info.matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1463 | if (lastWasNothing
| 0 | ||||||||||||||||||||||||
| 1464 | region = QRegion(info.rect) * matrix; | - | ||||||||||||||||||||||||
| 1465 | lastWasNothing = false; | - | ||||||||||||||||||||||||
| 1466 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1467 | } | - | ||||||||||||||||||||||||
| 1468 | if (info.operation == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||
| 1469 | - | |||||||||||||||||||||||||
| 1470 | if (matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 1471 | region &= matrix.mapRect(info.rect); never executed: region &= matrix.mapRect(info.rect); | 0 | ||||||||||||||||||||||||
| 1472 | else | - | ||||||||||||||||||||||||
| 1473 | region &= matrix.map(QRegion(info.rect)); never executed: region &= matrix.map(QRegion(info.rect)); | 0 | ||||||||||||||||||||||||
| 1474 | } else if (info.operation == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1475 | lastWasNothing = true; | - | ||||||||||||||||||||||||
| 1476 | region = QRegion(); | - | ||||||||||||||||||||||||
| 1477 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1478 | region = QRegion(info.rect) * matrix; | - | ||||||||||||||||||||||||
| 1479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1480 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1481 | } | - | ||||||||||||||||||||||||
| 1482 | - | |||||||||||||||||||||||||
| 1483 | case never executed: QPainterClipInfo::RectFClip:case QPainterClipInfo::RectFClip:never executed: {case QPainterClipInfo::RectFClip: | 0 | ||||||||||||||||||||||||
| 1484 | QTransform matrix = (info.matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1485 | if (lastWasNothing
| 0 | ||||||||||||||||||||||||
| 1486 | region = QRegion(info.rectf.toRect()) * matrix; | - | ||||||||||||||||||||||||
| 1487 | lastWasNothing = false; | - | ||||||||||||||||||||||||
| 1488 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 1489 | } | - | ||||||||||||||||||||||||
| 1490 | if (info.operation == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||
| 1491 | - | |||||||||||||||||||||||||
| 1492 | if (matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 1493 | region &= matrix.mapRect(info.rectf.toRect()); never executed: region &= matrix.mapRect(info.rectf.toRect()); | 0 | ||||||||||||||||||||||||
| 1494 | else | - | ||||||||||||||||||||||||
| 1495 | region &= matrix.map(QRegion(info.rectf.toRect())); never executed: region &= matrix.map(QRegion(info.rectf.toRect())); | 0 | ||||||||||||||||||||||||
| 1496 | } else if (info.operation == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1497 | lastWasNothing = true; | - | ||||||||||||||||||||||||
| 1498 | region = QRegion(); | - | ||||||||||||||||||||||||
| 1499 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1500 | region = QRegion(info.rectf.toRect()) * matrix; | - | ||||||||||||||||||||||||
| 1501 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1502 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1503 | } | - | ||||||||||||||||||||||||
| 1504 | } | - | ||||||||||||||||||||||||
| 1505 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1506 | - | |||||||||||||||||||||||||
| 1507 | return never executed: region;return region;never executed: return region; | 0 | ||||||||||||||||||||||||
| 1508 | } | - | ||||||||||||||||||||||||
| 1509 | - | |||||||||||||||||||||||||
| 1510 | extern QPainterPath qt_regionToPath(const QRegion ®ion); | - | ||||||||||||||||||||||||
| 1511 | QPainterPath QPainter::clipPath() const | - | ||||||||||||||||||||||||
| 1512 | { | - | ||||||||||||||||||||||||
| 1513 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1514 | - | |||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||
| 1516 | - | |||||||||||||||||||||||||
| 1517 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1518 | QMessageLogger(__FILE__, 2618, __PRETTY_FUNCTION__).warning("QPainter::clipPath: Painter not active"); | - | ||||||||||||||||||||||||
| 1519 | return never executed: QPainterPath();return QPainterPath();never executed: return QPainterPath(); | 0 | ||||||||||||||||||||||||
| 1520 | } | - | ||||||||||||||||||||||||
| 1521 | - | |||||||||||||||||||||||||
| 1522 | - | |||||||||||||||||||||||||
| 1523 | if (d->state->clipInfo.size() == 0
| 0 | ||||||||||||||||||||||||
| 1524 | return never executed: QPainterPath();return QPainterPath();never executed: return QPainterPath(); | 0 | ||||||||||||||||||||||||
| 1525 | } else { | - | ||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||
| 1527 | - | |||||||||||||||||||||||||
| 1528 | if (!d->txinv
| 0 | ||||||||||||||||||||||||
| 1529 | const_cast< never executed: QPainter *>(this)->d_ptr->updateInvMatrix();const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();never executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); | 0 | ||||||||||||||||||||||||
| 1530 | - | |||||||||||||||||||||||||
| 1531 | - | |||||||||||||||||||||||||
| 1532 | if (d->state->clipInfo.size() == 1
| 0 | ||||||||||||||||||||||||
| 1533 | && d->state->clipInfo.at(0).clipType == QPainterClipInfo::PathClip
| 0 | ||||||||||||||||||||||||
| 1534 | QTransform matrix = (d->state->clipInfo.at(0).matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1535 | return never executed: d->state->clipInfo.at(0).path * matrix;return d->state->clipInfo.at(0).path * matrix;never executed: return d->state->clipInfo.at(0).path * matrix; | 0 | ||||||||||||||||||||||||
| 1536 | - | |||||||||||||||||||||||||
| 1537 | } else if (d->state->clipInfo.size() == 1
| 0 | ||||||||||||||||||||||||
| 1538 | && d->state->clipInfo.at(0).clipType == QPainterClipInfo::RectClip
| 0 | ||||||||||||||||||||||||
| 1539 | QTransform matrix = (d->state->clipInfo.at(0).matrix * d->invMatrix); | - | ||||||||||||||||||||||||
| 1540 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1541 | path.addRect(d->state->clipInfo.at(0).rect); | - | ||||||||||||||||||||||||
| 1542 | return never executed: path * matrix;return path * matrix;never executed: return path * matrix; | 0 | ||||||||||||||||||||||||
| 1543 | } else { | - | ||||||||||||||||||||||||
| 1544 | - | |||||||||||||||||||||||||
| 1545 | return never executed: qt_regionToPath(clipRegion());return qt_regionToPath(clipRegion());never executed: return qt_regionToPath(clipRegion()); | 0 | ||||||||||||||||||||||||
| 1546 | } | - | ||||||||||||||||||||||||
| 1547 | } | - | ||||||||||||||||||||||||
| 1548 | } | - | ||||||||||||||||||||||||
| 1549 | QRectF QPainter::clipBoundingRect() const | - | ||||||||||||||||||||||||
| 1550 | { | - | ||||||||||||||||||||||||
| 1551 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||
| 1553 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1554 | QMessageLogger(__FILE__, 2667, __PRETTY_FUNCTION__).warning("QPainter::clipBoundingRect: Painter not active"); | - | ||||||||||||||||||||||||
| 1555 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||||||||||||||||||||
| 1556 | } | - | ||||||||||||||||||||||||
| 1557 | - | |||||||||||||||||||||||||
| 1558 | - | |||||||||||||||||||||||||
| 1559 | - | |||||||||||||||||||||||||
| 1560 | - | |||||||||||||||||||||||||
| 1561 | QRectF bounds; | - | ||||||||||||||||||||||||
| 1562 | for (int i=0; i<d->state->clipInfo.size()
| 0 | ||||||||||||||||||||||||
| 1563 | QRectF r; | - | ||||||||||||||||||||||||
| 1564 | const QPainterClipInfo &info = d->state->clipInfo.at(i); | - | ||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||
| 1566 | if (info.clipType == QPainterClipInfo::RectClip
| 0 | ||||||||||||||||||||||||
| 1567 | r = info.rect; never executed: r = info.rect; | 0 | ||||||||||||||||||||||||
| 1568 | else if (info.clipType == QPainterClipInfo::RectFClip
| 0 | ||||||||||||||||||||||||
| 1569 | r = info.rectf; never executed: r = info.rectf; | 0 | ||||||||||||||||||||||||
| 1570 | else if (info.clipType == QPainterClipInfo::RegionClip
| 0 | ||||||||||||||||||||||||
| 1571 | r = info.region.boundingRect(); never executed: r = info.region.boundingRect(); | 0 | ||||||||||||||||||||||||
| 1572 | else | - | ||||||||||||||||||||||||
| 1573 | r = info.path.boundingRect(); never executed: r = info.path.boundingRect(); | 0 | ||||||||||||||||||||||||
| 1574 | - | |||||||||||||||||||||||||
| 1575 | r = info.matrix.mapRect(r); | - | ||||||||||||||||||||||||
| 1576 | - | |||||||||||||||||||||||||
| 1577 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 1578 | bounds = r; never executed: bounds = r; | 0 | ||||||||||||||||||||||||
| 1579 | else if (info.operation == Qt::IntersectClip
| 0 | ||||||||||||||||||||||||
| 1580 | bounds &= r; never executed: bounds &= r; | 0 | ||||||||||||||||||||||||
| 1581 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||
| 1586 | if (!d->txinv
| 0 | ||||||||||||||||||||||||
| 1587 | const_cast< never executed: QPainter *>(this)->d_ptr->updateInvMatrix();const_cast<QPainter *>(this)->d_ptr->updateInvMatrix();never executed: const_cast<QPainter *>(this)->d_ptr->updateInvMatrix(); | 0 | ||||||||||||||||||||||||
| 1588 | - | |||||||||||||||||||||||||
| 1589 | return never executed: d->invMatrix.mapRect(bounds);return d->invMatrix.mapRect(bounds);never executed: return d->invMatrix.mapRect(bounds); | 0 | ||||||||||||||||||||||||
| 1590 | } | - | ||||||||||||||||||||||||
| 1591 | void QPainter::setClipRect(const QRectF &rect, Qt::ClipOperation op) | - | ||||||||||||||||||||||||
| 1592 | { | - | ||||||||||||||||||||||||
| 1593 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1594 | - | |||||||||||||||||||||||||
| 1595 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1596 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1597 | QMessageLogger(__FILE__, 2723, __PRETTY_FUNCTION__).warning("QPainter::setClipRect: Painter not active"); | - | ||||||||||||||||||||||||
| 1598 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1599 | } | - | ||||||||||||||||||||||||
| 1600 | bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); | - | ||||||||||||||||||||||||
| 1601 | if (simplifyClipOp
| 0 | ||||||||||||||||||||||||
| 1602 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1603 | - | |||||||||||||||||||||||||
| 1604 | qreal right = rect.x() + rect.width(); | - | ||||||||||||||||||||||||
| 1605 | qreal bottom = rect.y() + rect.height(); | - | ||||||||||||||||||||||||
| 1606 | qreal pts[] = { rect.x(), rect.y(), | - | ||||||||||||||||||||||||
| 1607 | right, rect.y(), | - | ||||||||||||||||||||||||
| 1608 | right, bottom, | - | ||||||||||||||||||||||||
| 1609 | rect.x(), bottom }; | - | ||||||||||||||||||||||||
| 1610 | QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); | - | ||||||||||||||||||||||||
| 1611 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1612 | d->extended->clip(vp, op); | - | ||||||||||||||||||||||||
| 1613 | if (op == Qt::ReplaceClip
| 0 | ||||||||||||||||||||||||
| 1614 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1615 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1616 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1617 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1618 | } | - | ||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||
| 1620 | if (qreal(int(rect.top())) == rect.top()
| 0 | ||||||||||||||||||||||||
| 1621 | && qreal(int(rect.bottom())) == rect.bottom()
| 0 | ||||||||||||||||||||||||
| 1622 | && qreal(int(rect.left())) == rect.left()
| 0 | ||||||||||||||||||||||||
| 1623 | && qreal(int(rect.right())) == rect.right()
| 0 | ||||||||||||||||||||||||
| 1624 | { | - | ||||||||||||||||||||||||
| 1625 | setClipRect(rect.toRect(), op); | - | ||||||||||||||||||||||||
| 1626 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1627 | } | - | ||||||||||||||||||||||||
| 1628 | - | |||||||||||||||||||||||||
| 1629 | if (rect.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1630 | setClipRegion(QRegion(), op); | - | ||||||||||||||||||||||||
| 1631 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1632 | } | - | ||||||||||||||||||||||||
| 1633 | - | |||||||||||||||||||||||||
| 1634 | QPainterPath path; | - | ||||||||||||||||||||||||
| 1635 | path.addRect(rect); | - | ||||||||||||||||||||||||
| 1636 | setClipPath(path, op); | - | ||||||||||||||||||||||||
| 1637 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1638 | void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) | - | ||||||||||||||||||||||||
| 1639 | { | - | ||||||||||||||||||||||||
| 1640 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1641 | - | |||||||||||||||||||||||||
| 1642 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1643 | QMessageLogger(__FILE__, 2777, __PRETTY_FUNCTION__).warning("QPainter::setClipRect: Painter not active"); | - | ||||||||||||||||||||||||
| 1644 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1645 | } | - | ||||||||||||||||||||||||
| 1646 | bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); | - | ||||||||||||||||||||||||
| 1647 | - | |||||||||||||||||||||||||
| 1648 | if (simplifyClipOp
| 0 | ||||||||||||||||||||||||
| 1649 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1650 | - | |||||||||||||||||||||||||
| 1651 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1652 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1653 | d->extended->clip(rect, op); | - | ||||||||||||||||||||||||
| 1654 | if (op == Qt::ReplaceClip
| 0 | ||||||||||||||||||||||||
| 1655 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1656 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1657 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1658 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1659 | } | - | ||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||
| 1661 | if (simplifyClipOp
| 0 | ||||||||||||||||||||||||
| 1662 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1663 | - | |||||||||||||||||||||||||
| 1664 | d->state->clipRegion = rect; | - | ||||||||||||||||||||||||
| 1665 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1666 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1667 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1668 | d->state->clipInfo << QPainterClipInfo(rect, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1669 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1670 | d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled; | - | ||||||||||||||||||||||||
| 1671 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 1672 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1673 | void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) | - | ||||||||||||||||||||||||
| 1674 | { | - | ||||||||||||||||||||||||
| 1675 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||
| 1679 | - | |||||||||||||||||||||||||
| 1680 | - | |||||||||||||||||||||||||
| 1681 | - | |||||||||||||||||||||||||
| 1682 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1683 | QMessageLogger(__FILE__, 2836, __PRETTY_FUNCTION__).warning("QPainter::setClipRegion: Painter not active"); | - | ||||||||||||||||||||||||
| 1684 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1685 | } | - | ||||||||||||||||||||||||
| 1686 | bool simplifyClipOp = (paintEngine()->type() != QPaintEngine::Picture); | - | ||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||
| 1688 | if (simplifyClipOp
| 0 | ||||||||||||||||||||||||
| 1689 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1690 | - | |||||||||||||||||||||||||
| 1691 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1692 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1693 | d->extended->clip(r, op); | - | ||||||||||||||||||||||||
| 1694 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1695 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1696 | d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1697 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1698 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1699 | } | - | ||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||
| 1701 | if (simplifyClipOp
| 0 | ||||||||||||||||||||||||
| 1702 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1703 | - | |||||||||||||||||||||||||
| 1704 | d->state->clipRegion = r; | - | ||||||||||||||||||||||||
| 1705 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1706 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1707 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1708 | d->state->clipInfo << QPainterClipInfo(r, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1709 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1710 | d->state->dirtyFlags |= QPaintEngine::DirtyClipRegion | QPaintEngine::DirtyClipEnabled; | - | ||||||||||||||||||||||||
| 1711 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 1712 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1713 | void QPainter::setWorldMatrix(const QMatrix &matrix, bool combine) | - | ||||||||||||||||||||||||
| 1714 | { | - | ||||||||||||||||||||||||
| 1715 | setWorldTransform(QTransform(matrix), combine); | - | ||||||||||||||||||||||||
| 1716 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1717 | const QMatrix &QPainter::worldMatrix() const | - | ||||||||||||||||||||||||
| 1718 | { | - | ||||||||||||||||||||||||
| 1719 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1720 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1721 | QMessageLogger(__FILE__, 2932, __PRETTY_FUNCTION__).warning("QPainter::worldMatrix: Painter not active"); | - | ||||||||||||||||||||||||
| 1722 | return never executed: d->fakeState()->transform.toAffine();return d->fakeState()->transform.toAffine();never executed: return d->fakeState()->transform.toAffine(); | 0 | ||||||||||||||||||||||||
| 1723 | } | - | ||||||||||||||||||||||||
| 1724 | return never executed: d->state->worldMatrix.toAffine();return d->state->worldMatrix.toAffine();never executed: return d->state->worldMatrix.toAffine(); | 0 | ||||||||||||||||||||||||
| 1725 | } | - | ||||||||||||||||||||||||
| 1726 | void QPainter::setMatrix(const QMatrix &matrix, bool combine) | - | ||||||||||||||||||||||||
| 1727 | { | - | ||||||||||||||||||||||||
| 1728 | setWorldTransform(QTransform(matrix), combine); | - | ||||||||||||||||||||||||
| 1729 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1730 | const QMatrix &QPainter::matrix() const | - | ||||||||||||||||||||||||
| 1731 | { | - | ||||||||||||||||||||||||
| 1732 | return never executed: worldMatrix();return worldMatrix();never executed: return worldMatrix(); | 0 | ||||||||||||||||||||||||
| 1733 | } | - | ||||||||||||||||||||||||
| 1734 | QMatrix QPainter::combinedMatrix() const | - | ||||||||||||||||||||||||
| 1735 | { | - | ||||||||||||||||||||||||
| 1736 | return never executed: combinedTransform().toAffine();return combinedTransform().toAffine();never executed: return combinedTransform().toAffine(); | 0 | ||||||||||||||||||||||||
| 1737 | } | - | ||||||||||||||||||||||||
| 1738 | const QMatrix &QPainter::deviceMatrix() const | - | ||||||||||||||||||||||||
| 1739 | { | - | ||||||||||||||||||||||||
| 1740 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1741 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1742 | QMessageLogger(__FILE__, 3006, __PRETTY_FUNCTION__).warning("QPainter::deviceMatrix: Painter not active"); | - | ||||||||||||||||||||||||
| 1743 | return never executed: d->fakeState()->transform.toAffine();return d->fakeState()->transform.toAffine();never executed: return d->fakeState()->transform.toAffine(); | 0 | ||||||||||||||||||||||||
| 1744 | } | - | ||||||||||||||||||||||||
| 1745 | return never executed: d->state->matrix.toAffine();return d->state->matrix.toAffine();never executed: return d->state->matrix.toAffine(); | 0 | ||||||||||||||||||||||||
| 1746 | } | - | ||||||||||||||||||||||||
| 1747 | void QPainter::resetMatrix() | - | ||||||||||||||||||||||||
| 1748 | { | - | ||||||||||||||||||||||||
| 1749 | resetTransform(); | - | ||||||||||||||||||||||||
| 1750 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1751 | void QPainter::setWorldMatrixEnabled(bool enable) | - | ||||||||||||||||||||||||
| 1752 | { | - | ||||||||||||||||||||||||
| 1753 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||
| 1755 | - | |||||||||||||||||||||||||
| 1756 | - | |||||||||||||||||||||||||
| 1757 | - | |||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||
| 1759 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1760 | QMessageLogger(__FILE__, 3052, __PRETTY_FUNCTION__).warning("QPainter::setMatrixEnabled: Painter not active"); | - | ||||||||||||||||||||||||
| 1761 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1762 | } | - | ||||||||||||||||||||||||
| 1763 | if (enable == d->state->WxF
| 0 | ||||||||||||||||||||||||
| 1764 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1765 | - | |||||||||||||||||||||||||
| 1766 | d->state->WxF = enable; | - | ||||||||||||||||||||||||
| 1767 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 1768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1769 | bool QPainter::worldMatrixEnabled() const | - | ||||||||||||||||||||||||
| 1770 | { | - | ||||||||||||||||||||||||
| 1771 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1772 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1773 | QMessageLogger(__FILE__, 3075, __PRETTY_FUNCTION__).warning("QPainter::worldMatrixEnabled: Painter not active"); | - | ||||||||||||||||||||||||
| 1774 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1775 | } | - | ||||||||||||||||||||||||
| 1776 | return never executed: d->state->WxF;return d->state->WxF;never executed: return d->state->WxF; | 0 | ||||||||||||||||||||||||
| 1777 | } | - | ||||||||||||||||||||||||
| 1778 | void QPainter::setMatrixEnabled(bool enable) | - | ||||||||||||||||||||||||
| 1779 | { | - | ||||||||||||||||||||||||
| 1780 | setWorldMatrixEnabled(enable); | - | ||||||||||||||||||||||||
| 1781 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1782 | bool QPainter::matrixEnabled() const | - | ||||||||||||||||||||||||
| 1783 | { | - | ||||||||||||||||||||||||
| 1784 | return never executed: worldMatrixEnabled();return worldMatrixEnabled();never executed: return worldMatrixEnabled(); | 0 | ||||||||||||||||||||||||
| 1785 | } | - | ||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||
| 1787 | - | |||||||||||||||||||||||||
| 1788 | - | |||||||||||||||||||||||||
| 1789 | - | |||||||||||||||||||||||||
| 1790 | - | |||||||||||||||||||||||||
| 1791 | - | |||||||||||||||||||||||||
| 1792 | - | |||||||||||||||||||||||||
| 1793 | void QPainter::scale(qreal sx, qreal sy) | - | ||||||||||||||||||||||||
| 1794 | { | - | ||||||||||||||||||||||||
| 1795 | - | |||||||||||||||||||||||||
| 1796 | - | |||||||||||||||||||||||||
| 1797 | - | |||||||||||||||||||||||||
| 1798 | - | |||||||||||||||||||||||||
| 1799 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1800 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1801 | QMessageLogger(__FILE__, 3121, __PRETTY_FUNCTION__).warning("QPainter::scale: Painter not active"); | - | ||||||||||||||||||||||||
| 1802 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1803 | } | - | ||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||
| 1805 | d->state->worldMatrix.scale(sx,sy); | - | ||||||||||||||||||||||||
| 1806 | d->state->WxF = true; | - | ||||||||||||||||||||||||
| 1807 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 1808 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1809 | - | |||||||||||||||||||||||||
| 1810 | - | |||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||
| 1813 | - | |||||||||||||||||||||||||
| 1814 | - | |||||||||||||||||||||||||
| 1815 | - | |||||||||||||||||||||||||
| 1816 | void QPainter::shear(qreal sh, qreal sv) | - | ||||||||||||||||||||||||
| 1817 | { | - | ||||||||||||||||||||||||
| 1818 | - | |||||||||||||||||||||||||
| 1819 | - | |||||||||||||||||||||||||
| 1820 | - | |||||||||||||||||||||||||
| 1821 | - | |||||||||||||||||||||||||
| 1822 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1823 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1824 | QMessageLogger(__FILE__, 3144, __PRETTY_FUNCTION__).warning("QPainter::shear: Painter not active"); | - | ||||||||||||||||||||||||
| 1825 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1826 | } | - | ||||||||||||||||||||||||
| 1827 | - | |||||||||||||||||||||||||
| 1828 | d->state->worldMatrix.shear(sh, sv); | - | ||||||||||||||||||||||||
| 1829 | d->state->WxF = true; | - | ||||||||||||||||||||||||
| 1830 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 1831 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1832 | void QPainter::rotate(qreal a) | - | ||||||||||||||||||||||||
| 1833 | { | - | ||||||||||||||||||||||||
| 1834 | - | |||||||||||||||||||||||||
| 1835 | - | |||||||||||||||||||||||||
| 1836 | - | |||||||||||||||||||||||||
| 1837 | - | |||||||||||||||||||||||||
| 1838 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1839 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1840 | QMessageLogger(__FILE__, 3169, __PRETTY_FUNCTION__).warning("QPainter::rotate: Painter not active"); | - | ||||||||||||||||||||||||
| 1841 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1842 | } | - | ||||||||||||||||||||||||
| 1843 | - | |||||||||||||||||||||||||
| 1844 | d->state->worldMatrix.rotate(a); | - | ||||||||||||||||||||||||
| 1845 | d->state->WxF = true; | - | ||||||||||||||||||||||||
| 1846 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 1847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1848 | - | |||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||
| 1850 | - | |||||||||||||||||||||||||
| 1851 | - | |||||||||||||||||||||||||
| 1852 | - | |||||||||||||||||||||||||
| 1853 | - | |||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||
| 1855 | void QPainter::translate(const QPointF &offset) | - | ||||||||||||||||||||||||
| 1856 | { | - | ||||||||||||||||||||||||
| 1857 | qreal dx = offset.x(); | - | ||||||||||||||||||||||||
| 1858 | qreal dy = offset.y(); | - | ||||||||||||||||||||||||
| 1859 | - | |||||||||||||||||||||||||
| 1860 | - | |||||||||||||||||||||||||
| 1861 | - | |||||||||||||||||||||||||
| 1862 | - | |||||||||||||||||||||||||
| 1863 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1864 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1865 | QMessageLogger(__FILE__, 3194, __PRETTY_FUNCTION__).warning("QPainter::translate: Painter not active"); | - | ||||||||||||||||||||||||
| 1866 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1867 | } | - | ||||||||||||||||||||||||
| 1868 | - | |||||||||||||||||||||||||
| 1869 | d->state->worldMatrix.translate(dx, dy); | - | ||||||||||||||||||||||||
| 1870 | d->state->WxF = true; | - | ||||||||||||||||||||||||
| 1871 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 1872 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1873 | void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) | - | ||||||||||||||||||||||||
| 1874 | { | - | ||||||||||||||||||||||||
| 1875 | - | |||||||||||||||||||||||||
| 1876 | - | |||||||||||||||||||||||||
| 1877 | - | |||||||||||||||||||||||||
| 1878 | - | |||||||||||||||||||||||||
| 1879 | - | |||||||||||||||||||||||||
| 1880 | - | |||||||||||||||||||||||||
| 1881 | - | |||||||||||||||||||||||||
| 1882 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1883 | - | |||||||||||||||||||||||||
| 1884 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1885 | QMessageLogger(__FILE__, 3241, __PRETTY_FUNCTION__).warning("QPainter::setClipPath: Painter not active"); | - | ||||||||||||||||||||||||
| 1886 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1887 | } | - | ||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||
| 1889 | if ((!d->state->clipEnabled
| 0 | ||||||||||||||||||||||||
| 1890 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1891 | - | |||||||||||||||||||||||||
| 1892 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1893 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1894 | d->extended->clip(path, op); | - | ||||||||||||||||||||||||
| 1895 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1896 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1897 | d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1898 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1899 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1900 | } | - | ||||||||||||||||||||||||
| 1901 | - | |||||||||||||||||||||||||
| 1902 | if (d->state->clipOperation == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1903 | op = Qt::ReplaceClip; never executed: op = Qt::ReplaceClip; | 0 | ||||||||||||||||||||||||
| 1904 | - | |||||||||||||||||||||||||
| 1905 | d->state->clipPath = path; | - | ||||||||||||||||||||||||
| 1906 | d->state->clipOperation = op; | - | ||||||||||||||||||||||||
| 1907 | if (op == Qt::NoClip
| 0 | ||||||||||||||||||||||||
| 1908 | d->state->clipInfo.clear(); never executed: d->state->clipInfo.clear(); | 0 | ||||||||||||||||||||||||
| 1909 | d->state->clipInfo << QPainterClipInfo(path, op, d->state->matrix); | - | ||||||||||||||||||||||||
| 1910 | d->state->clipEnabled = true; | - | ||||||||||||||||||||||||
| 1911 | d->state->dirtyFlags |= QPaintEngine::DirtyClipPath | QPaintEngine::DirtyClipEnabled; | - | ||||||||||||||||||||||||
| 1912 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 1913 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1914 | - | |||||||||||||||||||||||||
| 1915 | - | |||||||||||||||||||||||||
| 1916 | - | |||||||||||||||||||||||||
| 1917 | - | |||||||||||||||||||||||||
| 1918 | - | |||||||||||||||||||||||||
| 1919 | - | |||||||||||||||||||||||||
| 1920 | - | |||||||||||||||||||||||||
| 1921 | void QPainter::strokePath(const QPainterPath &path, const QPen &pen) | - | ||||||||||||||||||||||||
| 1922 | { | - | ||||||||||||||||||||||||
| 1923 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1924 | - | |||||||||||||||||||||||||
| 1925 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1926 | QMessageLogger(__FILE__, 3282, __PRETTY_FUNCTION__).warning("QPainter::strokePath: Painter not active"); | - | ||||||||||||||||||||||||
| 1927 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1928 | } | - | ||||||||||||||||||||||||
| 1929 | - | |||||||||||||||||||||||||
| 1930 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1931 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1932 | - | |||||||||||||||||||||||||
| 1933 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1934 | const QGradient *g = qpen_brush(pen).gradient(); | - | ||||||||||||||||||||||||
| 1935 | if (!g
| 0 | ||||||||||||||||||||||||
| 1936 | d->extended->stroke(qtVectorPathForPath(path), pen); | - | ||||||||||||||||||||||||
| 1937 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1938 | } | - | ||||||||||||||||||||||||
| 1939 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1940 | - | |||||||||||||||||||||||||
| 1941 | QBrush oldBrush = d->state->brush; | - | ||||||||||||||||||||||||
| 1942 | QPen oldPen = d->state->pen; | - | ||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||
| 1944 | setPen(pen); | - | ||||||||||||||||||||||||
| 1945 | setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 1946 | - | |||||||||||||||||||||||||
| 1947 | drawPath(path); | - | ||||||||||||||||||||||||
| 1948 | - | |||||||||||||||||||||||||
| 1949 | - | |||||||||||||||||||||||||
| 1950 | setPen(oldPen); | - | ||||||||||||||||||||||||
| 1951 | setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 1952 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1953 | void QPainter::fillPath(const QPainterPath &path, const QBrush &brush) | - | ||||||||||||||||||||||||
| 1954 | { | - | ||||||||||||||||||||||||
| 1955 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||
| 1957 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1958 | QMessageLogger(__FILE__, 3325, __PRETTY_FUNCTION__).warning("QPainter::fillPath: Painter not active"); | - | ||||||||||||||||||||||||
| 1959 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1960 | } | - | ||||||||||||||||||||||||
| 1961 | - | |||||||||||||||||||||||||
| 1962 | if (path.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1963 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1964 | - | |||||||||||||||||||||||||
| 1965 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1966 | const QGradient *g = brush.gradient(); | - | ||||||||||||||||||||||||
| 1967 | if (!g
| 0 | ||||||||||||||||||||||||
| 1968 | d->extended->fill(qtVectorPathForPath(path), brush); | - | ||||||||||||||||||||||||
| 1969 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1970 | } | - | ||||||||||||||||||||||||
| 1971 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1972 | - | |||||||||||||||||||||||||
| 1973 | QBrush oldBrush = d->state->brush; | - | ||||||||||||||||||||||||
| 1974 | QPen oldPen = d->state->pen; | - | ||||||||||||||||||||||||
| 1975 | - | |||||||||||||||||||||||||
| 1976 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 1977 | setBrush(brush); | - | ||||||||||||||||||||||||
| 1978 | - | |||||||||||||||||||||||||
| 1979 | drawPath(path); | - | ||||||||||||||||||||||||
| 1980 | - | |||||||||||||||||||||||||
| 1981 | - | |||||||||||||||||||||||||
| 1982 | setPen(oldPen); | - | ||||||||||||||||||||||||
| 1983 | setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 1984 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1985 | void QPainter::drawPath(const QPainterPath &path) | - | ||||||||||||||||||||||||
| 1986 | { | - | ||||||||||||||||||||||||
| 1987 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1988 | - | |||||||||||||||||||||||||
| 1989 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 1990 | QMessageLogger(__FILE__, 3380, __PRETTY_FUNCTION__).warning("QPainter::drawPath: Painter not active"); | - | ||||||||||||||||||||||||
| 1991 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1992 | } | - | ||||||||||||||||||||||||
| 1993 | - | |||||||||||||||||||||||||
| 1994 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 1995 | d->extended->drawPath(path); | - | ||||||||||||||||||||||||
| 1996 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1997 | } | - | ||||||||||||||||||||||||
| 1998 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 1999 | - | |||||||||||||||||||||||||
| 2000 | if (d->engine->hasFeature(QPaintEngine::PainterPaths)
| 0 | ||||||||||||||||||||||||
| 2001 | d->engine->drawPath(path); | - | ||||||||||||||||||||||||
| 2002 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2003 | d->draw_helper(path); | - | ||||||||||||||||||||||||
| 2004 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2005 | } | - | ||||||||||||||||||||||||
| 2006 | void QPainter::drawRects(const QRectF *rects, int rectCount) | - | ||||||||||||||||||||||||
| 2007 | { | - | ||||||||||||||||||||||||
| 2008 | - | |||||||||||||||||||||||||
| 2009 | - | |||||||||||||||||||||||||
| 2010 | - | |||||||||||||||||||||||||
| 2011 | - | |||||||||||||||||||||||||
| 2012 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2013 | - | |||||||||||||||||||||||||
| 2014 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2015 | QMessageLogger(__FILE__, 3492, __PRETTY_FUNCTION__).warning("QPainter::drawRects: Painter not active"); | - | ||||||||||||||||||||||||
| 2016 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2017 | } | - | ||||||||||||||||||||||||
| 2018 | - | |||||||||||||||||||||||||
| 2019 | if (rectCount <= 0
| 0 | ||||||||||||||||||||||||
| 2020 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2021 | - | |||||||||||||||||||||||||
| 2022 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2023 | d->extended->drawRects(rects, rectCount); | - | ||||||||||||||||||||||||
| 2024 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2025 | } | - | ||||||||||||||||||||||||
| 2026 | - | |||||||||||||||||||||||||
| 2027 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2028 | - | |||||||||||||||||||||||||
| 2029 | if (!d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2030 | d->engine->drawRects(rects, rectCount); | - | ||||||||||||||||||||||||
| 2031 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2032 | } | - | ||||||||||||||||||||||||
| 2033 | - | |||||||||||||||||||||||||
| 2034 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2035 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2036 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2037 | QRectF r(rects[i].x() + d->state->matrix.dx(), | - | ||||||||||||||||||||||||
| 2038 | rects[i].y() + d->state->matrix.dy(), | - | ||||||||||||||||||||||||
| 2039 | rects[i].width(), | - | ||||||||||||||||||||||||
| 2040 | rects[i].height()); | - | ||||||||||||||||||||||||
| 2041 | d->engine->drawRects(&r, 1); | - | ||||||||||||||||||||||||
| 2042 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2043 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2044 | if (d->state->brushNeedsResolving()
| 0 | ||||||||||||||||||||||||
| 2045 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2046 | QPainterPath rectPath; | - | ||||||||||||||||||||||||
| 2047 | rectPath.addRect(rects[i]); | - | ||||||||||||||||||||||||
| 2048 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2049 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2050 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2051 | QPainterPath rectPath; | - | ||||||||||||||||||||||||
| 2052 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2053 | rectPath.addRect(rects[i]); never executed: rectPath.addRect(rects[i]); | 0 | ||||||||||||||||||||||||
| 2054 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2055 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2056 | } | - | ||||||||||||||||||||||||
| 2057 | } | - | ||||||||||||||||||||||||
| 2058 | void QPainter::drawRects(const QRect *rects, int rectCount) | - | ||||||||||||||||||||||||
| 2059 | { | - | ||||||||||||||||||||||||
| 2060 | - | |||||||||||||||||||||||||
| 2061 | - | |||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||
| 2063 | - | |||||||||||||||||||||||||
| 2064 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2065 | - | |||||||||||||||||||||||||
| 2066 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2067 | QMessageLogger(__FILE__, 3552, __PRETTY_FUNCTION__).warning("QPainter::drawRects: Painter not active"); | - | ||||||||||||||||||||||||
| 2068 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2069 | } | - | ||||||||||||||||||||||||
| 2070 | - | |||||||||||||||||||||||||
| 2071 | if (rectCount <= 0
| 0 | ||||||||||||||||||||||||
| 2072 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2073 | - | |||||||||||||||||||||||||
| 2074 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2075 | d->extended->drawRects(rects, rectCount); | - | ||||||||||||||||||||||||
| 2076 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2077 | } | - | ||||||||||||||||||||||||
| 2078 | - | |||||||||||||||||||||||||
| 2079 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||
| 2081 | if (!d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2082 | d->engine->drawRects(rects, rectCount); | - | ||||||||||||||||||||||||
| 2083 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2084 | } | - | ||||||||||||||||||||||||
| 2085 | - | |||||||||||||||||||||||||
| 2086 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2087 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2088 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2089 | QRectF r(rects[i].x() + d->state->matrix.dx(), | - | ||||||||||||||||||||||||
| 2090 | rects[i].y() + d->state->matrix.dy(), | - | ||||||||||||||||||||||||
| 2091 | rects[i].width(), | - | ||||||||||||||||||||||||
| 2092 | rects[i].height()); | - | ||||||||||||||||||||||||
| 2093 | - | |||||||||||||||||||||||||
| 2094 | d->engine->drawRects(&r, 1); | - | ||||||||||||||||||||||||
| 2095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2096 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2097 | if (d->state->brushNeedsResolving()
| 0 | ||||||||||||||||||||||||
| 2098 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2099 | QPainterPath rectPath; | - | ||||||||||||||||||||||||
| 2100 | rectPath.addRect(rects[i]); | - | ||||||||||||||||||||||||
| 2101 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2102 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2103 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2104 | QPainterPath rectPath; | - | ||||||||||||||||||||||||
| 2105 | for (int i=0; i<rectCount
| 0 | ||||||||||||||||||||||||
| 2106 | rectPath.addRect(rects[i]); never executed: rectPath.addRect(rects[i]); | 0 | ||||||||||||||||||||||||
| 2107 | - | |||||||||||||||||||||||||
| 2108 | d->draw_helper(rectPath, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2109 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2110 | } | - | ||||||||||||||||||||||||
| 2111 | } | - | ||||||||||||||||||||||||
| 2112 | void QPainter::drawPoints(const QPointF *points, int pointCount) | - | ||||||||||||||||||||||||
| 2113 | { | - | ||||||||||||||||||||||||
| 2114 | - | |||||||||||||||||||||||||
| 2115 | - | |||||||||||||||||||||||||
| 2116 | - | |||||||||||||||||||||||||
| 2117 | - | |||||||||||||||||||||||||
| 2118 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2119 | - | |||||||||||||||||||||||||
| 2120 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2121 | QMessageLogger(__FILE__, 3652, __PRETTY_FUNCTION__).warning("QPainter::drawPoints: Painter not active"); | - | ||||||||||||||||||||||||
| 2122 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2123 | } | - | ||||||||||||||||||||||||
| 2124 | - | |||||||||||||||||||||||||
| 2125 | if (pointCount <= 0
| 0 | ||||||||||||||||||||||||
| 2126 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2127 | - | |||||||||||||||||||||||||
| 2128 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2129 | d->extended->drawPoints(points, pointCount); | - | ||||||||||||||||||||||||
| 2130 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2131 | } | - | ||||||||||||||||||||||||
| 2132 | - | |||||||||||||||||||||||||
| 2133 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2134 | - | |||||||||||||||||||||||||
| 2135 | if (!d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2136 | d->engine->drawPoints(points, pointCount); | - | ||||||||||||||||||||||||
| 2137 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2138 | } | - | ||||||||||||||||||||||||
| 2139 | - | |||||||||||||||||||||||||
| 2140 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2141 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2142 | - | |||||||||||||||||||||||||
| 2143 | for (int i=0; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2144 | QPointF pt(points[i].x() + d->state->matrix.dx(), | - | ||||||||||||||||||||||||
| 2145 | points[i].y() + d->state->matrix.dy()); | - | ||||||||||||||||||||||||
| 2146 | d->engine->drawPoints(&pt, 1); | - | ||||||||||||||||||||||||
| 2147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2148 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2149 | QPen pen = d->state->pen; | - | ||||||||||||||||||||||||
| 2150 | bool flat_pen = pen.capStyle() == Qt::FlatCap; | - | ||||||||||||||||||||||||
| 2151 | if (flat_pen
| 0 | ||||||||||||||||||||||||
| 2152 | save(); | - | ||||||||||||||||||||||||
| 2153 | pen.setCapStyle(Qt::SquareCap); | - | ||||||||||||||||||||||||
| 2154 | setPen(pen); | - | ||||||||||||||||||||||||
| 2155 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2156 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2157 | for (int i=0; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2158 | path.moveTo(points[i].x(), points[i].y()); | - | ||||||||||||||||||||||||
| 2159 | path.lineTo(points[i].x() + 0.0001, points[i].y()); | - | ||||||||||||||||||||||||
| 2160 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2161 | d->draw_helper(path, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2162 | if (flat_pen
| 0 | ||||||||||||||||||||||||
| 2163 | restore(); never executed: restore(); | 0 | ||||||||||||||||||||||||
| 2164 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2165 | } | - | ||||||||||||||||||||||||
| 2166 | void QPainter::drawPoints(const QPoint *points, int pointCount) | - | ||||||||||||||||||||||||
| 2167 | { | - | ||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||
| 2169 | - | |||||||||||||||||||||||||
| 2170 | - | |||||||||||||||||||||||||
| 2171 | - | |||||||||||||||||||||||||
| 2172 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2173 | - | |||||||||||||||||||||||||
| 2174 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2175 | QMessageLogger(__FILE__, 3714, __PRETTY_FUNCTION__).warning("QPainter::drawPoints: Painter not active"); | - | ||||||||||||||||||||||||
| 2176 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2177 | } | - | ||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||
| 2179 | if (pointCount <= 0
| 0 | ||||||||||||||||||||||||
| 2180 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2181 | - | |||||||||||||||||||||||||
| 2182 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2183 | d->extended->drawPoints(points, pointCount); | - | ||||||||||||||||||||||||
| 2184 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2185 | } | - | ||||||||||||||||||||||||
| 2186 | - | |||||||||||||||||||||||||
| 2187 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2188 | - | |||||||||||||||||||||||||
| 2189 | if (!d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2190 | d->engine->drawPoints(points, pointCount); | - | ||||||||||||||||||||||||
| 2191 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2192 | } | - | ||||||||||||||||||||||||
| 2193 | - | |||||||||||||||||||||||||
| 2194 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2195 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2196 | - | |||||||||||||||||||||||||
| 2197 | for (int i=0; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2198 | QPointF pt(points[i].x() + d->state->matrix.dx(), | - | ||||||||||||||||||||||||
| 2199 | points[i].y() + d->state->matrix.dy()); | - | ||||||||||||||||||||||||
| 2200 | d->engine->drawPoints(&pt, 1); | - | ||||||||||||||||||||||||
| 2201 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2202 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2203 | QPen pen = d->state->pen; | - | ||||||||||||||||||||||||
| 2204 | bool flat_pen = (pen.capStyle() == Qt::FlatCap); | - | ||||||||||||||||||||||||
| 2205 | if (flat_pen
| 0 | ||||||||||||||||||||||||
| 2206 | save(); | - | ||||||||||||||||||||||||
| 2207 | pen.setCapStyle(Qt::SquareCap); | - | ||||||||||||||||||||||||
| 2208 | setPen(pen); | - | ||||||||||||||||||||||||
| 2209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2210 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2211 | for (int i=0; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2212 | path.moveTo(points[i].x(), points[i].y()); | - | ||||||||||||||||||||||||
| 2213 | path.lineTo(points[i].x() + 0.0001, points[i].y()); | - | ||||||||||||||||||||||||
| 2214 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2215 | d->draw_helper(path, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2216 | if (flat_pen
| 0 | ||||||||||||||||||||||||
| 2217 | restore(); never executed: restore(); | 0 | ||||||||||||||||||||||||
| 2218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2219 | } | - | ||||||||||||||||||||||||
| 2220 | void QPainter::setBackgroundMode(Qt::BGMode mode) | - | ||||||||||||||||||||||||
| 2221 | { | - | ||||||||||||||||||||||||
| 2222 | - | |||||||||||||||||||||||||
| 2223 | - | |||||||||||||||||||||||||
| 2224 | - | |||||||||||||||||||||||||
| 2225 | - | |||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||
| 2227 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2228 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2229 | QMessageLogger(__FILE__, 3799, __PRETTY_FUNCTION__).warning("QPainter::setBackgroundMode: Painter not active"); | - | ||||||||||||||||||||||||
| 2230 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2231 | } | - | ||||||||||||||||||||||||
| 2232 | if (d->state->bgMode == mode
| 0 | ||||||||||||||||||||||||
| 2233 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2234 | - | |||||||||||||||||||||||||
| 2235 | d->state->bgMode = mode; | - | ||||||||||||||||||||||||
| 2236 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2237 | d->checkEmulation(); | - | ||||||||||||||||||||||||
| 2238 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2239 | d->state->dirtyFlags |= QPaintEngine::DirtyBackgroundMode; | - | ||||||||||||||||||||||||
| 2240 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2241 | } | - | ||||||||||||||||||||||||
| 2242 | - | |||||||||||||||||||||||||
| 2243 | - | |||||||||||||||||||||||||
| 2244 | - | |||||||||||||||||||||||||
| 2245 | - | |||||||||||||||||||||||||
| 2246 | - | |||||||||||||||||||||||||
| 2247 | - | |||||||||||||||||||||||||
| 2248 | Qt::BGMode QPainter::backgroundMode() const | - | ||||||||||||||||||||||||
| 2249 | { | - | ||||||||||||||||||||||||
| 2250 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2251 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2252 | QMessageLogger(__FILE__, 3822, __PRETTY_FUNCTION__).warning("QPainter::backgroundMode: Painter not active"); | - | ||||||||||||||||||||||||
| 2253 | return never executed: Qt::TransparentMode;return Qt::TransparentMode;never executed: return Qt::TransparentMode; | 0 | ||||||||||||||||||||||||
| 2254 | } | - | ||||||||||||||||||||||||
| 2255 | return never executed: d->state->bgMode;return d->state->bgMode;never executed: return d->state->bgMode; | 0 | ||||||||||||||||||||||||
| 2256 | } | - | ||||||||||||||||||||||||
| 2257 | void QPainter::setPen(const QColor &color) | - | ||||||||||||||||||||||||
| 2258 | { | - | ||||||||||||||||||||||||
| 2259 | - | |||||||||||||||||||||||||
| 2260 | - | |||||||||||||||||||||||||
| 2261 | - | |||||||||||||||||||||||||
| 2262 | - | |||||||||||||||||||||||||
| 2263 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2264 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2265 | QMessageLogger(__FILE__, 3844, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - | ||||||||||||||||||||||||
| 2266 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2267 | } | - | ||||||||||||||||||||||||
| 2268 | - | |||||||||||||||||||||||||
| 2269 | QPen pen(color.isValid() ? color : QColor(Qt::black)); | - | ||||||||||||||||||||||||
| 2270 | - | |||||||||||||||||||||||||
| 2271 | if (d->state->pen == pen
| 0 | ||||||||||||||||||||||||
| 2272 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2273 | - | |||||||||||||||||||||||||
| 2274 | d->state->pen = pen; | - | ||||||||||||||||||||||||
| 2275 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2276 | d->extended->penChanged(); never executed: d->extended->penChanged(); | 0 | ||||||||||||||||||||||||
| 2277 | else | - | ||||||||||||||||||||||||
| 2278 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyPen; | 0 | ||||||||||||||||||||||||
| 2279 | } | - | ||||||||||||||||||||||||
| 2280 | void QPainter::setPen(const QPen &pen) | - | ||||||||||||||||||||||||
| 2281 | { | - | ||||||||||||||||||||||||
| 2282 | - | |||||||||||||||||||||||||
| 2283 | - | |||||||||||||||||||||||||
| 2284 | - | |||||||||||||||||||||||||
| 2285 | - | |||||||||||||||||||||||||
| 2286 | - | |||||||||||||||||||||||||
| 2287 | - | |||||||||||||||||||||||||
| 2288 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2289 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2290 | QMessageLogger(__FILE__, 3879, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - | ||||||||||||||||||||||||
| 2291 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2292 | } | - | ||||||||||||||||||||||||
| 2293 | - | |||||||||||||||||||||||||
| 2294 | if (d->state->pen == pen
| 0 | ||||||||||||||||||||||||
| 2295 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2296 | - | |||||||||||||||||||||||||
| 2297 | d->state->pen = pen; | - | ||||||||||||||||||||||||
| 2298 | - | |||||||||||||||||||||||||
| 2299 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2300 | d->checkEmulation(); | - | ||||||||||||||||||||||||
| 2301 | d->extended->penChanged(); | - | ||||||||||||||||||||||||
| 2302 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2303 | } | - | ||||||||||||||||||||||||
| 2304 | - | |||||||||||||||||||||||||
| 2305 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; | - | ||||||||||||||||||||||||
| 2306 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2307 | void QPainter::setPen(Qt::PenStyle style) | - | ||||||||||||||||||||||||
| 2308 | { | - | ||||||||||||||||||||||||
| 2309 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2310 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2311 | QMessageLogger(__FILE__, 3908, __PRETTY_FUNCTION__).warning("QPainter::setPen: Painter not active"); | - | ||||||||||||||||||||||||
| 2312 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2313 | } | - | ||||||||||||||||||||||||
| 2314 | - | |||||||||||||||||||||||||
| 2315 | QPen pen = QPen(style); | - | ||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||
| 2317 | if (d->state->pen == pen
| 0 | ||||||||||||||||||||||||
| 2318 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||
| 2320 | d->state->pen = pen; | - | ||||||||||||||||||||||||
| 2321 | - | |||||||||||||||||||||||||
| 2322 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2323 | d->extended->penChanged(); never executed: d->extended->penChanged(); | 0 | ||||||||||||||||||||||||
| 2324 | else | - | ||||||||||||||||||||||||
| 2325 | d->state->dirtyFlags |= QPaintEngine::DirtyPen; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyPen; | 0 | ||||||||||||||||||||||||
| 2326 | - | |||||||||||||||||||||||||
| 2327 | } | - | ||||||||||||||||||||||||
| 2328 | - | |||||||||||||||||||||||||
| 2329 | - | |||||||||||||||||||||||||
| 2330 | - | |||||||||||||||||||||||||
| 2331 | - | |||||||||||||||||||||||||
| 2332 | - | |||||||||||||||||||||||||
| 2333 | - | |||||||||||||||||||||||||
| 2334 | - | |||||||||||||||||||||||||
| 2335 | const QPen &QPainter::pen() const | - | ||||||||||||||||||||||||
| 2336 | { | - | ||||||||||||||||||||||||
| 2337 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2338 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2339 | QMessageLogger(__FILE__, 3936, __PRETTY_FUNCTION__).warning("QPainter::pen: Painter not active"); | - | ||||||||||||||||||||||||
| 2340 | return never executed: d->fakeState()->pen;return d->fakeState()->pen;never executed: return d->fakeState()->pen; | 0 | ||||||||||||||||||||||||
| 2341 | } | - | ||||||||||||||||||||||||
| 2342 | return never executed: d->state->pen;return d->state->pen;never executed: return d->state->pen; | 0 | ||||||||||||||||||||||||
| 2343 | } | - | ||||||||||||||||||||||||
| 2344 | void QPainter::setBrush(const QBrush &brush) | - | ||||||||||||||||||||||||
| 2345 | { | - | ||||||||||||||||||||||||
| 2346 | - | |||||||||||||||||||||||||
| 2347 | - | |||||||||||||||||||||||||
| 2348 | - | |||||||||||||||||||||||||
| 2349 | - | |||||||||||||||||||||||||
| 2350 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2351 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2352 | QMessageLogger(__FILE__, 3959, __PRETTY_FUNCTION__).warning("QPainter::setBrush: Painter not active"); | - | ||||||||||||||||||||||||
| 2353 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2354 | } | - | ||||||||||||||||||||||||
| 2355 | - | |||||||||||||||||||||||||
| 2356 | if (d->state->brush.d == brush.d
| 0 | ||||||||||||||||||||||||
| 2357 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2358 | - | |||||||||||||||||||||||||
| 2359 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2360 | d->state->brush = brush; | - | ||||||||||||||||||||||||
| 2361 | d->checkEmulation(); | - | ||||||||||||||||||||||||
| 2362 | d->extended->brushChanged(); | - | ||||||||||||||||||||||||
| 2363 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2364 | } | - | ||||||||||||||||||||||||
| 2365 | - | |||||||||||||||||||||||||
| 2366 | d->state->brush = brush; | - | ||||||||||||||||||||||||
| 2367 | d->state->dirtyFlags |= QPaintEngine::DirtyBrush; | - | ||||||||||||||||||||||||
| 2368 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2369 | void QPainter::setBrush(Qt::BrushStyle style) | - | ||||||||||||||||||||||||
| 2370 | { | - | ||||||||||||||||||||||||
| 2371 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2372 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2373 | QMessageLogger(__FILE__, 3989, __PRETTY_FUNCTION__).warning("QPainter::setBrush: Painter not active"); | - | ||||||||||||||||||||||||
| 2374 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2375 | } | - | ||||||||||||||||||||||||
| 2376 | if (d->state->brush.style() == style
| 0 | ||||||||||||||||||||||||
| 2377 | (style == Qt::NoBrush
| 0 | ||||||||||||||||||||||||
| 2378 | || (style == Qt::SolidPattern
| 0 | ||||||||||||||||||||||||
| 2379 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2380 | d->state->brush = QBrush(Qt::black, style); | - | ||||||||||||||||||||||||
| 2381 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2382 | d->extended->brushChanged(); never executed: d->extended->brushChanged(); | 0 | ||||||||||||||||||||||||
| 2383 | else | - | ||||||||||||||||||||||||
| 2384 | d->state->dirtyFlags |= QPaintEngine::DirtyBrush; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyBrush; | 0 | ||||||||||||||||||||||||
| 2385 | } | - | ||||||||||||||||||||||||
| 2386 | - | |||||||||||||||||||||||||
| 2387 | - | |||||||||||||||||||||||||
| 2388 | - | |||||||||||||||||||||||||
| 2389 | - | |||||||||||||||||||||||||
| 2390 | - | |||||||||||||||||||||||||
| 2391 | - | |||||||||||||||||||||||||
| 2392 | - | |||||||||||||||||||||||||
| 2393 | const QBrush &QPainter::brush() const | - | ||||||||||||||||||||||||
| 2394 | { | - | ||||||||||||||||||||||||
| 2395 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2396 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2397 | QMessageLogger(__FILE__, 4013, __PRETTY_FUNCTION__).warning("QPainter::brush: Painter not active"); | - | ||||||||||||||||||||||||
| 2398 | return never executed: d->fakeState()->brush;return d->fakeState()->brush;never executed: return d->fakeState()->brush; | 0 | ||||||||||||||||||||||||
| 2399 | } | - | ||||||||||||||||||||||||
| 2400 | return never executed: d->state->brush;return d->state->brush;never executed: return d->state->brush; | 0 | ||||||||||||||||||||||||
| 2401 | } | - | ||||||||||||||||||||||||
| 2402 | void QPainter::setBackground(const QBrush &bg) | - | ||||||||||||||||||||||||
| 2403 | { | - | ||||||||||||||||||||||||
| 2404 | - | |||||||||||||||||||||||||
| 2405 | - | |||||||||||||||||||||||||
| 2406 | - | |||||||||||||||||||||||||
| 2407 | - | |||||||||||||||||||||||||
| 2408 | - | |||||||||||||||||||||||||
| 2409 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2410 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2411 | QMessageLogger(__FILE__, 4041, __PRETTY_FUNCTION__).warning("QPainter::setBackground: Painter not active"); | - | ||||||||||||||||||||||||
| 2412 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2413 | } | - | ||||||||||||||||||||||||
| 2414 | d->state->bgBrush = bg; | - | ||||||||||||||||||||||||
| 2415 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 2416 | d->state->dirtyFlags |= QPaintEngine::DirtyBackground; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyBackground; | 0 | ||||||||||||||||||||||||
| 2417 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2418 | void QPainter::setFont(const QFont &font) | - | ||||||||||||||||||||||||
| 2419 | { | - | ||||||||||||||||||||||||
| 2420 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2421 | - | |||||||||||||||||||||||||
| 2422 | - | |||||||||||||||||||||||||
| 2423 | - | |||||||||||||||||||||||||
| 2424 | - | |||||||||||||||||||||||||
| 2425 | - | |||||||||||||||||||||||||
| 2426 | - | |||||||||||||||||||||||||
| 2427 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2428 | QMessageLogger(__FILE__, 4072, __PRETTY_FUNCTION__).warning("QPainter::setFont: Painter not active"); | - | ||||||||||||||||||||||||
| 2429 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2430 | } | - | ||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||
| 2432 | d->state->font = QFont(font.resolve(d->state->deviceFont), device()); | - | ||||||||||||||||||||||||
| 2433 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 2434 | d->state->dirtyFlags |= QPaintEngine::DirtyFont; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyFont; | 0 | ||||||||||||||||||||||||
| 2435 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2436 | - | |||||||||||||||||||||||||
| 2437 | - | |||||||||||||||||||||||||
| 2438 | - | |||||||||||||||||||||||||
| 2439 | - | |||||||||||||||||||||||||
| 2440 | - | |||||||||||||||||||||||||
| 2441 | - | |||||||||||||||||||||||||
| 2442 | const QFont &QPainter::font() const | - | ||||||||||||||||||||||||
| 2443 | { | - | ||||||||||||||||||||||||
| 2444 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2445 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2446 | QMessageLogger(__FILE__, 4090, __PRETTY_FUNCTION__).warning("QPainter::font: Painter not active"); | - | ||||||||||||||||||||||||
| 2447 | return never executed: d->fakeState()->font;return d->fakeState()->font;never executed: return d->fakeState()->font; | 0 | ||||||||||||||||||||||||
| 2448 | } | - | ||||||||||||||||||||||||
| 2449 | return never executed: d->state->font;return d->state->font;never executed: return d->state->font; | 0 | ||||||||||||||||||||||||
| 2450 | } | - | ||||||||||||||||||||||||
| 2451 | void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode) | - | ||||||||||||||||||||||||
| 2452 | { | - | ||||||||||||||||||||||||
| 2453 | - | |||||||||||||||||||||||||
| 2454 | - | |||||||||||||||||||||||||
| 2455 | - | |||||||||||||||||||||||||
| 2456 | - | |||||||||||||||||||||||||
| 2457 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2458 | - | |||||||||||||||||||||||||
| 2459 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2460 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2461 | - | |||||||||||||||||||||||||
| 2462 | if (xRadius <= 0
| 0 | ||||||||||||||||||||||||
| 2463 | drawRect(rect); | - | ||||||||||||||||||||||||
| 2464 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2465 | } | - | ||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||
| 2467 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2468 | d->extended->drawRoundedRect(rect, xRadius, yRadius, mode); | - | ||||||||||||||||||||||||
| 2469 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2470 | } | - | ||||||||||||||||||||||||
| 2471 | - | |||||||||||||||||||||||||
| 2472 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2473 | path.addRoundedRect(rect, xRadius, yRadius, mode); | - | ||||||||||||||||||||||||
| 2474 | drawPath(path); | - | ||||||||||||||||||||||||
| 2475 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2476 | void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd) | - | ||||||||||||||||||||||||
| 2477 | { | - | ||||||||||||||||||||||||
| 2478 | drawRoundedRect(r, xRnd, yRnd, Qt::RelativeSize); | - | ||||||||||||||||||||||||
| 2479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2480 | void QPainter::drawEllipse(const QRectF &r) | - | ||||||||||||||||||||||||
| 2481 | { | - | ||||||||||||||||||||||||
| 2482 | - | |||||||||||||||||||||||||
| 2483 | - | |||||||||||||||||||||||||
| 2484 | - | |||||||||||||||||||||||||
| 2485 | - | |||||||||||||||||||||||||
| 2486 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2487 | - | |||||||||||||||||||||||||
| 2488 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2489 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2490 | - | |||||||||||||||||||||||||
| 2491 | QRectF rect(r.normalized()); | - | ||||||||||||||||||||||||
| 2492 | - | |||||||||||||||||||||||||
| 2493 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2494 | d->extended->drawEllipse(rect); | - | ||||||||||||||||||||||||
| 2495 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2496 | } | - | ||||||||||||||||||||||||
| 2497 | - | |||||||||||||||||||||||||
| 2498 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2499 | if (d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2500 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2501 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2502 | rect.translate(QPointF(d->state->matrix.dx(), d->state->matrix.dy())); | - | ||||||||||||||||||||||||
| 2503 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2504 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2505 | path.addEllipse(rect); | - | ||||||||||||||||||||||||
| 2506 | d->draw_helper(path, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2507 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2508 | } | - | ||||||||||||||||||||||||
| 2509 | } | - | ||||||||||||||||||||||||
| 2510 | - | |||||||||||||||||||||||||
| 2511 | d->engine->drawEllipse(rect); | - | ||||||||||||||||||||||||
| 2512 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2513 | void QPainter::drawEllipse(const QRect &r) | - | ||||||||||||||||||||||||
| 2514 | { | - | ||||||||||||||||||||||||
| 2515 | - | |||||||||||||||||||||||||
| 2516 | - | |||||||||||||||||||||||||
| 2517 | - | |||||||||||||||||||||||||
| 2518 | - | |||||||||||||||||||||||||
| 2519 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2520 | - | |||||||||||||||||||||||||
| 2521 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2522 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2523 | - | |||||||||||||||||||||||||
| 2524 | QRect rect(r.normalized()); | - | ||||||||||||||||||||||||
| 2525 | - | |||||||||||||||||||||||||
| 2526 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2527 | d->extended->drawEllipse(rect); | - | ||||||||||||||||||||||||
| 2528 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2529 | } | - | ||||||||||||||||||||||||
| 2530 | - | |||||||||||||||||||||||||
| 2531 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2532 | - | |||||||||||||||||||||||||
| 2533 | if (d->state->emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2534 | if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2535 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2536 | rect.translate(QPoint(qRound(d->state->matrix.dx()), qRound(d->state->matrix.dy()))); | - | ||||||||||||||||||||||||
| 2537 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2538 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2539 | path.addEllipse(rect); | - | ||||||||||||||||||||||||
| 2540 | d->draw_helper(path, QPainterPrivate::StrokeAndFillDraw); | - | ||||||||||||||||||||||||
| 2541 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2542 | } | - | ||||||||||||||||||||||||
| 2543 | } | - | ||||||||||||||||||||||||
| 2544 | - | |||||||||||||||||||||||||
| 2545 | d->engine->drawEllipse(rect); | - | ||||||||||||||||||||||||
| 2546 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2547 | void QPainter::drawArc(const QRectF &r, int a, int alen) | - | ||||||||||||||||||||||||
| 2548 | { | - | ||||||||||||||||||||||||
| 2549 | - | |||||||||||||||||||||||||
| 2550 | - | |||||||||||||||||||||||||
| 2551 | - | |||||||||||||||||||||||||
| 2552 | - | |||||||||||||||||||||||||
| 2553 | - | |||||||||||||||||||||||||
| 2554 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2555 | - | |||||||||||||||||||||||||
| 2556 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2557 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2558 | - | |||||||||||||||||||||||||
| 2559 | QRectF rect = r.normalized(); | - | ||||||||||||||||||||||||
| 2560 | - | |||||||||||||||||||||||||
| 2561 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2562 | path.arcMoveTo(rect, a/16.0); | - | ||||||||||||||||||||||||
| 2563 | path.arcTo(rect, a/16.0, alen/16.0); | - | ||||||||||||||||||||||||
| 2564 | strokePath(path, d->state->pen); | - | ||||||||||||||||||||||||
| 2565 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2566 | void QPainter::drawPie(const QRectF &r, int a, int alen) | - | ||||||||||||||||||||||||
| 2567 | { | - | ||||||||||||||||||||||||
| 2568 | - | |||||||||||||||||||||||||
| 2569 | - | |||||||||||||||||||||||||
| 2570 | - | |||||||||||||||||||||||||
| 2571 | - | |||||||||||||||||||||||||
| 2572 | - | |||||||||||||||||||||||||
| 2573 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2574 | - | |||||||||||||||||||||||||
| 2575 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2576 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2577 | - | |||||||||||||||||||||||||
| 2578 | if (a > (360*16)
| 0 | ||||||||||||||||||||||||
| 2579 | a = a % (360*16); | - | ||||||||||||||||||||||||
| 2580 | } never executed: else if (a < 0end of block
| 0 | ||||||||||||||||||||||||
| 2581 | a = a % (360*16); | - | ||||||||||||||||||||||||
| 2582 | if (a < 0
never executed: a += (360*16); | 0 | ||||||||||||||||||||||||
| 2583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2584 | - | |||||||||||||||||||||||||
| 2585 | QRectF rect = r.normalized(); | - | ||||||||||||||||||||||||
| 2586 | - | |||||||||||||||||||||||||
| 2587 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2588 | path.moveTo(rect.center()); | - | ||||||||||||||||||||||||
| 2589 | path.arcTo(rect.x(), rect.y(), rect.width(), rect.height(), a/16.0, alen/16.0); | - | ||||||||||||||||||||||||
| 2590 | path.closeSubpath(); | - | ||||||||||||||||||||||||
| 2591 | drawPath(path); | - | ||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||
| 2593 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2594 | void QPainter::drawChord(const QRectF &r, int a, int alen) | - | ||||||||||||||||||||||||
| 2595 | { | - | ||||||||||||||||||||||||
| 2596 | - | |||||||||||||||||||||||||
| 2597 | - | |||||||||||||||||||||||||
| 2598 | - | |||||||||||||||||||||||||
| 2599 | - | |||||||||||||||||||||||||
| 2600 | - | |||||||||||||||||||||||||
| 2601 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2602 | - | |||||||||||||||||||||||||
| 2603 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2604 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2605 | - | |||||||||||||||||||||||||
| 2606 | QRectF rect = r.normalized(); | - | ||||||||||||||||||||||||
| 2607 | - | |||||||||||||||||||||||||
| 2608 | QPainterPath path; | - | ||||||||||||||||||||||||
| 2609 | path.arcMoveTo(rect, a/16.0); | - | ||||||||||||||||||||||||
| 2610 | path.arcTo(rect, a/16.0, alen/16.0); | - | ||||||||||||||||||||||||
| 2611 | path.closeSubpath(); | - | ||||||||||||||||||||||||
| 2612 | drawPath(path); | - | ||||||||||||||||||||||||
| 2613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2614 | void QPainter::drawLines(const QLineF *lines, int lineCount) | - | ||||||||||||||||||||||||
| 2615 | { | - | ||||||||||||||||||||||||
| 2616 | - | |||||||||||||||||||||||||
| 2617 | - | |||||||||||||||||||||||||
| 2618 | - | |||||||||||||||||||||||||
| 2619 | - | |||||||||||||||||||||||||
| 2620 | - | |||||||||||||||||||||||||
| 2621 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2622 | - | |||||||||||||||||||||||||
| 2623 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2624 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2625 | - | |||||||||||||||||||||||||
| 2626 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2627 | d->extended->drawLines(lines, lineCount); | - | ||||||||||||||||||||||||
| 2628 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2629 | } | - | ||||||||||||||||||||||||
| 2630 | - | |||||||||||||||||||||||||
| 2631 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2632 | - | |||||||||||||||||||||||||
| 2633 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - | ||||||||||||||||||||||||
| 2634 | - | |||||||||||||||||||||||||
| 2635 | if (lineEmulation
| 0 | ||||||||||||||||||||||||
| 2636 | if (lineEmulation == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2637 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2638 | for (int i = 0; i < lineCount
| 0 | ||||||||||||||||||||||||
| 2639 | QLineF line = lines[i]; | - | ||||||||||||||||||||||||
| 2640 | line.translate(d->state->matrix.dx(), d->state->matrix.dy()); | - | ||||||||||||||||||||||||
| 2641 | d->engine->drawLines(&line, 1); | - | ||||||||||||||||||||||||
| 2642 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2643 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2644 | QPainterPath linePath; | - | ||||||||||||||||||||||||
| 2645 | for (int i = 0; i < lineCount
| 0 | ||||||||||||||||||||||||
| 2646 | linePath.moveTo(lines[i].p1()); | - | ||||||||||||||||||||||||
| 2647 | linePath.lineTo(lines[i].p2()); | - | ||||||||||||||||||||||||
| 2648 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2649 | d->draw_helper(linePath, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2650 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2651 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2652 | } | - | ||||||||||||||||||||||||
| 2653 | d->engine->drawLines(lines, lineCount); | - | ||||||||||||||||||||||||
| 2654 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2655 | void QPainter::drawLines(const QLine *lines, int lineCount) | - | ||||||||||||||||||||||||
| 2656 | { | - | ||||||||||||||||||||||||
| 2657 | - | |||||||||||||||||||||||||
| 2658 | - | |||||||||||||||||||||||||
| 2659 | - | |||||||||||||||||||||||||
| 2660 | - | |||||||||||||||||||||||||
| 2661 | - | |||||||||||||||||||||||||
| 2662 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2663 | - | |||||||||||||||||||||||||
| 2664 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2665 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2666 | - | |||||||||||||||||||||||||
| 2667 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2668 | d->extended->drawLines(lines, lineCount); | - | ||||||||||||||||||||||||
| 2669 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2670 | } | - | ||||||||||||||||||||||||
| 2671 | - | |||||||||||||||||||||||||
| 2672 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2673 | - | |||||||||||||||||||||||||
| 2674 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - | ||||||||||||||||||||||||
| 2675 | - | |||||||||||||||||||||||||
| 2676 | if (lineEmulation
| 0 | ||||||||||||||||||||||||
| 2677 | if (lineEmulation == QPaintEngine::PrimitiveTransform
| 0 | ||||||||||||||||||||||||
| 2678 | && d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2679 | for (int i = 0; i < lineCount
| 0 | ||||||||||||||||||||||||
| 2680 | QLineF line = lines[i]; | - | ||||||||||||||||||||||||
| 2681 | line.translate(d->state->matrix.dx(), d->state->matrix.dy()); | - | ||||||||||||||||||||||||
| 2682 | d->engine->drawLines(&line, 1); | - | ||||||||||||||||||||||||
| 2683 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2684 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2685 | QPainterPath linePath; | - | ||||||||||||||||||||||||
| 2686 | for (int i = 0; i < lineCount
| 0 | ||||||||||||||||||||||||
| 2687 | linePath.moveTo(lines[i].p1()); | - | ||||||||||||||||||||||||
| 2688 | linePath.lineTo(lines[i].p2()); | - | ||||||||||||||||||||||||
| 2689 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2690 | d->draw_helper(linePath, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2691 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2692 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2693 | } | - | ||||||||||||||||||||||||
| 2694 | d->engine->drawLines(lines, lineCount); | - | ||||||||||||||||||||||||
| 2695 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2696 | void QPainter::drawLines(const QPointF *pointPairs, int lineCount) | - | ||||||||||||||||||||||||
| 2697 | { | - | ||||||||||||||||||||||||
| 2698 | ((!(sizeof(QLineF) == 2*sizeof(QPointF))) ? qt_assert("sizeof(QLineF) == 2*sizeof(QPointF)",__FILE__,4626) : qt_noop()); | - | ||||||||||||||||||||||||
| 2699 | - | |||||||||||||||||||||||||
| 2700 | drawLines((const QLineF*)pointPairs, lineCount); | - | ||||||||||||||||||||||||
| 2701 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2702 | - | |||||||||||||||||||||||||
| 2703 | - | |||||||||||||||||||||||||
| 2704 | - | |||||||||||||||||||||||||
| 2705 | - | |||||||||||||||||||||||||
| 2706 | - | |||||||||||||||||||||||||
| 2707 | - | |||||||||||||||||||||||||
| 2708 | - | |||||||||||||||||||||||||
| 2709 | void QPainter::drawLines(const QPoint *pointPairs, int lineCount) | - | ||||||||||||||||||||||||
| 2710 | { | - | ||||||||||||||||||||||||
| 2711 | ((!(sizeof(QLine) == 2*sizeof(QPoint))) ? qt_assert("sizeof(QLine) == 2*sizeof(QPoint)",__FILE__,4639) : qt_noop()); | - | ||||||||||||||||||||||||
| 2712 | - | |||||||||||||||||||||||||
| 2713 | drawLines((const QLine*)pointPairs, lineCount); | - | ||||||||||||||||||||||||
| 2714 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2715 | void QPainter::drawPolyline(const QPointF *points, int pointCount) | - | ||||||||||||||||||||||||
| 2716 | { | - | ||||||||||||||||||||||||
| 2717 | - | |||||||||||||||||||||||||
| 2718 | - | |||||||||||||||||||||||||
| 2719 | - | |||||||||||||||||||||||||
| 2720 | - | |||||||||||||||||||||||||
| 2721 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2722 | - | |||||||||||||||||||||||||
| 2723 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2724 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2725 | - | |||||||||||||||||||||||||
| 2726 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2727 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - | ||||||||||||||||||||||||
| 2728 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2729 | } | - | ||||||||||||||||||||||||
| 2730 | - | |||||||||||||||||||||||||
| 2731 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2732 | - | |||||||||||||||||||||||||
| 2733 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - | ||||||||||||||||||||||||
| 2734 | - | |||||||||||||||||||||||||
| 2735 | if (lineEmulation
| 0 | ||||||||||||||||||||||||
| 2736 | - | |||||||||||||||||||||||||
| 2737 | - | |||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||
| 2739 | - | |||||||||||||||||||||||||
| 2740 | QPainterPath polylinePath(points[0]); | - | ||||||||||||||||||||||||
| 2741 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2742 | polylinePath.lineTo(points[i]); never executed: polylinePath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2743 | d->draw_helper(polylinePath, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2744 | - | |||||||||||||||||||||||||
| 2745 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2746 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - | ||||||||||||||||||||||||
| 2747 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2748 | } | - | ||||||||||||||||||||||||
| 2749 | - | |||||||||||||||||||||||||
| 2750 | - | |||||||||||||||||||||||||
| 2751 | - | |||||||||||||||||||||||||
| 2752 | - | |||||||||||||||||||||||||
| 2753 | - | |||||||||||||||||||||||||
| 2754 | - | |||||||||||||||||||||||||
| 2755 | - | |||||||||||||||||||||||||
| 2756 | void QPainter::drawPolyline(const QPoint *points, int pointCount) | - | ||||||||||||||||||||||||
| 2757 | { | - | ||||||||||||||||||||||||
| 2758 | - | |||||||||||||||||||||||||
| 2759 | - | |||||||||||||||||||||||||
| 2760 | - | |||||||||||||||||||||||||
| 2761 | - | |||||||||||||||||||||||||
| 2762 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2763 | - | |||||||||||||||||||||||||
| 2764 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2765 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2766 | - | |||||||||||||||||||||||||
| 2767 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2768 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - | ||||||||||||||||||||||||
| 2769 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2770 | } | - | ||||||||||||||||||||||||
| 2771 | - | |||||||||||||||||||||||||
| 2772 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2773 | - | |||||||||||||||||||||||||
| 2774 | uint lineEmulation = line_emulation(d->state->emulationSpecifier); | - | ||||||||||||||||||||||||
| 2775 | - | |||||||||||||||||||||||||
| 2776 | if (lineEmulation
| 0 | ||||||||||||||||||||||||
| 2777 | - | |||||||||||||||||||||||||
| 2778 | - | |||||||||||||||||||||||||
| 2779 | - | |||||||||||||||||||||||||
| 2780 | - | |||||||||||||||||||||||||
| 2781 | QPainterPath polylinePath(points[0]); | - | ||||||||||||||||||||||||
| 2782 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2783 | polylinePath.lineTo(points[i]); never executed: polylinePath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2784 | d->draw_helper(polylinePath, QPainterPrivate::StrokeDraw); | - | ||||||||||||||||||||||||
| 2785 | - | |||||||||||||||||||||||||
| 2786 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2787 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolylineMode); | - | ||||||||||||||||||||||||
| 2788 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2789 | } | - | ||||||||||||||||||||||||
| 2790 | void QPainter::drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule) | - | ||||||||||||||||||||||||
| 2791 | { | - | ||||||||||||||||||||||||
| 2792 | - | |||||||||||||||||||||||||
| 2793 | - | |||||||||||||||||||||||||
| 2794 | - | |||||||||||||||||||||||||
| 2795 | - | |||||||||||||||||||||||||
| 2796 | - | |||||||||||||||||||||||||
| 2797 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2798 | - | |||||||||||||||||||||||||
| 2799 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2800 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2801 | - | |||||||||||||||||||||||||
| 2802 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2803 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - | ||||||||||||||||||||||||
| 2804 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2805 | } | - | ||||||||||||||||||||||||
| 2806 | - | |||||||||||||||||||||||||
| 2807 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2808 | - | |||||||||||||||||||||||||
| 2809 | uint emulationSpecifier = d->state->emulationSpecifier; | - | ||||||||||||||||||||||||
| 2810 | - | |||||||||||||||||||||||||
| 2811 | if (emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2812 | QPainterPath polygonPath(points[0]); | - | ||||||||||||||||||||||||
| 2813 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2814 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2815 | polygonPath.closeSubpath(); | - | ||||||||||||||||||||||||
| 2816 | polygonPath.setFillRule(fillRule); | - | ||||||||||||||||||||||||
| 2817 | d->draw_helper(polygonPath); | - | ||||||||||||||||||||||||
| 2818 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2819 | } | - | ||||||||||||||||||||||||
| 2820 | - | |||||||||||||||||||||||||
| 2821 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - | ||||||||||||||||||||||||
| 2822 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2823 | - | |||||||||||||||||||||||||
| 2824 | - | |||||||||||||||||||||||||
| 2825 | - | |||||||||||||||||||||||||
| 2826 | - | |||||||||||||||||||||||||
| 2827 | - | |||||||||||||||||||||||||
| 2828 | - | |||||||||||||||||||||||||
| 2829 | void QPainter::drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fillRule) | - | ||||||||||||||||||||||||
| 2830 | { | - | ||||||||||||||||||||||||
| 2831 | - | |||||||||||||||||||||||||
| 2832 | - | |||||||||||||||||||||||||
| 2833 | - | |||||||||||||||||||||||||
| 2834 | - | |||||||||||||||||||||||||
| 2835 | - | |||||||||||||||||||||||||
| 2836 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2837 | - | |||||||||||||||||||||||||
| 2838 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2839 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2840 | - | |||||||||||||||||||||||||
| 2841 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2842 | d->extended->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - | ||||||||||||||||||||||||
| 2843 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2844 | } | - | ||||||||||||||||||||||||
| 2845 | - | |||||||||||||||||||||||||
| 2846 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2847 | - | |||||||||||||||||||||||||
| 2848 | uint emulationSpecifier = d->state->emulationSpecifier; | - | ||||||||||||||||||||||||
| 2849 | - | |||||||||||||||||||||||||
| 2850 | if (emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2851 | QPainterPath polygonPath(points[0]); | - | ||||||||||||||||||||||||
| 2852 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2853 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2854 | polygonPath.closeSubpath(); | - | ||||||||||||||||||||||||
| 2855 | polygonPath.setFillRule(fillRule); | - | ||||||||||||||||||||||||
| 2856 | d->draw_helper(polygonPath); | - | ||||||||||||||||||||||||
| 2857 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2858 | } | - | ||||||||||||||||||||||||
| 2859 | - | |||||||||||||||||||||||||
| 2860 | d->engine->drawPolygon(points, pointCount, QPaintEngine::PolygonDrawMode(fillRule)); | - | ||||||||||||||||||||||||
| 2861 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2862 | void QPainter::drawConvexPolygon(const QPoint *points, int pointCount) | - | ||||||||||||||||||||||||
| 2863 | { | - | ||||||||||||||||||||||||
| 2864 | - | |||||||||||||||||||||||||
| 2865 | - | |||||||||||||||||||||||||
| 2866 | - | |||||||||||||||||||||||||
| 2867 | - | |||||||||||||||||||||||||
| 2868 | - | |||||||||||||||||||||||||
| 2869 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2870 | - | |||||||||||||||||||||||||
| 2871 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2872 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2873 | - | |||||||||||||||||||||||||
| 2874 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2875 | d->extended->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - | ||||||||||||||||||||||||
| 2876 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2877 | } | - | ||||||||||||||||||||||||
| 2878 | - | |||||||||||||||||||||||||
| 2879 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2880 | - | |||||||||||||||||||||||||
| 2881 | uint emulationSpecifier = d->state->emulationSpecifier; | - | ||||||||||||||||||||||||
| 2882 | - | |||||||||||||||||||||||||
| 2883 | if (emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2884 | QPainterPath polygonPath(points[0]); | - | ||||||||||||||||||||||||
| 2885 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2886 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2887 | polygonPath.closeSubpath(); | - | ||||||||||||||||||||||||
| 2888 | polygonPath.setFillRule(Qt::WindingFill); | - | ||||||||||||||||||||||||
| 2889 | d->draw_helper(polygonPath); | - | ||||||||||||||||||||||||
| 2890 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2891 | } | - | ||||||||||||||||||||||||
| 2892 | - | |||||||||||||||||||||||||
| 2893 | d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - | ||||||||||||||||||||||||
| 2894 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2895 | - | |||||||||||||||||||||||||
| 2896 | void QPainter::drawConvexPolygon(const QPointF *points, int pointCount) | - | ||||||||||||||||||||||||
| 2897 | { | - | ||||||||||||||||||||||||
| 2898 | - | |||||||||||||||||||||||||
| 2899 | - | |||||||||||||||||||||||||
| 2900 | - | |||||||||||||||||||||||||
| 2901 | - | |||||||||||||||||||||||||
| 2902 | - | |||||||||||||||||||||||||
| 2903 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2904 | - | |||||||||||||||||||||||||
| 2905 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2906 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2907 | - | |||||||||||||||||||||||||
| 2908 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2909 | d->extended->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - | ||||||||||||||||||||||||
| 2910 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2911 | } | - | ||||||||||||||||||||||||
| 2912 | - | |||||||||||||||||||||||||
| 2913 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2914 | - | |||||||||||||||||||||||||
| 2915 | uint emulationSpecifier = d->state->emulationSpecifier; | - | ||||||||||||||||||||||||
| 2916 | - | |||||||||||||||||||||||||
| 2917 | if (emulationSpecifier
| 0 | ||||||||||||||||||||||||
| 2918 | QPainterPath polygonPath(points[0]); | - | ||||||||||||||||||||||||
| 2919 | for (int i=1; i<pointCount
| 0 | ||||||||||||||||||||||||
| 2920 | polygonPath.lineTo(points[i]); never executed: polygonPath.lineTo(points[i]); | 0 | ||||||||||||||||||||||||
| 2921 | polygonPath.closeSubpath(); | - | ||||||||||||||||||||||||
| 2922 | polygonPath.setFillRule(Qt::WindingFill); | - | ||||||||||||||||||||||||
| 2923 | d->draw_helper(polygonPath); | - | ||||||||||||||||||||||||
| 2924 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2925 | } | - | ||||||||||||||||||||||||
| 2926 | - | |||||||||||||||||||||||||
| 2927 | d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode); | - | ||||||||||||||||||||||||
| 2928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2929 | - | |||||||||||||||||||||||||
| 2930 | static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransform &m) | - | ||||||||||||||||||||||||
| 2931 | { | - | ||||||||||||||||||||||||
| 2932 | return never executed: m.inverted().map(QPointF(m.map(p).toPoint()));return m.inverted().map(QPointF(m.map(p).toPoint()));never executed: return m.inverted().map(QPointF(m.map(p).toPoint())); | 0 | ||||||||||||||||||||||||
| 2933 | } | - | ||||||||||||||||||||||||
| 2934 | void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm) | - | ||||||||||||||||||||||||
| 2935 | { | - | ||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||
| 2937 | - | |||||||||||||||||||||||||
| 2938 | - | |||||||||||||||||||||||||
| 2939 | - | |||||||||||||||||||||||||
| 2940 | - | |||||||||||||||||||||||||
| 2941 | - | |||||||||||||||||||||||||
| 2942 | - | |||||||||||||||||||||||||
| 2943 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2944 | - | |||||||||||||||||||||||||
| 2945 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 2946 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2947 | - | |||||||||||||||||||||||||
| 2948 | - | |||||||||||||||||||||||||
| 2949 | qt_painter_thread_test(d->device->devType(), d->engine->type(), "drawPixmap()"); | - | ||||||||||||||||||||||||
| 2950 | - | |||||||||||||||||||||||||
| 2951 | - | |||||||||||||||||||||||||
| 2952 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 2953 | d->extended->drawPixmap(p, pm); | - | ||||||||||||||||||||||||
| 2954 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2955 | } | - | ||||||||||||||||||||||||
| 2956 | - | |||||||||||||||||||||||||
| 2957 | qreal x = p.x(); | - | ||||||||||||||||||||||||
| 2958 | qreal y = p.y(); | - | ||||||||||||||||||||||||
| 2959 | - | |||||||||||||||||||||||||
| 2960 | int w = pm.width(); | - | ||||||||||||||||||||||||
| 2961 | int h = pm.height(); | - | ||||||||||||||||||||||||
| 2962 | - | |||||||||||||||||||||||||
| 2963 | if (w <= 0
| 0 | ||||||||||||||||||||||||
| 2964 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2965 | - | |||||||||||||||||||||||||
| 2966 | - | |||||||||||||||||||||||||
| 2967 | if (d->state->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 2968 | fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); | - | ||||||||||||||||||||||||
| 2969 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2970 | - | |||||||||||||||||||||||||
| 2971 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 2972 | - | |||||||||||||||||||||||||
| 2973 | if ((d->state->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 2974 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 2975 | || (!d->state->matrix.isAffine()
| 0 | ||||||||||||||||||||||||
| 2976 | || (d->state->opacity != 1.0
| 0 | ||||||||||||||||||||||||
| 2977 | { | - | ||||||||||||||||||||||||
| 2978 | save(); | - | ||||||||||||||||||||||||
| 2979 | - | |||||||||||||||||||||||||
| 2980 | - | |||||||||||||||||||||||||
| 2981 | if (d->state->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 2982 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - | ||||||||||||||||||||||||
| 2983 | x = p.x(); | - | ||||||||||||||||||||||||
| 2984 | y = p.y(); | - | ||||||||||||||||||||||||
| 2985 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2986 | translate(x, y); | - | ||||||||||||||||||||||||
| 2987 | setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 2988 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 2989 | QBrush brush(d->state->pen.color(), pm); | - | ||||||||||||||||||||||||
| 2990 | setBrush(brush); | - | ||||||||||||||||||||||||
| 2991 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 2992 | setBrushOrigin(QPointF(0, 0)); | - | ||||||||||||||||||||||||
| 2993 | - | |||||||||||||||||||||||||
| 2994 | drawRect(pm.rect()); | - | ||||||||||||||||||||||||
| 2995 | restore(); | - | ||||||||||||||||||||||||
| 2996 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2997 | if (!d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 2998 | x += d->state->matrix.dx(); | - | ||||||||||||||||||||||||
| 2999 | y += d->state->matrix.dy(); | - | ||||||||||||||||||||||||
| 3000 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3001 | qreal scale = pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 3002 | d->engine->drawPixmap(QRectF(x, y, w / scale, h / scale), pm, QRectF(0, 0, w, h)); | - | ||||||||||||||||||||||||
| 3003 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3004 | } | - | ||||||||||||||||||||||||
| 3005 | - | |||||||||||||||||||||||||
| 3006 | void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - | ||||||||||||||||||||||||
| 3007 | { | - | ||||||||||||||||||||||||
| 3008 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3009 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3010 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||
| 3012 | qt_painter_thread_test(d->device->devType(), d->engine->type(), "drawPixmap()"); | - | ||||||||||||||||||||||||
| 3013 | - | |||||||||||||||||||||||||
| 3014 | - | |||||||||||||||||||||||||
| 3015 | qreal x = r.x(); | - | ||||||||||||||||||||||||
| 3016 | qreal y = r.y(); | - | ||||||||||||||||||||||||
| 3017 | qreal w = r.width(); | - | ||||||||||||||||||||||||
| 3018 | qreal h = r.height(); | - | ||||||||||||||||||||||||
| 3019 | qreal sx = sr.x(); | - | ||||||||||||||||||||||||
| 3020 | qreal sy = sr.y(); | - | ||||||||||||||||||||||||
| 3021 | qreal sw = sr.width(); | - | ||||||||||||||||||||||||
| 3022 | qreal sh = sr.height(); | - | ||||||||||||||||||||||||
| 3023 | - | |||||||||||||||||||||||||
| 3024 | - | |||||||||||||||||||||||||
| 3025 | - | |||||||||||||||||||||||||
| 3026 | - | |||||||||||||||||||||||||
| 3027 | const qreal pmscale = pm.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 3028 | - | |||||||||||||||||||||||||
| 3029 | - | |||||||||||||||||||||||||
| 3030 | if (sw <= 0
| 0 | ||||||||||||||||||||||||
| 3031 | sw = pm.width() - sx; never executed: sw = pm.width() - sx; | 0 | ||||||||||||||||||||||||
| 3032 | - | |||||||||||||||||||||||||
| 3033 | if (sh <= 0
| 0 | ||||||||||||||||||||||||
| 3034 | sh = pm.height() - sy; never executed: sh = pm.height() - sy; | 0 | ||||||||||||||||||||||||
| 3035 | - | |||||||||||||||||||||||||
| 3036 | if (w < 0
| 0 | ||||||||||||||||||||||||
| 3037 | w = sw / pmscale; never executed: w = sw / pmscale; | 0 | ||||||||||||||||||||||||
| 3038 | if (h < 0
| 0 | ||||||||||||||||||||||||
| 3039 | h = sh / pmscale; never executed: h = sh / pmscale; | 0 | ||||||||||||||||||||||||
| 3040 | - | |||||||||||||||||||||||||
| 3041 | if (sx < 0
| 0 | ||||||||||||||||||||||||
| 3042 | qreal w_ratio = sx * w/sw; | - | ||||||||||||||||||||||||
| 3043 | x -= w_ratio; | - | ||||||||||||||||||||||||
| 3044 | w += w_ratio; | - | ||||||||||||||||||||||||
| 3045 | sw += sx; | - | ||||||||||||||||||||||||
| 3046 | sx = 0; | - | ||||||||||||||||||||||||
| 3047 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3048 | - | |||||||||||||||||||||||||
| 3049 | if (sy < 0
| 0 | ||||||||||||||||||||||||
| 3050 | qreal h_ratio = sy * h/sh; | - | ||||||||||||||||||||||||
| 3051 | y -= h_ratio; | - | ||||||||||||||||||||||||
| 3052 | h += h_ratio; | - | ||||||||||||||||||||||||
| 3053 | sh += sy; | - | ||||||||||||||||||||||||
| 3054 | sy = 0; | - | ||||||||||||||||||||||||
| 3055 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3056 | - | |||||||||||||||||||||||||
| 3057 | if (sw + sx > pm.width()
| 0 | ||||||||||||||||||||||||
| 3058 | qreal delta = sw - (pm.width() - sx); | - | ||||||||||||||||||||||||
| 3059 | qreal w_ratio = delta * w/sw; | - | ||||||||||||||||||||||||
| 3060 | sw -= delta; | - | ||||||||||||||||||||||||
| 3061 | w -= w_ratio; | - | ||||||||||||||||||||||||
| 3062 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3063 | - | |||||||||||||||||||||||||
| 3064 | if (sh + sy > pm.height()
| 0 | ||||||||||||||||||||||||
| 3065 | qreal delta = sh - (pm.height() - sy); | - | ||||||||||||||||||||||||
| 3066 | qreal h_ratio = delta * h/sh; | - | ||||||||||||||||||||||||
| 3067 | sh -= delta; | - | ||||||||||||||||||||||||
| 3068 | h -= h_ratio; | - | ||||||||||||||||||||||||
| 3069 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3070 | - | |||||||||||||||||||||||||
| 3071 | if (w == 0
| 0 | ||||||||||||||||||||||||
| 3072 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3073 | - | |||||||||||||||||||||||||
| 3074 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 3075 | d->extended->drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); | - | ||||||||||||||||||||||||
| 3076 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3077 | } | - | ||||||||||||||||||||||||
| 3078 | - | |||||||||||||||||||||||||
| 3079 | - | |||||||||||||||||||||||||
| 3080 | if (d->state->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 3081 | fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); never executed: fillRect(QRectF(x, y, w, h), d->state->bgBrush.color()); | 0 | ||||||||||||||||||||||||
| 3082 | - | |||||||||||||||||||||||||
| 3083 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||
| 3085 | if ((d->state->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3086 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3087 | || (!d->state->matrix.isAffine()
| 0 | ||||||||||||||||||||||||
| 3088 | || (d->state->opacity != 1.0
| 0 | ||||||||||||||||||||||||
| 3089 | || ((sw != w
| 0 | ||||||||||||||||||||||||
| 3090 | { | - | ||||||||||||||||||||||||
| 3091 | save(); | - | ||||||||||||||||||||||||
| 3092 | - | |||||||||||||||||||||||||
| 3093 | - | |||||||||||||||||||||||||
| 3094 | if (d->state->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 3095 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - | ||||||||||||||||||||||||
| 3096 | x = p.x(); | - | ||||||||||||||||||||||||
| 3097 | y = p.y(); | - | ||||||||||||||||||||||||
| 3098 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3099 | - | |||||||||||||||||||||||||
| 3100 | if (d->state->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3101 | sx = qRound(sx); | - | ||||||||||||||||||||||||
| 3102 | sy = qRound(sy); | - | ||||||||||||||||||||||||
| 3103 | sw = qRound(sw); | - | ||||||||||||||||||||||||
| 3104 | sh = qRound(sh); | - | ||||||||||||||||||||||||
| 3105 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3106 | - | |||||||||||||||||||||||||
| 3107 | translate(x, y); | - | ||||||||||||||||||||||||
| 3108 | scale(w / sw, h / sh); | - | ||||||||||||||||||||||||
| 3109 | setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 3110 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 3111 | QBrush brush; | - | ||||||||||||||||||||||||
| 3112 | - | |||||||||||||||||||||||||
| 3113 | if (sw == pm.width()
| 0 | ||||||||||||||||||||||||
| 3114 | brush = QBrush(d->state->pen.color(), pm); never executed: brush = QBrush(d->state->pen.color(), pm); | 0 | ||||||||||||||||||||||||
| 3115 | else | - | ||||||||||||||||||||||||
| 3116 | brush = QBrush(d->state->pen.color(), pm.copy(sx, sy, sw, sh)); never executed: brush = QBrush(d->state->pen.color(), pm.copy(sx, sy, sw, sh)); | 0 | ||||||||||||||||||||||||
| 3117 | - | |||||||||||||||||||||||||
| 3118 | setBrush(brush); | - | ||||||||||||||||||||||||
| 3119 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3120 | - | |||||||||||||||||||||||||
| 3121 | drawRect(QRectF(0, 0, sw, sh)); | - | ||||||||||||||||||||||||
| 3122 | restore(); | - | ||||||||||||||||||||||||
| 3123 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3124 | if (!d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3125 | x += d->state->matrix.dx(); | - | ||||||||||||||||||||||||
| 3126 | y += d->state->matrix.dy(); | - | ||||||||||||||||||||||||
| 3127 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3128 | d->engine->drawPixmap(QRectF(x, y, w, h), pm, QRectF(sx, sy, sw, sh)); | - | ||||||||||||||||||||||||
| 3129 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3130 | } | - | ||||||||||||||||||||||||
| 3131 | void QPainter::drawImage(const QPointF &p, const QImage &image) | - | ||||||||||||||||||||||||
| 3132 | { | - | ||||||||||||||||||||||||
| 3133 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3134 | - | |||||||||||||||||||||||||
| 3135 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3136 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3137 | - | |||||||||||||||||||||||||
| 3138 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 3139 | d->extended->drawImage(p, image); | - | ||||||||||||||||||||||||
| 3140 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3141 | } | - | ||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||
| 3143 | qreal x = p.x(); | - | ||||||||||||||||||||||||
| 3144 | qreal y = p.y(); | - | ||||||||||||||||||||||||
| 3145 | - | |||||||||||||||||||||||||
| 3146 | int w = image.width(); | - | ||||||||||||||||||||||||
| 3147 | int h = image.height(); | - | ||||||||||||||||||||||||
| 3148 | qreal scale = image.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 3149 | - | |||||||||||||||||||||||||
| 3150 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 3151 | - | |||||||||||||||||||||||||
| 3152 | if (((
| 0 | ||||||||||||||||||||||||
| 3153 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3154 | || (!d->state->matrix.isAffine()
| 0 | ||||||||||||||||||||||||
| 3155 | || (d->state->opacity != 1.0
| 0 | ||||||||||||||||||||||||
| 3156 | { | - | ||||||||||||||||||||||||
| 3157 | save(); | - | ||||||||||||||||||||||||
| 3158 | - | |||||||||||||||||||||||||
| 3159 | - | |||||||||||||||||||||||||
| 3160 | if (d->state->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 3161 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - | ||||||||||||||||||||||||
| 3162 | x = p.x(); | - | ||||||||||||||||||||||||
| 3163 | y = p.y(); | - | ||||||||||||||||||||||||
| 3164 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3165 | translate(x, y); | - | ||||||||||||||||||||||||
| 3166 | setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 3167 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 3168 | QBrush brush(image); | - | ||||||||||||||||||||||||
| 3169 | setBrush(brush); | - | ||||||||||||||||||||||||
| 3170 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3171 | setBrushOrigin(QPointF(0, 0)); | - | ||||||||||||||||||||||||
| 3172 | drawRect(QRect(QPoint(0, 0), image.size() / scale)); | - | ||||||||||||||||||||||||
| 3173 | restore(); | - | ||||||||||||||||||||||||
| 3174 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3175 | } | - | ||||||||||||||||||||||||
| 3176 | - | |||||||||||||||||||||||||
| 3177 | if (d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3178 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3179 | x += d->state->matrix.dx(); | - | ||||||||||||||||||||||||
| 3180 | y += d->state->matrix.dy(); | - | ||||||||||||||||||||||||
| 3181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3182 | - | |||||||||||||||||||||||||
| 3183 | d->engine->drawImage(QRectF(x, y, w / scale, h / scale), image, QRectF(0, 0, w, h), Qt::AutoColor); | - | ||||||||||||||||||||||||
| 3184 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3185 | - | |||||||||||||||||||||||||
| 3186 | void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, | - | ||||||||||||||||||||||||
| 3187 | Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 3188 | { | - | ||||||||||||||||||||||||
| 3189 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3190 | - | |||||||||||||||||||||||||
| 3191 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3192 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3193 | - | |||||||||||||||||||||||||
| 3194 | qreal x = targetRect.x(); | - | ||||||||||||||||||||||||
| 3195 | qreal y = targetRect.y(); | - | ||||||||||||||||||||||||
| 3196 | qreal w = targetRect.width(); | - | ||||||||||||||||||||||||
| 3197 | qreal h = targetRect.height(); | - | ||||||||||||||||||||||||
| 3198 | qreal sx = sourceRect.x(); | - | ||||||||||||||||||||||||
| 3199 | qreal sy = sourceRect.y(); | - | ||||||||||||||||||||||||
| 3200 | qreal sw = sourceRect.width(); | - | ||||||||||||||||||||||||
| 3201 | qreal sh = sourceRect.height(); | - | ||||||||||||||||||||||||
| 3202 | qreal imageScale = image.devicePixelRatio(); | - | ||||||||||||||||||||||||
| 3203 | - | |||||||||||||||||||||||||
| 3204 | - | |||||||||||||||||||||||||
| 3205 | if (sw <= 0
| 0 | ||||||||||||||||||||||||
| 3206 | sw = image.width() - sx; never executed: sw = image.width() - sx; | 0 | ||||||||||||||||||||||||
| 3207 | - | |||||||||||||||||||||||||
| 3208 | if (sh <= 0
| 0 | ||||||||||||||||||||||||
| 3209 | sh = image.height() - sy; never executed: sh = image.height() - sy; | 0 | ||||||||||||||||||||||||
| 3210 | - | |||||||||||||||||||||||||
| 3211 | if (w < 0
| 0 | ||||||||||||||||||||||||
| 3212 | w = sw / imageScale; never executed: w = sw / imageScale; | 0 | ||||||||||||||||||||||||
| 3213 | if (h < 0
| 0 | ||||||||||||||||||||||||
| 3214 | h = sh / imageScale; never executed: h = sh / imageScale; | 0 | ||||||||||||||||||||||||
| 3215 | - | |||||||||||||||||||||||||
| 3216 | if (sx < 0
| 0 | ||||||||||||||||||||||||
| 3217 | qreal w_ratio = sx * w/sw; | - | ||||||||||||||||||||||||
| 3218 | x -= w_ratio; | - | ||||||||||||||||||||||||
| 3219 | w += w_ratio; | - | ||||||||||||||||||||||||
| 3220 | sw += sx; | - | ||||||||||||||||||||||||
| 3221 | sx = 0; | - | ||||||||||||||||||||||||
| 3222 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3223 | - | |||||||||||||||||||||||||
| 3224 | if (sy < 0
| 0 | ||||||||||||||||||||||||
| 3225 | qreal h_ratio = sy * h/sh; | - | ||||||||||||||||||||||||
| 3226 | y -= h_ratio; | - | ||||||||||||||||||||||||
| 3227 | h += h_ratio; | - | ||||||||||||||||||||||||
| 3228 | sh += sy; | - | ||||||||||||||||||||||||
| 3229 | sy = 0; | - | ||||||||||||||||||||||||
| 3230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3231 | - | |||||||||||||||||||||||||
| 3232 | if (sw + sx > image.width()
| 0 | ||||||||||||||||||||||||
| 3233 | qreal delta = sw - (image.width() - sx); | - | ||||||||||||||||||||||||
| 3234 | qreal w_ratio = delta * w/sw; | - | ||||||||||||||||||||||||
| 3235 | sw -= delta; | - | ||||||||||||||||||||||||
| 3236 | w -= w_ratio; | - | ||||||||||||||||||||||||
| 3237 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3238 | - | |||||||||||||||||||||||||
| 3239 | if (sh + sy > image.height()
| 0 | ||||||||||||||||||||||||
| 3240 | qreal delta = sh - (image.height() - sy); | - | ||||||||||||||||||||||||
| 3241 | qreal h_ratio = delta * h/sh; | - | ||||||||||||||||||||||||
| 3242 | sh -= delta; | - | ||||||||||||||||||||||||
| 3243 | h -= h_ratio; | - | ||||||||||||||||||||||||
| 3244 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3245 | - | |||||||||||||||||||||||||
| 3246 | if (w == 0
| 0 | ||||||||||||||||||||||||
| 3247 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3248 | - | |||||||||||||||||||||||||
| 3249 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 3250 | d->extended->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags); | - | ||||||||||||||||||||||||
| 3251 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3252 | } | - | ||||||||||||||||||||||||
| 3253 | - | |||||||||||||||||||||||||
| 3254 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 3255 | - | |||||||||||||||||||||||||
| 3256 | if (((d->state->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3257 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3258 | || (!d->state->matrix.isAffine()
| 0 | ||||||||||||||||||||||||
| 3259 | || (d->state->opacity != 1.0
| 0 | ||||||||||||||||||||||||
| 3260 | { | - | ||||||||||||||||||||||||
| 3261 | save(); | - | ||||||||||||||||||||||||
| 3262 | - | |||||||||||||||||||||||||
| 3263 | - | |||||||||||||||||||||||||
| 3264 | if (d->state->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 3265 | const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix); | - | ||||||||||||||||||||||||
| 3266 | x = p.x(); | - | ||||||||||||||||||||||||
| 3267 | y = p.y(); | - | ||||||||||||||||||||||||
| 3268 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||
| 3270 | if (d->state->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3271 | sx = qRound(sx); | - | ||||||||||||||||||||||||
| 3272 | sy = qRound(sy); | - | ||||||||||||||||||||||||
| 3273 | sw = qRound(sw); | - | ||||||||||||||||||||||||
| 3274 | sh = qRound(sh); | - | ||||||||||||||||||||||||
| 3275 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3276 | translate(x, y); | - | ||||||||||||||||||||||||
| 3277 | scale(w / sw, h / sh); | - | ||||||||||||||||||||||||
| 3278 | setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 3279 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 3280 | QBrush brush(image); | - | ||||||||||||||||||||||||
| 3281 | setBrush(brush); | - | ||||||||||||||||||||||||
| 3282 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 3283 | setBrushOrigin(QPointF(-sx, -sy)); | - | ||||||||||||||||||||||||
| 3284 | - | |||||||||||||||||||||||||
| 3285 | drawRect(QRectF(0, 0, sw, sh)); | - | ||||||||||||||||||||||||
| 3286 | restore(); | - | ||||||||||||||||||||||||
| 3287 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3288 | } | - | ||||||||||||||||||||||||
| 3289 | - | |||||||||||||||||||||||||
| 3290 | if (d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 3291 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 3292 | x += d->state->matrix.dx(); | - | ||||||||||||||||||||||||
| 3293 | y += d->state->matrix.dy(); | - | ||||||||||||||||||||||||
| 3294 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3295 | - | |||||||||||||||||||||||||
| 3296 | d->engine->drawImage(QRectF(x, y, w, h), image, QRectF(sx, sy, sw, sh), flags); | - | ||||||||||||||||||||||||
| 3297 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3298 | void QPainter::drawGlyphRun(const QPointF &position, const QGlyphRun &glyphRun) | - | ||||||||||||||||||||||||
| 3299 | { | - | ||||||||||||||||||||||||
| 3300 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3301 | - | |||||||||||||||||||||||||
| 3302 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3303 | QMessageLogger(__FILE__, 5539, __PRETTY_FUNCTION__).warning("QPainter::drawGlyphRun: Painter not active"); | - | ||||||||||||||||||||||||
| 3304 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3305 | } | - | ||||||||||||||||||||||||
| 3306 | - | |||||||||||||||||||||||||
| 3307 | QRawFont font = glyphRun.rawFont(); | - | ||||||||||||||||||||||||
| 3308 | if (!font.isValid()
| 0 | ||||||||||||||||||||||||
| 3309 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3310 | - | |||||||||||||||||||||||||
| 3311 | QGlyphRunPrivate *glyphRun_d = QGlyphRunPrivate::get(glyphRun); | - | ||||||||||||||||||||||||
| 3312 | - | |||||||||||||||||||||||||
| 3313 | const quint32 *glyphIndexes = glyphRun_d->glyphIndexData; | - | ||||||||||||||||||||||||
| 3314 | const QPointF *glyphPositions = glyphRun_d->glyphPositionData; | - | ||||||||||||||||||||||||
| 3315 | - | |||||||||||||||||||||||||
| 3316 | int count = qMin(glyphRun_d->glyphIndexDataSize, glyphRun_d->glyphPositionDataSize); | - | ||||||||||||||||||||||||
| 3317 | QVarLengthArray<QFixedPoint, 128> fixedPointPositions(count); | - | ||||||||||||||||||||||||
| 3318 | - | |||||||||||||||||||||||||
| 3319 | QRawFontPrivate *fontD = QRawFontPrivate::get(font); | - | ||||||||||||||||||||||||
| 3320 | bool engineRequiresPretransformedGlyphPositions = d->extended
| 0 | ||||||||||||||||||||||||
| 3321 | ? d->extended->requiresPretransformedGlyphPositions(fontD->fontEngine, d->state->matrix) | - | ||||||||||||||||||||||||
| 3322 | : d->engine->type() != QPaintEngine::CoreGraphics
| 0 | ||||||||||||||||||||||||
| 3323 | - | |||||||||||||||||||||||||
| 3324 | for (int i=0; i<count
| 0 | ||||||||||||||||||||||||
| 3325 | QPointF processedPosition = position + glyphPositions[i]; | - | ||||||||||||||||||||||||
| 3326 | if (engineRequiresPretransformedGlyphPositions
| 0 | ||||||||||||||||||||||||
| 3327 | processedPosition = d->state->transform().map(processedPosition); never executed: processedPosition = d->state->transform().map(processedPosition); | 0 | ||||||||||||||||||||||||
| 3328 | fixedPointPositions[i] = QFixedPoint::fromPointF(processedPosition); | - | ||||||||||||||||||||||||
| 3329 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3330 | - | |||||||||||||||||||||||||
| 3331 | d->drawGlyphs(glyphIndexes, fixedPointPositions.data(), count, fontD->fontEngine, | - | ||||||||||||||||||||||||
| 3332 | glyphRun.overline(), glyphRun.underline(), glyphRun.strikeOut()); | - | ||||||||||||||||||||||||
| 3333 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3334 | - | |||||||||||||||||||||||||
| 3335 | void QPainterPrivate::drawGlyphs(const quint32 *glyphArray, QFixedPoint *positions, | - | ||||||||||||||||||||||||
| 3336 | int glyphCount, | - | ||||||||||||||||||||||||
| 3337 | QFontEngine *fontEngine, bool overline, bool underline, | - | ||||||||||||||||||||||||
| 3338 | bool strikeOut) | - | ||||||||||||||||||||||||
| 3339 | { | - | ||||||||||||||||||||||||
| 3340 | QPainter * const q = q_func(); | - | ||||||||||||||||||||||||
| 3341 | - | |||||||||||||||||||||||||
| 3342 | updateState(state); | - | ||||||||||||||||||||||||
| 3343 | - | |||||||||||||||||||||||||
| 3344 | QFixed leftMost; | - | ||||||||||||||||||||||||
| 3345 | QFixed rightMost; | - | ||||||||||||||||||||||||
| 3346 | QFixed baseLine; | - | ||||||||||||||||||||||||
| 3347 | for (int i=0; i<glyphCount
| 0 | ||||||||||||||||||||||||
| 3348 | glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]); | - | ||||||||||||||||||||||||
| 3349 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3350 | leftMost = positions[i].x; never executed: leftMost = positions[i].x; | 0 | ||||||||||||||||||||||||
| 3351 | - | |||||||||||||||||||||||||
| 3352 | - | |||||||||||||||||||||||||
| 3353 | - | |||||||||||||||||||||||||
| 3354 | - | |||||||||||||||||||||||||
| 3355 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3356 | baseLine = positions[i].y; never executed: baseLine = positions[i].y; | 0 | ||||||||||||||||||||||||
| 3357 | - | |||||||||||||||||||||||||
| 3358 | - | |||||||||||||||||||||||||
| 3359 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3360 | rightMost = positions[i].x + gm.xoff; never executed: rightMost = positions[i].x + gm.xoff; | 0 | ||||||||||||||||||||||||
| 3361 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3362 | - | |||||||||||||||||||||||||
| 3363 | QFixed width = rightMost - leftMost; | - | ||||||||||||||||||||||||
| 3364 | - | |||||||||||||||||||||||||
| 3365 | if (extended != 0
| 0 | ||||||||||||||||||||||||
| 3366 | QStaticTextItem staticTextItem; | - | ||||||||||||||||||||||||
| 3367 | staticTextItem.color = state->pen.color(); | - | ||||||||||||||||||||||||
| 3368 | staticTextItem.font = state->font; | - | ||||||||||||||||||||||||
| 3369 | staticTextItem.setFontEngine(fontEngine); | - | ||||||||||||||||||||||||
| 3370 | staticTextItem.numGlyphs = glyphCount; | - | ||||||||||||||||||||||||
| 3371 | staticTextItem.glyphs = reinterpret_cast<glyph_t *>(const_cast<glyph_t *>(glyphArray)); | - | ||||||||||||||||||||||||
| 3372 | staticTextItem.glyphPositions = positions; | - | ||||||||||||||||||||||||
| 3373 | - | |||||||||||||||||||||||||
| 3374 | staticTextItem.usesRawFont = true; | - | ||||||||||||||||||||||||
| 3375 | - | |||||||||||||||||||||||||
| 3376 | extended->drawStaticTextItem(&staticTextItem); | - | ||||||||||||||||||||||||
| 3377 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3378 | QTextItemInt textItem; | - | ||||||||||||||||||||||||
| 3379 | textItem.fontEngine = fontEngine; | - | ||||||||||||||||||||||||
| 3380 | - | |||||||||||||||||||||||||
| 3381 | QVarLengthArray<QFixed, 128> advances(glyphCount); | - | ||||||||||||||||||||||||
| 3382 | QVarLengthArray<QGlyphJustification, 128> glyphJustifications(glyphCount); | - | ||||||||||||||||||||||||
| 3383 | QVarLengthArray<QGlyphAttributes, 128> glyphAttributes(glyphCount); | - | ||||||||||||||||||||||||
| 3384 | memset(glyphAttributes.data(), 0, glyphAttributes.size() * sizeof(QGlyphAttributes)); | - | ||||||||||||||||||||||||
| 3385 | memset(advances.data(), 0, advances.size() * sizeof(QFixed)); | - | ||||||||||||||||||||||||
| 3386 | memset(glyphJustifications.data(), 0, glyphJustifications.size() * sizeof(QGlyphJustification)); | - | ||||||||||||||||||||||||
| 3387 | - | |||||||||||||||||||||||||
| 3388 | textItem.glyphs.numGlyphs = glyphCount; | - | ||||||||||||||||||||||||
| 3389 | textItem.glyphs.glyphs = const_cast<glyph_t *>(glyphArray); | - | ||||||||||||||||||||||||
| 3390 | textItem.glyphs.offsets = positions; | - | ||||||||||||||||||||||||
| 3391 | textItem.glyphs.advances = advances.data(); | - | ||||||||||||||||||||||||
| 3392 | textItem.glyphs.justifications = glyphJustifications.data(); | - | ||||||||||||||||||||||||
| 3393 | textItem.glyphs.attributes = glyphAttributes.data(); | - | ||||||||||||||||||||||||
| 3394 | - | |||||||||||||||||||||||||
| 3395 | engine->drawTextItem(QPointF(0, 0), textItem); | - | ||||||||||||||||||||||||
| 3396 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3397 | - | |||||||||||||||||||||||||
| 3398 | QTextItemInt::RenderFlags flags; | - | ||||||||||||||||||||||||
| 3399 | if (underline
| 0 | ||||||||||||||||||||||||
| 3400 | flags |= QTextItemInt::Underline; never executed: flags |= QTextItemInt::Underline; | 0 | ||||||||||||||||||||||||
| 3401 | if (overline
| 0 | ||||||||||||||||||||||||
| 3402 | flags |= QTextItemInt::Overline; never executed: flags |= QTextItemInt::Overline; | 0 | ||||||||||||||||||||||||
| 3403 | if (strikeOut
| 0 | ||||||||||||||||||||||||
| 3404 | flags |= QTextItemInt::StrikeOut; never executed: flags |= QTextItemInt::StrikeOut; | 0 | ||||||||||||||||||||||||
| 3405 | - | |||||||||||||||||||||||||
| 3406 | drawTextItemDecoration(q, QPointF(leftMost.toReal(), baseLine.toReal()), | - | ||||||||||||||||||||||||
| 3407 | fontEngine, | - | ||||||||||||||||||||||||
| 3408 | 0, | - | ||||||||||||||||||||||||
| 3409 | (underline | - | ||||||||||||||||||||||||
| 3410 | ? QTextCharFormat::SingleUnderline | - | ||||||||||||||||||||||||
| 3411 | : QTextCharFormat::NoUnderline), | - | ||||||||||||||||||||||||
| 3412 | flags, width.toReal(), QTextCharFormat()); | - | ||||||||||||||||||||||||
| 3413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3414 | void QPainter::drawText(const QPointF &p, const QString &str) | - | ||||||||||||||||||||||||
| 3415 | { | - | ||||||||||||||||||||||||
| 3416 | drawText(p, str, 0, 0); | - | ||||||||||||||||||||||||
| 3417 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3418 | void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText &staticText) | - | ||||||||||||||||||||||||
| 3419 | { | - | ||||||||||||||||||||||||
| 3420 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3421 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3422 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3423 | - | |||||||||||||||||||||||||
| 3424 | QStaticTextPrivate *staticText_d = | - | ||||||||||||||||||||||||
| 3425 | const_cast<QStaticTextPrivate *>(QStaticTextPrivate::get(&staticText)); | - | ||||||||||||||||||||||||
| 3426 | - | |||||||||||||||||||||||||
| 3427 | if (font() != staticText_d->font
| 0 | ||||||||||||||||||||||||
| 3428 | staticText_d->font = font(); | - | ||||||||||||||||||||||||
| 3429 | staticText_d->needsRelayout = true; | - | ||||||||||||||||||||||||
| 3430 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3431 | - | |||||||||||||||||||||||||
| 3432 | QFontEngine *fe = staticText_d->font.d->engineForScript(QChar::Script_Common); | - | ||||||||||||||||||||||||
| 3433 | if (fe->type() == QFontEngine::Multi
| 0 | ||||||||||||||||||||||||
| 3434 | fe = static_cast<QFontEngineMulti *>(fe)->engine(0); never executed: fe = static_cast<QFontEngineMulti *>(fe)->engine(0); | 0 | ||||||||||||||||||||||||
| 3435 | - | |||||||||||||||||||||||||
| 3436 | - | |||||||||||||||||||||||||
| 3437 | - | |||||||||||||||||||||||||
| 3438 | - | |||||||||||||||||||||||||
| 3439 | if (d->extended == 0
| 0 | ||||||||||||||||||||||||
| 3440 | || !d->state->matrix.isAffine()
| 0 | ||||||||||||||||||||||||
| 3441 | || !fe->supportsTransformation(d->state->matrix)
| 0 | ||||||||||||||||||||||||
| 3442 | staticText_d->paintText(topLeftPosition, this); | - | ||||||||||||||||||||||||
| 3443 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3444 | } | - | ||||||||||||||||||||||||
| 3445 | - | |||||||||||||||||||||||||
| 3446 | bool engineRequiresPretransform = d->extended->requiresPretransformedGlyphPositions(fe, d->state->matrix); | - | ||||||||||||||||||||||||
| 3447 | if (staticText_d->untransformedCoordinates
| 0 | ||||||||||||||||||||||||
| 3448 | - | |||||||||||||||||||||||||
| 3449 | - | |||||||||||||||||||||||||
| 3450 | staticText_d->untransformedCoordinates = false; | - | ||||||||||||||||||||||||
| 3451 | staticText_d->needsRelayout = true; | - | ||||||||||||||||||||||||
| 3452 | } never executed: else if (!staticText_d->untransformedCoordinatesend of block
| 0 | ||||||||||||||||||||||||
| 3453 | - | |||||||||||||||||||||||||
| 3454 | - | |||||||||||||||||||||||||
| 3455 | staticText_d->untransformedCoordinates = true; | - | ||||||||||||||||||||||||
| 3456 | staticText_d->needsRelayout = true; | - | ||||||||||||||||||||||||
| 3457 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3458 | - | |||||||||||||||||||||||||
| 3459 | - | |||||||||||||||||||||||||
| 3460 | - | |||||||||||||||||||||||||
| 3461 | QPointF transformedPosition = topLeftPosition; | - | ||||||||||||||||||||||||
| 3462 | if (!staticText_d->untransformedCoordinates
| 0 | ||||||||||||||||||||||||
| 3463 | transformedPosition = transformedPosition * d->state->matrix; never executed: transformedPosition = transformedPosition * d->state->matrix; | 0 | ||||||||||||||||||||||||
| 3464 | QTransform oldMatrix; | - | ||||||||||||||||||||||||
| 3465 | - | |||||||||||||||||||||||||
| 3466 | - | |||||||||||||||||||||||||
| 3467 | - | |||||||||||||||||||||||||
| 3468 | if (d->state->matrix.isTranslating()
| 0 | ||||||||||||||||||||||||
| 3469 | qreal m11 = d->state->matrix.m11(); | - | ||||||||||||||||||||||||
| 3470 | qreal m12 = d->state->matrix.m12(); | - | ||||||||||||||||||||||||
| 3471 | qreal m13 = d->state->matrix.m13(); | - | ||||||||||||||||||||||||
| 3472 | qreal m21 = d->state->matrix.m21(); | - | ||||||||||||||||||||||||
| 3473 | qreal m22 = d->state->matrix.m22(); | - | ||||||||||||||||||||||||
| 3474 | qreal m23 = d->state->matrix.m23(); | - | ||||||||||||||||||||||||
| 3475 | qreal m33 = d->state->matrix.m33(); | - | ||||||||||||||||||||||||
| 3476 | - | |||||||||||||||||||||||||
| 3477 | oldMatrix = d->state->matrix; | - | ||||||||||||||||||||||||
| 3478 | d->state->matrix.setMatrix(m11, m12, m13, | - | ||||||||||||||||||||||||
| 3479 | m21, m22, m23, | - | ||||||||||||||||||||||||
| 3480 | 0.0, 0.0, m33); | - | ||||||||||||||||||||||||
| 3481 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3482 | - | |||||||||||||||||||||||||
| 3483 | - | |||||||||||||||||||||||||
| 3484 | - | |||||||||||||||||||||||||
| 3485 | bool staticTextNeedsReinit = staticText_d->needsRelayout; | - | ||||||||||||||||||||||||
| 3486 | if (!staticText_d->untransformedCoordinates
| 0 | ||||||||||||||||||||||||
| 3487 | staticText_d->matrix = d->state->matrix; | - | ||||||||||||||||||||||||
| 3488 | staticTextNeedsReinit = true; | - | ||||||||||||||||||||||||
| 3489 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3490 | - | |||||||||||||||||||||||||
| 3491 | - | |||||||||||||||||||||||||
| 3492 | if (staticTextNeedsReinit
| 0 | ||||||||||||||||||||||||
| 3493 | staticText_d->init(); never executed: staticText_d->init(); | 0 | ||||||||||||||||||||||||
| 3494 | - | |||||||||||||||||||||||||
| 3495 | if (transformedPosition != staticText_d->position
| 0 | ||||||||||||||||||||||||
| 3496 | QFixed fx = QFixed::fromReal(transformedPosition.x()); | - | ||||||||||||||||||||||||
| 3497 | QFixed fy = QFixed::fromReal(transformedPosition.y()); | - | ||||||||||||||||||||||||
| 3498 | QFixed oldX = QFixed::fromReal(staticText_d->position.x()); | - | ||||||||||||||||||||||||
| 3499 | QFixed oldY = QFixed::fromReal(staticText_d->position.y()); | - | ||||||||||||||||||||||||
| 3500 | for (int item=0; item<staticText_d->itemCount
| 0 | ||||||||||||||||||||||||
| 3501 | QStaticTextItem *textItem = staticText_d->items + item; | - | ||||||||||||||||||||||||
| 3502 | for (int i=0; i<textItem->numGlyphs
| 0 | ||||||||||||||||||||||||
| 3503 | textItem->glyphPositions[i].x += fx - oldX; | - | ||||||||||||||||||||||||
| 3504 | textItem->glyphPositions[i].y += fy - oldY; | - | ||||||||||||||||||||||||
| 3505 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3506 | textItem->userDataNeedsUpdate = true; | - | ||||||||||||||||||||||||
| 3507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3508 | - | |||||||||||||||||||||||||
| 3509 | staticText_d->position = transformedPosition; | - | ||||||||||||||||||||||||
| 3510 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3511 | - | |||||||||||||||||||||||||
| 3512 | QPen oldPen = d->state->pen; | - | ||||||||||||||||||||||||
| 3513 | QColor currentColor = oldPen.color(); | - | ||||||||||||||||||||||||
| 3514 | for (int i=0; i<staticText_d->itemCount
| 0 | ||||||||||||||||||||||||
| 3515 | QStaticTextItem *item = staticText_d->items + i; | - | ||||||||||||||||||||||||
| 3516 | if (item->color.isValid()
| 0 | ||||||||||||||||||||||||
| 3517 | setPen(item->color); | - | ||||||||||||||||||||||||
| 3518 | currentColor = item->color; | - | ||||||||||||||||||||||||
| 3519 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3520 | d->extended->drawStaticTextItem(item); | - | ||||||||||||||||||||||||
| 3521 | - | |||||||||||||||||||||||||
| 3522 | qt_draw_decoration_for_glyphs(this, item->glyphs, item->glyphPositions, | - | ||||||||||||||||||||||||
| 3523 | item->numGlyphs, item->fontEngine(), staticText_d->font, | - | ||||||||||||||||||||||||
| 3524 | QTextCharFormat()); | - | ||||||||||||||||||||||||
| 3525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3526 | if (currentColor != oldPen.color()
| 0 | ||||||||||||||||||||||||
| 3527 | setPen(oldPen); never executed: setPen(oldPen); | 0 | ||||||||||||||||||||||||
| 3528 | - | |||||||||||||||||||||||||
| 3529 | if (!staticText_d->untransformedCoordinates
| 0 | ||||||||||||||||||||||||
| 3530 | d->state->matrix = oldMatrix; never executed: d->state->matrix = oldMatrix; | 0 | ||||||||||||||||||||||||
| 3531 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3532 | - | |||||||||||||||||||||||||
| 3533 | - | |||||||||||||||||||||||||
| 3534 | - | |||||||||||||||||||||||||
| 3535 | - | |||||||||||||||||||||||||
| 3536 | void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justificationPadding) | - | ||||||||||||||||||||||||
| 3537 | { | - | ||||||||||||||||||||||||
| 3538 | - | |||||||||||||||||||||||||
| 3539 | - | |||||||||||||||||||||||||
| 3540 | - | |||||||||||||||||||||||||
| 3541 | - | |||||||||||||||||||||||||
| 3542 | - | |||||||||||||||||||||||||
| 3543 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3544 | - | |||||||||||||||||||||||||
| 3545 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3546 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3547 | - | |||||||||||||||||||||||||
| 3548 | if (tf & Qt::TextBypassShaping
| 0 | ||||||||||||||||||||||||
| 3549 | - | |||||||||||||||||||||||||
| 3550 | int len = str.length(); | - | ||||||||||||||||||||||||
| 3551 | int numGlyphs = len; | - | ||||||||||||||||||||||||
| 3552 | QVarLengthGlyphLayoutArray glyphs(len); | - | ||||||||||||||||||||||||
| 3553 | QFontEngine *fontEngine = d->state->font.d->engineForScript(QChar::Script_Common); | - | ||||||||||||||||||||||||
| 3554 | if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)
| 0 | ||||||||||||||||||||||||
| 3555 | do { ((!(false)) ? qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached",__FILE__,5856) : qt_noop()); __builtin_unreachable(); } never executed: while (0);end of block | 0 | ||||||||||||||||||||||||
| 3556 | - | |||||||||||||||||||||||||
| 3557 | QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); | - | ||||||||||||||||||||||||
| 3558 | drawTextItem(p, gf); | - | ||||||||||||||||||||||||
| 3559 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3560 | } | - | ||||||||||||||||||||||||
| 3561 | - | |||||||||||||||||||||||||
| 3562 | QStackTextEngine engine(str, d->state->font); | - | ||||||||||||||||||||||||
| 3563 | engine.option.setTextDirection(d->state->layoutDirection); | - | ||||||||||||||||||||||||
| 3564 | if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)
| 0 | ||||||||||||||||||||||||
| 3565 | engine.ignoreBidi = true; | - | ||||||||||||||||||||||||
| 3566 | engine.option.setTextDirection((tf & Qt::TextForceLeftToRight) ? Qt::LeftToRight : Qt::RightToLeft); | - | ||||||||||||||||||||||||
| 3567 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3568 | engine.itemize(); | - | ||||||||||||||||||||||||
| 3569 | QScriptLine line; | - | ||||||||||||||||||||||||
| 3570 | line.length = str.length(); | - | ||||||||||||||||||||||||
| 3571 | engine.shapeLine(line); | - | ||||||||||||||||||||||||
| 3572 | - | |||||||||||||||||||||||||
| 3573 | int nItems = engine.layoutData->items.size(); | - | ||||||||||||||||||||||||
| 3574 | QVarLengthArray<int> visualOrder(nItems); | - | ||||||||||||||||||||||||
| 3575 | QVarLengthArray<uchar> levels(nItems); | - | ||||||||||||||||||||||||
| 3576 | for (int i = 0; i < nItems
| 0 | ||||||||||||||||||||||||
| 3577 | levels[i] = engine.layoutData->items[i].analysis.bidiLevel; never executed: levels[i] = engine.layoutData->items[i].analysis.bidiLevel; | 0 | ||||||||||||||||||||||||
| 3578 | QTextEngine::bidiReorder(nItems, levels.data(), visualOrder.data()); | - | ||||||||||||||||||||||||
| 3579 | - | |||||||||||||||||||||||||
| 3580 | if (justificationPadding > 0
| 0 | ||||||||||||||||||||||||
| 3581 | engine.option.setAlignment(Qt::AlignJustify); | - | ||||||||||||||||||||||||
| 3582 | engine.forceJustification = true; | - | ||||||||||||||||||||||||
| 3583 | - | |||||||||||||||||||||||||
| 3584 | line.width = justificationPadding; | - | ||||||||||||||||||||||||
| 3585 | engine.justify(line); | - | ||||||||||||||||||||||||
| 3586 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3587 | QFixed x = QFixed::fromReal(p.x()); | - | ||||||||||||||||||||||||
| 3588 | - | |||||||||||||||||||||||||
| 3589 | for (int i = 0; i < nItems
| 0 | ||||||||||||||||||||||||
| 3590 | int item = visualOrder[i]; | - | ||||||||||||||||||||||||
| 3591 | const QScriptItem &si = engine.layoutData->items.at(item); | - | ||||||||||||||||||||||||
| 3592 | if (si.analysis.flags >= QScriptAnalysis::TabOrObject
| 0 | ||||||||||||||||||||||||
| 3593 | x += si.width; | - | ||||||||||||||||||||||||
| 3594 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 3595 | } | - | ||||||||||||||||||||||||
| 3596 | QFont f = engine.font(si); | - | ||||||||||||||||||||||||
| 3597 | QTextItemInt gf(si, &f); | - | ||||||||||||||||||||||||
| 3598 | gf.glyphs = engine.shapedGlyphs(&si); | - | ||||||||||||||||||||||||
| 3599 | gf.chars = engine.layoutData->string.unicode() + si.position; | - | ||||||||||||||||||||||||
| 3600 | gf.num_chars = engine.length(item); | - | ||||||||||||||||||||||||
| 3601 | if (engine.forceJustification
| 0 | ||||||||||||||||||||||||
| 3602 | for (int j=0; j<gf.glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||
| 3603 | gf.width += gf.glyphs.effectiveAdvance(j); never executed: gf.width += gf.glyphs.effectiveAdvance(j); | 0 | ||||||||||||||||||||||||
| 3604 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3605 | gf.width = si.width; | - | ||||||||||||||||||||||||
| 3606 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3607 | gf.logClusters = engine.logClusters(&si); | - | ||||||||||||||||||||||||
| 3608 | - | |||||||||||||||||||||||||
| 3609 | drawTextItem(QPointF(x.toReal(), p.y()), gf); | - | ||||||||||||||||||||||||
| 3610 | - | |||||||||||||||||||||||||
| 3611 | x += gf.width; | - | ||||||||||||||||||||||||
| 3612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3613 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3614 | - | |||||||||||||||||||||||||
| 3615 | void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br) | - | ||||||||||||||||||||||||
| 3616 | { | - | ||||||||||||||||||||||||
| 3617 | - | |||||||||||||||||||||||||
| 3618 | - | |||||||||||||||||||||||||
| 3619 | - | |||||||||||||||||||||||||
| 3620 | - | |||||||||||||||||||||||||
| 3621 | - | |||||||||||||||||||||||||
| 3622 | - | |||||||||||||||||||||||||
| 3623 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3624 | - | |||||||||||||||||||||||||
| 3625 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3626 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3627 | - | |||||||||||||||||||||||||
| 3628 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 3629 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 | ||||||||||||||||||||||||
| 3630 | - | |||||||||||||||||||||||||
| 3631 | QRectF bounds; | - | ||||||||||||||||||||||||
| 3632 | qt_format_text(d->state->font, r, flags, 0, str, br ? &bounds : 0, 0, 0, 0, this); | - | ||||||||||||||||||||||||
| 3633 | if (br
| 0 | ||||||||||||||||||||||||
| 3634 | * never executed: br = bounds.toAlignedRect();*br = bounds.toAlignedRect();never executed: *br = bounds.toAlignedRect(); | 0 | ||||||||||||||||||||||||
| 3635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3636 | void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *br) | - | ||||||||||||||||||||||||
| 3637 | { | - | ||||||||||||||||||||||||
| 3638 | - | |||||||||||||||||||||||||
| 3639 | - | |||||||||||||||||||||||||
| 3640 | - | |||||||||||||||||||||||||
| 3641 | - | |||||||||||||||||||||||||
| 3642 | - | |||||||||||||||||||||||||
| 3643 | - | |||||||||||||||||||||||||
| 3644 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3645 | - | |||||||||||||||||||||||||
| 3646 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3647 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3648 | - | |||||||||||||||||||||||||
| 3649 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 3650 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 | ||||||||||||||||||||||||
| 3651 | - | |||||||||||||||||||||||||
| 3652 | qt_format_text(d->state->font, r, flags, 0, str, br, 0, 0, 0, this); | - | ||||||||||||||||||||||||
| 3653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3654 | void QPainter::drawText(const QRectF &r, const QString &text, const QTextOption &o) | - | ||||||||||||||||||||||||
| 3655 | { | - | ||||||||||||||||||||||||
| 3656 | - | |||||||||||||||||||||||||
| 3657 | - | |||||||||||||||||||||||||
| 3658 | - | |||||||||||||||||||||||||
| 3659 | - | |||||||||||||||||||||||||
| 3660 | - | |||||||||||||||||||||||||
| 3661 | - | |||||||||||||||||||||||||
| 3662 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3663 | - | |||||||||||||||||||||||||
| 3664 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 3665 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3666 | - | |||||||||||||||||||||||||
| 3667 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 3668 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 | ||||||||||||||||||||||||
| 3669 | - | |||||||||||||||||||||||||
| 3670 | qt_format_text(d->state->font, r, 0, &o, text, 0, 0, 0, 0, this); | - | ||||||||||||||||||||||||
| 3671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3672 | static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) | - | ||||||||||||||||||||||||
| 3673 | { | - | ||||||||||||||||||||||||
| 3674 | const qreal radiusBase = qMax(qreal(1), maxRadius); | - | ||||||||||||||||||||||||
| 3675 | - | |||||||||||||||||||||||||
| 3676 | QString key = QLatin1String("WaveUnderline-") | - | ||||||||||||||||||||||||
| 3677 | % pen.color().name() | - | ||||||||||||||||||||||||
| 3678 | % HexString<qreal>(radiusBase) | - | ||||||||||||||||||||||||
| 3679 | % HexString<qreal>(pen.widthF()); | - | ||||||||||||||||||||||||
| 3680 | - | |||||||||||||||||||||||||
| 3681 | QPixmap pixmap; | - | ||||||||||||||||||||||||
| 3682 | if (QPixmapCache::find(key, pixmap)
| 0 | ||||||||||||||||||||||||
| 3683 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 3684 | - | |||||||||||||||||||||||||
| 3685 | const qreal halfPeriod = qMax(qreal(2), qreal(radiusBase * 1.61803399)); | - | ||||||||||||||||||||||||
| 3686 | const int width = qCeil(100 / (2 * halfPeriod)) * (2 * halfPeriod); | - | ||||||||||||||||||||||||
| 3687 | const qreal radius = qFloor(radiusBase * 2) / 2.; | - | ||||||||||||||||||||||||
| 3688 | - | |||||||||||||||||||||||||
| 3689 | QPainterPath path; | - | ||||||||||||||||||||||||
| 3690 | - | |||||||||||||||||||||||||
| 3691 | qreal xs = 0; | - | ||||||||||||||||||||||||
| 3692 | qreal ys = radius; | - | ||||||||||||||||||||||||
| 3693 | - | |||||||||||||||||||||||||
| 3694 | while (xs < width
| 0 | ||||||||||||||||||||||||
| 3695 | xs += halfPeriod; | - | ||||||||||||||||||||||||
| 3696 | ys = -ys; | - | ||||||||||||||||||||||||
| 3697 | path.quadTo(xs - halfPeriod / 2, ys, xs, 0); | - | ||||||||||||||||||||||||
| 3698 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3699 | - | |||||||||||||||||||||||||
| 3700 | pixmap = QPixmap(width, radius * 2); | - | ||||||||||||||||||||||||
| 3701 | pixmap.fill(Qt::transparent); | - | ||||||||||||||||||||||||
| 3702 | { | - | ||||||||||||||||||||||||
| 3703 | QPen wavePen = pen; | - | ||||||||||||||||||||||||
| 3704 | wavePen.setCapStyle(Qt::SquareCap); | - | ||||||||||||||||||||||||
| 3705 | - | |||||||||||||||||||||||||
| 3706 | - | |||||||||||||||||||||||||
| 3707 | - | |||||||||||||||||||||||||
| 3708 | const qreal maxPenWidth = .8 * radius; | - | ||||||||||||||||||||||||
| 3709 | if (wavePen.widthF() > maxPenWidth
| 0 | ||||||||||||||||||||||||
| 3710 | wavePen.setWidthF(maxPenWidth); never executed: wavePen.setWidthF(maxPenWidth); | 0 | ||||||||||||||||||||||||
| 3711 | - | |||||||||||||||||||||||||
| 3712 | QPainter imgPainter(&pixmap); | - | ||||||||||||||||||||||||
| 3713 | imgPainter.setPen(wavePen); | - | ||||||||||||||||||||||||
| 3714 | imgPainter.setRenderHint(QPainter::Antialiasing); | - | ||||||||||||||||||||||||
| 3715 | imgPainter.translate(0, radius); | - | ||||||||||||||||||||||||
| 3716 | imgPainter.drawPath(path); | - | ||||||||||||||||||||||||
| 3717 | } | - | ||||||||||||||||||||||||
| 3718 | - | |||||||||||||||||||||||||
| 3719 | QPixmapCache::insert(key, pixmap); | - | ||||||||||||||||||||||||
| 3720 | - | |||||||||||||||||||||||||
| 3721 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 3722 | } | - | ||||||||||||||||||||||||
| 3723 | - | |||||||||||||||||||||||||
| 3724 | static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const QFontEngine *fe, QTextEngine *textEngine, | - | ||||||||||||||||||||||||
| 3725 | QTextCharFormat::UnderlineStyle underlineStyle, | - | ||||||||||||||||||||||||
| 3726 | QTextItem::RenderFlags flags, qreal width, | - | ||||||||||||||||||||||||
| 3727 | const QTextCharFormat &charFormat) | - | ||||||||||||||||||||||||
| 3728 | { | - | ||||||||||||||||||||||||
| 3729 | if (underlineStyle == QTextCharFormat::NoUnderline
| 0 | ||||||||||||||||||||||||
| 3730 | && !(flags & (QTextItem::StrikeOut | QTextItem::Overline))
| 0 | ||||||||||||||||||||||||
| 3731 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3732 | - | |||||||||||||||||||||||||
| 3733 | const QPen oldPen = painter->pen(); | - | ||||||||||||||||||||||||
| 3734 | const QBrush oldBrush = painter->brush(); | - | ||||||||||||||||||||||||
| 3735 | painter->setBrush(Qt::NoBrush); | - | ||||||||||||||||||||||||
| 3736 | QPen pen = oldPen; | - | ||||||||||||||||||||||||
| 3737 | pen.setStyle(Qt::SolidLine); | - | ||||||||||||||||||||||||
| 3738 | pen.setWidthF(fe->lineThickness().toReal()); | - | ||||||||||||||||||||||||
| 3739 | pen.setCapStyle(Qt::FlatCap); | - | ||||||||||||||||||||||||
| 3740 | - | |||||||||||||||||||||||||
| 3741 | QLineF line(qFloor(pos.x()), pos.y(), qFloor(pos.x() + width), pos.y()); | - | ||||||||||||||||||||||||
| 3742 | - | |||||||||||||||||||||||||
| 3743 | bool wasCompatiblePainting = painter->renderHints() | - | ||||||||||||||||||||||||
| 3744 | & QPainter::Qt4CompatiblePainting; | - | ||||||||||||||||||||||||
| 3745 | - | |||||||||||||||||||||||||
| 3746 | if (wasCompatiblePainting
| 0 | ||||||||||||||||||||||||
| 3747 | painter->setRenderHint(QPainter::Qt4CompatiblePainting, false); never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting, false); | 0 | ||||||||||||||||||||||||
| 3748 | - | |||||||||||||||||||||||||
| 3749 | const qreal underlineOffset = fe->underlinePosition().toReal(); | - | ||||||||||||||||||||||||
| 3750 | - | |||||||||||||||||||||||||
| 3751 | if (underlineStyle == QTextCharFormat::SpellCheckUnderline
| 0 | ||||||||||||||||||||||||
| 3752 | QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme(); | - | ||||||||||||||||||||||||
| 3753 | if (theme
| 0 | ||||||||||||||||||||||||
| 3754 | underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt()); never executed: underlineStyle = QTextCharFormat::UnderlineStyle(theme->themeHint(QPlatformTheme::SpellCheckUnderlineStyle).toInt()); | 0 | ||||||||||||||||||||||||
| 3755 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3756 | - | |||||||||||||||||||||||||
| 3757 | if (underlineStyle == QTextCharFormat::WaveUnderline
| 0 | ||||||||||||||||||||||||
| 3758 | painter->save(); | - | ||||||||||||||||||||||||
| 3759 | painter->translate(0, pos.y() + 1); | - | ||||||||||||||||||||||||
| 3760 | qreal maxHeight = fe->descent().toReal() - qreal(1); | - | ||||||||||||||||||||||||
| 3761 | - | |||||||||||||||||||||||||
| 3762 | QColor uc = charFormat.underlineColor(); | - | ||||||||||||||||||||||||
| 3763 | if (uc.isValid()
| 0 | ||||||||||||||||||||||||
| 3764 | pen.setColor(uc); never executed: pen.setColor(uc); | 0 | ||||||||||||||||||||||||
| 3765 | - | |||||||||||||||||||||||||
| 3766 | - | |||||||||||||||||||||||||
| 3767 | const QPixmap wave = generateWavyPixmap(qMin(qMax(underlineOffset, pen.widthF()), maxHeight / qreal(2.)), pen); | - | ||||||||||||||||||||||||
| 3768 | const int descent = qFloor(maxHeight); | - | ||||||||||||||||||||||||
| 3769 | - | |||||||||||||||||||||||||
| 3770 | painter->setBrushOrigin(painter->brushOrigin().x(), 0); | - | ||||||||||||||||||||||||
| 3771 | painter->fillRect(pos.x(), 0, qCeil(width), qMin(wave.height(), descent), wave); | - | ||||||||||||||||||||||||
| 3772 | painter->restore(); | - | ||||||||||||||||||||||||
| 3773 | } never executed: else if (underlineStyle != QTextCharFormat::NoUnderlineend of block
| 0 | ||||||||||||||||||||||||
| 3774 | - | |||||||||||||||||||||||||
| 3775 | - | |||||||||||||||||||||||||
| 3776 | qreal adjustedUnderlineOffset = std::ceil(underlineOffset) + 0.5; | - | ||||||||||||||||||||||||
| 3777 | if (underlineOffset <= fe->descent().toReal()
| 0 | ||||||||||||||||||||||||
| 3778 | adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5)); never executed: adjustedUnderlineOffset = qMin(adjustedUnderlineOffset, fe->descent().toReal() - qreal(0.5)); | 0 | ||||||||||||||||||||||||
| 3779 | const qreal underlinePos = pos.y() + adjustedUnderlineOffset; | - | ||||||||||||||||||||||||
| 3780 | QColor uc = charFormat.underlineColor(); | - | ||||||||||||||||||||||||
| 3781 | if (uc.isValid()
| 0 | ||||||||||||||||||||||||
| 3782 | pen.setColor(uc); never executed: pen.setColor(uc); | 0 | ||||||||||||||||||||||||
| 3783 | - | |||||||||||||||||||||||||
| 3784 | pen.setStyle((Qt::PenStyle)(underlineStyle)); | - | ||||||||||||||||||||||||
| 3785 | painter->setPen(pen); | - | ||||||||||||||||||||||||
| 3786 | QLineF underline(line.x1(), underlinePos, line.x2(), underlinePos); | - | ||||||||||||||||||||||||
| 3787 | if (textEngine
| 0 | ||||||||||||||||||||||||
| 3788 | textEngine->addUnderline(painter, underline); never executed: textEngine->addUnderline(painter, underline); | 0 | ||||||||||||||||||||||||
| 3789 | else | - | ||||||||||||||||||||||||
| 3790 | painter->drawLine(underline); never executed: painter->drawLine(underline); | 0 | ||||||||||||||||||||||||
| 3791 | } | - | ||||||||||||||||||||||||
| 3792 | - | |||||||||||||||||||||||||
| 3793 | pen.setStyle(Qt::SolidLine); | - | ||||||||||||||||||||||||
| 3794 | pen.setColor(oldPen.color()); | - | ||||||||||||||||||||||||
| 3795 | - | |||||||||||||||||||||||||
| 3796 | if (flags & QTextItem::StrikeOut
| 0 | ||||||||||||||||||||||||
| 3797 | QLineF strikeOutLine = line; | - | ||||||||||||||||||||||||
| 3798 | strikeOutLine.translate(0., - fe->ascent().toReal() / 3.); | - | ||||||||||||||||||||||||
| 3799 | painter->setPen(pen); | - | ||||||||||||||||||||||||
| 3800 | if (textEngine
| 0 | ||||||||||||||||||||||||
| 3801 | textEngine->addStrikeOut(painter, strikeOutLine); never executed: textEngine->addStrikeOut(painter, strikeOutLine); | 0 | ||||||||||||||||||||||||
| 3802 | else | - | ||||||||||||||||||||||||
| 3803 | painter->drawLine(strikeOutLine); never executed: painter->drawLine(strikeOutLine); | 0 | ||||||||||||||||||||||||
| 3804 | } | - | ||||||||||||||||||||||||
| 3805 | - | |||||||||||||||||||||||||
| 3806 | if (flags & QTextItem::Overline
| 0 | ||||||||||||||||||||||||
| 3807 | QLineF overline = line; | - | ||||||||||||||||||||||||
| 3808 | overline.translate(0., - fe->ascent().toReal()); | - | ||||||||||||||||||||||||
| 3809 | painter->setPen(pen); | - | ||||||||||||||||||||||||
| 3810 | if (textEngine
| 0 | ||||||||||||||||||||||||
| 3811 | textEngine->addOverline(painter, overline); never executed: textEngine->addOverline(painter, overline); | 0 | ||||||||||||||||||||||||
| 3812 | else | - | ||||||||||||||||||||||||
| 3813 | painter->drawLine(overline); never executed: painter->drawLine(overline); | 0 | ||||||||||||||||||||||||
| 3814 | } | - | ||||||||||||||||||||||||
| 3815 | - | |||||||||||||||||||||||||
| 3816 | painter->setPen(oldPen); | - | ||||||||||||||||||||||||
| 3817 | painter->setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 3818 | - | |||||||||||||||||||||||||
| 3819 | if (wasCompatiblePainting
| 0 | ||||||||||||||||||||||||
| 3820 | painter->setRenderHint(QPainter::Qt4CompatiblePainting); never executed: painter->setRenderHint(QPainter::Qt4CompatiblePainting); | 0 | ||||||||||||||||||||||||
| 3821 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3822 | - | |||||||||||||||||||||||||
| 3823 | __attribute__((visibility("default"))) void qt_draw_decoration_for_glyphs(QPainter *painter, const glyph_t *glyphArray, | - | ||||||||||||||||||||||||
| 3824 | const QFixedPoint *positions, int glyphCount, | - | ||||||||||||||||||||||||
| 3825 | QFontEngine *fontEngine, const QFont &font, | - | ||||||||||||||||||||||||
| 3826 | const QTextCharFormat &charFormat) | - | ||||||||||||||||||||||||
| 3827 | { | - | ||||||||||||||||||||||||
| 3828 | if (!(font.underline()
| 0 | ||||||||||||||||||||||||
| 3829 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3830 | - | |||||||||||||||||||||||||
| 3831 | QFixed leftMost; | - | ||||||||||||||||||||||||
| 3832 | QFixed rightMost; | - | ||||||||||||||||||||||||
| 3833 | QFixed baseLine; | - | ||||||||||||||||||||||||
| 3834 | for (int i=0; i<glyphCount
| 0 | ||||||||||||||||||||||||
| 3835 | glyph_metrics_t gm = fontEngine->boundingBox(glyphArray[i]); | - | ||||||||||||||||||||||||
| 3836 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3837 | leftMost = positions[i].x; never executed: leftMost = positions[i].x; | 0 | ||||||||||||||||||||||||
| 3838 | - | |||||||||||||||||||||||||
| 3839 | - | |||||||||||||||||||||||||
| 3840 | - | |||||||||||||||||||||||||
| 3841 | - | |||||||||||||||||||||||||
| 3842 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3843 | baseLine = positions[i].y; never executed: baseLine = positions[i].y; | 0 | ||||||||||||||||||||||||
| 3844 | - | |||||||||||||||||||||||||
| 3845 | - | |||||||||||||||||||||||||
| 3846 | if (i == 0
| 0 | ||||||||||||||||||||||||
| 3847 | rightMost = positions[i].x + gm.xoff; never executed: rightMost = positions[i].x + gm.xoff; | 0 | ||||||||||||||||||||||||
| 3848 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3849 | - | |||||||||||||||||||||||||
| 3850 | QFixed width = rightMost - leftMost; | - | ||||||||||||||||||||||||
| 3851 | QTextItem::RenderFlags flags = 0; | - | ||||||||||||||||||||||||
| 3852 | - | |||||||||||||||||||||||||
| 3853 | if (font.underline()
| 0 | ||||||||||||||||||||||||
| 3854 | flags |= QTextItem::Underline; never executed: flags |= QTextItem::Underline; | 0 | ||||||||||||||||||||||||
| 3855 | if (font.overline()
| 0 | ||||||||||||||||||||||||
| 3856 | flags |= QTextItem::Overline; never executed: flags |= QTextItem::Overline; | 0 | ||||||||||||||||||||||||
| 3857 | if (font.strikeOut()
| 0 | ||||||||||||||||||||||||
| 3858 | flags |= QTextItem::StrikeOut; never executed: flags |= QTextItem::StrikeOut; | 0 | ||||||||||||||||||||||||
| 3859 | - | |||||||||||||||||||||||||
| 3860 | drawTextItemDecoration(painter, QPointF(leftMost.toReal(), baseLine.toReal()), | - | ||||||||||||||||||||||||
| 3861 | fontEngine, | - | ||||||||||||||||||||||||
| 3862 | 0, | - | ||||||||||||||||||||||||
| 3863 | font.underline() ? QTextCharFormat::SingleUnderline | - | ||||||||||||||||||||||||
| 3864 | : QTextCharFormat::NoUnderline, flags, | - | ||||||||||||||||||||||||
| 3865 | width.toReal(), charFormat); | - | ||||||||||||||||||||||||
| 3866 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3867 | - | |||||||||||||||||||||||||
| 3868 | void QPainter::drawTextItem(const QPointF &p, const QTextItem &ti) | - | ||||||||||||||||||||||||
| 3869 | { | - | ||||||||||||||||||||||||
| 3870 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 3871 | - | |||||||||||||||||||||||||
| 3872 | d->drawTextItem(p, ti, static_cast<QTextEngine *>(0)); | - | ||||||||||||||||||||||||
| 3873 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3874 | - | |||||||||||||||||||||||||
| 3875 | void QPainterPrivate::drawTextItem(const QPointF &p, const QTextItem &_ti, QTextEngine *textEngine) | - | ||||||||||||||||||||||||
| 3876 | { | - | ||||||||||||||||||||||||
| 3877 | - | |||||||||||||||||||||||||
| 3878 | - | |||||||||||||||||||||||||
| 3879 | - | |||||||||||||||||||||||||
| 3880 | - | |||||||||||||||||||||||||
| 3881 | - | |||||||||||||||||||||||||
| 3882 | - | |||||||||||||||||||||||||
| 3883 | QPainter * const q = q_func(); | - | ||||||||||||||||||||||||
| 3884 | - | |||||||||||||||||||||||||
| 3885 | if (!engine
| 0 | ||||||||||||||||||||||||
| 3886 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3887 | - | |||||||||||||||||||||||||
| 3888 | QTextItemInt &ti = const_cast<QTextItemInt &>(static_cast<const QTextItemInt &>(_ti)); | - | ||||||||||||||||||||||||
| 3889 | - | |||||||||||||||||||||||||
| 3890 | if (!extended
| 0 | ||||||||||||||||||||||||
| 3891 | QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent).toReal()); | - | ||||||||||||||||||||||||
| 3892 | q->fillRect(rect, state->bgBrush); | - | ||||||||||||||||||||||||
| 3893 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3894 | - | |||||||||||||||||||||||||
| 3895 | if (q->pen().style() == Qt::NoPen
| 0 | ||||||||||||||||||||||||
| 3896 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3897 | - | |||||||||||||||||||||||||
| 3898 | const QPainter::RenderHints oldRenderHints = state->renderHints; | - | ||||||||||||||||||||||||
| 3899 | if (!(state->renderHints & QPainter::Antialiasing)
| 0 | ||||||||||||||||||||||||
| 3900 | - | |||||||||||||||||||||||||
| 3901 | - | |||||||||||||||||||||||||
| 3902 | - | |||||||||||||||||||||||||
| 3903 | bool aa = true; | - | ||||||||||||||||||||||||
| 3904 | const QTransform &m = state->matrix; | - | ||||||||||||||||||||||||
| 3905 | if (state->matrix.type() < QTransform::TxShear
| 0 | ||||||||||||||||||||||||
| 3906 | bool isPlain90DegreeRotation = | - | ||||||||||||||||||||||||
| 3907 | (qFuzzyIsNull(m.m11())
| 0 | ||||||||||||||||||||||||
| 3908 | && qFuzzyIsNull(m.m12() - qreal(1))
| 0 | ||||||||||||||||||||||||
| 3909 | && qFuzzyIsNull(m.m21() + qreal(1))
| 0 | ||||||||||||||||||||||||
| 3910 | && qFuzzyIsNull(m.m22())
| 0 | ||||||||||||||||||||||||
| 3911 | ) | - | ||||||||||||||||||||||||
| 3912 | || | - | ||||||||||||||||||||||||
| 3913 | (qFuzzyIsNull(m.m11() + qreal(1))
| 0 | ||||||||||||||||||||||||
| 3914 | && qFuzzyIsNull(m.m12())
| 0 | ||||||||||||||||||||||||
| 3915 | && qFuzzyIsNull(m.m21())
| 0 | ||||||||||||||||||||||||
| 3916 | && qFuzzyIsNull(m.m22() + qreal(1))
| 0 | ||||||||||||||||||||||||
| 3917 | ) | - | ||||||||||||||||||||||||
| 3918 | || | - | ||||||||||||||||||||||||
| 3919 | (qFuzzyIsNull(m.m11())
| 0 | ||||||||||||||||||||||||
| 3920 | && qFuzzyIsNull(m.m12() + qreal(1))
| 0 | ||||||||||||||||||||||||
| 3921 | && qFuzzyIsNull(m.m21() - qreal(1))
| 0 | ||||||||||||||||||||||||
| 3922 | && qFuzzyIsNull(m.m22())
| 0 | ||||||||||||||||||||||||
| 3923 | ) | - | ||||||||||||||||||||||||
| 3924 | ; | - | ||||||||||||||||||||||||
| 3925 | aa = !isPlain90DegreeRotation; | - | ||||||||||||||||||||||||
| 3926 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3927 | if (aa
| 0 | ||||||||||||||||||||||||
| 3928 | q->setRenderHint(QPainter::Antialiasing, true); never executed: q->setRenderHint(QPainter::Antialiasing, true); | 0 | ||||||||||||||||||||||||
| 3929 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3930 | - | |||||||||||||||||||||||||
| 3931 | if (!extended
| 0 | ||||||||||||||||||||||||
| 3932 | updateState(state); never executed: updateState(state); | 0 | ||||||||||||||||||||||||
| 3933 | - | |||||||||||||||||||||||||
| 3934 | if (!ti.glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||
| 3935 | - | |||||||||||||||||||||||||
| 3936 | } never executed: else if (ti.fontEngine->type() == QFontEngine::Multiend of block
| 0 | ||||||||||||||||||||||||
| 3937 | QFontEngineMulti *multi = static_cast<QFontEngineMulti *>(ti.fontEngine); | - | ||||||||||||||||||||||||
| 3938 | - | |||||||||||||||||||||||||
| 3939 | const QGlyphLayout &glyphs = ti.glyphs; | - | ||||||||||||||||||||||||
| 3940 | int which = glyphs.glyphs[0] >> 24; | - | ||||||||||||||||||||||||
| 3941 | - | |||||||||||||||||||||||||
| 3942 | qreal x = p.x(); | - | ||||||||||||||||||||||||
| 3943 | qreal y = p.y(); | - | ||||||||||||||||||||||||
| 3944 | - | |||||||||||||||||||||||||
| 3945 | bool rtl = ti.flags & QTextItem::RightToLeft; | - | ||||||||||||||||||||||||
| 3946 | if (rtl
| 0 | ||||||||||||||||||||||||
| 3947 | x += ti.width.toReal(); never executed: x += ti.width.toReal(); | 0 | ||||||||||||||||||||||||
| 3948 | - | |||||||||||||||||||||||||
| 3949 | int start = 0; | - | ||||||||||||||||||||||||
| 3950 | int end, i; | - | ||||||||||||||||||||||||
| 3951 | for (end = 0; end < ti.glyphs.numGlyphs
| 0 | ||||||||||||||||||||||||
| 3952 | const int e = glyphs.glyphs[end] >> 24; | - | ||||||||||||||||||||||||
| 3953 | if (e == which
| 0 | ||||||||||||||||||||||||
| 3954 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 3955 | - | |||||||||||||||||||||||||
| 3956 | - | |||||||||||||||||||||||||
| 3957 | multi->ensureEngineAt(which); | - | ||||||||||||||||||||||||
| 3958 | QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start); | - | ||||||||||||||||||||||||
| 3959 | ti2.width = 0; | - | ||||||||||||||||||||||||
| 3960 | - | |||||||||||||||||||||||||
| 3961 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||
| 3962 | glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff; | - | ||||||||||||||||||||||||
| 3963 | ti2.width += ti.glyphs.effectiveAdvance(i); | - | ||||||||||||||||||||||||
| 3964 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3965 | - | |||||||||||||||||||||||||
| 3966 | if (rtl
| 0 | ||||||||||||||||||||||||
| 3967 | x -= ti2.width.toReal(); never executed: x -= ti2.width.toReal(); | 0 | ||||||||||||||||||||||||
| 3968 | - | |||||||||||||||||||||||||
| 3969 | if (extended
| 0 | ||||||||||||||||||||||||
| 3970 | extended->drawTextItem(QPointF(x, y), ti2); never executed: extended->drawTextItem(QPointF(x, y), ti2); | 0 | ||||||||||||||||||||||||
| 3971 | else | - | ||||||||||||||||||||||||
| 3972 | engine->drawTextItem(QPointF(x, y), ti2); never executed: engine->drawTextItem(QPointF(x, y), ti2); | 0 | ||||||||||||||||||||||||
| 3973 | - | |||||||||||||||||||||||||
| 3974 | if (!rtl
| 0 | ||||||||||||||||||||||||
| 3975 | x += ti2.width.toReal(); never executed: x += ti2.width.toReal(); | 0 | ||||||||||||||||||||||||
| 3976 | - | |||||||||||||||||||||||||
| 3977 | - | |||||||||||||||||||||||||
| 3978 | const int hi = which << 24; | - | ||||||||||||||||||||||||
| 3979 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||
| 3980 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | - | ||||||||||||||||||||||||
| 3981 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3982 | - | |||||||||||||||||||||||||
| 3983 | - | |||||||||||||||||||||||||
| 3984 | start = end; | - | ||||||||||||||||||||||||
| 3985 | which = e; | - | ||||||||||||||||||||||||
| 3986 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3987 | - | |||||||||||||||||||||||||
| 3988 | multi->ensureEngineAt(which); | - | ||||||||||||||||||||||||
| 3989 | QTextItemInt ti2 = ti.midItem(multi->engine(which), start, end - start); | - | ||||||||||||||||||||||||
| 3990 | ti2.width = 0; | - | ||||||||||||||||||||||||
| 3991 | - | |||||||||||||||||||||||||
| 3992 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||
| 3993 | glyphs.glyphs[i] = glyphs.glyphs[i] & 0xffffff; | - | ||||||||||||||||||||||||
| 3994 | ti2.width += ti.glyphs.effectiveAdvance(i); | - | ||||||||||||||||||||||||
| 3995 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3996 | - | |||||||||||||||||||||||||
| 3997 | if (rtl
| 0 | ||||||||||||||||||||||||
| 3998 | x -= ti2.width.toReal(); never executed: x -= ti2.width.toReal(); | 0 | ||||||||||||||||||||||||
| 3999 | - | |||||||||||||||||||||||||
| 4000 | if (extended
| 0 | ||||||||||||||||||||||||
| 4001 | extended->drawTextItem(QPointF(x, y), ti2); never executed: extended->drawTextItem(QPointF(x, y), ti2); | 0 | ||||||||||||||||||||||||
| 4002 | else | - | ||||||||||||||||||||||||
| 4003 | engine->drawTextItem(QPointF(x,y), ti2); never executed: engine->drawTextItem(QPointF(x,y), ti2); | 0 | ||||||||||||||||||||||||
| 4004 | - | |||||||||||||||||||||||||
| 4005 | - | |||||||||||||||||||||||||
| 4006 | const int hi = which << 24; | - | ||||||||||||||||||||||||
| 4007 | for (i = start; i < end
| 0 | ||||||||||||||||||||||||
| 4008 | glyphs.glyphs[i] = hi | glyphs.glyphs[i]; never executed: glyphs.glyphs[i] = hi | glyphs.glyphs[i]; | 0 | ||||||||||||||||||||||||
| 4009 | - | |||||||||||||||||||||||||
| 4010 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4011 | if (extended
| 0 | ||||||||||||||||||||||||
| 4012 | extended->drawTextItem(p, ti); never executed: extended->drawTextItem(p, ti); | 0 | ||||||||||||||||||||||||
| 4013 | else | - | ||||||||||||||||||||||||
| 4014 | engine->drawTextItem(p, ti); never executed: engine->drawTextItem(p, ti); | 0 | ||||||||||||||||||||||||
| 4015 | } | - | ||||||||||||||||||||||||
| 4016 | drawTextItemDecoration(q, p, ti.fontEngine, textEngine, ti.underlineStyle, | - | ||||||||||||||||||||||||
| 4017 | ti.flags, ti.width.toReal(), ti.charFormat); | - | ||||||||||||||||||||||||
| 4018 | - | |||||||||||||||||||||||||
| 4019 | if (state->renderHints != oldRenderHints
| 0 | ||||||||||||||||||||||||
| 4020 | state->renderHints = oldRenderHints; | - | ||||||||||||||||||||||||
| 4021 | if (extended
| 0 | ||||||||||||||||||||||||
| 4022 | extended->renderHintsChanged(); never executed: extended->renderHintsChanged(); | 0 | ||||||||||||||||||||||||
| 4023 | else | - | ||||||||||||||||||||||||
| 4024 | state->dirtyFlags |= QPaintEngine::DirtyHints; never executed: state->dirtyFlags |= QPaintEngine::DirtyHints; | 0 | ||||||||||||||||||||||||
| 4025 | } | - | ||||||||||||||||||||||||
| 4026 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4027 | QRect QPainter::boundingRect(const QRect &rect, int flags, const QString &str) | - | ||||||||||||||||||||||||
| 4028 | { | - | ||||||||||||||||||||||||
| 4029 | if (str.isEmpty()
| 0 | ||||||||||||||||||||||||
| 4030 | return never executed: QRect(rect.x(),rect.y(), 0,0);return QRect(rect.x(),rect.y(), 0,0);never executed: return QRect(rect.x(),rect.y(), 0,0); | 0 | ||||||||||||||||||||||||
| 4031 | QRect brect; | - | ||||||||||||||||||||||||
| 4032 | drawText(rect, flags | Qt::TextDontPrint, str, &brect); | - | ||||||||||||||||||||||||
| 4033 | return never executed: brect;return brect;never executed: return brect; | 0 | ||||||||||||||||||||||||
| 4034 | } | - | ||||||||||||||||||||||||
| 4035 | - | |||||||||||||||||||||||||
| 4036 | - | |||||||||||||||||||||||||
| 4037 | - | |||||||||||||||||||||||||
| 4038 | QRectF QPainter::boundingRect(const QRectF &rect, int flags, const QString &str) | - | ||||||||||||||||||||||||
| 4039 | { | - | ||||||||||||||||||||||||
| 4040 | if (str.isEmpty()
| 0 | ||||||||||||||||||||||||
| 4041 | return never executed: QRectF(rect.x(),rect.y(), 0,0);return QRectF(rect.x(),rect.y(), 0,0);never executed: return QRectF(rect.x(),rect.y(), 0,0); | 0 | ||||||||||||||||||||||||
| 4042 | QRectF brect; | - | ||||||||||||||||||||||||
| 4043 | drawText(rect, flags | Qt::TextDontPrint, str, &brect); | - | ||||||||||||||||||||||||
| 4044 | return never executed: brect;return brect;never executed: return brect; | 0 | ||||||||||||||||||||||||
| 4045 | } | - | ||||||||||||||||||||||||
| 4046 | QRectF QPainter::boundingRect(const QRectF &r, const QString &text, const QTextOption &o) | - | ||||||||||||||||||||||||
| 4047 | { | - | ||||||||||||||||||||||||
| 4048 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4049 | - | |||||||||||||||||||||||||
| 4050 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4051 | return never executed: QRectF(r.x(),r.y(), 0,0);return QRectF(r.x(),r.y(), 0,0);never executed: return QRectF(r.x(),r.y(), 0,0); | 0 | ||||||||||||||||||||||||
| 4052 | - | |||||||||||||||||||||||||
| 4053 | QRectF br; | - | ||||||||||||||||||||||||
| 4054 | qt_format_text(d->state->font, r, Qt::TextDontPrint, &o, text, &br, 0, 0, 0, this); | - | ||||||||||||||||||||||||
| 4055 | return never executed: br;return br;never executed: return br; | 0 | ||||||||||||||||||||||||
| 4056 | } | - | ||||||||||||||||||||||||
| 4057 | void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &sp) | - | ||||||||||||||||||||||||
| 4058 | { | - | ||||||||||||||||||||||||
| 4059 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4060 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4061 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4062 | - | |||||||||||||||||||||||||
| 4063 | - | |||||||||||||||||||||||||
| 4064 | qt_painter_thread_test(d->device->devType(), d->engine->type(), "drawTiledPixmap()"); | - | ||||||||||||||||||||||||
| 4065 | - | |||||||||||||||||||||||||
| 4066 | - | |||||||||||||||||||||||||
| 4067 | qreal sw = pixmap.width(); | - | ||||||||||||||||||||||||
| 4068 | qreal sh = pixmap.height(); | - | ||||||||||||||||||||||||
| 4069 | qreal sx = sp.x(); | - | ||||||||||||||||||||||||
| 4070 | qreal sy = sp.y(); | - | ||||||||||||||||||||||||
| 4071 | if (sx < 0
| 0 | ||||||||||||||||||||||||
| 4072 | sx = qRound(sw) - qRound(-sx) % qRound(sw); never executed: sx = qRound(sw) - qRound(-sx) % qRound(sw); | 0 | ||||||||||||||||||||||||
| 4073 | else | - | ||||||||||||||||||||||||
| 4074 | sx = qRound(sx) % qRound(sw); never executed: sx = qRound(sx) % qRound(sw); | 0 | ||||||||||||||||||||||||
| 4075 | if (sy < 0
| 0 | ||||||||||||||||||||||||
| 4076 | sy = qRound(sh) - -qRound(sy) % qRound(sh); never executed: sy = qRound(sh) - -qRound(sy) % qRound(sh); | 0 | ||||||||||||||||||||||||
| 4077 | else | - | ||||||||||||||||||||||||
| 4078 | sy = qRound(sy) % qRound(sh); never executed: sy = qRound(sy) % qRound(sh); | 0 | ||||||||||||||||||||||||
| 4079 | - | |||||||||||||||||||||||||
| 4080 | - | |||||||||||||||||||||||||
| 4081 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4082 | d->extended->drawTiledPixmap(r, pixmap, QPointF(sx, sy)); | - | ||||||||||||||||||||||||
| 4083 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4084 | } | - | ||||||||||||||||||||||||
| 4085 | - | |||||||||||||||||||||||||
| 4086 | if (d->state->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 4087 | fillRect(r, d->state->bgBrush); never executed: fillRect(r, d->state->bgBrush); | 0 | ||||||||||||||||||||||||
| 4088 | - | |||||||||||||||||||||||||
| 4089 | d->updateState(d->state); | - | ||||||||||||||||||||||||
| 4090 | if ((d->state->matrix.type() > QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 4091 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 4092 | || (d->state->opacity != 1.0
| 0 | ||||||||||||||||||||||||
| 4093 | { | - | ||||||||||||||||||||||||
| 4094 | save(); | - | ||||||||||||||||||||||||
| 4095 | setBackgroundMode(Qt::TransparentMode); | - | ||||||||||||||||||||||||
| 4096 | setRenderHint(Antialiasing, renderHints() & SmoothPixmapTransform); | - | ||||||||||||||||||||||||
| 4097 | setBrush(QBrush(d->state->pen.color(), pixmap)); | - | ||||||||||||||||||||||||
| 4098 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 4099 | - | |||||||||||||||||||||||||
| 4100 | - | |||||||||||||||||||||||||
| 4101 | - | |||||||||||||||||||||||||
| 4102 | if (d->state->matrix.type() <= QTransform::TxScale
| 0 | ||||||||||||||||||||||||
| 4103 | const QPointF p = roundInDeviceCoordinates(r.topLeft(), d->state->matrix); | - | ||||||||||||||||||||||||
| 4104 | - | |||||||||||||||||||||||||
| 4105 | if (d->state->matrix.type() <= QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 4106 | sx = qRound(sx); | - | ||||||||||||||||||||||||
| 4107 | sy = qRound(sy); | - | ||||||||||||||||||||||||
| 4108 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4109 | - | |||||||||||||||||||||||||
| 4110 | setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); | - | ||||||||||||||||||||||||
| 4111 | drawRect(QRectF(p, r.size())); | - | ||||||||||||||||||||||||
| 4112 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4113 | setBrushOrigin(QPointF(r.x()-sx, r.y()-sy)); | - | ||||||||||||||||||||||||
| 4114 | drawRect(r); | - | ||||||||||||||||||||||||
| 4115 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4116 | restore(); | - | ||||||||||||||||||||||||
| 4117 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4118 | } | - | ||||||||||||||||||||||||
| 4119 | - | |||||||||||||||||||||||||
| 4120 | qreal x = r.x(); | - | ||||||||||||||||||||||||
| 4121 | qreal y = r.y(); | - | ||||||||||||||||||||||||
| 4122 | if (d->state->matrix.type() == QTransform::TxTranslate
| 0 | ||||||||||||||||||||||||
| 4123 | && !d->engine->hasFeature(QPaintEngine::PixmapTransform)
| 0 | ||||||||||||||||||||||||
| 4124 | x += d->state->matrix.dx(); | - | ||||||||||||||||||||||||
| 4125 | y += d->state->matrix.dy(); | - | ||||||||||||||||||||||||
| 4126 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4127 | - | |||||||||||||||||||||||||
| 4128 | d->engine->drawTiledPixmap(QRectF(x, y, r.width(), r.height()), pixmap, QPointF(sx, sy)); | - | ||||||||||||||||||||||||
| 4129 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4130 | void QPainter::drawPicture(const QPointF &p, const QPicture &picture) | - | ||||||||||||||||||||||||
| 4131 | { | - | ||||||||||||||||||||||||
| 4132 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4133 | - | |||||||||||||||||||||||||
| 4134 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4135 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4136 | - | |||||||||||||||||||||||||
| 4137 | if (!d->extended
| 0 | ||||||||||||||||||||||||
| 4138 | d->updateState(d->state); never executed: d->updateState(d->state); | 0 | ||||||||||||||||||||||||
| 4139 | - | |||||||||||||||||||||||||
| 4140 | save(); | - | ||||||||||||||||||||||||
| 4141 | translate(p); | - | ||||||||||||||||||||||||
| 4142 | const_cast<QPicture *>(&picture)->play(this); | - | ||||||||||||||||||||||||
| 4143 | restore(); | - | ||||||||||||||||||||||||
| 4144 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4145 | void QPainter::eraseRect(const QRectF &r) | - | ||||||||||||||||||||||||
| 4146 | { | - | ||||||||||||||||||||||||
| 4147 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4148 | - | |||||||||||||||||||||||||
| 4149 | fillRect(r, d->state->bgBrush); | - | ||||||||||||||||||||||||
| 4150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4151 | - | |||||||||||||||||||||||||
| 4152 | static inline bool needsResolving(const QBrush &brush) | - | ||||||||||||||||||||||||
| 4153 | { | - | ||||||||||||||||||||||||
| 4154 | Qt::BrushStyle s = brush.style(); | - | ||||||||||||||||||||||||
| 4155 | return never executed: ((s == Qt::LinearGradientPatternreturn ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || s == Qt::ConicalGradientPattern) && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode);
never executed: return ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || s == Qt::ConicalGradientPattern) && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode); | 0 | ||||||||||||||||||||||||
| 4156 | s == Qt::ConicalGradientPattern
never executed: return ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || s == Qt::ConicalGradientPattern) && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode); | 0 | ||||||||||||||||||||||||
| 4157 | brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode
never executed: return ((s == Qt::LinearGradientPattern || s == Qt::RadialGradientPattern || s == Qt::ConicalGradientPattern) && brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode); | 0 | ||||||||||||||||||||||||
| 4158 | } | - | ||||||||||||||||||||||||
| 4159 | void QPainter::fillRect(const QRectF &r, const QBrush &brush) | - | ||||||||||||||||||||||||
| 4160 | { | - | ||||||||||||||||||||||||
| 4161 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4162 | - | |||||||||||||||||||||||||
| 4163 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4164 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4165 | - | |||||||||||||||||||||||||
| 4166 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4167 | const QGradient *g = brush.gradient(); | - | ||||||||||||||||||||||||
| 4168 | if (!g
| 0 | ||||||||||||||||||||||||
| 4169 | d->extended->fillRect(r, brush); | - | ||||||||||||||||||||||||
| 4170 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4171 | } | - | ||||||||||||||||||||||||
| 4172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4173 | - | |||||||||||||||||||||||||
| 4174 | QPen oldPen = pen(); | - | ||||||||||||||||||||||||
| 4175 | QBrush oldBrush = this->brush(); | - | ||||||||||||||||||||||||
| 4176 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 4177 | if (brush.style() == Qt::SolidPattern
| 0 | ||||||||||||||||||||||||
| 4178 | d->colorBrush.setStyle(Qt::SolidPattern); | - | ||||||||||||||||||||||||
| 4179 | d->colorBrush.setColor(brush.color()); | - | ||||||||||||||||||||||||
| 4180 | setBrush(d->colorBrush); | - | ||||||||||||||||||||||||
| 4181 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4182 | setBrush(brush); | - | ||||||||||||||||||||||||
| 4183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4184 | - | |||||||||||||||||||||||||
| 4185 | drawRect(r); | - | ||||||||||||||||||||||||
| 4186 | setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 4187 | setPen(oldPen); | - | ||||||||||||||||||||||||
| 4188 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4189 | void QPainter::fillRect(const QRect &r, const QBrush &brush) | - | ||||||||||||||||||||||||
| 4190 | { | - | ||||||||||||||||||||||||
| 4191 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4192 | - | |||||||||||||||||||||||||
| 4193 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4194 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4195 | - | |||||||||||||||||||||||||
| 4196 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4197 | const QGradient *g = brush.gradient(); | - | ||||||||||||||||||||||||
| 4198 | if (!g
| 0 | ||||||||||||||||||||||||
| 4199 | d->extended->fillRect(r, brush); | - | ||||||||||||||||||||||||
| 4200 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4201 | } | - | ||||||||||||||||||||||||
| 4202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4203 | - | |||||||||||||||||||||||||
| 4204 | QPen oldPen = pen(); | - | ||||||||||||||||||||||||
| 4205 | QBrush oldBrush = this->brush(); | - | ||||||||||||||||||||||||
| 4206 | setPen(Qt::NoPen); | - | ||||||||||||||||||||||||
| 4207 | if (brush.style() == Qt::SolidPattern
| 0 | ||||||||||||||||||||||||
| 4208 | d->colorBrush.setStyle(Qt::SolidPattern); | - | ||||||||||||||||||||||||
| 4209 | d->colorBrush.setColor(brush.color()); | - | ||||||||||||||||||||||||
| 4210 | setBrush(d->colorBrush); | - | ||||||||||||||||||||||||
| 4211 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4212 | setBrush(brush); | - | ||||||||||||||||||||||||
| 4213 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4214 | - | |||||||||||||||||||||||||
| 4215 | drawRect(r); | - | ||||||||||||||||||||||||
| 4216 | setBrush(oldBrush); | - | ||||||||||||||||||||||||
| 4217 | setPen(oldPen); | - | ||||||||||||||||||||||||
| 4218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4219 | void QPainter::fillRect(const QRect &r, const QColor &color) | - | ||||||||||||||||||||||||
| 4220 | { | - | ||||||||||||||||||||||||
| 4221 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4222 | - | |||||||||||||||||||||||||
| 4223 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4224 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4225 | - | |||||||||||||||||||||||||
| 4226 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4227 | d->extended->fillRect(r, color); | - | ||||||||||||||||||||||||
| 4228 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4229 | } | - | ||||||||||||||||||||||||
| 4230 | - | |||||||||||||||||||||||||
| 4231 | fillRect(r, QBrush(color)); | - | ||||||||||||||||||||||||
| 4232 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4233 | void QPainter::fillRect(const QRectF &r, const QColor &color) | - | ||||||||||||||||||||||||
| 4234 | { | - | ||||||||||||||||||||||||
| 4235 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4236 | - | |||||||||||||||||||||||||
| 4237 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4238 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4239 | - | |||||||||||||||||||||||||
| 4240 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4241 | d->extended->fillRect(r, color); | - | ||||||||||||||||||||||||
| 4242 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4243 | } | - | ||||||||||||||||||||||||
| 4244 | - | |||||||||||||||||||||||||
| 4245 | fillRect(r, QBrush(color)); | - | ||||||||||||||||||||||||
| 4246 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4247 | void QPainter::setRenderHint(RenderHint hint, bool on) | - | ||||||||||||||||||||||||
| 4248 | { | - | ||||||||||||||||||||||||
| 4249 | - | |||||||||||||||||||||||||
| 4250 | - | |||||||||||||||||||||||||
| 4251 | - | |||||||||||||||||||||||||
| 4252 | - | |||||||||||||||||||||||||
| 4253 | - | |||||||||||||||||||||||||
| 4254 | - | |||||||||||||||||||||||||
| 4255 | static const bool antialiasingDisabled = qEnvironmentVariableIntValue("QT_NO_ANTIALIASING"); | - | ||||||||||||||||||||||||
| 4256 | if (hint == QPainter::Antialiasing
| 0 | ||||||||||||||||||||||||
| 4257 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4258 | - | |||||||||||||||||||||||||
| 4259 | - | |||||||||||||||||||||||||
| 4260 | setRenderHints(hint, on); | - | ||||||||||||||||||||||||
| 4261 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4262 | void QPainter::setRenderHints(RenderHints hints, bool on) | - | ||||||||||||||||||||||||
| 4263 | { | - | ||||||||||||||||||||||||
| 4264 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4265 | - | |||||||||||||||||||||||||
| 4266 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4267 | QMessageLogger(__FILE__, 7090, __PRETTY_FUNCTION__).warning("QPainter::setRenderHint: Painter must be active to set rendering hints"); | - | ||||||||||||||||||||||||
| 4268 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4269 | } | - | ||||||||||||||||||||||||
| 4270 | - | |||||||||||||||||||||||||
| 4271 | if (on
| 0 | ||||||||||||||||||||||||
| 4272 | d->state->renderHints |= hints; never executed: d->state->renderHints |= hints; | 0 | ||||||||||||||||||||||||
| 4273 | else | - | ||||||||||||||||||||||||
| 4274 | d->state->renderHints &= ~hints; never executed: d->state->renderHints &= ~hints; | 0 | ||||||||||||||||||||||||
| 4275 | - | |||||||||||||||||||||||||
| 4276 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4277 | d->extended->renderHintsChanged(); never executed: d->extended->renderHintsChanged(); | 0 | ||||||||||||||||||||||||
| 4278 | else | - | ||||||||||||||||||||||||
| 4279 | d->state->dirtyFlags |= QPaintEngine::DirtyHints; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyHints; | 0 | ||||||||||||||||||||||||
| 4280 | } | - | ||||||||||||||||||||||||
| 4281 | - | |||||||||||||||||||||||||
| 4282 | - | |||||||||||||||||||||||||
| 4283 | - | |||||||||||||||||||||||||
| 4284 | - | |||||||||||||||||||||||||
| 4285 | - | |||||||||||||||||||||||||
| 4286 | - | |||||||||||||||||||||||||
| 4287 | - | |||||||||||||||||||||||||
| 4288 | QPainter::RenderHints QPainter::renderHints() const | - | ||||||||||||||||||||||||
| 4289 | { | - | ||||||||||||||||||||||||
| 4290 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4291 | - | |||||||||||||||||||||||||
| 4292 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4293 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 4294 | - | |||||||||||||||||||||||||
| 4295 | return never executed: d->state->renderHints;return d->state->renderHints;never executed: return d->state->renderHints; | 0 | ||||||||||||||||||||||||
| 4296 | } | - | ||||||||||||||||||||||||
| 4297 | bool QPainter::viewTransformEnabled() const | - | ||||||||||||||||||||||||
| 4298 | { | - | ||||||||||||||||||||||||
| 4299 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4300 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4301 | QMessageLogger(__FILE__, 7141, __PRETTY_FUNCTION__).warning("QPainter::viewTransformEnabled: Painter not active"); | - | ||||||||||||||||||||||||
| 4302 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 4303 | } | - | ||||||||||||||||||||||||
| 4304 | return never executed: d->state->VxF;return d->state->VxF;never executed: return d->state->VxF; | 0 | ||||||||||||||||||||||||
| 4305 | } | - | ||||||||||||||||||||||||
| 4306 | void QPainter::setWindow(const QRect &r) | - | ||||||||||||||||||||||||
| 4307 | { | - | ||||||||||||||||||||||||
| 4308 | - | |||||||||||||||||||||||||
| 4309 | - | |||||||||||||||||||||||||
| 4310 | - | |||||||||||||||||||||||||
| 4311 | - | |||||||||||||||||||||||||
| 4312 | - | |||||||||||||||||||||||||
| 4313 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4314 | - | |||||||||||||||||||||||||
| 4315 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4316 | QMessageLogger(__FILE__, 7182, __PRETTY_FUNCTION__).warning("QPainter::setWindow: Painter not active"); | - | ||||||||||||||||||||||||
| 4317 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4318 | } | - | ||||||||||||||||||||||||
| 4319 | - | |||||||||||||||||||||||||
| 4320 | d->state->wx = r.x(); | - | ||||||||||||||||||||||||
| 4321 | d->state->wy = r.y(); | - | ||||||||||||||||||||||||
| 4322 | d->state->ww = r.width(); | - | ||||||||||||||||||||||||
| 4323 | d->state->wh = r.height(); | - | ||||||||||||||||||||||||
| 4324 | - | |||||||||||||||||||||||||
| 4325 | d->state->VxF = true; | - | ||||||||||||||||||||||||
| 4326 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 4327 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4328 | - | |||||||||||||||||||||||||
| 4329 | - | |||||||||||||||||||||||||
| 4330 | - | |||||||||||||||||||||||||
| 4331 | - | |||||||||||||||||||||||||
| 4332 | - | |||||||||||||||||||||||||
| 4333 | - | |||||||||||||||||||||||||
| 4334 | - | |||||||||||||||||||||||||
| 4335 | QRect QPainter::window() const | - | ||||||||||||||||||||||||
| 4336 | { | - | ||||||||||||||||||||||||
| 4337 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4338 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4339 | QMessageLogger(__FILE__, 7205, __PRETTY_FUNCTION__).warning("QPainter::window: Painter not active"); | - | ||||||||||||||||||||||||
| 4340 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||||||||
| 4341 | } | - | ||||||||||||||||||||||||
| 4342 | return never executed: QRect(d->state->wx, d->state->wy, d->state->ww, d->state->wh);return QRect(d->state->wx, d->state->wy, d->state->ww, d->state->wh);never executed: return QRect(d->state->wx, d->state->wy, d->state->ww, d->state->wh); | 0 | ||||||||||||||||||||||||
| 4343 | } | - | ||||||||||||||||||||||||
| 4344 | void QPainter::setViewport(const QRect &r) | - | ||||||||||||||||||||||||
| 4345 | { | - | ||||||||||||||||||||||||
| 4346 | - | |||||||||||||||||||||||||
| 4347 | - | |||||||||||||||||||||||||
| 4348 | - | |||||||||||||||||||||||||
| 4349 | - | |||||||||||||||||||||||||
| 4350 | - | |||||||||||||||||||||||||
| 4351 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4352 | - | |||||||||||||||||||||||||
| 4353 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4354 | QMessageLogger(__FILE__, 7246, __PRETTY_FUNCTION__).warning("QPainter::setViewport: Painter not active"); | - | ||||||||||||||||||||||||
| 4355 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4356 | } | - | ||||||||||||||||||||||||
| 4357 | - | |||||||||||||||||||||||||
| 4358 | d->state->vx = r.x(); | - | ||||||||||||||||||||||||
| 4359 | d->state->vy = r.y(); | - | ||||||||||||||||||||||||
| 4360 | d->state->vw = r.width(); | - | ||||||||||||||||||||||||
| 4361 | d->state->vh = r.height(); | - | ||||||||||||||||||||||||
| 4362 | - | |||||||||||||||||||||||||
| 4363 | d->state->VxF = true; | - | ||||||||||||||||||||||||
| 4364 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 4365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4366 | - | |||||||||||||||||||||||||
| 4367 | - | |||||||||||||||||||||||||
| 4368 | - | |||||||||||||||||||||||||
| 4369 | - | |||||||||||||||||||||||||
| 4370 | - | |||||||||||||||||||||||||
| 4371 | - | |||||||||||||||||||||||||
| 4372 | - | |||||||||||||||||||||||||
| 4373 | QRect QPainter::viewport() const | - | ||||||||||||||||||||||||
| 4374 | { | - | ||||||||||||||||||||||||
| 4375 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4376 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4377 | QMessageLogger(__FILE__, 7269, __PRETTY_FUNCTION__).warning("QPainter::viewport: Painter not active"); | - | ||||||||||||||||||||||||
| 4378 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||||||||
| 4379 | } | - | ||||||||||||||||||||||||
| 4380 | return never executed: QRect(d->state->vx, d->state->vy, d->state->vw, d->state->vh);return QRect(d->state->vx, d->state->vy, d->state->vw, d->state->vh);never executed: return QRect(d->state->vx, d->state->vy, d->state->vw, d->state->vh); | 0 | ||||||||||||||||||||||||
| 4381 | } | - | ||||||||||||||||||||||||
| 4382 | void QPainter::setViewTransformEnabled(bool enable) | - | ||||||||||||||||||||||||
| 4383 | { | - | ||||||||||||||||||||||||
| 4384 | - | |||||||||||||||||||||||||
| 4385 | - | |||||||||||||||||||||||||
| 4386 | - | |||||||||||||||||||||||||
| 4387 | - | |||||||||||||||||||||||||
| 4388 | - | |||||||||||||||||||||||||
| 4389 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4390 | - | |||||||||||||||||||||||||
| 4391 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4392 | QMessageLogger(__FILE__, 7293, __PRETTY_FUNCTION__).warning("QPainter::setViewTransformEnabled: Painter not active"); | - | ||||||||||||||||||||||||
| 4393 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4394 | } | - | ||||||||||||||||||||||||
| 4395 | - | |||||||||||||||||||||||||
| 4396 | if (enable == d->state->VxF
| 0 | ||||||||||||||||||||||||
| 4397 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4398 | - | |||||||||||||||||||||||||
| 4399 | d->state->VxF = enable; | - | ||||||||||||||||||||||||
| 4400 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 4401 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4402 | void QPainter::setRedirected(const QPaintDevice *device, | - | ||||||||||||||||||||||||
| 4403 | QPaintDevice *replacement, | - | ||||||||||||||||||||||||
| 4404 | const QPoint &offset) | - | ||||||||||||||||||||||||
| 4405 | { | - | ||||||||||||||||||||||||
| 4406 | ((!(device != 0)) ? qt_assert("device != 0",__FILE__,7331) : qt_noop()); | - | ||||||||||||||||||||||||
| 4407 | (void)device; | - | ||||||||||||||||||||||||
| 4408 | (void)replacement; | - | ||||||||||||||||||||||||
| 4409 | (void)offset; | - | ||||||||||||||||||||||||
| 4410 | QMessageLogger(__FILE__, 7335, __PRETTY_FUNCTION__).warning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); | - | ||||||||||||||||||||||||
| 4411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4412 | void QPainter::restoreRedirected(const QPaintDevice *device) | - | ||||||||||||||||||||||||
| 4413 | { | - | ||||||||||||||||||||||||
| 4414 | (void)device; | - | ||||||||||||||||||||||||
| 4415 | QMessageLogger(__FILE__, 7358, __PRETTY_FUNCTION__).warning("QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead"); | - | ||||||||||||||||||||||||
| 4416 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4417 | QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset) | - | ||||||||||||||||||||||||
| 4418 | { | - | ||||||||||||||||||||||||
| 4419 | (void)device; | - | ||||||||||||||||||||||||
| 4420 | (void)offset; | - | ||||||||||||||||||||||||
| 4421 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 4422 | } | - | ||||||||||||||||||||||||
| 4423 | - | |||||||||||||||||||||||||
| 4424 | void qt_format_text(const QFont &fnt, const QRectF &_r, | - | ||||||||||||||||||||||||
| 4425 | int tf, const QString& str, QRectF *brect, | - | ||||||||||||||||||||||||
| 4426 | int tabstops, int *ta, int tabarraylen, | - | ||||||||||||||||||||||||
| 4427 | QPainter *painter) | - | ||||||||||||||||||||||||
| 4428 | { | - | ||||||||||||||||||||||||
| 4429 | qt_format_text(fnt, _r, | - | ||||||||||||||||||||||||
| 4430 | tf, 0, str, brect, | - | ||||||||||||||||||||||||
| 4431 | tabstops, ta, tabarraylen, | - | ||||||||||||||||||||||||
| 4432 | painter); | - | ||||||||||||||||||||||||
| 4433 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4434 | void qt_format_text(const QFont &fnt, const QRectF &_r, | - | ||||||||||||||||||||||||
| 4435 | int tf, const QTextOption *option, const QString& str, QRectF *brect, | - | ||||||||||||||||||||||||
| 4436 | int tabstops, int *ta, int tabarraylen, | - | ||||||||||||||||||||||||
| 4437 | QPainter *painter) | - | ||||||||||||||||||||||||
| 4438 | { | - | ||||||||||||||||||||||||
| 4439 | - | |||||||||||||||||||||||||
| 4440 | ((!(!((tf & ~Qt::TextDontPrint)!=0 && option!=0))) ? qt_assert("!((tf & ~Qt::TextDontPrint)!=0 && option!=0)",__FILE__,7401) : qt_noop()); | - | ||||||||||||||||||||||||
| 4441 | - | |||||||||||||||||||||||||
| 4442 | if (option
| 0 | ||||||||||||||||||||||||
| 4443 | tf |= option->alignment(); | - | ||||||||||||||||||||||||
| 4444 | if (option->wrapMode() != QTextOption::NoWrap
| 0 | ||||||||||||||||||||||||
| 4445 | tf |= Qt::TextWordWrap; never executed: tf |= Qt::TextWordWrap; | 0 | ||||||||||||||||||||||||
| 4446 | - | |||||||||||||||||||||||||
| 4447 | if (option->flags() & QTextOption::IncludeTrailingSpaces
| 0 | ||||||||||||||||||||||||
| 4448 | tf |= Qt::TextIncludeTrailingSpaces; never executed: tf |= Qt::TextIncludeTrailingSpaces; | 0 | ||||||||||||||||||||||||
| 4449 | - | |||||||||||||||||||||||||
| 4450 | if (option->tabStop() >= 0
| 0 | ||||||||||||||||||||||||
| 4451 | tf |= Qt::TextExpandTabs; never executed: tf |= Qt::TextExpandTabs; | 0 | ||||||||||||||||||||||||
| 4452 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4453 | - | |||||||||||||||||||||||||
| 4454 | - | |||||||||||||||||||||||||
| 4455 | QRectF r(_r); | - | ||||||||||||||||||||||||
| 4456 | - | |||||||||||||||||||||||||
| 4457 | bool dontclip = (tf & Qt::TextDontClip); | - | ||||||||||||||||||||||||
| 4458 | bool wordwrap = (
| 0 | ||||||||||||||||||||||||
| 4459 | bool singleline = (tf & Qt::TextSingleLine); | - | ||||||||||||||||||||||||
| 4460 | bool showmnemonic = (tf & Qt::TextShowMnemonic); | - | ||||||||||||||||||||||||
| 4461 | bool hidemnmemonic = (tf & Qt::TextHideMnemonic); | - | ||||||||||||||||||||||||
| 4462 | - | |||||||||||||||||||||||||
| 4463 | Qt::LayoutDirection layout_direction; | - | ||||||||||||||||||||||||
| 4464 | if (tf & Qt::TextForceLeftToRight
| 0 | ||||||||||||||||||||||||
| 4465 | layout_direction = Qt::LeftToRight; never executed: layout_direction = Qt::LeftToRight; | 0 | ||||||||||||||||||||||||
| 4466 | else if (tf & Qt::TextForceRightToLeft
| 0 | ||||||||||||||||||||||||
| 4467 | layout_direction = Qt::RightToLeft; never executed: layout_direction = Qt::RightToLeft; | 0 | ||||||||||||||||||||||||
| 4468 | else if (option
| 0 | ||||||||||||||||||||||||
| 4469 | layout_direction = option->textDirection(); never executed: layout_direction = option->textDirection(); | 0 | ||||||||||||||||||||||||
| 4470 | else if (painter
| 0 | ||||||||||||||||||||||||
| 4471 | layout_direction = painter->layoutDirection(); never executed: layout_direction = painter->layoutDirection(); | 0 | ||||||||||||||||||||||||
| 4472 | else | - | ||||||||||||||||||||||||
| 4473 | layout_direction = Qt::LeftToRight; never executed: layout_direction = Qt::LeftToRight; | 0 | ||||||||||||||||||||||||
| 4474 | - | |||||||||||||||||||||||||
| 4475 | tf = QGuiApplicationPrivate::visualAlignment(layout_direction, QFlag(tf)); | - | ||||||||||||||||||||||||
| 4476 | - | |||||||||||||||||||||||||
| 4477 | bool isRightToLeft = layout_direction == Qt::RightToLeft; | - | ||||||||||||||||||||||||
| 4478 | bool expandtabs = ((
| 0 | ||||||||||||||||||||||||
| 4479 | (((
| 0 | ||||||||||||||||||||||||
| 4480 | ((
| 0 | ||||||||||||||||||||||||
| 4481 | - | |||||||||||||||||||||||||
| 4482 | if (!painter
| 0 | ||||||||||||||||||||||||
| 4483 | tf |= Qt::TextDontPrint; never executed: tf |= Qt::TextDontPrint; | 0 | ||||||||||||||||||||||||
| 4484 | - | |||||||||||||||||||||||||
| 4485 | uint maxUnderlines = 0; | - | ||||||||||||||||||||||||
| 4486 | - | |||||||||||||||||||||||||
| 4487 | QFontMetricsF fm(fnt); | - | ||||||||||||||||||||||||
| 4488 | QString text = str; | - | ||||||||||||||||||||||||
| 4489 | int offset = 0; | - | ||||||||||||||||||||||||
| 4490 | start_lengthVariant: code before this statement never executed: start_lengthVariant: | 0 | ||||||||||||||||||||||||
| 4491 | bool hasMoreLengthVariants = false; | - | ||||||||||||||||||||||||
| 4492 | - | |||||||||||||||||||||||||
| 4493 | - | |||||||||||||||||||||||||
| 4494 | int old_offset = offset; | - | ||||||||||||||||||||||||
| 4495 | for (; offset < text.length()
| 0 | ||||||||||||||||||||||||
| 4496 | QChar chr = text.at(offset); | - | ||||||||||||||||||||||||
| 4497 | if (chr == QLatin1Char('\r')
| 0 | ||||||||||||||||||||||||
| 4498 | text[offset] = QLatin1Char(' '); | - | ||||||||||||||||||||||||
| 4499 | } never executed: else if (chr == QLatin1Char('\n')end of block
| 0 | ||||||||||||||||||||||||
| 4500 | text[offset] = QChar::LineSeparator; | - | ||||||||||||||||||||||||
| 4501 | } never executed: else if (chr == QLatin1Char('&')end of block
| 0 | ||||||||||||||||||||||||
| 4502 | ++maxUnderlines; | - | ||||||||||||||||||||||||
| 4503 | } never executed: else if (chr == QLatin1Char('\t')end of block
| 0 | ||||||||||||||||||||||||
| 4504 | if (!expandtabs
| 0 | ||||||||||||||||||||||||
| 4505 | text[offset] = QLatin1Char(' '); | - | ||||||||||||||||||||||||
| 4506 | } never executed: else if (!tabarraylenend of block
| 0 | ||||||||||||||||||||||||
| 4507 | tabstops = qRound(fm.width(QLatin1Char('x'))*8); | - | ||||||||||||||||||||||||
| 4508 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4509 | } never executed: else if (chr == QChar(ushort(0x9c))end of block
| 0 | ||||||||||||||||||||||||
| 4510 | - | |||||||||||||||||||||||||
| 4511 | hasMoreLengthVariants = true; | - | ||||||||||||||||||||||||
| 4512 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4513 | } | - | ||||||||||||||||||||||||
| 4514 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4515 | - | |||||||||||||||||||||||||
| 4516 | QVector<QTextLayout::FormatRange> underlineFormats; | - | ||||||||||||||||||||||||
| 4517 | int length = offset - old_offset; | - | ||||||||||||||||||||||||
| 4518 | if ((hidemnmemonic
| 0 | ||||||||||||||||||||||||
| 4519 | QChar *cout = text.data() + old_offset; | - | ||||||||||||||||||||||||
| 4520 | QChar *cout0 = cout; | - | ||||||||||||||||||||||||
| 4521 | QChar *cin = cout; | - | ||||||||||||||||||||||||
| 4522 | int l = length; | - | ||||||||||||||||||||||||
| 4523 | while (l
| 0 | ||||||||||||||||||||||||
| 4524 | if (*
| 0 | ||||||||||||||||||||||||
| 4525 | ++cin; | - | ||||||||||||||||||||||||
| 4526 | --length; | - | ||||||||||||||||||||||||
| 4527 | --l; | - | ||||||||||||||||||||||||
| 4528 | if (!l
| 0 | ||||||||||||||||||||||||
| 4529 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4530 | if (*
| 0 | ||||||||||||||||||||||||
| 4531 | QTextLayout::FormatRange range; | - | ||||||||||||||||||||||||
| 4532 | range.start = cout - cout0; | - | ||||||||||||||||||||||||
| 4533 | range.length = 1; | - | ||||||||||||||||||||||||
| 4534 | range.format.setFontUnderline(true); | - | ||||||||||||||||||||||||
| 4535 | underlineFormats.append(range); | - | ||||||||||||||||||||||||
| 4536 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4538 | *cout = *cin; | - | ||||||||||||||||||||||||
| 4539 | ++cout; | - | ||||||||||||||||||||||||
| 4540 | ++cin; | - | ||||||||||||||||||||||||
| 4541 | --l; | - | ||||||||||||||||||||||||
| 4542 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4543 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4544 | - | |||||||||||||||||||||||||
| 4545 | qreal height = 0; | - | ||||||||||||||||||||||||
| 4546 | qreal width = 0; | - | ||||||||||||||||||||||||
| 4547 | - | |||||||||||||||||||||||||
| 4548 | QString finalText = text.mid(old_offset, length); | - | ||||||||||||||||||||||||
| 4549 | QStackTextEngine engine(finalText, fnt); | - | ||||||||||||||||||||||||
| 4550 | if (option
| 0 | ||||||||||||||||||||||||
| 4551 | engine.option = *option; | - | ||||||||||||||||||||||||
| 4552 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4553 | - | |||||||||||||||||||||||||
| 4554 | if (engine.option.tabStop() < 0
| 0 | ||||||||||||||||||||||||
| 4555 | engine.option.setTabStop(tabstops); never executed: engine.option.setTabStop(tabstops); | 0 | ||||||||||||||||||||||||
| 4556 | - | |||||||||||||||||||||||||
| 4557 | if (engine.option.tabs().isEmpty()
| 0 | ||||||||||||||||||||||||
| 4558 | QList<qreal> tabs; | - | ||||||||||||||||||||||||
| 4559 | tabs.reserve(tabarraylen); | - | ||||||||||||||||||||||||
| 4560 | for (int i = 0; i < tabarraylen
| 0 | ||||||||||||||||||||||||
| 4561 | tabs.append(qreal(ta[i])); never executed: tabs.append(qreal(ta[i])); | 0 | ||||||||||||||||||||||||
| 4562 | engine.option.setTabArray(tabs); | - | ||||||||||||||||||||||||
| 4563 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4564 | - | |||||||||||||||||||||||||
| 4565 | engine.option.setTextDirection(layout_direction); | - | ||||||||||||||||||||||||
| 4566 | if (tf & Qt::AlignJustify
| 0 | ||||||||||||||||||||||||
| 4567 | engine.option.setAlignment(Qt::AlignJustify); never executed: engine.option.setAlignment(Qt::AlignJustify); | 0 | ||||||||||||||||||||||||
| 4568 | else | - | ||||||||||||||||||||||||
| 4569 | engine.option.setAlignment(Qt::AlignLeft); never executed: engine.option.setAlignment(Qt::AlignLeft); | 0 | ||||||||||||||||||||||||
| 4570 | - | |||||||||||||||||||||||||
| 4571 | if (!option
| 0 | ||||||||||||||||||||||||
| 4572 | engine.option.setWrapMode(QTextOption::WrapAnywhere); never executed: engine.option.setWrapMode(QTextOption::WrapAnywhere); | 0 | ||||||||||||||||||||||||
| 4573 | - | |||||||||||||||||||||||||
| 4574 | if (tf & Qt::TextJustificationForced
| 0 | ||||||||||||||||||||||||
| 4575 | engine.forceJustification = true; never executed: engine.forceJustification = true; | 0 | ||||||||||||||||||||||||
| 4576 | QTextLayout textLayout(&engine); | - | ||||||||||||||||||||||||
| 4577 | textLayout.setCacheEnabled(true); | - | ||||||||||||||||||||||||
| 4578 | textLayout.setFormats(underlineFormats); | - | ||||||||||||||||||||||||
| 4579 | - | |||||||||||||||||||||||||
| 4580 | if (finalText.isEmpty()
| 0 | ||||||||||||||||||||||||
| 4581 | height = fm.height(); | - | ||||||||||||||||||||||||
| 4582 | width = 0; | - | ||||||||||||||||||||||||
| 4583 | tf |= Qt::TextDontPrint; | - | ||||||||||||||||||||||||
| 4584 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4585 | qreal lineWidth = 0x01000000; | - | ||||||||||||||||||||||||
| 4586 | if (wordwrap
| 0 | ||||||||||||||||||||||||
| 4587 | lineWidth = qMax<qreal>(0, r.width()); never executed: lineWidth = qMax<qreal>(0, r.width()); | 0 | ||||||||||||||||||||||||
| 4588 | if(!wordwrap
| 0 | ||||||||||||||||||||||||
| 4589 | tf |= Qt::TextIncludeTrailingSpaces; never executed: tf |= Qt::TextIncludeTrailingSpaces; | 0 | ||||||||||||||||||||||||
| 4590 | textLayout.beginLayout(); | - | ||||||||||||||||||||||||
| 4591 | - | |||||||||||||||||||||||||
| 4592 | qreal leading = fm.leading(); | - | ||||||||||||||||||||||||
| 4593 | height = -leading; | - | ||||||||||||||||||||||||
| 4594 | - | |||||||||||||||||||||||||
| 4595 | while (1) { | - | ||||||||||||||||||||||||
| 4596 | QTextLine l = textLayout.createLine(); | - | ||||||||||||||||||||||||
| 4597 | if (!l.isValid()
| 0 | ||||||||||||||||||||||||
| 4598 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4599 | - | |||||||||||||||||||||||||
| 4600 | l.setLineWidth(lineWidth); | - | ||||||||||||||||||||||||
| 4601 | height += leading; | - | ||||||||||||||||||||||||
| 4602 | - | |||||||||||||||||||||||||
| 4603 | - | |||||||||||||||||||||||||
| 4604 | height = qCeil(height); | - | ||||||||||||||||||||||||
| 4605 | l.setPosition(QPointF(0., height)); | - | ||||||||||||||||||||||||
| 4606 | height += textLayout.engine()->lines[l.lineNumber()].height().toReal(); | - | ||||||||||||||||||||||||
| 4607 | width = qMax(width, l.naturalTextWidth()); | - | ||||||||||||||||||||||||
| 4608 | if (!dontclip
| 0 | ||||||||||||||||||||||||
| 4609 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 4610 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4611 | textLayout.endLayout(); | - | ||||||||||||||||||||||||
| 4612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4613 | - | |||||||||||||||||||||||||
| 4614 | qreal yoff = 0; | - | ||||||||||||||||||||||||
| 4615 | qreal xoff = 0; | - | ||||||||||||||||||||||||
| 4616 | if (tf & Qt::AlignBottom
| 0 | ||||||||||||||||||||||||
| 4617 | yoff = r.height() - height; never executed: yoff = r.height() - height; | 0 | ||||||||||||||||||||||||
| 4618 | else if (tf & Qt::AlignVCenter
| 0 | ||||||||||||||||||||||||
| 4619 | yoff = (r.height() - height)/2; never executed: yoff = (r.height() - height)/2; | 0 | ||||||||||||||||||||||||
| 4620 | - | |||||||||||||||||||||||||
| 4621 | if (tf & Qt::AlignRight
| 0 | ||||||||||||||||||||||||
| 4622 | xoff = r.width() - width; never executed: xoff = r.width() - width; | 0 | ||||||||||||||||||||||||
| 4623 | else if (tf & Qt::AlignHCenter
| 0 | ||||||||||||||||||||||||
| 4624 | xoff = (r.width() - width)/2; never executed: xoff = (r.width() - width)/2; | 0 | ||||||||||||||||||||||||
| 4625 | - | |||||||||||||||||||||||||
| 4626 | QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height); | - | ||||||||||||||||||||||||
| 4627 | - | |||||||||||||||||||||||||
| 4628 | if (hasMoreLengthVariants
| 0 | ||||||||||||||||||||||||
| 4629 | offset++; | - | ||||||||||||||||||||||||
| 4630 | goto never executed: start_lengthVariant;goto start_lengthVariant;never executed: goto start_lengthVariant; | 0 | ||||||||||||||||||||||||
| 4631 | } | - | ||||||||||||||||||||||||
| 4632 | if (brect
| 0 | ||||||||||||||||||||||||
| 4633 | * never executed: brect = bounds;*brect = bounds;never executed: *brect = bounds; | 0 | ||||||||||||||||||||||||
| 4634 | - | |||||||||||||||||||||||||
| 4635 | if (!(tf & Qt::TextDontPrint)
| 0 | ||||||||||||||||||||||||
| 4636 | bool restore = false; | - | ||||||||||||||||||||||||
| 4637 | if (!dontclip
| 0 | ||||||||||||||||||||||||
| 4638 | restore = true; | - | ||||||||||||||||||||||||
| 4639 | painter->save(); | - | ||||||||||||||||||||||||
| 4640 | painter->setClipRect(r, Qt::IntersectClip); | - | ||||||||||||||||||||||||
| 4641 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4642 | - | |||||||||||||||||||||||||
| 4643 | for (int i = 0; i < textLayout.lineCount()
| 0 | ||||||||||||||||||||||||
| 4644 | QTextLine line = textLayout.lineAt(i); | - | ||||||||||||||||||||||||
| 4645 | QTextEngine *eng = textLayout.engine(); | - | ||||||||||||||||||||||||
| 4646 | eng->enableDelayDecorations(); | - | ||||||||||||||||||||||||
| 4647 | - | |||||||||||||||||||||||||
| 4648 | qreal advance = line.horizontalAdvance(); | - | ||||||||||||||||||||||||
| 4649 | xoff = 0; | - | ||||||||||||||||||||||||
| 4650 | if (tf & Qt::AlignRight
| 0 | ||||||||||||||||||||||||
| 4651 | xoff = r.width() - advance - | - | ||||||||||||||||||||||||
| 4652 | eng->leadingSpaceWidth(eng->lines[line.lineNumber()]).toReal(); | - | ||||||||||||||||||||||||
| 4653 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4654 | else if (tf & Qt::AlignHCenter
| 0 | ||||||||||||||||||||||||
| 4655 | xoff = (r.width() - advance) / 2; never executed: xoff = (r.width() - advance) / 2; | 0 | ||||||||||||||||||||||||
| 4656 | - | |||||||||||||||||||||||||
| 4657 | line.draw(painter, QPointF(r.x() + xoff, r.y() + yoff)); | - | ||||||||||||||||||||||||
| 4658 | eng->drawDecorations(painter); | - | ||||||||||||||||||||||||
| 4659 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4660 | - | |||||||||||||||||||||||||
| 4661 | if (restore
| 0 | ||||||||||||||||||||||||
| 4662 | painter->restore(); | - | ||||||||||||||||||||||||
| 4663 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4664 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4665 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4666 | void QPainter::setLayoutDirection(Qt::LayoutDirection direction) | - | ||||||||||||||||||||||||
| 4667 | { | - | ||||||||||||||||||||||||
| 4668 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4669 | if (d->state
| 0 | ||||||||||||||||||||||||
| 4670 | d->state->layoutDirection = direction; never executed: d->state->layoutDirection = direction; | 0 | ||||||||||||||||||||||||
| 4671 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4672 | - | |||||||||||||||||||||||||
| 4673 | - | |||||||||||||||||||||||||
| 4674 | - | |||||||||||||||||||||||||
| 4675 | - | |||||||||||||||||||||||||
| 4676 | - | |||||||||||||||||||||||||
| 4677 | - | |||||||||||||||||||||||||
| 4678 | Qt::LayoutDirection QPainter::layoutDirection() const | - | ||||||||||||||||||||||||
| 4679 | { | - | ||||||||||||||||||||||||
| 4680 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4681 | return never executed: d->statereturn d->state ? d->state->layoutDirection : Qt::LayoutDirectionAuto;
never executed: return d->state ? d->state->layoutDirection : Qt::LayoutDirectionAuto; | 0 | ||||||||||||||||||||||||
| 4682 | } | - | ||||||||||||||||||||||||
| 4683 | - | |||||||||||||||||||||||||
| 4684 | QPainterState::QPainterState(const QPainterState *s) | - | ||||||||||||||||||||||||
| 4685 | : brushOrigin(s->brushOrigin), font(s->font), deviceFont(s->deviceFont), | - | ||||||||||||||||||||||||
| 4686 | pen(s->pen), brush(s->brush), bgBrush(s->bgBrush), | - | ||||||||||||||||||||||||
| 4687 | clipRegion(s->clipRegion), clipPath(s->clipPath), | - | ||||||||||||||||||||||||
| 4688 | clipOperation(s->clipOperation), | - | ||||||||||||||||||||||||
| 4689 | renderHints(s->renderHints), clipInfo(s->clipInfo), | - | ||||||||||||||||||||||||
| 4690 | worldMatrix(s->worldMatrix), matrix(s->matrix), redirectionMatrix(s->redirectionMatrix), | - | ||||||||||||||||||||||||
| 4691 | wx(s->wx), wy(s->wy), ww(s->ww), wh(s->wh), | - | ||||||||||||||||||||||||
| 4692 | vx(s->vx), vy(s->vy), vw(s->vw), vh(s->vh), | - | ||||||||||||||||||||||||
| 4693 | opacity(s->opacity), WxF(s->WxF), VxF(s->VxF), | - | ||||||||||||||||||||||||
| 4694 | clipEnabled(s->clipEnabled), bgMode(s->bgMode), painter(s->painter), | - | ||||||||||||||||||||||||
| 4695 | layoutDirection(s->layoutDirection), | - | ||||||||||||||||||||||||
| 4696 | composition_mode(s->composition_mode), | - | ||||||||||||||||||||||||
| 4697 | emulationSpecifier(s->emulationSpecifier), changeFlags(0) | - | ||||||||||||||||||||||||
| 4698 | { | - | ||||||||||||||||||||||||
| 4699 | dirtyFlags = s->dirtyFlags; | - | ||||||||||||||||||||||||
| 4700 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4701 | - | |||||||||||||||||||||||||
| 4702 | QPainterState::QPainterState() | - | ||||||||||||||||||||||||
| 4703 | : brushOrigin(0, 0), bgBrush(Qt::white), clipOperation(Qt::NoClip), | - | ||||||||||||||||||||||||
| 4704 | renderHints(0), | - | ||||||||||||||||||||||||
| 4705 | wx(0), wy(0), ww(0), wh(0), vx(0), vy(0), vw(0), vh(0), | - | ||||||||||||||||||||||||
| 4706 | opacity(1), WxF(false), VxF(false), clipEnabled(true), | - | ||||||||||||||||||||||||
| 4707 | bgMode(Qt::TransparentMode), painter(0), | - | ||||||||||||||||||||||||
| 4708 | layoutDirection(QGuiApplication::layoutDirection()), | - | ||||||||||||||||||||||||
| 4709 | composition_mode(QPainter::CompositionMode_SourceOver), | - | ||||||||||||||||||||||||
| 4710 | emulationSpecifier(0), changeFlags(0) | - | ||||||||||||||||||||||||
| 4711 | { | - | ||||||||||||||||||||||||
| 4712 | dirtyFlags = 0; | - | ||||||||||||||||||||||||
| 4713 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4714 | - | |||||||||||||||||||||||||
| 4715 | QPainterState::~QPainterState() | - | ||||||||||||||||||||||||
| 4716 | { | - | ||||||||||||||||||||||||
| 4717 | } | - | ||||||||||||||||||||||||
| 4718 | - | |||||||||||||||||||||||||
| 4719 | void QPainterState::init(QPainter *p) { | - | ||||||||||||||||||||||||
| 4720 | bgBrush = Qt::white; | - | ||||||||||||||||||||||||
| 4721 | bgMode = Qt::TransparentMode; | - | ||||||||||||||||||||||||
| 4722 | WxF = false; | - | ||||||||||||||||||||||||
| 4723 | VxF = false; | - | ||||||||||||||||||||||||
| 4724 | clipEnabled = true; | - | ||||||||||||||||||||||||
| 4725 | wx = wy = ww = wh = 0; | - | ||||||||||||||||||||||||
| 4726 | vx = vy = vw = vh = 0; | - | ||||||||||||||||||||||||
| 4727 | painter = p; | - | ||||||||||||||||||||||||
| 4728 | pen = QPen(); | - | ||||||||||||||||||||||||
| 4729 | brushOrigin = QPointF(0, 0); | - | ||||||||||||||||||||||||
| 4730 | brush = QBrush(); | - | ||||||||||||||||||||||||
| 4731 | font = deviceFont = QFont(); | - | ||||||||||||||||||||||||
| 4732 | clipRegion = QRegion(); | - | ||||||||||||||||||||||||
| 4733 | clipPath = QPainterPath(); | - | ||||||||||||||||||||||||
| 4734 | clipOperation = Qt::NoClip; | - | ||||||||||||||||||||||||
| 4735 | clipInfo.clear(); | - | ||||||||||||||||||||||||
| 4736 | worldMatrix.reset(); | - | ||||||||||||||||||||||||
| 4737 | matrix.reset(); | - | ||||||||||||||||||||||||
| 4738 | layoutDirection = QGuiApplication::layoutDirection(); | - | ||||||||||||||||||||||||
| 4739 | composition_mode = QPainter::CompositionMode_SourceOver; | - | ||||||||||||||||||||||||
| 4740 | emulationSpecifier = 0; | - | ||||||||||||||||||||||||
| 4741 | dirtyFlags = 0; | - | ||||||||||||||||||||||||
| 4742 | changeFlags = 0; | - | ||||||||||||||||||||||||
| 4743 | renderHints = 0; | - | ||||||||||||||||||||||||
| 4744 | opacity = 1; | - | ||||||||||||||||||||||||
| 4745 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4746 | QPen QPaintEngineState::pen() const | - | ||||||||||||||||||||||||
| 4747 | { | - | ||||||||||||||||||||||||
| 4748 | return never executed: static_cast<const QPainterState *>(this)->pen;return static_cast<const QPainterState *>(this)->pen;never executed: return static_cast<const QPainterState *>(this)->pen; | 0 | ||||||||||||||||||||||||
| 4749 | } | - | ||||||||||||||||||||||||
| 4750 | QBrush QPaintEngineState::brush() const | - | ||||||||||||||||||||||||
| 4751 | { | - | ||||||||||||||||||||||||
| 4752 | return never executed: static_cast<const QPainterState *>(this)->brush;return static_cast<const QPainterState *>(this)->brush;never executed: return static_cast<const QPainterState *>(this)->brush; | 0 | ||||||||||||||||||||||||
| 4753 | } | - | ||||||||||||||||||||||||
| 4754 | QPointF QPaintEngineState::brushOrigin() const | - | ||||||||||||||||||||||||
| 4755 | { | - | ||||||||||||||||||||||||
| 4756 | return never executed: static_cast<const QPainterState *>(this)->brushOrigin;return static_cast<const QPainterState *>(this)->brushOrigin;never executed: return static_cast<const QPainterState *>(this)->brushOrigin; | 0 | ||||||||||||||||||||||||
| 4757 | } | - | ||||||||||||||||||||||||
| 4758 | QBrush QPaintEngineState::backgroundBrush() const | - | ||||||||||||||||||||||||
| 4759 | { | - | ||||||||||||||||||||||||
| 4760 | return never executed: static_cast<const QPainterState *>(this)->bgBrush;return static_cast<const QPainterState *>(this)->bgBrush;never executed: return static_cast<const QPainterState *>(this)->bgBrush; | 0 | ||||||||||||||||||||||||
| 4761 | } | - | ||||||||||||||||||||||||
| 4762 | Qt::BGMode QPaintEngineState::backgroundMode() const | - | ||||||||||||||||||||||||
| 4763 | { | - | ||||||||||||||||||||||||
| 4764 | return never executed: static_cast<const QPainterState *>(this)->bgMode;return static_cast<const QPainterState *>(this)->bgMode;never executed: return static_cast<const QPainterState *>(this)->bgMode; | 0 | ||||||||||||||||||||||||
| 4765 | } | - | ||||||||||||||||||||||||
| 4766 | QFont QPaintEngineState::font() const | - | ||||||||||||||||||||||||
| 4767 | { | - | ||||||||||||||||||||||||
| 4768 | return never executed: static_cast<const QPainterState *>(this)->font;return static_cast<const QPainterState *>(this)->font;never executed: return static_cast<const QPainterState *>(this)->font; | 0 | ||||||||||||||||||||||||
| 4769 | } | - | ||||||||||||||||||||||||
| 4770 | QMatrix QPaintEngineState::matrix() const | - | ||||||||||||||||||||||||
| 4771 | { | - | ||||||||||||||||||||||||
| 4772 | const QPainterState *st = static_cast<const QPainterState *>(this); | - | ||||||||||||||||||||||||
| 4773 | - | |||||||||||||||||||||||||
| 4774 | return never executed: st->matrix.toAffine();return st->matrix.toAffine();never executed: return st->matrix.toAffine(); | 0 | ||||||||||||||||||||||||
| 4775 | } | - | ||||||||||||||||||||||||
| 4776 | QTransform QPaintEngineState::transform() const | - | ||||||||||||||||||||||||
| 4777 | { | - | ||||||||||||||||||||||||
| 4778 | const QPainterState *st = static_cast<const QPainterState *>(this); | - | ||||||||||||||||||||||||
| 4779 | - | |||||||||||||||||||||||||
| 4780 | return never executed: st->matrix;return st->matrix;never executed: return st->matrix; | 0 | ||||||||||||||||||||||||
| 4781 | } | - | ||||||||||||||||||||||||
| 4782 | Qt::ClipOperation QPaintEngineState::clipOperation() const | - | ||||||||||||||||||||||||
| 4783 | { | - | ||||||||||||||||||||||||
| 4784 | return never executed: static_cast<const QPainterState *>(this)->clipOperation;return static_cast<const QPainterState *>(this)->clipOperation;never executed: return static_cast<const QPainterState *>(this)->clipOperation; | 0 | ||||||||||||||||||||||||
| 4785 | } | - | ||||||||||||||||||||||||
| 4786 | bool QPaintEngineState::brushNeedsResolving() const | - | ||||||||||||||||||||||||
| 4787 | { | - | ||||||||||||||||||||||||
| 4788 | const QBrush &brush = static_cast<const QPainterState *>(this)->brush; | - | ||||||||||||||||||||||||
| 4789 | return never executed: needsResolving(brush);return needsResolving(brush);never executed: return needsResolving(brush); | 0 | ||||||||||||||||||||||||
| 4790 | } | - | ||||||||||||||||||||||||
| 4791 | bool QPaintEngineState::penNeedsResolving() const | - | ||||||||||||||||||||||||
| 4792 | { | - | ||||||||||||||||||||||||
| 4793 | const QPen &pen = static_cast<const QPainterState *>(this)->pen; | - | ||||||||||||||||||||||||
| 4794 | return never executed: needsResolving(pen.brush());return needsResolving(pen.brush());never executed: return needsResolving(pen.brush()); | 0 | ||||||||||||||||||||||||
| 4795 | } | - | ||||||||||||||||||||||||
| 4796 | QRegion QPaintEngineState::clipRegion() const | - | ||||||||||||||||||||||||
| 4797 | { | - | ||||||||||||||||||||||||
| 4798 | return never executed: static_cast<const QPainterState *>(this)->clipRegion;return static_cast<const QPainterState *>(this)->clipRegion;never executed: return static_cast<const QPainterState *>(this)->clipRegion; | 0 | ||||||||||||||||||||||||
| 4799 | } | - | ||||||||||||||||||||||||
| 4800 | QPainterPath QPaintEngineState::clipPath() const | - | ||||||||||||||||||||||||
| 4801 | { | - | ||||||||||||||||||||||||
| 4802 | return never executed: static_cast<const QPainterState *>(this)->clipPath;return static_cast<const QPainterState *>(this)->clipPath;never executed: return static_cast<const QPainterState *>(this)->clipPath; | 0 | ||||||||||||||||||||||||
| 4803 | } | - | ||||||||||||||||||||||||
| 4804 | bool QPaintEngineState::isClipEnabled() const | - | ||||||||||||||||||||||||
| 4805 | { | - | ||||||||||||||||||||||||
| 4806 | return never executed: static_cast<const QPainterState *>(this)->clipEnabled;return static_cast<const QPainterState *>(this)->clipEnabled;never executed: return static_cast<const QPainterState *>(this)->clipEnabled; | 0 | ||||||||||||||||||||||||
| 4807 | } | - | ||||||||||||||||||||||||
| 4808 | QPainter::RenderHints QPaintEngineState::renderHints() const | - | ||||||||||||||||||||||||
| 4809 | { | - | ||||||||||||||||||||||||
| 4810 | return never executed: static_cast<const QPainterState *>(this)->renderHints;return static_cast<const QPainterState *>(this)->renderHints;never executed: return static_cast<const QPainterState *>(this)->renderHints; | 0 | ||||||||||||||||||||||||
| 4811 | } | - | ||||||||||||||||||||||||
| 4812 | QPainter::CompositionMode QPaintEngineState::compositionMode() const | - | ||||||||||||||||||||||||
| 4813 | { | - | ||||||||||||||||||||||||
| 4814 | return never executed: static_cast<const QPainterState *>(this)->composition_mode;return static_cast<const QPainterState *>(this)->composition_mode;never executed: return static_cast<const QPainterState *>(this)->composition_mode; | 0 | ||||||||||||||||||||||||
| 4815 | } | - | ||||||||||||||||||||||||
| 4816 | - | |||||||||||||||||||||||||
| 4817 | - | |||||||||||||||||||||||||
| 4818 | - | |||||||||||||||||||||||||
| 4819 | - | |||||||||||||||||||||||||
| 4820 | - | |||||||||||||||||||||||||
| 4821 | - | |||||||||||||||||||||||||
| 4822 | - | |||||||||||||||||||||||||
| 4823 | QPainter *QPaintEngineState::painter() const | - | ||||||||||||||||||||||||
| 4824 | { | - | ||||||||||||||||||||||||
| 4825 | return never executed: static_cast<const QPainterState *>(this)->painter;return static_cast<const QPainterState *>(this)->painter;never executed: return static_cast<const QPainterState *>(this)->painter; | 0 | ||||||||||||||||||||||||
| 4826 | } | - | ||||||||||||||||||||||||
| 4827 | qreal QPaintEngineState::opacity() const | - | ||||||||||||||||||||||||
| 4828 | { | - | ||||||||||||||||||||||||
| 4829 | return never executed: static_cast<const QPainterState *>(this)->opacity;return static_cast<const QPainterState *>(this)->opacity;never executed: return static_cast<const QPainterState *>(this)->opacity; | 0 | ||||||||||||||||||||||||
| 4830 | } | - | ||||||||||||||||||||||||
| 4831 | void QPainter::setTransform(const QTransform &transform, bool combine ) | - | ||||||||||||||||||||||||
| 4832 | { | - | ||||||||||||||||||||||||
| 4833 | setWorldTransform(transform, combine); | - | ||||||||||||||||||||||||
| 4834 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4835 | - | |||||||||||||||||||||||||
| 4836 | - | |||||||||||||||||||||||||
| 4837 | - | |||||||||||||||||||||||||
| 4838 | - | |||||||||||||||||||||||||
| 4839 | - | |||||||||||||||||||||||||
| 4840 | - | |||||||||||||||||||||||||
| 4841 | - | |||||||||||||||||||||||||
| 4842 | const QTransform & QPainter::transform() const | - | ||||||||||||||||||||||||
| 4843 | { | - | ||||||||||||||||||||||||
| 4844 | return never executed: worldTransform();return worldTransform();never executed: return worldTransform(); | 0 | ||||||||||||||||||||||||
| 4845 | } | - | ||||||||||||||||||||||||
| 4846 | const QTransform & QPainter::deviceTransform() const | - | ||||||||||||||||||||||||
| 4847 | { | - | ||||||||||||||||||||||||
| 4848 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4849 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4850 | QMessageLogger(__FILE__, 8222, __PRETTY_FUNCTION__).warning("QPainter::deviceTransform: Painter not active"); | - | ||||||||||||||||||||||||
| 4851 | return never executed: d->fakeState()->transform;return d->fakeState()->transform;never executed: return d->fakeState()->transform; | 0 | ||||||||||||||||||||||||
| 4852 | } | - | ||||||||||||||||||||||||
| 4853 | return never executed: d->state->matrix;return d->state->matrix;never executed: return d->state->matrix; | 0 | ||||||||||||||||||||||||
| 4854 | } | - | ||||||||||||||||||||||||
| 4855 | void QPainter::resetTransform() | - | ||||||||||||||||||||||||
| 4856 | { | - | ||||||||||||||||||||||||
| 4857 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4858 | - | |||||||||||||||||||||||||
| 4859 | - | |||||||||||||||||||||||||
| 4860 | - | |||||||||||||||||||||||||
| 4861 | - | |||||||||||||||||||||||||
| 4862 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4863 | QMessageLogger(__FILE__, 8245, __PRETTY_FUNCTION__).warning("QPainter::resetMatrix: Painter not active"); | - | ||||||||||||||||||||||||
| 4864 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4865 | } | - | ||||||||||||||||||||||||
| 4866 | - | |||||||||||||||||||||||||
| 4867 | d->state->wx = d->state->wy = d->state->vx = d->state->vy = 0; | - | ||||||||||||||||||||||||
| 4868 | d->state->ww = d->state->vw = d->device->metric(QPaintDevice::PdmWidth); | - | ||||||||||||||||||||||||
| 4869 | d->state->wh = d->state->vh = d->device->metric(QPaintDevice::PdmHeight); | - | ||||||||||||||||||||||||
| 4870 | d->state->worldMatrix = QTransform(); | - | ||||||||||||||||||||||||
| 4871 | setMatrixEnabled(false); | - | ||||||||||||||||||||||||
| 4872 | setViewTransformEnabled(false); | - | ||||||||||||||||||||||||
| 4873 | if (d->extended
| 0 | ||||||||||||||||||||||||
| 4874 | d->extended->transformChanged(); never executed: d->extended->transformChanged(); | 0 | ||||||||||||||||||||||||
| 4875 | else | - | ||||||||||||||||||||||||
| 4876 | d->state->dirtyFlags |= QPaintEngine::DirtyTransform; never executed: d->state->dirtyFlags |= QPaintEngine::DirtyTransform; | 0 | ||||||||||||||||||||||||
| 4877 | } | - | ||||||||||||||||||||||||
| 4878 | void QPainter::setWorldTransform(const QTransform &matrix, bool combine ) | - | ||||||||||||||||||||||||
| 4879 | { | - | ||||||||||||||||||||||||
| 4880 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4881 | - | |||||||||||||||||||||||||
| 4882 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4883 | QMessageLogger(__FILE__, 8274, __PRETTY_FUNCTION__).warning("QPainter::setWorldTransform: Painter not active"); | - | ||||||||||||||||||||||||
| 4884 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4885 | } | - | ||||||||||||||||||||||||
| 4886 | - | |||||||||||||||||||||||||
| 4887 | if (combine
| 0 | ||||||||||||||||||||||||
| 4888 | d->state->worldMatrix = matrix * d->state->worldMatrix; never executed: d->state->worldMatrix = matrix * d->state->worldMatrix; | 0 | ||||||||||||||||||||||||
| 4889 | else | - | ||||||||||||||||||||||||
| 4890 | d->state->worldMatrix = matrix; never executed: d->state->worldMatrix = matrix; | 0 | ||||||||||||||||||||||||
| 4891 | - | |||||||||||||||||||||||||
| 4892 | d->state->WxF = true; | - | ||||||||||||||||||||||||
| 4893 | d->updateMatrix(); | - | ||||||||||||||||||||||||
| 4894 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4895 | - | |||||||||||||||||||||||||
| 4896 | - | |||||||||||||||||||||||||
| 4897 | - | |||||||||||||||||||||||||
| 4898 | - | |||||||||||||||||||||||||
| 4899 | - | |||||||||||||||||||||||||
| 4900 | const QTransform & QPainter::worldTransform() const | - | ||||||||||||||||||||||||
| 4901 | { | - | ||||||||||||||||||||||||
| 4902 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4903 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4904 | QMessageLogger(__FILE__, 8295, __PRETTY_FUNCTION__).warning("QPainter::worldTransform: Painter not active"); | - | ||||||||||||||||||||||||
| 4905 | return never executed: d->fakeState()->transform;return d->fakeState()->transform;never executed: return d->fakeState()->transform; | 0 | ||||||||||||||||||||||||
| 4906 | } | - | ||||||||||||||||||||||||
| 4907 | return never executed: d->state->worldMatrix;return d->state->worldMatrix;never executed: return d->state->worldMatrix; | 0 | ||||||||||||||||||||||||
| 4908 | } | - | ||||||||||||||||||||||||
| 4909 | QTransform QPainter::combinedTransform() const | - | ||||||||||||||||||||||||
| 4910 | { | - | ||||||||||||||||||||||||
| 4911 | const QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4912 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4913 | QMessageLogger(__FILE__, 8312, __PRETTY_FUNCTION__).warning("QPainter::combinedTransform: Painter not active"); | - | ||||||||||||||||||||||||
| 4914 | return never executed: QTransform();return QTransform();never executed: return QTransform(); | 0 | ||||||||||||||||||||||||
| 4915 | } | - | ||||||||||||||||||||||||
| 4916 | return never executed: d->state->worldMatrix * d->viewTransform() * d->hidpiScaleTransform();return d->state->worldMatrix * d->viewTransform() * d->hidpiScaleTransform();never executed: return d->state->worldMatrix * d->viewTransform() * d->hidpiScaleTransform(); | 0 | ||||||||||||||||||||||||
| 4917 | } | - | ||||||||||||||||||||||||
| 4918 | void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragmentCount, | - | ||||||||||||||||||||||||
| 4919 | const QPixmap &pixmap, PixmapFragmentHints hints) | - | ||||||||||||||||||||||||
| 4920 | { | - | ||||||||||||||||||||||||
| 4921 | QPainterPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 4922 | - | |||||||||||||||||||||||||
| 4923 | if (!d->engine
| 0 | ||||||||||||||||||||||||
| 4924 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 4925 | - | |||||||||||||||||||||||||
| 4926 | - | |||||||||||||||||||||||||
| 4927 | for (int i = 0; i < fragmentCount
| 0 | ||||||||||||||||||||||||
| 4928 | QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, | - | ||||||||||||||||||||||||
| 4929 | fragments[i].width, fragments[i].height); | - | ||||||||||||||||||||||||
| 4930 | if (!(QRectF(pixmap.rect()).contains(sourceRect))
| 0 | ||||||||||||||||||||||||
| 4931 | QMessageLogger(__FILE__, 8346, __PRETTY_FUNCTION__).warning("QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle"); never executed: QMessageLogger(__FILE__, 8346, __PRETTY_FUNCTION__).warning("QPainter::drawPixmapFragments - the source rect is not contained by the pixmap's rectangle"); | 0 | ||||||||||||||||||||||||
| 4932 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4933 | - | |||||||||||||||||||||||||
| 4934 | - | |||||||||||||||||||||||||
| 4935 | if (d->engine->isExtended()
| 0 | ||||||||||||||||||||||||
| 4936 | d->extended->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); | - | ||||||||||||||||||||||||
| 4937 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4938 | qreal oldOpacity = opacity(); | - | ||||||||||||||||||||||||
| 4939 | QTransform oldTransform = transform(); | - | ||||||||||||||||||||||||
| 4940 | - | |||||||||||||||||||||||||
| 4941 | for (int i = 0; i < fragmentCount
| 0 | ||||||||||||||||||||||||
| 4942 | QTransform transform = oldTransform; | - | ||||||||||||||||||||||||
| 4943 | qreal xOffset = 0; | - | ||||||||||||||||||||||||
| 4944 | qreal yOffset = 0; | - | ||||||||||||||||||||||||
| 4945 | if (fragments[i].rotation == 0
| 0 | ||||||||||||||||||||||||
| 4946 | xOffset = fragments[i].x; | - | ||||||||||||||||||||||||
| 4947 | yOffset = fragments[i].y; | - | ||||||||||||||||||||||||
| 4948 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 4949 | transform.translate(fragments[i].x, fragments[i].y); | - | ||||||||||||||||||||||||
| 4950 | transform.rotate(fragments[i].rotation); | - | ||||||||||||||||||||||||
| 4951 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4952 | setOpacity(oldOpacity * fragments[i].opacity); | - | ||||||||||||||||||||||||
| 4953 | setTransform(transform); | - | ||||||||||||||||||||||||
| 4954 | - | |||||||||||||||||||||||||
| 4955 | qreal w = fragments[i].scaleX * fragments[i].width; | - | ||||||||||||||||||||||||
| 4956 | qreal h = fragments[i].scaleY * fragments[i].height; | - | ||||||||||||||||||||||||
| 4957 | QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop, | - | ||||||||||||||||||||||||
| 4958 | fragments[i].width, fragments[i].height); | - | ||||||||||||||||||||||||
| 4959 | drawPixmap(QRectF(-0.5 * w + xOffset, -0.5 * h + yOffset, w, h), pixmap, sourceRect); | - | ||||||||||||||||||||||||
| 4960 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4961 | - | |||||||||||||||||||||||||
| 4962 | setOpacity(oldOpacity); | - | ||||||||||||||||||||||||
| 4963 | setTransform(oldTransform); | - | ||||||||||||||||||||||||
| 4964 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4965 | } | - | ||||||||||||||||||||||||
| 4966 | QPainter::PixmapFragment QPainter::PixmapFragment::create(const QPointF &pos, const QRectF &sourceRect, | - | ||||||||||||||||||||||||
| 4967 | qreal scaleX, qreal scaleY, qreal rotation, | - | ||||||||||||||||||||||||
| 4968 | qreal opacity) | - | ||||||||||||||||||||||||
| 4969 | { | - | ||||||||||||||||||||||||
| 4970 | PixmapFragment fragment = {pos.x(), pos.y(), sourceRect.x(), sourceRect.y(), sourceRect.width(), | - | ||||||||||||||||||||||||
| 4971 | sourceRect.height(), scaleX, scaleY, rotation, opacity}; | - | ||||||||||||||||||||||||
| 4972 | return never executed: fragment;return fragment;never executed: return fragment; | 0 | ||||||||||||||||||||||||
| 4973 | } | - | ||||||||||||||||||||||||
| 4974 | void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation) | - | ||||||||||||||||||||||||
| 4975 | { | - | ||||||||||||||||||||||||
| 4976 | p->draw_helper(path, operation); | - | ||||||||||||||||||||||||
| 4977 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 4978 | - | |||||||||||||||||||||||||
| 4979 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |