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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "core/fxcodec/include/fx_codec.h" | 9 #include "core/fxcodec/include/fx_codec.h" |
10 #include "core/fxge/ge/fx_text_int.h" | 10 #include "core/fxge/ge/fx_text_int.h" |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 SkSafeUnref(m_pTypeface); | 1281 SkSafeUnref(m_pTypeface); |
1282 #endif | 1282 #endif |
1283 } | 1283 } |
1284 | 1284 |
1285 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 1285 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
1286 void CFX_FaceCache::InitPlatform() {} | 1286 void CFX_FaceCache::InitPlatform() {} |
1287 #endif | 1287 #endif |
1288 CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( | 1288 CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( |
1289 CFX_Font* pFont, | 1289 CFX_Font* pFont, |
1290 const CFX_Matrix* pMatrix, | 1290 const CFX_Matrix* pMatrix, |
1291 CFX_ByteStringC& FaceGlyphsKey, | 1291 const CFX_ByteString& FaceGlyphsKey, |
1292 uint32_t glyph_index, | 1292 uint32_t glyph_index, |
1293 FX_BOOL bFontStyle, | 1293 FX_BOOL bFontStyle, |
1294 int dest_width, | 1294 int dest_width, |
1295 int anti_alias) { | 1295 int anti_alias) { |
1296 CFX_SizeGlyphCache* pSizeCache; | 1296 CFX_SizeGlyphCache* pSizeCache; |
1297 auto it = m_SizeMap.find(FaceGlyphsKey); | 1297 auto it = m_SizeMap.find(FaceGlyphsKey); |
1298 if (it == m_SizeMap.end()) { | 1298 if (it == m_SizeMap.end()) { |
1299 pSizeCache = new CFX_SizeGlyphCache; | 1299 pSizeCache = new CFX_SizeGlyphCache; |
1300 m_SizeMap[FaceGlyphsKey] = pSizeCache; | 1300 m_SizeMap[FaceGlyphsKey] = pSizeCache; |
1301 } else { | 1301 } else { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), | 1352 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), |
1353 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, | 1353 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, |
1354 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical(), | 1354 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical(), |
1355 3); | 1355 3); |
1356 else | 1356 else |
1357 keygen.Generate(7, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 1357 keygen.Generate(7, (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, 3); | 1359 dest_width, anti_alias, 3); |
1360 } | 1360 } |
1361 #endif | 1361 #endif |
1362 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); | 1362 CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); |
1363 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 1363 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
1364 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, | 1364 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, |
1365 bFontStyle, dest_width, anti_alias); | 1365 bFontStyle, dest_width, anti_alias); |
1366 #else | 1366 #else |
1367 if (text_flags & FXTEXT_NO_NATIVETEXT) { | 1367 if (text_flags & FXTEXT_NO_NATIVETEXT) { |
1368 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, | 1368 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, |
1369 bFontStyle, dest_width, anti_alias); | 1369 bFontStyle, dest_width, anti_alias); |
1370 } | 1370 } |
1371 CFX_GlyphBitmap* pGlyphBitmap; | 1371 CFX_GlyphBitmap* pGlyphBitmap; |
1372 auto it = m_SizeMap.find(FaceGlyphsKey); | 1372 auto it = m_SizeMap.find(FaceGlyphsKey); |
(...skipping 21 matching lines...) Expand all Loading... |
1394 } | 1394 } |
1395 if (pFont->GetSubstFont()) | 1395 if (pFont->GetSubstFont()) |
1396 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 1396 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
1397 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), | 1397 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), |
1398 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, | 1398 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, |
1399 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); | 1399 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); |
1400 else | 1400 else |
1401 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 1401 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
1402 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), | 1402 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), |
1403 dest_width, anti_alias); | 1403 dest_width, anti_alias); |
1404 CFX_ByteStringC FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); | 1404 CFX_ByteString FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen); |
1405 text_flags |= FXTEXT_NO_NATIVETEXT; | 1405 text_flags |= FXTEXT_NO_NATIVETEXT; |
1406 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, | 1406 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, |
1407 bFontStyle, dest_width, anti_alias); | 1407 bFontStyle, dest_width, anti_alias); |
1408 #endif | 1408 #endif |
1409 } | 1409 } |
1410 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { | 1410 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { |
1411 for (const auto& pair : m_GlyphMap) { | 1411 for (const auto& pair : m_GlyphMap) { |
1412 delete pair.second; | 1412 delete pair.second; |
1413 } | 1413 } |
1414 m_GlyphMap.clear(); | 1414 m_GlyphMap.clear(); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 void _CFX_UniqueKeyGen::Generate(int count, ...) { | 1907 void _CFX_UniqueKeyGen::Generate(int count, ...) { |
1908 va_list argList; | 1908 va_list argList; |
1909 va_start(argList, count); | 1909 va_start(argList, count); |
1910 for (int i = 0; i < count; i++) { | 1910 for (int i = 0; i < count; i++) { |
1911 int p = va_arg(argList, int); | 1911 int p = va_arg(argList, int); |
1912 ((uint32_t*)m_Key)[i] = p; | 1912 ((uint32_t*)m_Key)[i] = p; |
1913 } | 1913 } |
1914 va_end(argList); | 1914 va_end(argList); |
1915 m_KeyLen = count * sizeof(uint32_t); | 1915 m_KeyLen = count * sizeof(uint32_t); |
1916 } | 1916 } |
OLD | NEW |