summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_renderstatus.cpp
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-11-22 12:44:25 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-22 12:44:25 -0800
commit687fbde2e4ee13637cb3fd9b1fec39a436ef73d7 (patch)
tree9c0d588a6494957b1bfeb12944c6f41e07a01711 /core/fpdfapi/render/cpdf_renderstatus.cpp
parent89a2d92549d25df6786d53de5671eb141e1fd3e2 (diff)
downloadpdfium-687fbde2e4ee13637cb3fd9b1fec39a436ef73d7.tar.xz
handle antialiased rendering as premultiplied
Transparencies and bitmap patterns need to be unpremultiplied after Skia renders them so that PDFium can use its own compositing. Also added some linear (i.e. axial) gradient support, although its unclear if any of the test corpus uses this feature. R=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2520073003
Diffstat (limited to 'core/fpdfapi/render/cpdf_renderstatus.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index d2a17d27fc..aad9af04e3 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -893,6 +893,9 @@ std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap(
CPDF_RenderContext context(pDoc, pCache);
context.AppendLayer(pPattern->form(), &mtPattern2Bitmap);
context.Render(&bitmap_device, &options, nullptr);
+#if defined _SKIA_SUPPORT_PATHS_
+ pBitmap->UnPreMultiply();
+#endif
return pBitmap;
}
@@ -1136,9 +1139,6 @@ void CPDF_RenderStatus::ProcessObjectNoClip(CPDF_PageObject* pObj,
#if defined _SKIA_SUPPORT_
DebugVerifyDeviceIsPreMultiplied();
#endif
-#if defined _SKIA_SUPPORT_PATHS_
- UnPreMultiplyDevice();
-#endif
}
bool CPDF_RenderStatus::DrawObjWithBlend(CPDF_PageObject* pObj,
@@ -1547,6 +1547,9 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
nullptr, nullptr, &m_Options, 0, m_bDropObjects,
pFormResource, true);
bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix);
+#if defined _SKIA_SUPPORT_PATHS_
+ bitmap->UnPreMultiply();
+#endif
m_bStopped = bitmap_render.m_bStopped;
if (pSMaskDict) {
CFX_Matrix smask_matrix = *pPageObj->m_GeneralState.GetSMaskMatrix();
@@ -1650,12 +1653,6 @@ void CPDF_RenderStatus::DebugVerifyDeviceIsPreMultiplied() const {
}
#endif
-#if defined _SKIA_SUPPORT_PATHS_
-void CPDF_RenderStatus::UnPreMultiplyDevice() {
- m_pDevice->UnPreMultiplyDevice();
-}
-#endif
-
bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
CFX_PathData* pClippingPath) {