diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-07-22 14:59:55 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-07-22 14:59:55 -0700 |
commit | 7cc97521db1e52d5927f5605de5f9a7102f8af40 (patch) | |
tree | df96cf98cd470e794c7817f347511f3c554c96e4 /core/src/fxge/ge | |
parent | b05f1fd710496dea44b001bb905fa1c16a39bb28 (diff) | |
download | pdfium-7cc97521db1e52d5927f5605de5f9a7102f8af40.tar.xz |
Fix else-after-returns throughout pdfium.
Driven by CS search for
pcre:yes file:third_party/pdfium/ -file:pdfium/third_party/
\breturn\b[^;]*;\s*\n*\s*\}*\s*\n*\r*else
Note: Care is required to ensure the preceding block is not an else-if.
As usual, removed any tabs I saw.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1243883003 .
Diffstat (limited to 'core/src/fxge/ge')
-rw-r--r-- | core/src/fxge/ge/fx_ge_device.cpp | 9 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_font.cpp | 27 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 12 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_linux.cpp | 9 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_path.cpp | 6 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 57 |
6 files changed, 57 insertions, 63 deletions
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp index 793dfc5ee2..0baa99cdc7 100644 --- a/core/src/fxge/ge/fx_ge_device.cpp +++ b/core/src/fxge/ge/fx_ge_device.cpp @@ -64,13 +64,14 @@ FX_BOOL CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width, { if (m_RenderCaps & FXRC_CMYK_OUTPUT) { return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Cmyka : FXDIB_Cmyk); - } else if (m_RenderCaps & FXRC_BYTEMASK_OUTPUT) { + } + if (m_RenderCaps & FXRC_BYTEMASK_OUTPUT) { return pDIB->Create(width, height, FXDIB_8bppMask); - } else + } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb32); + return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb32); #else - return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb); + return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb); #endif } FX_BOOL CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData, diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index f88cbaacde..6a950bf20b 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -309,9 +309,8 @@ CFX_ByteString CFX_Font::GetFamilyName() const } if (m_Face) { return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face)); - } else { - return m_pSubstFont->m_Family; } + return m_pSubstFont->m_Family; } CFX_ByteString CFX_Font::GetFaceName() const { @@ -329,9 +328,8 @@ CFX_ByteString CFX_Font::GetFaceName() const facename += " " + style; } return facename; - } else { - return m_pSubstFont->m_Family; } + return m_pSubstFont->m_Family; } FX_BOOL CFX_Font::GetBBox(FX_RECT &bbox) { @@ -410,21 +408,20 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) } FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCodeEx(FX_DWORD charcode, int encoding) { - FXFT_Face face = m_pFont->GetFace(); + FXFT_Face face = m_pFont->GetFace(); if (!face) { return charcode; } if (encoding == ENCODING_UNICODE) { - return GlyphFromCharCode(charcode); - } else { - int nmaps = FXFT_Get_Face_CharmapCount(m_pFont->m_Face); - int i = 0; - while (i < nmaps) { - int encoding = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i++]); - if (encoding != FXFT_ENCODING_UNICODE) { - FXFT_Select_Charmap(face, encoding); - break; - } + return GlyphFromCharCode(charcode); + } + int nmaps = FXFT_Get_Face_CharmapCount(m_pFont->m_Face); + int i = 0; + while (i < nmaps) { + int encoding = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i++]); + if (encoding != FXFT_ENCODING_UNICODE) { + FXFT_Select_Charmap(face, encoding); + break; } } return FXFT_Get_Char_Index(face, charcode); diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 8956cd1c88..4674589911 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -688,7 +688,8 @@ uint8_t _GetCharsetFromCodePage(FX_WORD codepage) const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid]; if (codepage == cp.codepage) { return cp.charset; - } else if (codepage < cp.codepage) { + } + if (codepage < cp.codepage) { iEnd = iMid - 1; } else { iStart = iMid + 1; @@ -1159,14 +1160,10 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru m_pFontMgr->GetStandardFont(pFontData, size, 12); m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); return m_FoxitFaces[12]; - } else { - pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; - return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, weight, italic_angle, 0, pSubstFont); } -#else +#endif pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, weight, italic_angle, 0, pSubstFont); -#endif } if (Charset == FXFONT_ANSI_CHARSET) { pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; @@ -1175,9 +1172,8 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru int index = m_CharsetArray.Find(Charset); if (index < 0) { return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, PitchFamily); - } else { - hFont = m_pFontInfo->GetFont(m_FaceArray[index]); } + hFont = m_pFontInfo->GetFont(m_FaceArray[index]); } } pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index 631ff8e93f..4e7334596b 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -63,15 +63,14 @@ static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int pic if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { if (face.Find("PGothic") >= 0 || face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) { return 0; - } else { - return 1; } - } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { + return 1; + } + if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) { if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) { return 2; - } else { - return 3; } + return 3; } if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) { return 0; diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp index ea1d80390b..b1410b3911 100644 --- a/core/src/fxge/ge/fx_ge_path.cpp +++ b/core/src/fxge/ge/fx_ge_path.cpp @@ -55,7 +55,8 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma if (m_Box.IsEmpty()) { m_Type = RectI; return; - } else if (m_Box == mask_rect) { + } + if (m_Box == mask_rect) { m_Mask = Mask; return; } @@ -229,7 +230,8 @@ static void _UpdateLineEndPoints(CFX_FloatRect& rect, FX_FLOAT start_x, FX_FLOAT rect.UpdateRect(end_x + hw, point_y); rect.UpdateRect(end_x - hw, point_y); return; - } else if (start_y == end_y) { + } + if (start_y == end_y) { FX_FLOAT point_x; if (end_x < start_x) { point_x = end_x - hw; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 76c7cf429e..233ed94963 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -1154,38 +1154,37 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD #else if (text_flags & FXTEXT_NO_NATIVETEXT) { return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); + } + CFX_GlyphBitmap* pGlyphBitmap; + CFX_SizeGlyphCache* pSizeCache = NULL; + if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { + if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { + return pGlyphBitmap; + } + pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); + if (pGlyphBitmap) { + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); + return pGlyphBitmap; + } } else { - CFX_GlyphBitmap* pGlyphBitmap; - CFX_SizeGlyphCache* pSizeCache = NULL; - if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) { - return pGlyphBitmap; - } - pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); - if (pGlyphBitmap) { - pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); - return pGlyphBitmap; - } - } else { - pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); - if (pGlyphBitmap) { - pSizeCache = new CFX_SizeGlyphCache; - m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); - pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); - return pGlyphBitmap; - } + pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); + if (pGlyphBitmap) { + pSizeCache = new CFX_SizeGlyphCache; + m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); + pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); + return pGlyphBitmap; } - if (pFont->GetSubstFont()) - keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), - (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias, - pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); - else - keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), - (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias); - CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); - text_flags |= FXTEXT_NO_NATIVETEXT; - return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); } + if (pFont->GetSubstFont()) + keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), + (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias, + pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); + else + keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), + (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias); + CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); + text_flags |= FXTEXT_NO_NATIVETEXT; + return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); #endif } CFX_SizeGlyphCache::~CFX_SizeGlyphCache() |