summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2018-01-30 21:42:41 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-30 21:42:41 +0000
commit2334660053e044ca79a1831a6c73f69891f039e0 (patch)
tree1114eeb0e18288235dff4ff694a8c7129541a7f2 /core/fxge
parent90d9386825b872a0b668eac5dff3e268fa7ad16c (diff)
downloadpdfium-2334660053e044ca79a1831a6c73f69891f039e0.tar.xz
Use unsigned for char widthchromium/3335
Bug: 806612 Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1 Reviewed-on: https://pdfium-review.googlesource.com/24410 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp2
-rw-r--r--core/fxge/cfx_facecache.cpp8
-rw-r--r--core/fxge/cfx_facecache.h12
-rw-r--r--core/fxge/cfx_font.cpp12
-rw-r--r--core/fxge/cfx_font.h12
-rw-r--r--core/fxge/cfx_renderdevice.h2
-rw-r--r--core/fxge/skia/fx_skia_device_unittest.cpp2
7 files changed, 26 insertions, 24 deletions
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 3c142c6984..1801814e66 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -169,7 +169,7 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph_Nativetext(
const CFX_Font* pFont,
uint32_t glyph_index,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias) {
return nullptr;
}
diff --git a/core/fxge/cfx_facecache.cpp b/core/fxge/cfx_facecache.cpp
index 4f373fff89..ea72905f1b 100644
--- a/core/fxge/cfx_facecache.cpp
+++ b/core/fxge/cfx_facecache.cpp
@@ -73,7 +73,7 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph(
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias) {
if (!m_Face)
return nullptr;
@@ -193,7 +193,7 @@ std::unique_ptr<CFX_GlyphBitmap> CFX_FaceCache::RenderGlyph(
const CFX_PathData* CFX_FaceCache::LoadGlyphPath(const CFX_Font* pFont,
uint32_t glyph_index,
- int dest_width) {
+ uint32_t dest_width) {
if (!m_Face || glyph_index == kInvalidGlyphIndex)
return nullptr;
@@ -216,7 +216,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(const CFX_Font* pFont,
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias,
int& text_flags) {
if (glyph_index == kInvalidGlyphIndex)
@@ -339,7 +339,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(
const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
- int dest_width,
+ uint32_t dest_width,
int anti_alias) {
SizeGlyphCache* pSizeCache;
auto it = m_SizeMap.find(FaceGlyphsKey);
diff --git a/core/fxge/cfx_facecache.h b/core/fxge/cfx_facecache.h
index a39da88b01..4ff4c41b1d 100644
--- a/core/fxge/cfx_facecache.h
+++ b/core/fxge/cfx_facecache.h
@@ -30,12 +30,12 @@ class CFX_FaceCache {
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias,
int& text_flags);
const CFX_PathData* LoadGlyphPath(const CFX_Font* pFont,
uint32_t glyph_index,
- int dest_width);
+ uint32_t dest_width);
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
CFX_TypeFace* GetDeviceCache(const CFX_Font* pFont);
@@ -44,26 +44,26 @@ class CFX_FaceCache {
private:
using SizeGlyphCache = std::map<uint32_t, std::unique_ptr<CFX_GlyphBitmap>>;
// <glyph_index, width, weight, angle, vertical>
- using PathMapKey = std::tuple<uint32_t, int, int, int, bool>;
+ using PathMapKey = std::tuple<uint32_t, uint32_t, int, int, bool>;
std::unique_ptr<CFX_GlyphBitmap> RenderGlyph(const CFX_Font* pFont,
uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias);
std::unique_ptr<CFX_GlyphBitmap> RenderGlyph_Nativetext(
const CFX_Font* pFont,
uint32_t glyph_index,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias);
CFX_GlyphBitmap* LookUpGlyphBitmap(const CFX_Font* pFont,
const CFX_Matrix* pMatrix,
const ByteString& FaceGlyphsKey,
uint32_t glyph_index,
bool bFontStyle,
- int dest_width,
+ uint32_t dest_width,
int anti_alias);
void InitPlatform();
void DestroyPlatform();
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 6d969a345c..ece3f96bed 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -295,7 +295,7 @@ bool CFX_Font::LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile,
}
#endif // PDF_ENABLE_XFA
-int CFX_Font::GetGlyphWidth(uint32_t glyph_index) {
+uint32_t CFX_Font::GetGlyphWidth(uint32_t glyph_index) {
if (!m_Face)
return 0;
if (m_pSubstFont && m_pSubstFont->m_bFlagMM)
@@ -307,7 +307,7 @@ int CFX_Font::GetGlyphWidth(uint32_t glyph_index) {
return 0;
int horiAdvance = FXFT_Get_Glyph_HoriAdvance(m_Face);
- if (horiAdvance < kThousandthMinInt || horiAdvance > kThousandthMaxInt)
+ if (horiAdvance < 0 || horiAdvance > kThousandthMaxInt)
return 0;
return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face), horiAdvance);
@@ -501,7 +501,7 @@ void CFX_Font::ClearFaceCache() {
}
void CFX_Font::AdjustMMParams(int glyph_index,
- int dest_width,
+ uint32_t dest_width,
int weight) const {
FXFT_MM_Var pMasters = nullptr;
FXFT_Get_MM_Var(m_Face, &pMasters);
@@ -544,7 +544,7 @@ void CFX_Font::AdjustMMParams(int glyph_index,
}
CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
- int dest_width) const {
+ uint32_t dest_width) const {
if (!m_Face)
return nullptr;
FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
@@ -613,7 +613,7 @@ CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
const CFX_GlyphBitmap* CFX_Font::LoadGlyphBitmap(uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias,
int& text_flags) const {
return GetFaceCache()->LoadGlyphBitmap(this, glyph_index, bFontStyle, pMatrix,
@@ -621,7 +621,7 @@ const CFX_GlyphBitmap* CFX_Font::LoadGlyphBitmap(uint32_t glyph_index,
}
const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index,
- int dest_width) const {
+ uint32_t dest_width) const {
return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width);
}
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index c8c4cf7a5f..3739cad9f3 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -52,16 +52,17 @@ class CFX_Font {
const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index,
bool bFontStyle,
const CFX_Matrix* pMatrix,
- int dest_width,
+ uint32_t dest_width,
int anti_alias,
int& text_flags) const;
- const CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width) const;
+ const CFX_PathData* LoadGlyphPath(uint32_t glyph_index,
+ uint32_t dest_width) const;
#if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_
CFX_TypeFace* GetDeviceCache() const;
#endif
- int GetGlyphWidth(uint32_t glyph_index);
+ uint32_t GetGlyphWidth(uint32_t glyph_index);
int GetAscent() const;
int GetDescent() const;
bool GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox);
@@ -83,9 +84,10 @@ class CFX_Font {
#endif
uint8_t* GetFontData() const { return m_pFontData; }
uint32_t GetSize() const { return m_dwSize; }
- void AdjustMMParams(int glyph_index, int width, int weight) const;
+ void AdjustMMParams(int glyph_index, uint32_t width, int weight) const;
- CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, int dest_width) const;
+ CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index,
+ uint32_t dest_width) const;
static const size_t kAngleSkewArraySize = 30;
static const char s_AngleSkew[kAngleSkewArraySize];
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index d8cb9a6952..d3ebed41c4 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -76,7 +76,7 @@ class FXTEXT_CHARPOS {
CFX_PointF m_Origin;
uint32_t m_Unicode;
uint32_t m_GlyphIndex;
- int32_t m_FontCharWidth;
+ uint32_t m_FontCharWidth;
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
uint32_t m_ExtGID;
#endif
diff --git a/core/fxge/skia/fx_skia_device_unittest.cpp b/core/fxge/skia/fx_skia_device_unittest.cpp
index 7cb28cfb49..66db939539 100644
--- a/core/fxge/skia/fx_skia_device_unittest.cpp
+++ b/core/fxge/skia/fx_skia_device_unittest.cpp
@@ -38,7 +38,7 @@ void CommonTest(CFX_SkiaDeviceDriver* driver, const State& state) {
FXTEXT_CHARPOS charPos[1];
charPos[0].m_Origin = CFX_PointF(0, 1);
charPos[0].m_GlyphIndex = 1;
- charPos[0].m_FontCharWidth = 4;
+ charPos[0].m_FontCharWidth = 4u;
CFX_Font font;
float fontSize = 1;