Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2665)

Unified Diff: core/fpdfapi/fpdf_render/fpdf_render_image.cpp

Issue 2120353004: copy graphics state fully (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: wip; remove byte order Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render.cpp ('k') | core/fpdfapi/fpdf_render/render_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_render/fpdf_render_image.cpp
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 10fd5f3f1550f739ed6a24a60b13f84e5fbb5087..b9826a9338f249bd7f4d56780af754212d52cf90 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -63,8 +63,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
#endif
}
#ifdef _SKIA_SUPPORT_
- static_cast<CFX_SkiaDeviceDriver*>(m_pDevice->GetDeviceDriver())
- ->PreMultiply(pDIBitmap);
+ CFX_SkiaDeviceDriver::PreMultiply(pDIBitmap);
#endif
if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
return;
@@ -717,7 +716,7 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() {
bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask);
bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap());
#ifdef _SKIA_SUPPORT_
- bitmap_device1.PreMultiply(); // convert unpremultiplied to premultiplied
+ CFX_SkiaDeviceDriver::PreMultiply(bitmap_device1.GetBitmap());
#endif
if (m_BitmapAlpha < 255) {
bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha);
@@ -737,6 +736,19 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
m_Flags |= RENDER_FORCE_DOWNSAMPLE;
}
}
+#ifdef _SKIA_SUPPORT_
+ CFX_DIBitmap* premultiplied = m_pDIBSource->Clone();
+ CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
+ if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
+ premultiplied, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
+ m_DeviceHandle, m_BlendType)) {
+ if (m_DeviceHandle) {
+ m_Status = 3;
+ return TRUE;
+ }
+ return FALSE;
+ }
+#else
if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
m_DeviceHandle, m_BlendType)) {
@@ -746,6 +758,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() {
}
return FALSE;
}
+#endif
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOutterRect();
int dest_width = image_rect.Width();
« no previous file with comments | « core/fpdfapi/fpdf_render/fpdf_render.cpp ('k') | core/fpdfapi/fpdf_render/render_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698