| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qemulationpaintengine.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | QEmulationPaintEngine::QEmulationPaintEngine(QPaintEngineEx *engine) | - | ||||||||||||||||||||||||
| 5 | : real_engine(engine) | - | ||||||||||||||||||||||||
| 6 | { | - | ||||||||||||||||||||||||
| 7 | QPaintEngine::state = real_engine->state(); | - | ||||||||||||||||||||||||
| 8 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | QPaintEngine::Type QEmulationPaintEngine::type() const | - | ||||||||||||||||||||||||
| 12 | { | - | ||||||||||||||||||||||||
| 13 | return never executed: real_engine->type();return real_engine->type();never executed: return real_engine->type(); | 0 | ||||||||||||||||||||||||
| 14 | } | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | bool QEmulationPaintEngine::begin(QPaintDevice *) | - | ||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||
| 18 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 19 | } | - | ||||||||||||||||||||||||
| 20 | - | |||||||||||||||||||||||||
| 21 | bool QEmulationPaintEngine::end() | - | ||||||||||||||||||||||||
| 22 | { | - | ||||||||||||||||||||||||
| 23 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 24 | } | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | QPainterState *QEmulationPaintEngine::createState(QPainterState *orig) const | - | ||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||
| 29 | return never executed: real_engine->createState(orig);return real_engine->createState(orig);never executed: return real_engine->createState(orig); | 0 | ||||||||||||||||||||||||
| 30 | } | - | ||||||||||||||||||||||||
| 31 | - | |||||||||||||||||||||||||
| 32 | void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush) | - | ||||||||||||||||||||||||
| 33 | { | - | ||||||||||||||||||||||||
| 34 | QPainterState *s = state(); | - | ||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | if (s->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 37 | Qt::BrushStyle style = brush.style(); | - | ||||||||||||||||||||||||
| 38 | if ((style >= Qt::Dense1Pattern
| 0 | ||||||||||||||||||||||||
| 39 | real_engine->fill(path, s->bgBrush); never executed: real_engine->fill(path, s->bgBrush); | 0 | ||||||||||||||||||||||||
| 40 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 41 | - | |||||||||||||||||||||||||
| 42 | Qt::BrushStyle style = qbrush_style(brush); | - | ||||||||||||||||||||||||
| 43 | if (style >= Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 44 | const QGradient *g = brush.gradient(); | - | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | if (g->coordinateMode() > QGradient::LogicalMode
| 0 | ||||||||||||||||||||||||
| 47 | if (g->coordinateMode() == QGradient::StretchToDeviceMode
| 0 | ||||||||||||||||||||||||
| 48 | QBrush copy = brush; | - | ||||||||||||||||||||||||
| 49 | QTransform mat = copy.transform(); | - | ||||||||||||||||||||||||
| 50 | mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); | - | ||||||||||||||||||||||||
| 51 | copy.setTransform(mat); | - | ||||||||||||||||||||||||
| 52 | real_engine->fill(path, copy); | - | ||||||||||||||||||||||||
| 53 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 54 | } else if (g->coordinateMode() == QGradient::ObjectBoundingMode
| 0 | ||||||||||||||||||||||||
| 55 | QBrush copy = brush; | - | ||||||||||||||||||||||||
| 56 | QTransform mat = copy.transform(); | - | ||||||||||||||||||||||||
| 57 | QRectF r = path.controlPointRect(); | - | ||||||||||||||||||||||||
| 58 | mat.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||
| 59 | mat.scale(r.width(), r.height()); | - | ||||||||||||||||||||||||
| 60 | copy.setTransform(mat); | - | ||||||||||||||||||||||||
| 61 | real_engine->fill(path, copy); | - | ||||||||||||||||||||||||
| 62 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 63 | } | - | ||||||||||||||||||||||||
| 64 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 65 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | real_engine->fill(path, brush); | - | ||||||||||||||||||||||||
| 68 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | void QEmulationPaintEngine::stroke(const QVectorPath &path, const QPen &pen) | - | ||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||
| 72 | QPainterState *s = state(); | - | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | if (s->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 75 | QPen bgPen = pen; | - | ||||||||||||||||||||||||
| 76 | bgPen.setBrush(s->bgBrush); | - | ||||||||||||||||||||||||
| 77 | bgPen.setStyle(Qt::SolidLine); | - | ||||||||||||||||||||||||
| 78 | real_engine->stroke(path, bgPen); | - | ||||||||||||||||||||||||
| 79 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||
| 81 | QBrush brush = pen.brush(); | - | ||||||||||||||||||||||||
| 82 | QPen copy = pen; | - | ||||||||||||||||||||||||
| 83 | Qt::BrushStyle style = qbrush_style(brush); | - | ||||||||||||||||||||||||
| 84 | if (style >= Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 85 | const QGradient *g = brush.gradient(); | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | if (g->coordinateMode() > QGradient::LogicalMode
| 0 | ||||||||||||||||||||||||
| 88 | if (g->coordinateMode() == QGradient::StretchToDeviceMode
| 0 | ||||||||||||||||||||||||
| 89 | QTransform mat = brush.transform(); | - | ||||||||||||||||||||||||
| 90 | mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); | - | ||||||||||||||||||||||||
| 91 | brush.setTransform(mat); | - | ||||||||||||||||||||||||
| 92 | copy.setBrush(brush); | - | ||||||||||||||||||||||||
| 93 | real_engine->stroke(path, copy); | - | ||||||||||||||||||||||||
| 94 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 95 | } else if (g->coordinateMode() == QGradient::ObjectBoundingMode
| 0 | ||||||||||||||||||||||||
| 96 | QTransform mat = brush.transform(); | - | ||||||||||||||||||||||||
| 97 | QRectF r = path.controlPointRect(); | - | ||||||||||||||||||||||||
| 98 | mat.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||
| 99 | mat.scale(r.width(), r.height()); | - | ||||||||||||||||||||||||
| 100 | brush.setTransform(mat); | - | ||||||||||||||||||||||||
| 101 | copy.setBrush(brush); | - | ||||||||||||||||||||||||
| 102 | real_engine->stroke(path, copy); | - | ||||||||||||||||||||||||
| 103 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 104 | } | - | ||||||||||||||||||||||||
| 105 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 106 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | real_engine->stroke(path, pen); | - | ||||||||||||||||||||||||
| 109 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 110 | - | |||||||||||||||||||||||||
| 111 | void QEmulationPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) | - | ||||||||||||||||||||||||
| 112 | { | - | ||||||||||||||||||||||||
| 113 | real_engine->clip(path, op); | - | ||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||
| 116 | void QEmulationPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) | - | ||||||||||||||||||||||||
| 117 | { | - | ||||||||||||||||||||||||
| 118 | if (state()->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 119 | fillBGRect(r); never executed: fillBGRect(r); | 0 | ||||||||||||||||||||||||
| 120 | real_engine->drawPixmap(r, pm, sr); | - | ||||||||||||||||||||||||
| 121 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 122 | - | |||||||||||||||||||||||||
| 123 | void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) | - | ||||||||||||||||||||||||
| 124 | { | - | ||||||||||||||||||||||||
| 125 | if (state()->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 126 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||||||||||||||
| 127 | QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent).toReal()); | - | ||||||||||||||||||||||||
| 128 | fillBGRect(rect); | - | ||||||||||||||||||||||||
| 129 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 130 | - | |||||||||||||||||||||||||
| 131 | QPainterState *s = state(); | - | ||||||||||||||||||||||||
| 132 | Qt::BrushStyle style = qbrush_style(s->pen.brush()); | - | ||||||||||||||||||||||||
| 133 | if (style >= Qt::LinearGradientPattern
| 0 | ||||||||||||||||||||||||
| 134 | { | - | ||||||||||||||||||||||||
| 135 | QPen savedPen = s->pen; | - | ||||||||||||||||||||||||
| 136 | QGradient g = *s->pen.brush().gradient(); | - | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | if (g.coordinateMode() > QGradient::LogicalMode
| 0 | ||||||||||||||||||||||||
| 139 | QTransform mat = s->pen.brush().transform(); | - | ||||||||||||||||||||||||
| 140 | if (g.coordinateMode() == QGradient::StretchToDeviceMode
| 0 | ||||||||||||||||||||||||
| 141 | mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); | - | ||||||||||||||||||||||||
| 142 | } never executed: else if (g.coordinateMode() == QGradient::ObjectBoundingModeend of block
| 0 | ||||||||||||||||||||||||
| 143 | const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); | - | ||||||||||||||||||||||||
| 144 | QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); | - | ||||||||||||||||||||||||
| 145 | mat.translate(r.x(), r.y()); | - | ||||||||||||||||||||||||
| 146 | mat.scale(r.width(), r.height()); | - | ||||||||||||||||||||||||
| 147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 148 | g.setCoordinateMode(QGradient::LogicalMode); | - | ||||||||||||||||||||||||
| 149 | QBrush brush(g); | - | ||||||||||||||||||||||||
| 150 | brush.setTransform(mat); | - | ||||||||||||||||||||||||
| 151 | s->pen.setBrush(brush); | - | ||||||||||||||||||||||||
| 152 | penChanged(); | - | ||||||||||||||||||||||||
| 153 | real_engine->drawTextItem(p, textItem); | - | ||||||||||||||||||||||||
| 154 | s->pen = savedPen; | - | ||||||||||||||||||||||||
| 155 | penChanged(); | - | ||||||||||||||||||||||||
| 156 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 157 | } | - | ||||||||||||||||||||||||
| 158 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | real_engine->drawTextItem(p, textItem); | - | ||||||||||||||||||||||||
| 161 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 162 | - | |||||||||||||||||||||||||
| 163 | void QEmulationPaintEngine::drawStaticTextItem(QStaticTextItem *item) | - | ||||||||||||||||||||||||
| 164 | { | - | ||||||||||||||||||||||||
| 165 | real_engine->drawStaticTextItem(item); | - | ||||||||||||||||||||||||
| 166 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||
| 168 | void QEmulationPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) | - | ||||||||||||||||||||||||
| 169 | { | - | ||||||||||||||||||||||||
| 170 | if (state()->bgMode == Qt::OpaqueMode
| 0 | ||||||||||||||||||||||||
| 171 | fillBGRect(r); never executed: fillBGRect(r); | 0 | ||||||||||||||||||||||||
| 172 | real_engine->drawTiledPixmap(r, pixmap, s); | - | ||||||||||||||||||||||||
| 173 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | void QEmulationPaintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags) | - | ||||||||||||||||||||||||
| 176 | { | - | ||||||||||||||||||||||||
| 177 | real_engine->drawImage(r, pm, sr, flags); | - | ||||||||||||||||||||||||
| 178 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||
| 180 | void QEmulationPaintEngine::clipEnabledChanged() | - | ||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||
| 182 | real_engine->clipEnabledChanged(); | - | ||||||||||||||||||||||||
| 183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | void QEmulationPaintEngine::penChanged() | - | ||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||
| 187 | real_engine->penChanged(); | - | ||||||||||||||||||||||||
| 188 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | void QEmulationPaintEngine::brushChanged() | - | ||||||||||||||||||||||||
| 191 | { | - | ||||||||||||||||||||||||
| 192 | real_engine->brushChanged(); | - | ||||||||||||||||||||||||
| 193 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 194 | - | |||||||||||||||||||||||||
| 195 | void QEmulationPaintEngine::brushOriginChanged() | - | ||||||||||||||||||||||||
| 196 | { | - | ||||||||||||||||||||||||
| 197 | real_engine->brushOriginChanged(); | - | ||||||||||||||||||||||||
| 198 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 199 | - | |||||||||||||||||||||||||
| 200 | void QEmulationPaintEngine::opacityChanged() | - | ||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||
| 202 | real_engine->opacityChanged(); | - | ||||||||||||||||||||||||
| 203 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 204 | - | |||||||||||||||||||||||||
| 205 | void QEmulationPaintEngine::compositionModeChanged() | - | ||||||||||||||||||||||||
| 206 | { | - | ||||||||||||||||||||||||
| 207 | real_engine->compositionModeChanged(); | - | ||||||||||||||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | void QEmulationPaintEngine::renderHintsChanged() | - | ||||||||||||||||||||||||
| 211 | { | - | ||||||||||||||||||||||||
| 212 | real_engine->renderHintsChanged(); | - | ||||||||||||||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | void QEmulationPaintEngine::transformChanged() | - | ||||||||||||||||||||||||
| 216 | { | - | ||||||||||||||||||||||||
| 217 | real_engine->transformChanged(); | - | ||||||||||||||||||||||||
| 218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | void QEmulationPaintEngine::setState(QPainterState *s) | - | ||||||||||||||||||||||||
| 221 | { | - | ||||||||||||||||||||||||
| 222 | QPaintEngine::state = s; | - | ||||||||||||||||||||||||
| 223 | real_engine->setState(s); | - | ||||||||||||||||||||||||
| 224 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||
| 226 | void QEmulationPaintEngine::beginNativePainting() | - | ||||||||||||||||||||||||
| 227 | { | - | ||||||||||||||||||||||||
| 228 | real_engine->beginNativePainting(); | - | ||||||||||||||||||||||||
| 229 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 230 | - | |||||||||||||||||||||||||
| 231 | void QEmulationPaintEngine::endNativePainting() | - | ||||||||||||||||||||||||
| 232 | { | - | ||||||||||||||||||||||||
| 233 | real_engine->endNativePainting(); | - | ||||||||||||||||||||||||
| 234 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | void QEmulationPaintEngine::fillBGRect(const QRectF &r) | - | ||||||||||||||||||||||||
| 237 | { | - | ||||||||||||||||||||||||
| 238 | qreal pts[] = { r.x(), r.y(), r.x() + r.width(), r.y(), | - | ||||||||||||||||||||||||
| 239 | r.x() + r.width(), r.y() + r.height(), r.x(), r.y() + r.height() }; | - | ||||||||||||||||||||||||
| 240 | QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint); | - | ||||||||||||||||||||||||
| 241 | real_engine->fill(vp, state()->bgBrush); | - | ||||||||||||||||||||||||
| 242 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |