OLD | NEW |
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 "core/include/fxge/fx_ge.h" | 7 #include "core/include/fxge/fx_ge.h" |
8 #include "core/include/fxge/fx_freetype.h" | 8 #include "core/include/fxge/fx_freetype.h" |
9 #include "core/include/fxcodec/fx_codec.h" | 9 #include "core/include/fxcodec/fx_codec.h" |
10 #include "text_int.h" | 10 #include "text_int.h" |
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 bFontStyle, dest_width, anti_alias); | 1326 bFontStyle, dest_width, anti_alias); |
1327 #else | 1327 #else |
1328 if (text_flags & FXTEXT_NO_NATIVETEXT) { | 1328 if (text_flags & FXTEXT_NO_NATIVETEXT) { |
1329 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, | 1329 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, |
1330 bFontStyle, dest_width, anti_alias); | 1330 bFontStyle, dest_width, anti_alias); |
1331 } | 1331 } |
1332 CFX_GlyphBitmap* pGlyphBitmap; | 1332 CFX_GlyphBitmap* pGlyphBitmap; |
1333 auto it = m_SizeMap.find(FaceGlyphsKey); | 1333 auto it = m_SizeMap.find(FaceGlyphsKey); |
1334 if (it != m_SizeMap.end()) { | 1334 if (it != m_SizeMap.end()) { |
1335 CFX_SizeGlyphCache* pSizeCache = it->second; | 1335 CFX_SizeGlyphCache* pSizeCache = it->second; |
1336 if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, | 1336 auto it2 = pSizeCache->m_GlyphMap.find(glyph_index); |
1337 (void*&)pGlyphBitmap)) { | 1337 if (it2 != pSizeCache->m_GlyphMap.end()) |
1338 return pGlyphBitmap; | 1338 return it2->second; |
1339 } | 1339 |
1340 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, | 1340 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, |
1341 dest_width, anti_alias); | 1341 dest_width, anti_alias); |
1342 if (pGlyphBitmap) { | 1342 if (pGlyphBitmap) { |
1343 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); | 1343 pSizeCache->m_GlyphMap[glyph_index] = pGlyphBitmap; |
1344 return pGlyphBitmap; | 1344 return pGlyphBitmap; |
1345 } | 1345 } |
1346 } else { | 1346 } else { |
1347 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, | 1347 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, |
1348 dest_width, anti_alias); | 1348 dest_width, anti_alias); |
1349 if (pGlyphBitmap) { | 1349 if (pGlyphBitmap) { |
1350 CFX_SizeGlyphCache* pSizeCache = new CFX_SizeGlyphCache; | 1350 CFX_SizeGlyphCache* pSizeCache = new CFX_SizeGlyphCache; |
1351 m_SizeMap[FaceGlyphsKey] = pSizeCache; | 1351 m_SizeMap[FaceGlyphsKey] = pSizeCache; |
1352 pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap); | 1352 pSizeCache->m_GlyphMap[glyph_index] = pGlyphBitmap; |
1353 return pGlyphBitmap; | 1353 return pGlyphBitmap; |
1354 } | 1354 } |
1355 } | 1355 } |
1356 if (pFont->GetSubstFont()) | 1356 if (pFont->GetSubstFont()) |
1357 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 1357 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
1358 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), | 1358 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), |
1359 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, | 1359 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, |
1360 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); | 1360 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); |
1361 else | 1361 else |
1362 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 1362 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 void _CFX_UniqueKeyGen::Generate(int count, ...) { | 1860 void _CFX_UniqueKeyGen::Generate(int count, ...) { |
1861 va_list argList; | 1861 va_list argList; |
1862 va_start(argList, count); | 1862 va_start(argList, count); |
1863 for (int i = 0; i < count; i++) { | 1863 for (int i = 0; i < count; i++) { |
1864 int p = va_arg(argList, int); | 1864 int p = va_arg(argList, int); |
1865 ((FX_DWORD*)m_Key)[i] = p; | 1865 ((FX_DWORD*)m_Key)[i] = p; |
1866 } | 1866 } |
1867 va_end(argList); | 1867 va_end(argList); |
1868 m_KeyLen = count * sizeof(FX_DWORD); | 1868 m_KeyLen = count * sizeof(FX_DWORD); |
1869 } | 1869 } |
OLD | NEW |