diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-17 13:41:13 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-17 13:41:13 -0800 |
commit | 979ddd8e4d331b330360f321b7b0c1acaead6445 (patch) | |
tree | 473af0a917597b08b66c4154cfd4c8e5fdd0a923 /core/src/fpdfdoc | |
parent | 1871821653de9f4b1706d726f4d318cf739e55af (diff) | |
download | pdfium-979ddd8e4d331b330360f321b7b0c1acaead6445.tar.xz |
Merge to XFA: Tidy CPDF_RenderContext
Original Review URL: https://codereview.chromium.org/1536623004 .
(cherry picked from commit 761660c4074269ac806d06c9bef70e4e9fb0eb29)
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1531423002 .
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r-- | core/src/fpdfdoc/doc_annot.cpp | 13 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_formcontrol.cpp | 16 |
2 files changed, 13 insertions, 16 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 8f3d7f99eb..f4a75e6afc 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -46,7 +46,7 @@ CPDF_AnnotList::~CPDF_AnnotList() { delete annot; } -void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, +void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, FX_BOOL bPrinting, @@ -97,7 +97,7 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage, } } -void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage, +void CPDF_AnnotList::DisplayAnnots(CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, FX_BOOL bPrinting, @@ -216,7 +216,7 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage, matrix.Concat(*pUser2Device); return pForm; } -FX_BOOL CPDF_Annot::DrawAppearance(const CPDF_Page* pPage, +FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_Matrix* pUser2Device, AppearanceMode mode, @@ -227,13 +227,12 @@ FX_BOOL CPDF_Annot::DrawAppearance(const CPDF_Page* pPage, if (!pForm) { return FALSE; } - CPDF_RenderContext context; - context.Create((CPDF_Page*)pPage); + CPDF_RenderContext context(pPage); context.DrawObjectList(pDevice, pForm, &matrix, pOptions); return TRUE; } FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, - const CPDF_RenderContext* pContext, + CPDF_RenderContext* pContext, const CFX_Matrix* pUser2Device, AppearanceMode mode) { CFX_Matrix matrix; @@ -242,7 +241,7 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage, if (!pForm) { return FALSE; } - ((CPDF_RenderContext*)pContext)->AppendObjectList(pForm, &matrix); + pContext->AppendObjectList(pForm, &matrix); return TRUE; } void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp index fa0441cf79..93e837feaf 100644 --- a/core/src/fpdfdoc/doc_formcontrol.cpp +++ b/core/src/fpdfdoc/doc_formcontrol.cpp @@ -170,22 +170,20 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CPDF_Form form(m_pField->m_pForm->m_pDocument, m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); form.ParseContent(NULL, NULL, NULL, NULL); - CPDF_RenderContext context; - context.Create(pPage); + CPDF_RenderContext context(pPage); context.DrawObjectList(pDevice, &form, &matrix, pOptions); } -const FX_CHAR* g_sHighlightingMode[] = {"N", "I", "O", "P", "T", ""}; +static const FX_CHAR* const g_sHighlightingMode[] = { + // Must match order of HiglightingMode enum. + "N", "I", "O", "P", "T", nullptr}; CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() { if (!m_pWidgetDict) { return Invert; } CFX_ByteString csH = m_pWidgetDict->GetString("H", "I"); - int i = 0; - while (g_sHighlightingMode[i][0] != '\0') { - if (csH.Equal(g_sHighlightingMode[i])) { - return (HighlightingMode)i; - } - i++; + for (int i = 0; g_sHighlightingMode[i]; ++i) { + if (csH.Equal(g_sHighlightingMode[i])) + return static_cast<HighlightingMode>(i); } return Invert; } |