From 739ad76846bc3d49472aacad9ed056cda314e26f Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Wed, 21 May 2014 11:10:50 +0200 Subject: 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 Reviewed-by: Gunnar Sletta --- src/printsupport/kernel/qprintengine_win.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/printsupport/kernel/qprintengine_win.cpp') 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); -- cgit v1.2.3