summaryrefslogtreecommitdiffstats
path: root/src/printsupport/kernel/qprintengine_win.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@digia.com>2014-05-21 11:10:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-31 14:29:31 +0200
commit739ad76846bc3d49472aacad9ed056cda314e26f (patch)
tree21c60bbcbb7075573e3d78dfce5f78a4c034bb66 /src/printsupport/kernel/qprintengine_win.cpp
parent9ce8a6b94cd92ef78224bb126979b80d7764bfbf (diff)
Do not always fallback to bitmap printing when printing alpha.
The previous code resulted in that all regions that had some alpha blending content had to be rasterized as bitmaps. With this patch, we only need to fallback to proper alpha blending if there is a background content to blend against. If there is no background content we simly assume that the background is white (which happen to be the most common paper color). It will then be treated as a solid background. Task-number: QTBUG-33548 Change-Id: I9d2c9be95a701704cdb3724480421db49b4cdd98 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Diffstat (limited to 'src/printsupport/kernel/qprintengine_win.cpp')
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index 52b67d162b..8fbf20529c 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -573,7 +573,13 @@ void QWin32PrintEngine::drawPixmap(const QRectF &targetRect,
width = (tw - (x * txinc));
}
- QPixmap p = pixmap.copy(tileSize * x, tileSize * y, imgw, imgh);
+
+ QImage img(QSize(imgw, imgh), QImage::Format_RGB32);
+ img.fill(Qt::white);
+ QPainter painter(&img);
+ painter.drawPixmap(0,0, pixmap, tileSize * x, tileSize * y, imgw, imgh);
+ QPixmap p = QPixmap::fromImage(img);
+
HBITMAP hbitmap = qt_pixmapToWinHBITMAP(p, HBitmapNoAlpha);
HDC display_dc = GetDC(0);
HDC hbitmap_hdc = CreateCompatibleDC(display_dc);