summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2015-01-05 10:11:47 -0800
committerBo Xu <bo_xu@foxitsoftware.com>2015-01-05 10:11:47 -0800
commit07f10ae2eede1ad1fbb4424064eaaaa77dfb90d2 (patch)
tree94b66b4acb8a6f2f20a292505e6bfb79acb79085 /fpdfsdk/src
parentd66051b5edfee0279b504b49f7d167f03c17c6dd (diff)
downloadpdfium-07f10ae2eede1ad1fbb4424064eaaaa77dfb90d2.tar.xz
In windows printing, convert src bitmap to dest bitmap using CompositeBitmap.
When dealing with transparency, the printing procedure will generate a bitmap first, then draw this bitmap in windows DC. The format of source bitmap is argb, but the destination bitmap is rgb. Simply doing memcpy will lose the alpha channel information, so CompositeBitmap function is needed. BUG=412908 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/826633002
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfview.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index d8ec8c676a..653702382c 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -383,9 +383,10 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int
if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER)
{
CFX_DIBitmap* pDst = FX_NEW CFX_DIBitmap;
- pDst->Create(pBitmap->GetWidth(), pBitmap->GetHeight(),FXDIB_Rgb32);
- FXSYS_memcpy(pDst->GetBuffer(), pBitmap->GetBuffer(), pBitmap->GetPitch()*pBitmap->GetHeight());
-// WinDC.SetDIBits(pDst,0,0);
+ int pitch = pBitmap->GetPitch();
+ pDst->Create(size_x, size_y, FXDIB_Rgb32);
+ FXSYS_memset(pDst->GetBuffer(), -1, pitch*size_y);
+ pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, NULL);
WinDC.StretchDIBits(pDst,0,0,size_x,size_y);
delete pDst;
}