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

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

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00), 1147 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1148 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias, 3); 1148 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias, 3);
1149 } 1149 }
1150 #endif 1150 #endif
1151 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); 1151 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1152 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 1152 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
1153 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias); 1153 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias);
1154 #else 1154 #else
1155 if (text_flags & FXTEXT_NO_NATIVETEXT) { 1155 if (text_flags & FXTEXT_NO_NATIVETEXT) {
1156 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias); 1156 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias);
1157 }
1158 CFX_GlyphBitmap* pGlyphBitmap;
1159 CFX_SizeGlyphCache* pSizeCache = NULL;
1160 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
1161 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*& )pGlyphBitmap)) {
1162 return pGlyphBitmap;
1163 }
1164 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_ width, anti_alias);
1165 if (pGlyphBitmap) {
1166 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi tmap);
1167 return pGlyphBitmap;
1168 }
1157 } else { 1169 } else {
1158 CFX_GlyphBitmap* pGlyphBitmap; 1170 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_ width, anti_alias);
1159 CFX_SizeGlyphCache* pSizeCache = NULL; 1171 if (pGlyphBitmap) {
1160 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { 1172 pSizeCache = new CFX_SizeGlyphCache;
1161 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (vo id*&)pGlyphBitmap)) { 1173 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1162 return pGlyphBitmap; 1174 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBi tmap);
1163 } 1175 return pGlyphBitmap;
1164 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1165 if (pGlyphBitmap) {
1166 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly phBitmap);
1167 return pGlyphBitmap;
1168 }
1169 } else {
1170 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1171 if (pGlyphBitmap) {
1172 pSizeCache = new CFX_SizeGlyphCache;
1173 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1174 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGly phBitmap);
1175 return pGlyphBitmap;
1176 }
1177 } 1176 }
1178 if (pFont->GetSubstFont())
1179 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1180 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias,
1181 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont ()->m_ItalicAngle, pFont->IsVertical());
1182 else
1183 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1184 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias);
1185 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1186 text_flags |= FXTEXT_NO_NATIVETEXT;
1187 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias);
1188 } 1177 }
1178 if (pFont->GetSubstFont())
1179 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
1180 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de st_width, anti_alias,
1181 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()-> m_ItalicAngle, pFont->IsVertical());
1182 else
1183 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
1184 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), de st_width, anti_alias);
1185 CFX_ByteStringC FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
1186 text_flags |= FXTEXT_NO_NATIVETEXT;
1187 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, bFontS tyle, dest_width, anti_alias);
1189 #endif 1188 #endif
1190 } 1189 }
1191 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() 1190 CFX_SizeGlyphCache::~CFX_SizeGlyphCache()
1192 { 1191 {
1193 FX_POSITION pos = m_GlyphMap.GetStartPosition(); 1192 FX_POSITION pos = m_GlyphMap.GetStartPosition();
1194 void* Key; 1193 void* Key;
1195 CFX_GlyphBitmap* pGlyphBitmap = NULL; 1194 CFX_GlyphBitmap* pGlyphBitmap = NULL;
1196 while(pos) { 1195 while(pos) {
1197 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); 1196 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap);
1198 delete pGlyphBitmap; 1197 delete pGlyphBitmap;
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 { 1709 {
1711 va_list argList; 1710 va_list argList;
1712 va_start(argList, count); 1711 va_start(argList, count);
1713 for (int i = 0; i < count; i ++) { 1712 for (int i = 0; i < count; i ++) {
1714 int p = va_arg(argList, int); 1713 int p = va_arg(argList, int);
1715 ((FX_DWORD*)m_Key)[i] = p; 1714 ((FX_DWORD*)m_Key)[i] = p;
1716 } 1715 }
1717 va_end(argList); 1716 va_end(argList);
1718 m_KeyLen = count * sizeof(FX_DWORD); 1717 m_KeyLen = count * sizeof(FX_DWORD);
1719 } 1718 }
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