summaryrefslogtreecommitdiff
path: root/core/fxge/cfx_font.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-12 15:37:39 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 15:37:39 +0000
commit1c23a6d78c95ff0714cda6f642420e0502edac29 (patch)
tree82d35256f9a214cc26f03d7c5626653a2398f56b /core/fxge/cfx_font.cpp
parente6d4559a1b6c2eb0eb433b9db70745e3be3d8465 (diff)
downloadpdfium-1c23a6d78c95ff0714cda6f642420e0502edac29.tar.xz
Make CFX_Font take FX_RECT out params by pointer.
Change-Id: I6643aaf66bf3e9d53d5afab5c99a5cb7deab3661 Reviewed-on: https://pdfium-review.googlesource.com/30054 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/cfx_font.cpp')
-rw-r--r--core/fxge/cfx_font.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index ece3f96bed..98322fdf98 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -349,7 +349,7 @@ int CFX_Font::GetDescent() const {
return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), descender);
}
-bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
+bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT* pBBox) {
if (!m_Face)
return false;
@@ -373,20 +373,20 @@ bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
int pixel_size_x = m_Face->size->metrics.x_ppem,
pixel_size_y = m_Face->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {
- bbox.left = cbox.xMin;
- bbox.right = cbox.xMax;
- bbox.top = cbox.yMax;
- bbox.bottom = cbox.yMin;
+ pBBox->left = cbox.xMin;
+ pBBox->right = cbox.xMax;
+ pBBox->top = cbox.yMax;
+ pBBox->bottom = cbox.yMin;
} else {
- bbox.left = cbox.xMin * 1000 / pixel_size_x;
- bbox.right = cbox.xMax * 1000 / pixel_size_x;
- bbox.top = cbox.yMax * 1000 / pixel_size_y;
- bbox.bottom = cbox.yMin * 1000 / pixel_size_y;
+ pBBox->left = cbox.xMin * 1000 / pixel_size_x;
+ pBBox->right = cbox.xMax * 1000 / pixel_size_x;
+ pBBox->top = cbox.yMax * 1000 / pixel_size_y;
+ pBBox->bottom = cbox.yMin * 1000 / pixel_size_y;
}
- bbox.top = std::min(bbox.top,
- static_cast<int32_t>(FXFT_Get_Face_Ascender(m_Face)));
- bbox.bottom = std::max(
- bbox.bottom, static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face)));
+ pBBox->top = std::min(pBBox->top,
+ static_cast<int32_t>(FXFT_Get_Face_Ascender(m_Face)));
+ pBBox->bottom = std::max(
+ pBBox->bottom, static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face)));
FT_Done_Glyph(glyph);
return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
}
@@ -397,19 +397,19 @@ bool CFX_Font::GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox) {
}
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
- bbox.left = FXFT_Get_Glyph_HoriBearingX(m_Face);
- bbox.bottom = FXFT_Get_Glyph_HoriBearingY(m_Face);
- bbox.top = bbox.bottom - FXFT_Get_Glyph_Height(m_Face);
- bbox.right = bbox.left + FXFT_Get_Glyph_Width(m_Face);
+ pBBox->left = FXFT_Get_Glyph_HoriBearingX(m_Face);
+ pBBox->bottom = FXFT_Get_Glyph_HoriBearingY(m_Face);
+ pBBox->top = pBBox->bottom - FXFT_Get_Glyph_Height(m_Face);
+ pBBox->right = pBBox->left + FXFT_Get_Glyph_Width(m_Face);
} else {
- bbox.left = FXFT_Get_Glyph_HoriBearingX(m_Face) * 1000 / em;
- bbox.top =
+ pBBox->left = FXFT_Get_Glyph_HoriBearingX(m_Face) * 1000 / em;
+ pBBox->top =
(FXFT_Get_Glyph_HoriBearingY(m_Face) - FXFT_Get_Glyph_Height(m_Face)) *
1000 / em;
- bbox.right =
+ pBBox->right =
(FXFT_Get_Glyph_HoriBearingX(m_Face) + FXFT_Get_Glyph_Width(m_Face)) *
1000 / em;
- bbox.bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
+ pBBox->bottom = (FXFT_Get_Glyph_HoriBearingY(m_Face)) * 1000 / em;
}
return true;
}
@@ -467,21 +467,21 @@ ByteString CFX_Font::GetFaceName() const {
return m_pSubstFont->m_Family;
}
-bool CFX_Font::GetBBox(FX_RECT& bbox) {
+bool CFX_Font::GetBBox(FX_RECT* pBBox) {
if (!m_Face)
return false;
int em = FXFT_Get_Face_UnitsPerEM(m_Face);
if (em == 0) {
- bbox.left = FXFT_Get_Face_xMin(m_Face);
- bbox.bottom = FXFT_Get_Face_yMax(m_Face);
- bbox.top = FXFT_Get_Face_yMin(m_Face);
- bbox.right = FXFT_Get_Face_xMax(m_Face);
+ pBBox->left = FXFT_Get_Face_xMin(m_Face);
+ pBBox->bottom = FXFT_Get_Face_yMax(m_Face);
+ pBBox->top = FXFT_Get_Face_yMin(m_Face);
+ pBBox->right = FXFT_Get_Face_xMax(m_Face);
} else {
- bbox.left = FXFT_Get_Face_xMin(m_Face) * 1000 / em;
- bbox.top = FXFT_Get_Face_yMin(m_Face) * 1000 / em;
- bbox.right = FXFT_Get_Face_xMax(m_Face) * 1000 / em;
- bbox.bottom = FXFT_Get_Face_yMax(m_Face) * 1000 / em;
+ pBBox->left = FXFT_Get_Face_xMin(m_Face) * 1000 / em;
+ pBBox->top = FXFT_Get_Face_yMin(m_Face) * 1000 / em;
+ pBBox->right = FXFT_Get_Face_xMax(m_Face) * 1000 / em;
+ pBBox->bottom = FXFT_Get_Face_yMax(m_Face) * 1000 / em;
}
return true;
}