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 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "core/fxcodec/include/fx_codec.h" | 10 #include "core/fxcodec/include/fx_codec.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 void Color2Argb(FX_ARGB& argb, | 352 void Color2Argb(FX_ARGB& argb, |
353 uint32_t color, | 353 uint32_t color, |
354 int alpha_flag, | 354 int alpha_flag, |
355 void* pIccTransform) { | 355 void* pIccTransform) { |
356 if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) { | 356 if (!pIccTransform && !FXGETFLAG_COLORTYPE(alpha_flag)) { |
357 argb = color; | 357 argb = color; |
358 return; | 358 return; |
359 } | 359 } |
360 if (!CFX_GEModule::Get()->GetCodecModule() || | 360 if (!CFX_GEModule::Get()->GetCodecModule() || |
361 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { | 361 !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) { |
362 pIccTransform = NULL; | 362 pIccTransform = nullptr; |
363 } | 363 } |
364 uint8_t bgra[4]; | 364 uint8_t bgra[4]; |
365 if (pIccTransform) { | 365 if (pIccTransform) { |
366 CCodec_IccModule* pIccModule = | 366 CCodec_IccModule* pIccModule = |
367 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); | 367 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); |
368 color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) | 368 color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) |
369 : FXARGB_TODIB(color); | 369 : FXARGB_TODIB(color); |
370 pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, | 370 pIccModule->TranslateScanline(pIccTransform, bgra, (const uint8_t*)&color, |
371 1); | 371 1); |
372 bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) | 372 bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 return pGlyphBitmap; | 840 return pGlyphBitmap; |
841 } | 841 } |
842 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, | 842 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, |
843 uint32_t glyph_index, | 843 uint32_t glyph_index, |
844 FX_BOOL bFontStyle, | 844 FX_BOOL bFontStyle, |
845 const CFX_Matrix* pMatrix, | 845 const CFX_Matrix* pMatrix, |
846 int dest_width, | 846 int dest_width, |
847 int anti_alias, | 847 int anti_alias, |
848 int& text_flags) { | 848 int& text_flags) { |
849 if (glyph_index == (uint32_t)-1) { | 849 if (glyph_index == (uint32_t)-1) { |
850 return NULL; | 850 return nullptr; |
851 } | 851 } |
852 _CFX_UniqueKeyGen keygen; | 852 _CFX_UniqueKeyGen keygen; |
853 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 853 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
854 if (pFont->GetSubstFont()) | 854 if (pFont->GetSubstFont()) |
855 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 855 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
856 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), | 856 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), |
857 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, | 857 dest_width, anti_alias, pFont->GetSubstFont()->m_Weight, |
858 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); | 858 pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical()); |
859 else | 859 else |
860 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), | 860 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 #endif | 934 #endif |
935 } | 935 } |
936 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { | 936 CFX_SizeGlyphCache::~CFX_SizeGlyphCache() { |
937 for (const auto& pair : m_GlyphMap) { | 937 for (const auto& pair : m_GlyphMap) { |
938 delete pair.second; | 938 delete pair.second; |
939 } | 939 } |
940 m_GlyphMap.clear(); | 940 m_GlyphMap.clear(); |
941 } | 941 } |
942 #define CONTRAST_RAMP_STEP 1 | 942 #define CONTRAST_RAMP_STEP 1 |
943 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) { | 943 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) { |
944 FXFT_MM_Var pMasters = NULL; | 944 FXFT_MM_Var pMasters = nullptr; |
945 FXFT_Get_MM_Var(m_Face, &pMasters); | 945 FXFT_Get_MM_Var(m_Face, &pMasters); |
946 if (!pMasters) { | 946 if (!pMasters) { |
947 return; | 947 return; |
948 } | 948 } |
949 long coords[2]; | 949 long coords[2]; |
950 if (weight == 0) { | 950 if (weight == 0) { |
951 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; | 951 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; |
952 } else { | 952 } else { |
953 coords[0] = weight; | 953 coords[0] = weight; |
954 } | 954 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 } | 1070 } |
1071 } | 1071 } |
1072 } | 1072 } |
1073 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, | 1073 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, |
1074 uint32_t glyph_index, | 1074 uint32_t glyph_index, |
1075 FX_BOOL bFontStyle, | 1075 FX_BOOL bFontStyle, |
1076 const CFX_Matrix* pMatrix, | 1076 const CFX_Matrix* pMatrix, |
1077 int dest_width, | 1077 int dest_width, |
1078 int anti_alias) { | 1078 int anti_alias) { |
1079 if (!m_Face) { | 1079 if (!m_Face) { |
1080 return NULL; | 1080 return nullptr; |
1081 } | 1081 } |
1082 FXFT_Matrix ft_matrix; | 1082 FXFT_Matrix ft_matrix; |
1083 ft_matrix.xx = (signed long)(pMatrix->GetA() / 64 * 65536); | 1083 ft_matrix.xx = (signed long)(pMatrix->GetA() / 64 * 65536); |
1084 ft_matrix.xy = (signed long)(pMatrix->GetC() / 64 * 65536); | 1084 ft_matrix.xy = (signed long)(pMatrix->GetC() / 64 * 65536); |
1085 ft_matrix.yx = (signed long)(pMatrix->GetB() / 64 * 65536); | 1085 ft_matrix.yx = (signed long)(pMatrix->GetB() / 64 * 65536); |
1086 ft_matrix.yy = (signed long)(pMatrix->GetD() / 64 * 65536); | 1086 ft_matrix.yy = (signed long)(pMatrix->GetD() / 64 * 65536); |
1087 FX_BOOL bUseCJKSubFont = FALSE; | 1087 FX_BOOL bUseCJKSubFont = FALSE; |
1088 const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); | 1088 const CFX_SubstFont* pSubstFont = pFont->GetSubstFont(); |
1089 if (pSubstFont) { | 1089 if (pSubstFont) { |
1090 bUseCJKSubFont = pSubstFont->m_bSubstOfCJK && bFontStyle; | 1090 bUseCJKSubFont = pSubstFont->m_bSubstOfCJK && bFontStyle; |
(...skipping 23 matching lines...) Expand all Loading... |
1114 } | 1114 } |
1115 } | 1115 } |
1116 ScopedFontTransform scoped_transform(m_Face, &ft_matrix); | 1116 ScopedFontTransform scoped_transform(m_Face, &ft_matrix); |
1117 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) | 1117 int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT) |
1118 ? FXFT_LOAD_NO_BITMAP | 1118 ? FXFT_LOAD_NO_BITMAP |
1119 : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING); | 1119 : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING); |
1120 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); | 1120 int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); |
1121 if (error) { | 1121 if (error) { |
1122 // if an error is returned, try to reload glyphs without hinting. | 1122 // if an error is returned, try to reload glyphs without hinting. |
1123 if (load_flags & FT_LOAD_NO_HINTING || load_flags & FT_LOAD_NO_SCALE) { | 1123 if (load_flags & FT_LOAD_NO_HINTING || load_flags & FT_LOAD_NO_SCALE) { |
1124 return NULL; | 1124 return nullptr; |
1125 } | 1125 } |
1126 | 1126 |
1127 load_flags |= FT_LOAD_NO_HINTING; | 1127 load_flags |= FT_LOAD_NO_HINTING; |
1128 error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); | 1128 error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags); |
1129 | 1129 |
1130 if (error) { | 1130 if (error) { |
1131 return NULL; | 1131 return nullptr; |
1132 } | 1132 } |
1133 } | 1133 } |
1134 int weight = 0; | 1134 int weight = 0; |
1135 if (bUseCJKSubFont) { | 1135 if (bUseCJKSubFont) { |
1136 weight = pSubstFont->m_WeightCJK; | 1136 weight = pSubstFont->m_WeightCJK; |
1137 } else { | 1137 } else { |
1138 weight = pSubstFont ? pSubstFont->m_Weight : 0; | 1138 weight = pSubstFont ? pSubstFont->m_Weight : 0; |
1139 } | 1139 } |
1140 if (pSubstFont && !(pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && | 1140 if (pSubstFont && !(pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && |
1141 weight > 400) { | 1141 weight > 400) { |
1142 uint32_t index = (weight - 400) / 10; | 1142 uint32_t index = (weight - 400) / 10; |
1143 if (index >= WEIGHTPOW_ARRAY_SIZE) | 1143 if (index >= WEIGHTPOW_ARRAY_SIZE) |
1144 return NULL; | 1144 return nullptr; |
1145 int level = 0; | 1145 int level = 0; |
1146 if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { | 1146 if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) { |
1147 level = | 1147 level = |
1148 g_WeightPow_SHIFTJIS[index] * 2 * | 1148 g_WeightPow_SHIFTJIS[index] * 2 * |
1149 (FXSYS_abs((int)(ft_matrix.xx)) + FXSYS_abs((int)(ft_matrix.xy))) / | 1149 (FXSYS_abs((int)(ft_matrix.xx)) + FXSYS_abs((int)(ft_matrix.xy))) / |
1150 36655; | 1150 36655; |
1151 } else { | 1151 } else { |
1152 level = g_WeightPow_11[index] * (FXSYS_abs((int)(ft_matrix.xx)) + | 1152 level = g_WeightPow_11[index] * (FXSYS_abs((int)(ft_matrix.xx)) + |
1153 FXSYS_abs((int)(ft_matrix.xy))) / | 1153 FXSYS_abs((int)(ft_matrix.xy))) / |
1154 36655; | 1154 36655; |
1155 } | 1155 } |
1156 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); | 1156 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); |
1157 } | 1157 } |
1158 FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(), | 1158 FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(), |
1159 FT_LCD_FILTER_DEFAULT); | 1159 FT_LCD_FILTER_DEFAULT); |
1160 error = FXFT_Render_Glyph(m_Face, anti_alias); | 1160 error = FXFT_Render_Glyph(m_Face, anti_alias); |
1161 if (error) { | 1161 if (error) { |
1162 return NULL; | 1162 return nullptr; |
1163 } | 1163 } |
1164 int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face)); | 1164 int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face)); |
1165 int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face)); | 1165 int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face)); |
1166 if (bmwidth > 2048 || bmheight > 2048) { | 1166 if (bmwidth > 2048 || bmheight > 2048) { |
1167 return NULL; | 1167 return nullptr; |
1168 } | 1168 } |
1169 int dib_width = bmwidth; | 1169 int dib_width = bmwidth; |
1170 CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; | 1170 CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; |
1171 pGlyphBitmap->m_Bitmap.Create( | 1171 pGlyphBitmap->m_Bitmap.Create( |
1172 dib_width, bmheight, | 1172 dib_width, bmheight, |
1173 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask); | 1173 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask); |
1174 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); | 1174 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); |
1175 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); | 1175 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); |
1176 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); | 1176 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); |
1177 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); | 1177 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 param->m_pPoints[param->m_PointCount + 2].m_Flag = FXPT_BEZIERTO; | 1351 param->m_pPoints[param->m_PointCount + 2].m_Flag = FXPT_BEZIERTO; |
1352 param->m_CurX = to->x; | 1352 param->m_CurX = to->x; |
1353 param->m_CurY = to->y; | 1353 param->m_CurY = to->y; |
1354 } | 1354 } |
1355 param->m_PointCount += 3; | 1355 param->m_PointCount += 3; |
1356 return 0; | 1356 return 0; |
1357 } | 1357 } |
1358 }; | 1358 }; |
1359 CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) { | 1359 CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, int dest_width) { |
1360 if (!m_Face) { | 1360 if (!m_Face) { |
1361 return NULL; | 1361 return nullptr; |
1362 } | 1362 } |
1363 FXFT_Set_Pixel_Sizes(m_Face, 0, 64); | 1363 FXFT_Set_Pixel_Sizes(m_Face, 0, 64); |
1364 FXFT_Matrix ft_matrix = {65536, 0, 0, 65536}; | 1364 FXFT_Matrix ft_matrix = {65536, 0, 0, 65536}; |
1365 if (m_pSubstFont) { | 1365 if (m_pSubstFont) { |
1366 if (m_pSubstFont->m_ItalicAngle) { | 1366 if (m_pSubstFont->m_ItalicAngle) { |
1367 int skew = m_pSubstFont->m_ItalicAngle; | 1367 int skew = m_pSubstFont->m_ItalicAngle; |
1368 // |skew| is nonpositive so |-skew| is used as the index. We need to make | 1368 // |skew| is nonpositive so |-skew| is used as the index. We need to make |
1369 // sure |skew| != INT_MIN since -INT_MIN is undefined. | 1369 // sure |skew| != INT_MIN since -INT_MIN is undefined. |
1370 if (skew <= 0 && skew != std::numeric_limits<int>::min() && | 1370 if (skew <= 0 && skew != std::numeric_limits<int>::min() && |
1371 static_cast<size_t>(-skew) < ANGLESKEW_ARRAY_SIZE) { | 1371 static_cast<size_t>(-skew) < ANGLESKEW_ARRAY_SIZE) { |
1372 skew = -g_AngleSkew[-skew]; | 1372 skew = -g_AngleSkew[-skew]; |
1373 } else { | 1373 } else { |
1374 skew = -58; | 1374 skew = -58; |
1375 } | 1375 } |
1376 if (m_bVertical) | 1376 if (m_bVertical) |
1377 ft_matrix.yx += ft_matrix.yy * skew / 100; | 1377 ft_matrix.yx += ft_matrix.yy * skew / 100; |
1378 else | 1378 else |
1379 ft_matrix.xy -= ft_matrix.xx * skew / 100; | 1379 ft_matrix.xy -= ft_matrix.xx * skew / 100; |
1380 } | 1380 } |
1381 if (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { | 1381 if (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) { |
1382 AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight); | 1382 AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight); |
1383 } | 1383 } |
1384 } | 1384 } |
1385 ScopedFontTransform scoped_transform(m_Face, &ft_matrix); | 1385 ScopedFontTransform scoped_transform(m_Face, &ft_matrix); |
1386 int load_flags = FXFT_LOAD_NO_BITMAP; | 1386 int load_flags = FXFT_LOAD_NO_BITMAP; |
1387 if (!(m_Face->face_flags & FT_FACE_FLAG_SFNT) || !FT_IS_TRICKY(m_Face)) { | 1387 if (!(m_Face->face_flags & FT_FACE_FLAG_SFNT) || !FT_IS_TRICKY(m_Face)) { |
1388 load_flags |= FT_LOAD_NO_HINTING; | 1388 load_flags |= FT_LOAD_NO_HINTING; |
1389 } | 1389 } |
1390 if (FXFT_Load_Glyph(m_Face, glyph_index, load_flags)) | 1390 if (FXFT_Load_Glyph(m_Face, glyph_index, load_flags)) |
1391 return NULL; | 1391 return nullptr; |
1392 if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && | 1392 if (m_pSubstFont && !(m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM) && |
1393 m_pSubstFont->m_Weight > 400) { | 1393 m_pSubstFont->m_Weight > 400) { |
1394 uint32_t index = (m_pSubstFont->m_Weight - 400) / 10; | 1394 uint32_t index = (m_pSubstFont->m_Weight - 400) / 10; |
1395 if (index >= WEIGHTPOW_ARRAY_SIZE) | 1395 if (index >= WEIGHTPOW_ARRAY_SIZE) |
1396 index = WEIGHTPOW_ARRAY_SIZE - 1; | 1396 index = WEIGHTPOW_ARRAY_SIZE - 1; |
1397 int level = 0; | 1397 int level = 0; |
1398 if (m_pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) | 1398 if (m_pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET) |
1399 level = g_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655; | 1399 level = g_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655; |
1400 else | 1400 else |
1401 level = g_WeightPow[index] * 2; | 1401 level = g_WeightPow[index] * 2; |
1402 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); | 1402 FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face), level); |
1403 } | 1403 } |
1404 FXFT_Outline_Funcs funcs; | 1404 FXFT_Outline_Funcs funcs; |
1405 funcs.move_to = _Outline_MoveTo; | 1405 funcs.move_to = _Outline_MoveTo; |
1406 funcs.line_to = _Outline_LineTo; | 1406 funcs.line_to = _Outline_LineTo; |
1407 funcs.conic_to = _Outline_ConicTo; | 1407 funcs.conic_to = _Outline_ConicTo; |
1408 funcs.cubic_to = _Outline_CubicTo; | 1408 funcs.cubic_to = _Outline_CubicTo; |
1409 funcs.shift = 0; | 1409 funcs.shift = 0; |
1410 funcs.delta = 0; | 1410 funcs.delta = 0; |
1411 OUTLINE_PARAMS params; | 1411 OUTLINE_PARAMS params; |
1412 params.m_bCount = TRUE; | 1412 params.m_bCount = TRUE; |
1413 params.m_PointCount = 0; | 1413 params.m_PointCount = 0; |
1414 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); | 1414 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); |
1415 if (params.m_PointCount == 0) { | 1415 if (params.m_PointCount == 0) { |
1416 return NULL; | 1416 return nullptr; |
1417 } | 1417 } |
1418 CFX_PathData* pPath = new CFX_PathData; | 1418 CFX_PathData* pPath = new CFX_PathData; |
1419 pPath->SetPointCount(params.m_PointCount); | 1419 pPath->SetPointCount(params.m_PointCount); |
1420 params.m_bCount = FALSE; | 1420 params.m_bCount = FALSE; |
1421 params.m_PointCount = 0; | 1421 params.m_PointCount = 0; |
1422 params.m_pPoints = pPath->GetPoints(); | 1422 params.m_pPoints = pPath->GetPoints(); |
1423 params.m_CurX = params.m_CurY = 0; | 1423 params.m_CurX = params.m_CurY = 0; |
1424 params.m_CoordUnit = 64 * 64.0; | 1424 params.m_CoordUnit = 64 * 64.0; |
1425 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); | 1425 FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face), &funcs, ¶ms); |
1426 _Outline_CheckEmptyContour(¶ms); | 1426 _Outline_CheckEmptyContour(¶ms); |
1427 pPath->TrimPoints(params.m_PointCount); | 1427 pPath->TrimPoints(params.m_PointCount); |
1428 if (params.m_PointCount) { | 1428 if (params.m_PointCount) { |
1429 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; | 1429 pPath->GetPoints()[params.m_PointCount - 1].m_Flag |= FXPT_CLOSEFIGURE; |
1430 } | 1430 } |
1431 return pPath; | 1431 return pPath; |
1432 } | 1432 } |
1433 void _CFX_UniqueKeyGen::Generate(int count, ...) { | 1433 void _CFX_UniqueKeyGen::Generate(int count, ...) { |
1434 va_list argList; | 1434 va_list argList; |
1435 va_start(argList, count); | 1435 va_start(argList, count); |
1436 for (int i = 0; i < count; i++) { | 1436 for (int i = 0; i < count; i++) { |
1437 int p = va_arg(argList, int); | 1437 int p = va_arg(argList, int); |
1438 ((uint32_t*)m_Key)[i] = p; | 1438 ((uint32_t*)m_Key)[i] = p; |
1439 } | 1439 } |
1440 va_end(argList); | 1440 va_end(argList); |
1441 m_KeyLen = count * sizeof(uint32_t); | 1441 m_KeyLen = count * sizeof(uint32_t); |
1442 } | 1442 } |
OLD | NEW |