| 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 "../../../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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 int space = (*next_origin) - (*this_origin); | 71 int space = (*next_origin) - (*this_origin); |
| 72 FX_FLOAT space_f = next_origin_f - this_origin_f; | 72 FX_FLOAT space_f = next_origin_f - this_origin_f; |
| 73 FX_FLOAT error = (FX_FLOAT)(FXSYS_fabs(space_f) - FXSYS_fabs((FX_FLOAT)(
space))); | 73 FX_FLOAT error = (FX_FLOAT)(FXSYS_fabs(space_f) - FXSYS_fabs((FX_FLOAT)(
space))); |
| 74 if (error > 0.5f) { | 74 if (error > 0.5f) { |
| 75 *this_origin += space > 0 ? -1 : 1; | 75 *this_origin += space > 0 ? -1 : 1; |
| 76 } | 76 } |
| 77 next_origin = this_origin; | 77 next_origin = this_origin; |
| 78 next_origin_f = this_origin_f; | 78 next_origin_f = this_origin_f; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 static const FX_BYTE g_GdipGamma_bgw[9] = {0, 0, 63, 120, 0, 168, 210, 239, 255}
; | |
| 82 static const FX_BYTE g_GdipGamma_fgw[9] = {0, 0, 16, 45, 0, 87, 135, 192, 255}; | |
| 83 static const FX_BYTE g_GdipGammaAdjust_47[48] = { | |
| 84 0, 30, 33, 34, 35, 36, 37, 38, 38, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 4
2, 42, 43, | |
| 85 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 46, | |
| 86 46, 46, 46, 46, 46, 46, 46, 47 | |
| 87 }; | |
| 88 static const FX_BYTE g_GdipGammaAdjust_75[76] = { | |
| 89 0, 46, 50, 52, 54, 55, 56, 57, 58, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 6
4, 64, 65, | |
| 90 65, 65, 66, 66, 66, 67, 67, 67, 67, 68, 68, 68, 68, 68, 69, 69, 69, 69, 69,
70, 70, 70, | |
| 91 70, 70, 71, 71, 71, 71, 71, 71, 72, 72, 72, 72, 72, 72, 72, 73, 73, 73, 73,
73, 73, 73, | |
| 92 73, 74, 74, 74, 74, 74, 74, 74, 74, 75 | |
| 93 }; | |
| 94 static const FX_BYTE g_GdipGammaAdjust_81[82] = { | |
| 95 0, 49, 53, 56, 58, 59, 60, 61, 62, 63, 64, 65, 65, 66, 66, 67, 67, 68, 68, 6
9, 69, 69, 70, 70, 70, | |
| 96 71, 71, 71, 72, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 74, 74, 75, 75, 75,
75, 75, 76, 76, 76, 76, | |
| 97 76, 76, 77, 77, 77, 77, 77, 77, 78, 78, 78, 78, 78, 78, 78, 79, 79, 79, 79,
79, 79, 79, 79, 80, | |
| 98 80, 80, 80, 80, 80, 80, 80, 81 | |
| 99 }; | |
| 100 static void _Adjust_alpha(int background, int foreground, int& src_alpha, int te
xt_flags, int a) | |
| 101 { | |
| 102 } | |
| 103 static const FX_BYTE g_TextGammaAdjust[256] = { | 81 static const FX_BYTE g_TextGammaAdjust[256] = { |
| 104 0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 19, | 82 0, 2, 3, 4, 6, 7, 8, 10, 11, 12, 13, 15, 16, 17, 18, 19, |
| 105 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, | 83 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, |
| 106 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, | 84 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, |
| 107 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, | 85 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, |
| 108 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, | 86 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, |
| 109 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, | 87 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 110 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 1
20, | 88 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 1
20, |
| 111 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 1
35, | 89 121, 122, 123, 124, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, 1
35, |
| 112 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 1
51, | 90 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 1
51, |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); | 1184 m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap); |
| 1207 delete pGlyphBitmap; | 1185 delete pGlyphBitmap; |
| 1208 } | 1186 } |
| 1209 m_GlyphMap.RemoveAll(); | 1187 m_GlyphMap.RemoveAll(); |
| 1210 } | 1188 } |
| 1211 #if defined(_FPDFAPI_MINI_) | 1189 #if defined(_FPDFAPI_MINI_) |
| 1212 #define CONTRAST_RAMP_STEP 16 | 1190 #define CONTRAST_RAMP_STEP 16 |
| 1213 #else | 1191 #else |
| 1214 #define CONTRAST_RAMP_STEP 1 | 1192 #define CONTRAST_RAMP_STEP 1 |
| 1215 #endif | 1193 #endif |
| 1216 static const FX_BYTE g_adjust_contrast11[256] = { | |
| 1217 0, 0, 2, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 17, 18, 19, 21, 22, 24, 25, 2
6, 28, 29, 31, | |
| 1218 32, 33, 35, 36, 38, 39, 40, 42, 43, 45, 46, 48, 49, 51, 52, 54, 55, 56, 58,
59, 61, 62, 64, 65, | |
| 1219 67, 68, 70, 71, 72, 74, 75, 77, 78, 80, 81, 83, 84, 86, 87, 89, 90, 91, 93,
94, 96, 97, 99, 100, | |
| 1220 101, 103, 104, 106, 107, 109, 110, 111, 113, 114, 116, 117, 118, 120, 121, 1
23, 124, 125, 127, | |
| 1221 128, 130, 131, 132, 134, 135, 136, 138, 139, 140, 142, 143, 144, 146, 147, 1
48, 149, 151, 152, | |
| 1222 153, 155, 156, 157, 158, 160, 161, 162, 163, 165, 166, 167, 168, 169, 171, 1
72, 173, 174, 175, | |
| 1223 177, 178, 179, 180, 181, 182, 183, 185, 186, 187, 188, 189, 190, 191, 192, 1
93, 194, 195, 196, | |
| 1224 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 2
12, 213, 214, 215, | |
| 1225 215, 216, 217, 218, 219, 220, 221, 221, 222, 223, 224, 224, 225, 226, 227, 2
27, 228, 229, 230, | |
| 1226 230, 231, 232, 232, 233, 234, 234, 235, 236, 236, 237, 237, 238, 239, 239, 2
40, 240, 241, 241, | |
| 1227 242, 242, 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, 248, 2
48, 249, 249, 249, | |
| 1228 250, 250, 250, 251, 251, 251, 251, 252, 252, 252, 252, 253, 253, 253, 253, 2
53, 253, 254, 254, | |
| 1229 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, | |
| 1230 }; | |
| 1231 static const FX_BYTE g_adjust_contrast15[256] = { | |
| 1232 0, 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 10, 11, 12, 13,
14, 15, 16, 17, 18, 19, 20, 21, | |
| 1233 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 40, 41, 42,
43, 45, 46, 47, 48, 50, 51, | |
| 1234 52, 54, 55, 56, 58, 59, 60, 62, 63, 64, 66, 67, 68, 70, 71, 73, 74, 75, 77,
78, 80, 81, 82, 84, 85, 87, | |
| 1235 88, 90, 91, 93, 94, 95, 97, 98, 100, 101, 103, 104, 106, 107, 109, 110, 111,
113, 114, 116, 117, 119, | |
| 1236 120, 122, 123, 125, 126, 128, 129, 130, 132, 133, 135, 136, 138, 139, 141, 1
42, 143, 145, 146, 148, | |
| 1237 149, 150, 152, 153, 155, 156, 157, 159, 160, 161, 163, 164, 166, 167, 168, 1
70, 171, 172, 174, 175, | |
| 1238 176, 177, 179, 180, 181, 183, 184, 185, 186, 188, 189, 190, 191, 192, 194, 1
95, 196, 197, 198, 199, | |
| 1239 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 2
16, 217, 218, 219, 220, | |
| 1240 221, 222, 223, 224, 225, 226, 227, 227, 228, 229, 230, 231, 232, 232, 233, 2
34, 235, 235, 236, 237, | |
| 1241 237, 238, 239, 239, 240, 241, 241, 242, 242, 243, 244, 244, 245, 245, 246, 2
46, 247, 247, 248, 248, | |
| 1242 248, 249, 249, 250, 250, 250, 251, 251, 251, 252, 252, 252, 252, 253, 253, 2
53, 253, 253, 254, 254, | |
| 1243 254, 254, 254, 254, 254, 254, 254, 254, 254, 255, | |
| 1244 }; | |
| 1245 static void _CalcContrastRamp(FX_LPBYTE ramp, int level) | |
| 1246 { | |
| 1247 int contrast_min = 0, contrast_max = 255 - level, i; | |
| 1248 for (i = 0; i < contrast_min; i ++) { | |
| 1249 ramp[i] = 0; | |
| 1250 } | |
| 1251 for (i = contrast_min; i < contrast_max; i ++) { | |
| 1252 ramp[i] = 255 * (i - contrast_min) / (contrast_max - contrast_min); | |
| 1253 } | |
| 1254 for (i = contrast_max; i < 256; i ++) { | |
| 1255 ramp[i] = 255; | |
| 1256 } | |
| 1257 } | |
| 1258 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) | 1194 void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) |
| 1259 { | 1195 { |
| 1260 FXFT_MM_Var pMasters = NULL; | 1196 FXFT_MM_Var pMasters = NULL; |
| 1261 FXFT_Get_MM_Var(m_Face, &pMasters); | 1197 FXFT_Get_MM_Var(m_Face, &pMasters); |
| 1262 if (pMasters == NULL) { | 1198 if (pMasters == NULL) { |
| 1263 return; | 1199 return; |
| 1264 } | 1200 } |
| 1265 long coords[2]; | 1201 long coords[2]; |
| 1266 if (weight == 0) { | 1202 if (weight == 0) { |
| 1267 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; | 1203 coords[0] = FXFT_Get_MM_Axis_Def(FXFT_Get_MM_Axis(pMasters, 0)) / 65536; |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1765 { | 1701 { |
| 1766 va_list argList; | 1702 va_list argList; |
| 1767 va_start(argList, count); | 1703 va_start(argList, count); |
| 1768 for (int i = 0; i < count; i ++) { | 1704 for (int i = 0; i < count; i ++) { |
| 1769 int p = va_arg(argList, int); | 1705 int p = va_arg(argList, int); |
| 1770 ((FX_DWORD*)m_Key)[i] = p; | 1706 ((FX_DWORD*)m_Key)[i] = p; |
| 1771 } | 1707 } |
| 1772 va_end(argList); | 1708 va_end(argList); |
| 1773 m_KeyLen = count * sizeof(FX_DWORD); | 1709 m_KeyLen = count * sizeof(FX_DWORD); |
| 1774 } | 1710 } |
| OLD | NEW |