summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render/cpdf_imagerenderer.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-05 10:27:45 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-05 17:04:57 +0000
commit4ce4f5f8ab0b25ac10a5c66cac1a8c281e24a69b (patch)
tree7853cdd1e63d94c01b1893fef0722433400033a9 /core/fpdfapi/render/cpdf_imagerenderer.cpp
parent645e78a1152b035fb83ac5bbe93715b54f11a1b6 (diff)
downloadpdfium-4ce4f5f8ab0b25ac10a5c66cac1a8c281e24a69b.tar.xz
Cleanup CPDF_RenderStatus
This CL removes friend classes and moves public members to be private in the CPDF_RenderStatus class. Change-Id: Icdd6291bb8c1e5f43386d4a939b1eeaa16b8886d Reviewed-on: https://pdfium-review.googlesource.com/15530 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_imagerenderer.cpp')
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp84
1 files changed, 44 insertions, 40 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index f2ddced6b1..d71bcf49e5 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -60,9 +60,9 @@ bool CPDF_ImageRenderer::StartLoadDIBSource() {
return false;
if (m_Loader.Start(m_pImageObject.Get(),
- m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS,
- m_pRenderStatus->m_GroupFamily,
- m_pRenderStatus->m_bLoadMask, m_pRenderStatus.Get())) {
+ m_pRenderStatus->GetContext()->GetPageCache(), m_bStdCS,
+ m_pRenderStatus->GetGroupFamily(),
+ m_pRenderStatus->GetLoadMask(), m_pRenderStatus.Get())) {
m_Status = 4;
return true;
}
@@ -76,7 +76,8 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
CPDF_GeneralState& state = m_pImageObject->m_GeneralState;
m_BitmapAlpha = FXSYS_round(255 * state.GetFillAlpha());
m_pDIBSource = m_Loader.m_pBitmap;
- if (m_pRenderStatus->m_Options.m_ColorMode == CPDF_RenderOptions::kAlpha &&
+ if (m_pRenderStatus->GetRenderOptions()->m_ColorMode ==
+ CPDF_RenderOptions::kAlpha &&
!m_Loader.m_pMask) {
return StartBitmapAlpha();
}
@@ -103,22 +104,22 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
m_bPatternColor = true;
}
m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject.Get());
- } else if (m_pRenderStatus->m_Options.m_ColorMode ==
+ } else if (m_pRenderStatus->GetRenderOptions()->m_ColorMode ==
CPDF_RenderOptions::kGray) {
m_pClone = m_pDIBSource->Clone(nullptr);
m_pClone->ConvertColorScale(0xffffff, 0);
m_pDIBSource = m_pClone;
}
m_Flags = 0;
- if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE)
+ if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_FORCE_DOWNSAMPLE)
m_Flags |= RENDER_FORCE_DOWNSAMPLE;
- else if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE)
+ else if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_FORCE_HALFTONE)
m_Flags |= RENDER_FORCE_HALFTONE;
- if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY)
+ if (m_pRenderStatus->GetRenderDevice()->GetDeviceClass() != FXDC_DISPLAY)
HandleFilters();
- if (m_pRenderStatus->m_Options.m_Flags & RENDER_NOIMAGESMOOTH)
+ if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_NOIMAGESMOOTH)
m_Flags |= FXDIB_NOSMOOTH;
else if (m_pImageObject->GetImage()->IsInterpol())
m_Flags |= FXDIB_INTERPOL;
@@ -136,7 +137,7 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
}
CPDF_Document* pDocument = nullptr;
CPDF_Page* pPage = nullptr;
- if (auto* pPageCache = m_pRenderStatus->m_pContext->GetPageCache()) {
+ if (auto* pPageCache = m_pRenderStatus->GetContext()->GetPageCache()) {
pPage = pPageCache->GetPage();
pDocument = pPage->m_pDocument.Get();
} else {
@@ -172,8 +173,9 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
m_BlendType = blendType;
m_pObj2Device = pObj2Device;
CPDF_Dictionary* pOC = m_pImageObject->GetImage()->GetOC();
- if (pOC && m_pRenderStatus->m_Options.m_pOCContext &&
- !m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
+ if (pOC && m_pRenderStatus->GetRenderOptions()->m_pOCContext &&
+ !m_pRenderStatus->GetRenderOptions()->m_pOCContext->CheckOCGVisible(
+ pOC)) {
return false;
}
m_ImageMatrix = m_pImageObject->matrix();
@@ -203,13 +205,14 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
}
bool CPDF_ImageRenderer::NotDrawing() const {
- return m_pRenderStatus->m_bPrint &&
- !(m_pRenderStatus->m_pDevice->GetRenderCaps() & FXRC_BLEND_MODE);
+ return m_pRenderStatus->IsPrint() &&
+ !(m_pRenderStatus->GetRenderDevice()->GetRenderCaps() &
+ FXRC_BLEND_MODE);
}
FX_RECT CPDF_ImageRenderer::GetDrawRect() const {
FX_RECT rect = m_ImageMatrix.GetUnitRect().GetOuterRect();
- rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox());
+ rect.Intersect(m_pRenderStatus->GetRenderDevice()->GetClipBox());
return rect;
}
@@ -226,9 +229,9 @@ void CPDF_ImageRenderer::CalculateDrawImage(
CFX_Matrix* pNewMatrix,
const FX_RECT& rect) const {
CPDF_RenderStatus bitmap_render;
- bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), pBitmapDevice2,
+ bitmap_render.Initialize(m_pRenderStatus->GetContext(), pBitmapDevice2,
nullptr, nullptr, nullptr, nullptr, nullptr, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, true);
+ m_pRenderStatus->GetDropObjects(), nullptr, true);
CPDF_ImageRenderer image_render;
if (image_render.Start(&bitmap_render, pDIBSource, 0xffffffff, 255,
pNewMatrix, m_Flags, true, FXDIB_BLEND_NORMAL)) {
@@ -277,10 +280,10 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
bitmap_device1.GetBitmap()->Clear(0xffffff);
CPDF_RenderStatus bitmap_render;
- bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), &bitmap_device1,
+ bitmap_render.Initialize(m_pRenderStatus->GetContext(), &bitmap_device1,
nullptr, nullptr, nullptr, nullptr,
- &m_pRenderStatus->m_Options, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, true);
+ m_pRenderStatus->GetRenderOptions(), 0,
+ m_pRenderStatus->GetDropObjects(), nullptr, true);
CFX_Matrix patternDevice = *pObj2Device;
patternDevice.Translate(static_cast<float>(-rect.left),
static_cast<float>(-rect.top));
@@ -304,7 +307,7 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) {
bitmap_device2.GetBitmap()->ConvertFormat(FXDIB_8bppMask);
bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap());
bitmap_device1.GetBitmap()->MultiplyAlpha(255);
- m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
+ m_pRenderStatus->GetRenderDevice()->SetDIBitsWithBlend(
bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
return false;
}
@@ -330,9 +333,9 @@ bool CPDF_ImageRenderer::DrawMaskedImage() {
bitmap_device1.GetBitmap()->Clear(0xffffff);
#endif
CPDF_RenderStatus bitmap_render;
- bitmap_render.Initialize(m_pRenderStatus->m_pContext.Get(), &bitmap_device1,
+ bitmap_render.Initialize(m_pRenderStatus->GetContext(), &bitmap_device1,
nullptr, nullptr, nullptr, nullptr, nullptr, 0,
- m_pRenderStatus->m_bDropObjects, nullptr, true);
+ m_pRenderStatus->GetDropObjects(), nullptr, true);
CPDF_ImageRenderer image_render;
if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix,
m_Flags, true, FXDIB_BLEND_NORMAL)) {
@@ -351,7 +354,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() {
CalculateDrawImage(&bitmap_device1, &bitmap_device2, m_Loader.m_pMask,
&new_matrix, rect);
#ifdef _SKIA_SUPPORT_
- m_pRenderStatus->m_pDevice->SetBitsWithMask(
+ m_pRenderStatus->GetRenderDevice()->SetBitsWithMask(
bitmap_device1.GetBitmap(), bitmap_device2.GetBitmap(), rect.left,
rect.top, m_BitmapAlpha, m_BlendType);
#else
@@ -359,7 +362,7 @@ bool CPDF_ImageRenderer::DrawMaskedImage() {
bitmap_device1.GetBitmap()->MultiplyAlpha(bitmap_device2.GetBitmap());
if (m_BitmapAlpha < 255)
bitmap_device1.GetBitmap()->MultiplyAlpha(m_BitmapAlpha);
- m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
+ m_pRenderStatus->GetRenderDevice()->SetDIBitsWithBlend(
bitmap_device1.GetBitmap(), rect.left, rect.top, m_BlendType);
#endif // _SKIA_SUPPORT_
return false;
@@ -383,7 +386,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
RetainPtr<CFX_DIBitmap> premultiplied = m_pDIBSource->Clone(nullptr);
if (m_pDIBSource->HasAlpha())
CFX_SkiaDeviceDriver::PreMultiply(premultiplied);
- if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
+ if (m_pRenderStatus->GetRenderDevice()->StartDIBitsWithBlend(
premultiplied, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
&m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
@@ -393,7 +396,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
return false;
}
#else
- if (m_pRenderStatus->m_pDevice->StartDIBitsWithBlend(
+ if (m_pRenderStatus->GetRenderDevice()->StartDIBitsWithBlend(
m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags,
&m_DeviceHandle, m_BlendType)) {
if (m_DeviceHandle) {
@@ -414,7 +417,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
return false;
}
- FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
+ FX_RECT clip_box = m_pRenderStatus->GetRenderDevice()->GetClipBox();
clip_box.Intersect(image_rect);
m_Status = 2;
m_pTransformer = pdfium::MakeUnique<CFX_ImageTransformer>(
@@ -430,7 +433,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
int dest_left = dest_width > 0 ? image_rect.left : image_rect.right;
int dest_top = dest_height > 0 ? image_rect.top : image_rect.bottom;
if (m_pDIBSource->IsOpaqueImage() && m_BitmapAlpha == 255) {
- if (m_pRenderStatus->m_pDevice->StretchDIBitsWithFlagsAndBlend(
+ if (m_pRenderStatus->GetRenderDevice()->StretchDIBitsWithFlagsAndBlend(
m_pDIBSource, dest_left, dest_top, dest_width, dest_height, m_Flags,
m_BlendType)) {
return false;
@@ -439,7 +442,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
if (m_pDIBSource->IsAlphaMask()) {
if (m_BitmapAlpha != 255)
m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- if (m_pRenderStatus->m_pDevice->StretchBitMaskWithFlags(
+ if (m_pRenderStatus->GetRenderDevice()->StretchBitMaskWithFlags(
m_pDIBSource, dest_left, dest_top, dest_width, dest_height,
m_FillArgb, m_Flags)) {
return false;
@@ -450,7 +453,7 @@ bool CPDF_ImageRenderer::StartDIBSource() {
return true;
}
- FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox();
+ FX_RECT clip_box = m_pRenderStatus->GetRenderDevice()->GetClipBox();
FX_RECT dest_rect = clip_box;
dest_rect.Intersect(image_rect);
FX_RECT dest_clip(
@@ -473,8 +476,8 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() {
path.Transform(&m_ImageMatrix);
uint32_t fill_color =
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
- m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0,
- FXFILL_WINDING);
+ m_pRenderStatus->GetRenderDevice()->DrawPath(&path, nullptr, nullptr,
+ fill_color, 0, FXFILL_WINDING);
return false;
}
RetainPtr<CFX_DIBSource> pAlphaMask;
@@ -491,7 +494,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() {
if (!pTransformed)
return true;
- m_pRenderStatus->m_pDevice->SetBitMask(
+ m_pRenderStatus->GetRenderDevice()->SetBitMask(
pTransformed, left, top,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
@@ -504,7 +507,7 @@ bool CPDF_ImageRenderer::StartBitmapAlpha() {
m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();
int left = dest_width > 0 ? image_rect.left : image_rect.right;
int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
- m_pRenderStatus->m_pDevice->StretchBitMask(
+ m_pRenderStatus->GetRenderDevice()->StretchBitMask(
pAlphaMask, left, top, dest_width, dest_height,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
@@ -522,21 +525,22 @@ bool CPDF_ImageRenderer::Continue(IFX_PauseIndicator* pPause) {
if (pBitmap->IsAlphaMask()) {
if (m_BitmapAlpha != 255)
m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
- m_Result = m_pRenderStatus->m_pDevice->SetBitMask(
+ m_Result = m_pRenderStatus->GetRenderDevice()->SetBitMask(
pBitmap, m_pTransformer->result().left, m_pTransformer->result().top,
m_FillArgb);
} else {
if (m_BitmapAlpha != 255)
pBitmap->MultiplyAlpha(m_BitmapAlpha);
- m_Result = m_pRenderStatus->m_pDevice->SetDIBitsWithBlend(
+ m_Result = m_pRenderStatus->GetRenderDevice()->SetDIBitsWithBlend(
pBitmap, m_pTransformer->result().left, m_pTransformer->result().top,
m_BlendType);
}
return false;
}
- if (m_Status == 3)
- return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle.get(),
- pPause);
+ if (m_Status == 3) {
+ return m_pRenderStatus->GetRenderDevice()->ContinueDIBits(
+ m_DeviceHandle.get(), pPause);
+ }
if (m_Status == 4) {
if (m_Loader.Continue(pPause, m_pRenderStatus.Get()))