summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-05-26 11:37:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-26 11:37:27 -0700
commitfd6cfad310187631554613c375ec1b4c5ef887a3 (patch)
treef802d78debcd2daf8c336c2d4fea489f23fc388b /core/fpdfapi
parent7091c5b674069884adb005eaa41cdfb836ef4cfa (diff)
downloadpdfium-fd6cfad310187631554613c375ec1b4c5ef887a3.tar.xz
Clean up CPDF_TextRenderer slightly.
- Remove dead code - Remove default arguments - Move code into anonymous namespace Review-Url: https://codereview.chromium.org/2013023002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp2
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp28
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h25
3 files changed, 14 insertions, 41 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 365e4c0464..b69863b5b0 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -816,7 +816,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
&text_device, textobj->m_nChars, textobj->m_pCharCodes,
textobj->m_pCharPos, textobj->m_TextState.GetFont(),
textobj->m_TextState.GetFontSize(), &text_matrix, &new_matrix,
- textobj->m_GraphState, (FX_ARGB)-1, 0, NULL);
+ textobj->m_GraphState, (FX_ARGB)-1, 0, nullptr, 0);
}
}
CPDF_RenderStatus bitmap_render;
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 7c2fec7c78..e4ee49afc9 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -528,9 +528,11 @@ class CPDF_CharPosList {
CPDF_CharPosList::CPDF_CharPosList() {
m_pCharPos = NULL;
}
+
CPDF_CharPosList::~CPDF_CharPosList() {
FX_Free(m_pCharPos);
}
+
void CPDF_CharPosList::Load(int nChars,
uint32_t* pCharCodes,
FX_FLOAT* pCharPos,
@@ -590,6 +592,7 @@ void CPDF_CharPosList::Load(int nChars,
}
}
+// static
FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
int nChars,
uint32_t* pCharCodes,
@@ -614,24 +617,7 @@ FX_BOOL CPDF_TextRenderer::DrawTextPath(CFX_RenderDevice* pDevice,
pClippingPath, nFlag);
}
-void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
- int left,
- int top,
- CPDF_Font* pFont,
- int height,
- const CFX_ByteString& str,
- FX_ARGB argb) {
- FX_RECT font_bbox;
- pFont->GetFontBBox(font_bbox);
- FX_FLOAT font_size =
- (FX_FLOAT)height * 1000.0f / (FX_FLOAT)(font_bbox.top - font_bbox.bottom);
- FX_FLOAT origin_x = (FX_FLOAT)left;
- FX_FLOAT origin_y =
- (FX_FLOAT)top + font_size * (FX_FLOAT)font_bbox.top / 1000.0f;
- CFX_Matrix matrix(1.0f, 0, 0, -1.0f, 0, 0);
- DrawTextString(pDevice, origin_x, origin_y, pFont, font_size, &matrix, str,
- argb);
-}
+// static
void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
FX_FLOAT origin_x,
FX_FLOAT origin_y,
@@ -680,7 +666,8 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
&matrix, fill_argb, pOptions);
} else {
DrawTextPath(pDevice, nChars, pCharCodes, pCharPos, pFont, font_size,
- &matrix, NULL, pGraphState, fill_argb, stroke_argb, NULL);
+ &matrix, nullptr, pGraphState, fill_argb, stroke_argb,
+ nullptr, 0);
}
}
@@ -689,6 +676,8 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
FX_Free(pCharPos);
}
}
+
+// static
FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
int nChars,
uint32_t* pCharCodes,
@@ -734,6 +723,7 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice,
&pFont->m_Font, pCache, font_size,
pText2Device, fill_argb, FXGE_flags);
}
+
void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
const CFX_Matrix* pObj2Device,
CPDF_Font* pFont,
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
index d532196675..c4031bbbff 100644
--- a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
+++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
@@ -21,14 +21,6 @@ class CPDF_Font;
class CPDF_TextRenderer {
public:
static void DrawTextString(CFX_RenderDevice* pDevice,
- int left,
- int top,
- CPDF_Font* pFont,
- int height,
- const CFX_ByteString& str,
- FX_ARGB argb);
-
- static void DrawTextString(CFX_RenderDevice* pDevice,
FX_FLOAT origin_x,
FX_FLOAT origin_y,
CPDF_Font* pFont,
@@ -36,9 +28,9 @@ class CPDF_TextRenderer {
const CFX_Matrix* matrix,
const CFX_ByteString& str,
FX_ARGB fill_argb,
- FX_ARGB stroke_argb = 0,
- const CFX_GraphStateData* pGraphState = NULL,
- const CPDF_RenderOptions* pOptions = NULL);
+ FX_ARGB stroke_argb,
+ const CFX_GraphStateData* pGraphState,
+ const CPDF_RenderOptions* pOptions);
static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice,
int nChars,
@@ -52,7 +44,7 @@ class CPDF_TextRenderer {
FX_ARGB fill_argb,
FX_ARGB stroke_argb,
CFX_PathData* pClippingPath,
- int nFlag = 0);
+ int nFlag);
static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice,
int nChars,
@@ -63,15 +55,6 @@ class CPDF_TextRenderer {
const CFX_Matrix* pText2Device,
FX_ARGB fill_argb,
const CPDF_RenderOptions* pOptions);
-
- static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice,
- int nChars,
- uint32_t* pCharCodes,
- FX_FLOAT* pCharPos,
- CPDF_Font* pFont,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2Device,
- FX_ARGB fill_argb);
};
#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_