From 921fe6bfde3b4cf3da4b55fab77103af3a65cab4 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 5 Oct 2017 11:14:12 -0400 Subject: Move CPDF_RenderOptions members to private This CL moves the members of CPDF_RenderOptions to be private members and adds accessor methods as needed. Change-Id: Ie91665ff53ae00cc4c53741d089d375503fabe11 Reviewed-on: https://pdfium-review.googlesource.com/15531 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- fpdfsdk/cpdfsdk_pageview.cpp | 3 ++- fpdfsdk/fpdfformfill.cpp | 18 ++++++++++-------- fpdfsdk/fpdfview.cpp | 34 +++++++++++++++++++++------------- fpdfsdk/pwl/cpwl_edit_impl.cpp | 5 +++-- 4 files changed, 36 insertions(+), 24 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index bdde975267..f46c74f79a 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -117,7 +117,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, CPDFSDK_AnnotIteration annotIteration(this, true); for (const auto& pSDKAnnot : annotIteration) { m_pFormFillEnv->GetAnnotHandlerMgr()->Annot_OnDraw( - this, pSDKAnnot.Get(), pDevice, pUser2Device, pOptions->m_bDrawAnnots); + this, pSDKAnnot.Get(), pDevice, pUser2Device, + pOptions->GetDrawAnnots()); } } diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 3d821b601f..e789df461e 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -120,25 +120,27 @@ void FFLCommon(FPDF_FORMHANDLE hHandle, pDevice->SetClip_Rect(clip); CPDF_RenderOptions options; + uint32_t option_flags = options.GetFlags(); if (flags & FPDF_LCD_TEXT) - options.m_Flags |= RENDER_CLEARTYPE; + option_flags |= RENDER_CLEARTYPE; else - options.m_Flags &= ~RENDER_CLEARTYPE; + option_flags &= ~RENDER_CLEARTYPE; + options.SetFlags(option_flags); // Grayscale output if (flags & FPDF_GRAYSCALE) - options.m_ColorMode = CPDF_RenderOptions::kGray; + options.SetColorMode(CPDF_RenderOptions::kGray); - options.m_bDrawAnnots = flags & FPDF_ANNOT; + options.SetDrawAnnots(flags & FPDF_ANNOT); #ifdef PDF_ENABLE_XFA - options.m_pOCContext = - pdfium::MakeRetain(pPDFDoc, CPDF_OCContext::View); + options.SetOCContext( + pdfium::MakeRetain(pPDFDoc, CPDF_OCContext::View)); if (CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, true)) pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options, clip); #else // PDF_ENABLE_XFA - options.m_pOCContext = pdfium::MakeRetain( - pPage->m_pDocument.Get(), CPDF_OCContext::View); + options.SetOCContext(pdfium::MakeRetain( + pPage->m_pDocument.Get(), CPDF_OCContext::View)); if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) pPageView->PageView_OnDraw(pDevice.get(), &matrix, &options); #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 40851176e2..af1d0db1af 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -80,34 +80,36 @@ void RenderPageImpl(CPDF_PageRenderContext* pContext, if (!pContext->m_pOptions) pContext->m_pOptions = pdfium::MakeUnique(); + uint32_t option_flags = pContext->m_pOptions->GetFlags(); if (flags & FPDF_LCD_TEXT) - pContext->m_pOptions->m_Flags |= RENDER_CLEARTYPE; + option_flags |= RENDER_CLEARTYPE; else - pContext->m_pOptions->m_Flags &= ~RENDER_CLEARTYPE; + option_flags &= ~RENDER_CLEARTYPE; if (flags & FPDF_NO_NATIVETEXT) - pContext->m_pOptions->m_Flags |= RENDER_NO_NATIVETEXT; + option_flags |= RENDER_NO_NATIVETEXT; if (flags & FPDF_RENDER_LIMITEDIMAGECACHE) - pContext->m_pOptions->m_Flags |= RENDER_LIMITEDIMAGECACHE; + option_flags |= RENDER_LIMITEDIMAGECACHE; if (flags & FPDF_RENDER_FORCEHALFTONE) - pContext->m_pOptions->m_Flags |= RENDER_FORCE_HALFTONE; + option_flags |= RENDER_FORCE_HALFTONE; #ifndef PDF_ENABLE_XFA if (flags & FPDF_RENDER_NO_SMOOTHTEXT) - pContext->m_pOptions->m_Flags |= RENDER_NOTEXTSMOOTH; + option_flags |= RENDER_NOTEXTSMOOTH; if (flags & FPDF_RENDER_NO_SMOOTHIMAGE) - pContext->m_pOptions->m_Flags |= RENDER_NOIMAGESMOOTH; + option_flags |= RENDER_NOIMAGESMOOTH; if (flags & FPDF_RENDER_NO_SMOOTHPATH) - pContext->m_pOptions->m_Flags |= RENDER_NOPATHSMOOTH; + option_flags |= RENDER_NOPATHSMOOTH; #endif // PDF_ENABLE_XFA + pContext->m_pOptions->SetFlags(option_flags); // Grayscale output if (flags & FPDF_GRAYSCALE) - pContext->m_pOptions->m_ColorMode = CPDF_RenderOptions::kGray; + pContext->m_pOptions->SetColorMode(CPDF_RenderOptions::kGray); const CPDF_OCContext::UsageType usage = (flags & FPDF_PRINTING) ? CPDF_OCContext::Print : CPDF_OCContext::View; - pContext->m_pOptions->m_pOCContext = - pdfium::MakeRetain(pPage->m_pDocument.Get(), usage); + pContext->m_pOptions->SetOCContext( + pdfium::MakeRetain(pPage->m_pDocument.Get(), usage)); pContext->m_pDevice->SaveState(); pContext->m_pDevice->SetClip_Rect(clipping_rect); @@ -881,7 +883,9 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc, pDevice->Attach(pBitmap, false, nullptr, false); if (bHasMask) { pContext->m_pOptions = pdfium::MakeUnique(); - pContext->m_pOptions->m_Flags |= RENDER_BREAKFORMASKS; + uint32_t option_flags = pContext->m_pOptions->GetFlags(); + option_flags |= RENDER_BREAKFORMASKS; + pContext->m_pOptions->SetFlags(option_flags); } } else { pContext->m_pDevice = pdfium::MakeUnique(dc); @@ -913,7 +917,11 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc, pContext = pPage->GetRenderContext(); pContext->m_pDevice = pdfium::MakeUnique(dc); pContext->m_pOptions = pdfium::MakeUnique(); - pContext->m_pOptions->m_Flags |= RENDER_BREAKFORMASKS; + + uint32_t option_flags = pContext->m_pOptions->GetFlags(); + option_flags |= RENDER_BREAKFORMASKS; + pContext->m_pOptions->SetFlags(option_flags); + FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y, rotate, flags, true, nullptr); diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index 89b19de63d..7d8c0c3ba6 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -59,8 +59,9 @@ void DrawTextString(CFX_RenderDevice* pDevice, } CPDF_RenderOptions ro; - ro.m_Flags = RENDER_CLEARTYPE; - ro.m_ColorMode = CPDF_RenderOptions::kNormal; + ro.SetFlags(RENDER_CLEARTYPE); + + ro.SetColorMode(CPDF_RenderOptions::kNormal); CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, &mt, str, crTextFill, nullptr, &ro); } -- cgit v1.2.3