void QEmulationPaintEngine::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints) { if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) { qreal oldOpacity = real_engine->state()->opacity; QTransform oldTransform = real_engine->state()->matrix; for (int i = 0; i < fragmentCount; ++i) { QTransform transform = oldTransform; transform.translate(fragments[i].x, fragments[i].y); transform.rotate(fragments[i].rotation); real_engine->state()->opacity = oldOpacity * fragments[i].opacity; real_engine->state()->matrix = transform; real_engine->opacityChanged(); real_engine->transformChanged(); qreal w = fragments[i].scaleX * fragments[i].width; qreal h = fragments[i].scaleY * fragments[i].height; fillBGRect(QRectF(-0.5 * w, -0.5 * h, w, h)); } real_engine->state()->opacity = oldOpacity; real_engine->state()->matrix = oldTransform; real_engine->opacityChanged(); real_engine->transformChanged(); } real_engine->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); }
void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) { if (state()->bgMode == Qt::OpaqueMode) { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); fillBGRect(rect); } real_engine->drawTextItem(p, textItem); }
void QEmulationPaintEngine::drawPixmapFragments(const QRectF *targetRects, const QRectF *sourceRects, int fragmentCount, const QPixmap &pixmap, QPainter::PixmapFragmentHints hints) { if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) { for (int i = 0; i < fragmentCount; ++i) fillBGRect(targetRects[i]); } real_engine->drawPixmapFragments(targetRects, sourceRects, fragmentCount, pixmap, hints); }
void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) { if (state()->bgMode == Qt::OpaqueMode) { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); fillBGRect(rect); } QPainterState *s = state(); Qt::BrushStyle style = qbrush_style(s->pen.brush()); if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { QPen savedPen = s->pen; QGradient g = *s->pen.brush().gradient(); if (g.coordinateMode() > QGradient::LogicalMode) { QTransform mat = s->pen.brush().transform(); if (g.coordinateMode() == QGradient::StretchToDeviceMode) { mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height()); } else if (g.coordinateMode() == QGradient::ObjectBoundingMode) { const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem); QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal()); mat.translate(r.x(), r.y()); mat.scale(r.width(), r.height()); } g.setCoordinateMode(QGradient::LogicalMode); QBrush brush(g); brush.setTransform(mat); s->pen.setBrush(brush); penChanged(); real_engine->drawTextItem(p, textItem); s->pen = savedPen; penChanged(); return; } } real_engine->drawTextItem(p, textItem); }
void QEmulationPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) { if (state()->bgMode == Qt::OpaqueMode && pixmap.isQBitmap()) fillBGRect(r); real_engine->drawTiledPixmap(r, pixmap, s); }
void QEmulationPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { if (state()->bgMode == Qt::OpaqueMode && pm.isQBitmap()) fillBGRect(r); real_engine->drawPixmap(r, pm, sr); }