summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-11-01 11:49:41 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-11-01 13:05:09 (GMT)
commit60da9087f137f59d6b34e3b5c12f7c266de2d1f0 (patch)
tree844d0c61490426bfef9b778d0a14902de1c1bf9c /src
parent35a55ddea4d942344eb49b28efe15889e7d023f0 (diff)
downloadQt-60da9087f137f59d6b34e3b5c12f7c266de2d1f0.zip
Qt-60da9087f137f59d6b34e3b5c12f7c266de2d1f0.tar.gz
Qt-60da9087f137f59d6b34e3b5c12f7c266de2d1f0.tar.bz2
Make use of the fast image paths for CompositionMode_Source as well.
Blending / blitting of images without an alpha-channel gives the same result with CompositionMode_Source and CompositionMode_SourceOver. Task-number: QTBUG-14901 Reviewed-by: Kim
Diffstat (limited to 'src')
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp17
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h1
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 4b3e14d..a2da94c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2483,7 +2483,7 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img)
const QClipData *clip = d->clip();
QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy());
- if (s->flags.fast_images) {
+ if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
if (func) {
if (!clip) {
@@ -2664,7 +2664,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
bool exceedsPrecision = targetBounds.width() > 0xffff
|| targetBounds.height() > 0xffff;
- if (s->flags.fast_images && !exceedsPrecision) {
+ if (!exceedsPrecision && d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
if (s->matrix.type() > QTransform::TxScale) {
SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()];
if (func && (!clip || clip->hasRectClip)) {
@@ -2736,8 +2736,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
fillPath(path, &d->image_filler_xform);
s->matrix = m;
} else {
-
- if (s->flags.fast_images) {
+ if (d->canUseFastImageBlending(d->rasterBuffer->compositionMode, img)) {
SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()];
if (func) {
QPointF pt(r.x() + s->matrix.dx(), r.y() + s->matrix.dy());
@@ -4291,11 +4290,19 @@ void QRasterPaintEnginePrivate::recalculateFastImages()
QRasterPaintEngineState *s = q->state();
s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform)
- && rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
&& s->matrix.type() <= QTransform::TxShear;
}
+bool QRasterPaintEnginePrivate::canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const
+{
+ Q_Q(const QRasterPaintEngine);
+ const QRasterPaintEngineState *s = q->state();
+ return s->flags.fast_images
+ && (mode == QPainter::CompositionMode_SourceOver
+ || (mode == QPainter::CompositionMode_Source
+ && !image.hasAlphaChannel()));
+}
QImage QRasterBuffer::colorizeBitmap(const QImage &image, const QColor &color)
{
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index fd635e6..404528c 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -340,6 +340,7 @@ public:
void initializeRasterizer(QSpanData *data);
void recalculateFastImages();
+ bool canUseFastImageBlending(QPainter::CompositionMode mode, const QImage &image) const;
QPaintDevice *device;
QScopedPointer<QOutlineMapper> outlineMapper;