summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp18
-rw-r--r--core/fpdfapi/render/cpdf_progressiverenderer.cpp8
-rw-r--r--core/fpdfapi/render/cpdf_rendercontext.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_renderoptions.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_renderoptions.h18
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp70
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp13
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp4
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp3
-rw-r--r--fpdfsdk/fpdfformfill.cpp18
-rw-r--r--fpdfsdk/fpdfview.cpp34
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp5
13 files changed, 119 insertions, 86 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index d71bcf49e5..6efc62c84b 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -76,8 +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->GetRenderOptions()->m_ColorMode ==
- CPDF_RenderOptions::kAlpha &&
+ if (m_pRenderStatus->GetRenderOptions()->ColorModeIs(
+ CPDF_RenderOptions::kAlpha) &&
!m_Loader.m_pMask) {
return StartBitmapAlpha();
}
@@ -104,22 +104,22 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() {
m_bPatternColor = true;
}
m_FillArgb = m_pRenderStatus->GetFillArgb(m_pImageObject.Get());
- } else if (m_pRenderStatus->GetRenderOptions()->m_ColorMode ==
- CPDF_RenderOptions::kGray) {
+ } else if (m_pRenderStatus->GetRenderOptions()->ColorModeIs(
+ CPDF_RenderOptions::kGray)) {
m_pClone = m_pDIBSource->Clone(nullptr);
m_pClone->ConvertColorScale(0xffffff, 0);
m_pDIBSource = m_pClone;
}
m_Flags = 0;
- if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_FORCE_DOWNSAMPLE)
+ if (m_pRenderStatus->GetRenderOptions()->HasFlag(RENDER_FORCE_DOWNSAMPLE))
m_Flags |= RENDER_FORCE_DOWNSAMPLE;
- else if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_FORCE_HALFTONE)
+ else if (m_pRenderStatus->GetRenderOptions()->HasFlag(RENDER_FORCE_HALFTONE))
m_Flags |= RENDER_FORCE_HALFTONE;
if (m_pRenderStatus->GetRenderDevice()->GetDeviceClass() != FXDC_DISPLAY)
HandleFilters();
- if (m_pRenderStatus->GetRenderOptions()->m_Flags & RENDER_NOIMAGESMOOTH)
+ if (m_pRenderStatus->GetRenderOptions()->HasFlag(RENDER_NOIMAGESMOOTH))
m_Flags |= FXDIB_NOSMOOTH;
else if (m_pImageObject->GetImage()->IsInterpol())
m_Flags |= FXDIB_INTERPOL;
@@ -173,8 +173,8 @@ bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus,
m_BlendType = blendType;
m_pObj2Device = pObj2Device;
CPDF_Dictionary* pOC = m_pImageObject->GetImage()->GetOC();
- if (pOC && m_pRenderStatus->GetRenderOptions()->m_pOCContext &&
- !m_pRenderStatus->GetRenderOptions()->m_pOCContext->CheckOCGVisible(
+ if (pOC && m_pRenderStatus->GetRenderOptions()->GetOCContext() &&
+ !m_pRenderStatus->GetRenderOptions()->GetOCContext()->CheckOCGVisible(
pOC)) {
return false;
}
diff --git a/core/fpdfapi/render/cpdf_progressiverenderer.cpp b/core/fpdfapi/render/cpdf_progressiverenderer.cpp
index 275fc6b85e..603c951856 100644
--- a/core/fpdfapi/render/cpdf_progressiverenderer.cpp
+++ b/core/fpdfapi/render/cpdf_progressiverenderer.cpp
@@ -80,7 +80,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_PauseIndicator* pPause) {
pCurObj->m_Right >= m_ClipRect.left &&
pCurObj->m_Bottom <= m_ClipRect.top &&
pCurObj->m_Top >= m_ClipRect.bottom) {
- if (m_pOptions->m_Flags & RENDER_BREAKFORMASKS && pCurObj->IsImage() &&
+ if (m_pOptions->HasFlag(RENDER_BREAKFORMASKS) && pCurObj->IsImage() &&
pCurObj->AsImage()->GetImage()->IsMask()) {
if (m_pDevice->GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER) {
m_LastObjectRendered = iter;
@@ -94,10 +94,10 @@ void CPDF_ProgressiveRenderer::Continue(IFX_PauseIndicator* pPause) {
pCurObj, &m_pCurrentLayer->m_Matrix, pPause)) {
return;
}
- if (pCurObj->IsImage() && m_pRenderStatus->GetRenderOptions()->m_Flags &
- RENDER_LIMITEDIMAGECACHE) {
+ if (pCurObj->IsImage() && m_pRenderStatus->GetRenderOptions()->HasFlag(
+ RENDER_LIMITEDIMAGECACHE)) {
m_pContext->GetPageCache()->CacheOptimization(
- m_pRenderStatus->GetRenderOptions()->m_dwLimitCacheSize);
+ m_pRenderStatus->GetRenderOptions()->GetCacheSizeLimit());
}
if (pCurObj->IsForm() || pCurObj->IsShading())
nObjsToGo = 0;
diff --git a/core/fpdfapi/render/cpdf_rendercontext.cpp b/core/fpdfapi/render/cpdf_rendercontext.cpp
index 2fc7da812d..bba24d683c 100644
--- a/core/fpdfapi/render/cpdf_rendercontext.cpp
+++ b/core/fpdfapi/render/cpdf_rendercontext.cpp
@@ -78,9 +78,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice,
nullptr);
status.RenderObjectList(layer.m_pObjectHolder.Get(), &layer.m_Matrix);
}
- if (status.GetRenderOptions()->m_Flags & RENDER_LIMITEDIMAGECACHE) {
+ if (status.GetRenderOptions()->HasFlag(RENDER_LIMITEDIMAGECACHE)) {
m_pPageCache->CacheOptimization(
- status.GetRenderOptions()->m_dwLimitCacheSize);
+ status.GetRenderOptions()->GetCacheSizeLimit());
}
if (status.IsStopped())
break;
diff --git a/core/fpdfapi/render/cpdf_renderoptions.cpp b/core/fpdfapi/render/cpdf_renderoptions.cpp
index 7916243cba..9af951137e 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.cpp
+++ b/core/fpdfapi/render/cpdf_renderoptions.cpp
@@ -22,9 +22,9 @@ CPDF_RenderOptions::CPDF_RenderOptions(const CPDF_RenderOptions& rhs)
CPDF_RenderOptions::~CPDF_RenderOptions() {}
FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const {
- if (m_ColorMode == kNormal)
+ if (ColorModeIs(kNormal))
return argb;
- if (m_ColorMode == kAlpha)
+ if (ColorModeIs(kAlpha))
return argb;
int a;
diff --git a/core/fpdfapi/render/cpdf_renderoptions.h b/core/fpdfapi/render/cpdf_renderoptions.h
index 1f6afc30e2..9dca633f3f 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.h
+++ b/core/fpdfapi/render/cpdf_renderoptions.h
@@ -40,6 +40,24 @@ class CPDF_RenderOptions {
FX_ARGB TranslateColor(FX_ARGB argb) const;
+ void SetColorMode(Type mode) { m_ColorMode = mode; }
+ bool ColorModeIs(Type mode) const { return m_ColorMode == mode; }
+
+ bool HasFlag(uint32_t flag) const { return !!(m_Flags & flag); }
+ uint32_t GetFlags() const { return m_Flags; }
+ void SetFlags(uint32_t flags) { m_Flags = flags; }
+
+ uint32_t GetCacheSizeLimit() const { return m_dwLimitCacheSize; }
+
+ void SetDrawAnnots(bool draw) { m_bDrawAnnots = draw; }
+ bool GetDrawAnnots() const { return m_bDrawAnnots; }
+
+ void SetOCContext(RetainPtr<CPDF_OCContext> context) {
+ m_pOCContext = context;
+ }
+ CPDF_OCContext* GetOCContext() const { return m_pOCContext.Get(); }
+
+ private:
Type m_ColorMode;
uint32_t m_Flags;
uint32_t m_dwLimitCacheSize;
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 906143048d..935fb64ca6 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -937,10 +937,11 @@ RetainPtr<CFX_DIBitmap> DrawPatternBitmap(CPDF_Document* pDoc,
mtPattern2Bitmap.Concat(mtAdjust);
CPDF_RenderOptions options;
if (!pPattern->colored())
- options.m_ColorMode = CPDF_RenderOptions::kAlpha;
+ options.SetColorMode(CPDF_RenderOptions::kAlpha);
flags |= RENDER_FORCE_HALFTONE;
- options.m_Flags = flags;
+ options.SetFlags(flags);
+
CPDF_RenderContext context(pDoc, pCache);
context.AppendLayer(pPattern->form(), &mtPattern2Bitmap);
context.Render(&bitmap_device, &options, nullptr);
@@ -1084,8 +1085,8 @@ void CPDF_RenderStatus::RenderSingleObject(CPDF_PageObject* pObj,
return;
}
m_pCurObj = pObj;
- if (m_Options.m_pOCContext && pObj->m_ContentMark.HasRef()) {
- if (!m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
+ if (m_Options.GetOCContext() && pObj->m_ContentMark.HasRef()) {
+ if (!m_Options.GetOCContext()->CheckObjectVisible(pObj)) {
return;
}
}
@@ -1113,8 +1114,8 @@ bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj,
}
m_pCurObj = pObj;
- if (m_Options.m_pOCContext && pObj->m_ContentMark.HasRef() &&
- !m_Options.m_pOCContext->CheckObjectVisible(pObj)) {
+ if (m_Options.GetOCContext() && pObj->m_ContentMark.HasRef() &&
+ !m_Options.GetOCContext()->CheckObjectVisible(pObj)) {
return false;
}
@@ -1254,8 +1255,8 @@ bool CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj,
DebugVerifyDeviceIsPreMultiplied();
#endif
CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDictFor("OC");
- if (pOC && m_Options.m_pOCContext &&
- !m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
+ if (pOC && m_Options.GetOCContext() &&
+ !m_Options.GetOCContext()->CheckOCGVisible(pOC)) {
return true;
}
CFX_Matrix matrix = pFormObj->m_FormMatrix;
@@ -1295,11 +1296,11 @@ bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
if (!IsAvailableMatrix(path_matrix))
return true;
- if (FillType && (m_Options.m_Flags & RENDER_RECT_AA))
+ if (FillType && (m_Options.HasFlag(RENDER_RECT_AA)))
FillType |= FXFILL_RECT_AA;
- if (m_Options.m_Flags & RENDER_FILL_FULLCOVER)
+ if (m_Options.HasFlag(RENDER_FILL_FULLCOVER))
FillType |= FXFILL_FULLCOVER;
- if (m_Options.m_Flags & RENDER_NOPATHSMOOTH)
+ if (m_Options.HasFlag(RENDER_NOPATHSMOOTH))
FillType |= FXFILL_NOPATHSMOOTH;
if (bStroke)
FillType |= FX_FILL_STROKE;
@@ -1312,7 +1313,7 @@ bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj,
FillType |= FX_FILL_TEXT_MODE;
CFX_GraphState graphState = pPathObj->m_GraphState;
- if (m_Options.m_Flags & RENDER_THINLINE)
+ if (m_Options.HasFlag(RENDER_THINLINE))
graphState.SetLineWidth(0);
return m_pDevice->DrawPathWithBlend(
pPathObj->m_Path.GetObject(), &path_matrix, graphState.GetObject(),
@@ -1436,7 +1437,7 @@ void CPDF_RenderStatus::ProcessClipPath(const CPDF_ClipPath& ClipPath,
continue;
int fill_mode = FXFILL_WINDING;
- if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH)
+ if (m_Options.HasFlag(RENDER_NOTEXTSMOOTH))
fill_mode |= FXFILL_NOPATHSMOOTH;
m_pDevice->SetClip_PathFill(pTextClippingPath.get(), nullptr, fill_mode);
pTextClippingPath.reset();
@@ -1450,13 +1451,13 @@ bool CPDF_RenderStatus::SelectClipPath(const CPDF_PathObject* pPathObj,
path_matrix.Concat(*pObj2Device);
if (bStroke) {
CFX_GraphState graphState = pPathObj->m_GraphState;
- if (m_Options.m_Flags & RENDER_THINLINE)
+ if (m_Options.HasFlag(RENDER_THINLINE))
graphState.SetLineWidth(0);
return m_pDevice->SetClip_PathStroke(pPathObj->m_Path.GetObject(),
&path_matrix, graphState.GetObject());
}
int fill_mode = pPathObj->m_FillType;
- if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) {
+ if (m_Options.HasFlag(RENDER_NOPATHSMOOTH)) {
fill_mode |= FXFILL_NOPATHSMOOTH;
}
return m_pDevice->SetClip_PathFill(pPathObj->m_Path.GetObject(), &path_matrix,
@@ -1497,7 +1498,7 @@ bool CPDF_RenderStatus::ProcessTransparency(CPDF_PageObject* pPageObj,
(pPageObj->m_ClipPath.HasRef() && pPageObj->m_ClipPath.GetTextCount() &&
m_pDevice->GetDeviceClass() == FXDC_DISPLAY &&
!(m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP));
- if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() &&
+ if ((m_Options.HasFlag(RENDER_OVERPRINT)) && pPageObj->IsImage() &&
pPageObj->m_GeneralState.GetFillOP() &&
pPageObj->m_GeneralState.GetStrokeOP()) {
CPDF_Document* pDocument = nullptr;
@@ -1802,7 +1803,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj,
}
if (textobj->m_GeneralState.GetStrokeAdjust())
flag |= FX_STROKE_ADJUST;
- if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH)
+ if (m_Options.HasFlag(RENDER_NOTEXTSMOOTH))
flag |= FXFILL_NOPATHSMOOTH;
return CPDF_TextRenderer::DrawTextPath(
m_pDevice, textobj->GetCharCodes(), textobj->GetCharPositions(), pFont,
@@ -1880,9 +1881,12 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
}
std::unique_ptr<CPDF_GraphicStates> pStates =
CloneObjStates(textobj, false);
- CPDF_RenderOptions Options = m_Options;
- Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA;
- Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE;
+ CPDF_RenderOptions options = m_Options;
+ uint32_t option_flags = options.GetFlags();
+ option_flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA;
+ option_flags &= ~RENDER_FORCE_DOWNSAMPLE;
+ options.SetFlags(option_flags);
+
CPDF_Dictionary* pFormResource = nullptr;
if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) {
pFormResource =
@@ -1891,7 +1895,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
if (fill_alpha == 255) {
CPDF_RenderStatus status;
status.Initialize(m_pContext.Get(), m_pDevice, nullptr, nullptr, this,
- pStates.get(), &Options,
+ pStates.get(), &options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache = m_Type3FontCache;
@@ -1912,7 +1916,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj,
bitmap_device.GetBitmap()->Clear(0);
CPDF_RenderStatus status;
status.Initialize(m_pContext.Get(), &bitmap_device, nullptr, nullptr,
- this, pStates.get(), &Options,
+ this, pStates.get(), &options,
pType3Char->m_pForm->m_Transparency, m_bDropObjects,
pFormResource, false, pType3Char, fill_argb);
status.m_Type3FontCache = m_Type3FontCache;
@@ -2093,7 +2097,6 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
return;
pBitmap->Clear(background);
- int fill_mode = m_Options.m_Flags;
switch (pPattern->GetShadingType()) {
case kInvalidShading:
case kMaxShading:
@@ -2130,14 +2133,15 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
// the case of dictionary at the moment.
if (CPDF_Stream* pStream = ToStream(pPattern->GetShadingObject())) {
DrawCoonPatchMeshes(pPattern->GetShadingType(), pBitmap, &FinalMatrix,
- pStream, funcs, pColorSpace, fill_mode, alpha);
+ pStream, funcs, pColorSpace, m_Options.GetFlags(),
+ alpha);
}
} break;
}
if (bAlphaMode)
pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
- if (m_Options.m_ColorMode == CPDF_RenderOptions::kGray)
+ if (m_Options.ColorModeIs(CPDF_RenderOptions::kGray))
pBitmap->ConvertColorScale(0, 0xffffff);
buffer.OutputToDevice();
}
@@ -2169,7 +2173,7 @@ void CPDF_RenderStatus::DrawShadingPattern(CPDF_ShadingPattern* pattern,
FXSYS_round(255 * (bStroke ? pPageObj->m_GeneralState.GetStrokeAlpha()
: pPageObj->m_GeneralState.GetFillAlpha()));
DrawShading(pattern, &matrix, rect, alpha,
- m_Options.m_ColorMode == CPDF_RenderOptions::kAlpha);
+ m_Options.ColorModeIs(CPDF_RenderOptions::kAlpha));
}
void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj,
@@ -2184,7 +2188,7 @@ void CPDF_RenderStatus::ProcessShading(const CPDF_ShadingObject* pShadingObj,
matrix.Concat(*pObj2Device);
DrawShading(pShadingObj->m_pShading.Get(), &matrix, rect,
FXSYS_round(255 * pShadingObj->m_GeneralState.GetFillAlpha()),
- m_Options.m_ColorMode == CPDF_RenderOptions::kAlpha);
+ m_Options.ColorModeIs(CPDF_RenderOptions::kAlpha));
}
void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
@@ -2296,19 +2300,19 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
if (width * height < 16) {
RetainPtr<CFX_DIBitmap> pEnlargedBitmap =
DrawPatternBitmap(m_pContext->GetDocument(), m_pContext->GetPageCache(),
- pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
+ pPattern, pObj2Device, 8, 8, m_Options.GetFlags());
pPatternBitmap = pEnlargedBitmap->StretchTo(width, height, 0, nullptr);
} else {
pPatternBitmap = DrawPatternBitmap(
m_pContext->GetDocument(), m_pContext->GetPageCache(), pPattern,
- pObj2Device, width, height, m_Options.m_Flags);
+ pObj2Device, width, height, m_Options.GetFlags());
}
if (!pPatternBitmap)
return;
- if (m_Options.m_ColorMode == CPDF_RenderOptions::kGray) {
+ if (m_Options.ColorModeIs(CPDF_RenderOptions::kGray))
pPatternBitmap->ConvertColorScale(0, 0xffffff);
- }
+
FX_ARGB fill_argb = GetFillArgb(pPageObj);
int clip_width = clip_box.right - clip_box.left;
int clip_height = clip_box.bottom - clip_box.top;
@@ -2611,8 +2615,8 @@ RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask(
pFormResource = form.m_pFormDict->GetDictFor("Resources");
}
CPDF_RenderOptions options;
- options.m_ColorMode =
- bLuminosity ? CPDF_RenderOptions::kNormal : CPDF_RenderOptions::kAlpha;
+ options.SetColorMode(bLuminosity ? CPDF_RenderOptions::kNormal
+ : CPDF_RenderOptions::kAlpha);
CPDF_RenderStatus status;
status.Initialize(m_pContext.Get(), &bitmap_device, nullptr, nullptr, nullptr,
nullptr, &options, 0, m_bDropObjects, pFormResource, true,
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 283d9946fa..711dbfaf39 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -125,19 +125,18 @@ bool CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
return true;
int FXGE_flags = 0;
if (pOptions) {
- uint32_t dwFlags = pOptions->m_Flags;
- if (dwFlags & RENDER_CLEARTYPE) {
+ if (pOptions->HasFlag(RENDER_CLEARTYPE)) {
FXGE_flags |= FXTEXT_CLEARTYPE;
- if (dwFlags & RENDER_BGR_STRIPE)
+ if (pOptions->HasFlag(RENDER_BGR_STRIPE))
FXGE_flags |= FXTEXT_BGR_STRIPE;
}
- if (dwFlags & RENDER_NOTEXTSMOOTH)
+ if (pOptions->HasFlag(RENDER_NOTEXTSMOOTH))
FXGE_flags |= FXTEXT_NOSMOOTH;
- if (dwFlags & RENDER_PRINTGRAPHICTEXT)
+ if (pOptions->HasFlag(RENDER_PRINTGRAPHICTEXT))
FXGE_flags |= FXTEXT_PRINTGRAPHICTEXT;
- if (dwFlags & RENDER_NO_NATIVETEXT)
+ if (pOptions->HasFlag(RENDER_NO_NATIVETEXT))
FXGE_flags |= FXTEXT_NO_NATIVETEXT;
- if (dwFlags & RENDER_PRINTIMAGETEXT)
+ if (pOptions->HasFlag(RENDER_PRINTIMAGETEXT))
FXGE_flags |= FXTEXT_PRINTIMAGETEXT;
} else {
FXGE_flags = FXTEXT_CLEARTYPE;
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 1a8538057c..1ccb890c04 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -418,7 +418,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
return;
}
bool bPrinting = pDevice->GetDeviceClass() == FXDC_PRINTER ||
- (pOptions && (pOptions->m_Flags & RENDER_PRINTPREVIEW));
+ (pOptions && (pOptions->HasFlag(RENDER_PRINTPREVIEW)));
if (bPrinting && (annot_flags & ANNOTFLAG_PRINT) == 0) {
return;
}
@@ -501,7 +501,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
path.AppendRect(rect.left + width, rect.bottom + width, rect.right - width,
rect.top - width);
int fill_type = 0;
- if (pOptions && (pOptions->m_Flags & RENDER_NOPATHSMOOTH))
+ if (pOptions && (pOptions->HasFlag(RENDER_NOPATHSMOOTH)))
fill_type |= FXFILL_NOPATHSMOOTH;
pDevice->DrawPath(&path, pUser2Device, &graph_state, argb, argb, fill_type);
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 503c533b84..9224943d1e 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -141,10 +141,10 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
continue;
if (pOptions) {
- RetainPtr<CPDF_OCContext> pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
- if (pOCContext && pAnnotDict &&
- !pOCContext->CheckOCGVisible(pAnnotDict->GetDictFor("OC"))) {
+ if (pOptions->GetOCContext() && pAnnotDict &&
+ !pOptions->GetOCContext()->CheckOCGVisible(
+ pAnnotDict->GetDictFor("OC"))) {
continue;
}
}
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<CPDF_OCContext>(pPDFDoc, CPDF_OCContext::View);
+ options.SetOCContext(
+ pdfium::MakeRetain<CPDF_OCContext>(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<CPDF_OCContext>(
- pPage->m_pDocument.Get(), CPDF_OCContext::View);
+ options.SetOCContext(pdfium::MakeRetain<CPDF_OCContext>(
+ 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<CPDF_RenderOptions>();
+ 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<CPDF_OCContext>(pPage->m_pDocument.Get(), usage);
+ pContext->m_pOptions->SetOCContext(
+ pdfium::MakeRetain<CPDF_OCContext>(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<CPDF_RenderOptions>();
- 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<CFX_WindowsRenderDevice>(dc);
@@ -913,7 +917,11 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_RenderPage(HDC dc,
pContext = pPage->GetRenderContext();
pContext->m_pDevice = pdfium::MakeUnique<CFX_WindowsRenderDevice>(dc);
pContext->m_pOptions = pdfium::MakeUnique<CPDF_RenderOptions>();
- 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);
}