Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: core/src/fxge/ge/fx_ge_text.cpp

Issue 1243883003: Fix else-after-returns throughout pdfium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, Address comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/ge/fx_ge_path.cpp ('k') | core/src/fxge/skia/fx_skia_blitter_new.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "../../../include/fxcodec/fx_codec.h" 9 #include "../../../include/fxcodec/fx_codec.h"
10 #include "text_int.h" 10 #include "text_int.h"
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00), 1149 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1150 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias, 3); 1150 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias, 3);
1151 } 1151 }
1152 #endif 1152 #endif
1153 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); 1153 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1154 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 1154 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
1155 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias); 1155 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias);
1156 #else 1156 #else
1157 if (text_flags & FXTEXT_NO_NATIVETEXT) { 1157 if (text_flags & FXTEXT_NO_NATIVETEXT) {
1158 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias); 1158 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias);
1159 }
1160 CFX_GlyphBitmap* pGlyphBitmap;
1161 CFX_SizeGlyphCache* pSizeCache = NULL;
1162 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
1163 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*& )pGlyphBitmap)) {
1164 return pGlyphBitmap;
1165 }
1166 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_ width, anti_alias);
1167 if (pGlyphBitmap) {
1168 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi tmap);
1169 return pGlyphBitmap;
1170 }
1159 } else { 1171 } else {
1160 CFX_GlyphBitmap* pGlyphBitmap; 1172 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_ width, anti_alias);
1161 CFX_SizeGlyphCache* pSizeCache = NULL; 1173 if (pGlyphBitmap) {
1162 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { 1174 pSizeCache = new CFX_SizeGlyphCache;
1163 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (vo id*&)pGlyphBitmap)) { 1175 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1164 return pGlyphBitmap; 1176 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi tmap);
1165 } 1177 return pGlyphBitmap;
1166 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1167 if (pGlyphBitmap) {
1168 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly phBitmap);
1169 return pGlyphBitmap;
1170 }
1171 } else {
1172 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1173 if (pGlyphBitmap) {
1174 pSizeCache = new CFX_SizeGlyphCache;
1175 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1176 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly phBitmap);
1177 return pGlyphBitmap;
1178 }
1179 } 1178 }
1180 if (pFont->GetSubstFont())
1181 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1182 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias,
1183 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont ()->m_ItalicAngle, pFont->IsVertical());
1184 else
1185 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1186 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias);
1187 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1188 text_flags |= FXTEXT_NO_NATIVETEXT;
1189 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias);
1190 } 1179 }
1180 if (pFont->GetSubstFont())
1181 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
1182 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de st_width, anti_alias,
1183 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()-> m_ItalicAngle, pFont->IsVertical());
1184 else
1185 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
1186 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de st_width, anti_alias);
1187 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1188 text_flags |= FXTEXT_NO_NATIVETEXT;
1189 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias);
1191 #endif 1190 #endif
1192 } 1191 }
1193 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() 1192 CFX_SizeGlyphCache::~CFX_SizeGlyphCache()
1194 { 1193 {
1195 FX_POSITION pos = m_GlyphMap.GetStartPosition(); 1194 FX_POSITION pos = m_GlyphMap.GetStartPosition();
1196 void* Key; 1195 void* Key;
1197 CFX_GlyphBitmap* pGlyphBitmap = NULL; 1196 CFX_GlyphBitmap* pGlyphBitmap = NULL;
1198 while(pos) { 1197 while(pos) {
1199 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); 1198 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap);
1200 delete pGlyphBitmap; 1199 delete pGlyphBitmap;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 { 1711 {
1713 va_list argList; 1712 va_list argList;
1714 va_start(argList, count); 1713 va_start(argList, count);
1715 for (int i = 0; i < count; i ++) { 1714 for (int i = 0; i < count; i ++) {
1716 int p = va_arg(argList, int); 1715 int p = va_arg(argList, int);
1717 ((FX_DWORD*)m_Key)[i] = p; 1716 ((FX_DWORD*)m_Key)[i] = p;
1718 } 1717 }
1719 va_end(argList); 1718 va_end(argList);
1720 m_KeyLen = count * sizeof(FX_DWORD); 1719 m_KeyLen = count * sizeof(FX_DWORD);
1721 } 1720 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_path.cpp ('k') | core/src/fxge/skia/fx_skia_blitter_new.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698