Index: core/fpdfapi/render/fpdf_render_text.cpp |
diff --git a/core/fpdfapi/render/fpdf_render_text.cpp b/core/fpdfapi/render/fpdf_render_text.cpp |
index b8f44f8bd91294b3163d3a153a3de6bd51c9e330..d4ee392dfeb4f0f7042936824a49df10782b08b4 100644 |
--- a/core/fpdfapi/render/fpdf_render_text.cpp |
+++ b/core/fpdfapi/render/fpdf_render_text.cpp |
@@ -275,7 +275,6 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, |
CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd); |
if (!pBitmap) |
continue; |
- |
int origin_x = FXSYS_round(matrix.e); |
int origin_y = FXSYS_round(matrix.f); |
if (glyphs.empty()) { |
@@ -302,7 +301,6 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, |
if (glyphs.empty()) |
return TRUE; |
- |
FX_RECT rect = FXGE_GetGlyphsBBox(glyphs, 0, sa, sd); |
CFX_DIBitmap bitmap; |
if (!bitmap.Create(static_cast<int>(rect.Width() * sa), |
@@ -314,13 +312,25 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, |
if (!glyph.m_pGlyph) |
continue; |
- bitmap.TransferBitmap( |
- static_cast<int>( |
- (glyph.m_OriginX + glyph.m_pGlyph->m_Left - rect.left) * sa), |
- static_cast<int>((glyph.m_OriginY - glyph.m_pGlyph->m_Top - rect.top) * |
- sd), |
- glyph.m_pGlyph->m_Bitmap.GetWidth(), |
- glyph.m_pGlyph->m_Bitmap.GetHeight(), &glyph.m_pGlyph->m_Bitmap, 0, 0); |
+ pdfium::base::CheckedNumeric<int> left = glyph.m_OriginX; |
Lei Zhang
2016/10/28 18:58:20
nit: include the header for CheckedNumeric.
npm
2016/10/28 19:26:25
Done.
|
+ left += glyph.m_pGlyph->m_Left; |
+ left -= rect.left; |
+ left *= sa; |
+ if (!left.IsValid()) |
+ continue; |
+ |
+ pdfium::base::CheckedNumeric<int> top = glyph.m_OriginY; |
+ top -= glyph.m_pGlyph->m_Top; |
+ top -= rect.top; |
+ top *= sd; |
+ if (!top.IsValid()) |
+ continue; |
+ |
+ bitmap.CompositeMask(left.ValueOrDie(), top.ValueOrDie(), |
+ glyph.m_pGlyph->m_Bitmap.GetWidth(), |
+ glyph.m_pGlyph->m_Bitmap.GetHeight(), |
+ &glyph.m_pGlyph->m_Bitmap, fill_argb, 0, 0, |
+ FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr); |
} |
m_pDevice->SetBitMask(&bitmap, rect.left, rect.top, fill_argb); |
return TRUE; |