| 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_TextGammaAdjust[256] = { | 81 static const uint8_t g_TextGammaAdjust[256] = { |
| 82 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, |
| 83 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, |
| 84 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, |
| 85 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, |
| 86 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, |
| 87 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, |
| 88 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, |
| 89 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, |
| 90 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, |
| 91 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 1
66, | 91 152, 153, 154, 155, 156, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 1
66, |
| 92 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 1
81, | 92 167, 168, 169, 170, 171, 172, 173, 174, 174, 175, 176, 177, 178, 179, 180, 1
81, |
| 93 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 1
96, | 93 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 193, 194, 195, 1
96, |
| 94 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 2
11, | 94 197, 198, 199, 200, 201, 202, 203, 204, 204, 205, 206, 207, 208, 209, 210, 2
11, |
| 95 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 223, 224, 225, 2
26, | 95 212, 213, 214, 215, 216, 217, 217, 218, 219, 220, 221, 222, 223, 224, 225, 2
26, |
| 96 227, 228, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 239, 2
40, | 96 227, 228, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 239, 2
40, |
| 97 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 2
55, | 97 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 250, 251, 252, 253, 254, 2
55, |
| 98 }; | 98 }; |
| 99 #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ | 99 #define ADJUST_ALPHA(background, foreground, src_alpha, text_flags, a) \ |
| 100 src_alpha = g_TextGammaAdjust[(FX_BYTE)src_alpha]; | 100 src_alpha = g_TextGammaAdjust[(uint8_t)src_alpha]; |
| 101 void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf
orm) | 101 void _Color2Argb(FX_ARGB& argb, FX_DWORD color, int alpha_flag, void* pIccTransf
orm) |
| 102 { | 102 { |
| 103 if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { | 103 if (pIccTransform == NULL && !FXGETFLAG_COLORTYPE(alpha_flag)) { |
| 104 argb = color; | 104 argb = color; |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodec
Module()->GetIccModule()) { | 107 if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodec
Module()->GetIccModule()) { |
| 108 pIccTransform = NULL; | 108 pIccTransform = NULL; |
| 109 } | 109 } |
| 110 FX_BYTE bgra[4]; | 110 uint8_t bgra[4]; |
| 111 if (pIccTransform) { | 111 if (pIccTransform) { |
| 112 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge
tIccModule(); | 112 ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->Ge
tIccModule(); |
| 113 color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_T
ODIB(color); | 113 color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_T
ODIB(color); |
| 114 pIccModule->TranslateScanline(pIccTransform, bgra, (FX_LPCBYTE)&color, 1
); | 114 pIccModule->TranslateScanline(pIccTransform, bgra, (FX_LPCBYTE)&color, 1
); |
| 115 bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) ? | 115 bgra[3] = FXGETFLAG_COLORTYPE(alpha_flag) ? |
| 116 (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETF
LAG_ALPHA_STROKE(alpha_flag) : | 116 (alpha_flag >> 24) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXGETF
LAG_ALPHA_STROKE(alpha_flag) : |
| 117 FXARGB_A(color); | 117 FXARGB_A(color); |
| 118 argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]); | 118 argb = FXARGB_MAKE(bgra[3], bgra[2], bgra[1], bgra[0]); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 src_scan += 3; | 438 src_scan += 3; |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 } else { | 441 } else { |
| 442 if (x_subpixel == 0) { | 442 if (x_subpixel == 0) { |
| 443 for (int col = start_col; col < end_col; col ++) { | 443 for (int col = start_col; col < end_col; col ++) { |
| 444 if (bNormal) { | 444 if (bNormal) { |
| 445 int src_alpha1 = (src_scan[0] + src_scan[1] + sr
c_scan[2]) / 3; | 445 int src_alpha1 = (src_scan[0] + src_scan[1] + sr
c_scan[2]) / 3; |
| 446 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); | 446 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); |
| 447 src_alpha1 = src_alpha1 * a / 255; | 447 src_alpha1 = src_alpha1 * a / 255; |
| 448 FX_BYTE back_alpha = dest_scan[3]; | 448 uint8_t back_alpha = dest_scan[3]; |
| 449 if (back_alpha == 0) { | 449 if (back_alpha == 0) { |
| 450 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); | 450 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); |
| 451 dest_scan += 4; | 451 dest_scan += 4; |
| 452 src_scan += 3; | 452 src_scan += 3; |
| 453 continue; | 453 continue; |
| 454 } | 454 } |
| 455 if (src_alpha1 == 0) { | 455 if (src_alpha1 == 0) { |
| 456 dest_scan += 4; | 456 dest_scan += 4; |
| 457 src_scan += 3; | 457 src_scan += 3; |
| 458 continue; | 458 continue; |
| 459 } | 459 } |
| 460 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; | 460 uint8_t dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; |
| 461 dest_scan[3] = dest_alpha; | 461 dest_scan[3] = dest_alpha; |
| 462 int alpha_ratio = src_alpha1 * 255 / dest_alpha; | 462 int alpha_ratio = src_alpha1 * 255 / dest_alpha; |
| 463 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); | 463 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); |
| 464 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); | 464 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); |
| 465 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); | 465 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); |
| 466 dest_scan += 4; | 466 dest_scan += 4; |
| 467 src_scan += 3; | 467 src_scan += 3; |
| 468 continue; | 468 continue; |
| 469 } | 469 } |
| 470 int src_alpha = src_scan[0]; | 470 int src_alpha = src_scan[0]; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 485 } | 485 } |
| 486 } else if (x_subpixel == 1) { | 486 } else if (x_subpixel == 1) { |
| 487 if (bNormal) { | 487 if (bNormal) { |
| 488 int src_alpha1 = start_col > left ? ((src_scan[-1] +
src_scan[0] + src_scan[1]) / 3) : ((src_scan[0] + src_scan[1]) / 3); | 488 int src_alpha1 = start_col > left ? ((src_scan[-1] +
src_scan[0] + src_scan[1]) / 3) : ((src_scan[0] + src_scan[1]) / 3); |
| 489 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext
_flags, a); | 489 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext
_flags, a); |
| 490 src_alpha1 = src_alpha1 * a / 255; | 490 src_alpha1 = src_alpha1 * a / 255; |
| 491 if (src_alpha1 == 0) { | 491 if (src_alpha1 == 0) { |
| 492 dest_scan += 4; | 492 dest_scan += 4; |
| 493 src_scan += 3; | 493 src_scan += 3; |
| 494 } else { | 494 } else { |
| 495 FX_BYTE back_alpha = dest_scan[3]; | 495 uint8_t back_alpha = dest_scan[3]; |
| 496 if (back_alpha == 0) { | 496 if (back_alpha == 0) { |
| 497 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); | 497 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); |
| 498 } else { | 498 } else { |
| 499 FX_BYTE dest_alpha = back_alpha + src_alpha1
- back_alpha * src_alpha1 / 255; | 499 uint8_t dest_alpha = back_alpha + src_alpha1
- back_alpha * src_alpha1 / 255; |
| 500 dest_scan[3] = dest_alpha; | 500 dest_scan[3] = dest_alpha; |
| 501 int alpha_ratio = src_alpha1 * 255 / dest_al
pha; | 501 int alpha_ratio = src_alpha1 * 255 / dest_al
pha; |
| 502 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); | 502 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); |
| 503 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); | 503 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); |
| 504 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); | 504 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); |
| 505 } | 505 } |
| 506 dest_scan += 4; | 506 dest_scan += 4; |
| 507 src_scan += 3; | 507 src_scan += 3; |
| 508 } | 508 } |
| 509 } else { | 509 } else { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 523 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX
_GAMMA(dest_scan[0]), b, src_alpha)); | 523 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX
_GAMMA(dest_scan[0]), b, src_alpha)); |
| 524 dest_scan[3] = 255; | 524 dest_scan[3] = 255; |
| 525 dest_scan += 4; | 525 dest_scan += 4; |
| 526 src_scan += 3; | 526 src_scan += 3; |
| 527 } | 527 } |
| 528 for (int col = start_col + 1; col < end_col; col ++) { | 528 for (int col = start_col + 1; col < end_col; col ++) { |
| 529 if (bNormal) { | 529 if (bNormal) { |
| 530 int src_alpha1 = (src_scan[-1] + src_scan[0] + s
rc_scan[1]) / 3; | 530 int src_alpha1 = (src_scan[-1] + src_scan[0] + s
rc_scan[1]) / 3; |
| 531 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); | 531 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); |
| 532 src_alpha1 = src_alpha1 * a / 255; | 532 src_alpha1 = src_alpha1 * a / 255; |
| 533 FX_BYTE back_alpha = dest_scan[3]; | 533 uint8_t back_alpha = dest_scan[3]; |
| 534 if (back_alpha == 0) { | 534 if (back_alpha == 0) { |
| 535 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); | 535 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); |
| 536 dest_scan += 4; | 536 dest_scan += 4; |
| 537 src_scan += 3; | 537 src_scan += 3; |
| 538 continue; | 538 continue; |
| 539 } | 539 } |
| 540 if (src_alpha1 == 0) { | 540 if (src_alpha1 == 0) { |
| 541 dest_scan += 4; | 541 dest_scan += 4; |
| 542 src_scan += 3; | 542 src_scan += 3; |
| 543 continue; | 543 continue; |
| 544 } | 544 } |
| 545 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; | 545 uint8_t dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; |
| 546 dest_scan[3] = dest_alpha; | 546 dest_scan[3] = dest_alpha; |
| 547 int alpha_ratio = src_alpha1 * 255 / dest_alpha; | 547 int alpha_ratio = src_alpha1 * 255 / dest_alpha; |
| 548 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); | 548 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); |
| 549 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); | 549 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); |
| 550 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); | 550 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); |
| 551 dest_scan += 4; | 551 dest_scan += 4; |
| 552 src_scan += 3; | 552 src_scan += 3; |
| 553 continue; | 553 continue; |
| 554 } | 554 } |
| 555 int src_alpha = src_scan[-1]; | 555 int src_alpha = src_scan[-1]; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 570 } | 570 } |
| 571 } else { | 571 } else { |
| 572 if (bNormal) { | 572 if (bNormal) { |
| 573 int src_alpha1 = start_col > left ? ((src_scan[-2] +
src_scan[-1] + src_scan[0]) / 3) : ((src_scan[0]) / 3); | 573 int src_alpha1 = start_col > left ? ((src_scan[-2] +
src_scan[-1] + src_scan[0]) / 3) : ((src_scan[0]) / 3); |
| 574 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext
_flags, a); | 574 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext
_flags, a); |
| 575 src_alpha1 = src_alpha1 * a / 255; | 575 src_alpha1 = src_alpha1 * a / 255; |
| 576 if (src_alpha1 == 0) { | 576 if (src_alpha1 == 0) { |
| 577 dest_scan += 4; | 577 dest_scan += 4; |
| 578 src_scan += 3; | 578 src_scan += 3; |
| 579 } else { | 579 } else { |
| 580 FX_BYTE back_alpha = dest_scan[3]; | 580 uint8_t back_alpha = dest_scan[3]; |
| 581 if (back_alpha == 0) { | 581 if (back_alpha == 0) { |
| 582 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); | 582 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); |
| 583 } else { | 583 } else { |
| 584 FX_BYTE dest_alpha = back_alpha + src_alpha1
- back_alpha * src_alpha1 / 255; | 584 uint8_t dest_alpha = back_alpha + src_alpha1
- back_alpha * src_alpha1 / 255; |
| 585 dest_scan[3] = dest_alpha; | 585 dest_scan[3] = dest_alpha; |
| 586 int alpha_ratio = src_alpha1 * 255 / dest_al
pha; | 586 int alpha_ratio = src_alpha1 * 255 / dest_al
pha; |
| 587 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); | 587 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); |
| 588 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); | 588 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); |
| 589 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); | 589 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_
MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); |
| 590 } | 590 } |
| 591 dest_scan += 4; | 591 dest_scan += 4; |
| 592 src_scan += 3; | 592 src_scan += 3; |
| 593 } | 593 } |
| 594 } else { | 594 } else { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 608 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX
_GAMMA(dest_scan[0]), b, src_alpha)); | 608 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX
_GAMMA(dest_scan[0]), b, src_alpha)); |
| 609 dest_scan[3] = 255; | 609 dest_scan[3] = 255; |
| 610 dest_scan += 4; | 610 dest_scan += 4; |
| 611 src_scan += 3; | 611 src_scan += 3; |
| 612 } | 612 } |
| 613 for (int col = start_col + 1; col < end_col; col ++) { | 613 for (int col = start_col + 1; col < end_col; col ++) { |
| 614 if (bNormal) { | 614 if (bNormal) { |
| 615 int src_alpha1 = (src_scan[-2] + src_scan[-1] +
src_scan[0]) / 3; | 615 int src_alpha1 = (src_scan[-2] + src_scan[-1] +
src_scan[0]) / 3; |
| 616 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); | 616 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native
text_flags, a); |
| 617 src_alpha1 = src_alpha1 * a / 255; | 617 src_alpha1 = src_alpha1 * a / 255; |
| 618 FX_BYTE back_alpha = dest_scan[3]; | 618 uint8_t back_alpha = dest_scan[3]; |
| 619 if (back_alpha == 0) { | 619 if (back_alpha == 0) { |
| 620 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); | 620 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp
ha1, r, g, b)); |
| 621 dest_scan += 4; | 621 dest_scan += 4; |
| 622 src_scan += 3; | 622 src_scan += 3; |
| 623 continue; | 623 continue; |
| 624 } | 624 } |
| 625 if (src_alpha1 == 0) { | 625 if (src_alpha1 == 0) { |
| 626 dest_scan += 4; | 626 dest_scan += 4; |
| 627 src_scan += 3; | 627 src_scan += 3; |
| 628 continue; | 628 continue; |
| 629 } | 629 } |
| 630 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; | 630 uint8_t dest_alpha = back_alpha + src_alpha1 - b
ack_alpha * src_alpha1 / 255; |
| 631 dest_scan[3] = dest_alpha; | 631 dest_scan[3] = dest_alpha; |
| 632 int alpha_ratio = src_alpha1 * 255 / dest_alpha; | 632 int alpha_ratio = src_alpha1 * 255 / dest_alpha; |
| 633 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); | 633 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); |
| 634 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); | 634 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); |
| 635 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); | 635 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG
E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); |
| 636 dest_scan += 4; | 636 dest_scan += 4; |
| 637 src_scan += 3; | 637 src_scan += 3; |
| 638 continue; | 638 continue; |
| 639 } | 639 } |
| 640 int src_alpha = src_scan[-2]; | 640 int src_alpha = src_scan[-2]; |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff
ineMatrix* pMatrix, | 1064 CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff
ineMatrix* pMatrix, |
| 1065 CFX_ByteStringC& FaceGlyphsKey, FX_DWORD glyph_index, FX_BOOL bFontStyle
, | 1065 CFX_ByteStringC& FaceGlyphsKey, FX_DWORD glyph_index, FX_BOOL bFontStyle
, |
| 1066 int dest_width, int anti_alias) | 1066 int dest_width, int anti_alias) |
| 1067 { | 1067 { |
| 1068 CFX_SizeGlyphCache* pSizeCache = NULL; | 1068 CFX_SizeGlyphCache* pSizeCache = NULL; |
| 1069 if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { | 1069 if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { |
| 1070 pSizeCache = new CFX_SizeGlyphCache; | 1070 pSizeCache = new CFX_SizeGlyphCache; |
| 1071 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); | 1071 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); |
| 1072 } | 1072 } |
| 1073 CFX_GlyphBitmap* pGlyphBitmap = NULL; | 1073 CFX_GlyphBitmap* pGlyphBitmap = NULL; |
| 1074 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index, (void*
&)pGlyphBitmap)) { | 1074 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&
)pGlyphBitmap)) { |
| 1075 return pGlyphBitmap; | 1075 return pGlyphBitmap; |
| 1076 } | 1076 } |
| 1077 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_wid
th, anti_alias); | 1077 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_wid
th, anti_alias); |
| 1078 if (pGlyphBitmap == NULL) { | 1078 if (pGlyphBitmap == NULL) { |
| 1079 return NULL; | 1079 return NULL; |
| 1080 } | 1080 } |
| 1081 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitma
p); | 1081 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap
); |
| 1082 return pGlyphBitmap; | 1082 return pGlyphBitmap; |
| 1083 } | 1083 } |
| 1084 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD
glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, | 1084 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD
glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, |
| 1085 int dest_width, int anti_alias, int& text_flags) | 1085 int dest_width, int anti_alias, int& text_flags) |
| 1086 { | 1086 { |
| 1087 if (glyph_index == (FX_DWORD) - 1) { | 1087 if (glyph_index == (FX_DWORD) - 1) { |
| 1088 return NULL; | 1088 return NULL; |
| 1089 } | 1089 } |
| 1090 _CFX_UniqueKeyGen keygen; | 1090 _CFX_UniqueKeyGen keygen; |
| 1091 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 1091 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1118 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); | 1118 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); |
| 1119 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ | 1119 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ |
| 1120 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt
yle, dest_width, anti_alias); | 1120 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt
yle, dest_width, anti_alias); |
| 1121 #else | 1121 #else |
| 1122 if (text_flags & FXTEXT_NO_NATIVETEXT) { | 1122 if (text_flags & FXTEXT_NO_NATIVETEXT) { |
| 1123 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo
ntStyle, dest_width, anti_alias); | 1123 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo
ntStyle, dest_width, anti_alias); |
| 1124 } else { | 1124 } else { |
| 1125 CFX_GlyphBitmap* pGlyphBitmap; | 1125 CFX_GlyphBitmap* pGlyphBitmap; |
| 1126 CFX_SizeGlyphCache* pSizeCache = NULL; | 1126 CFX_SizeGlyphCache* pSizeCache = NULL; |
| 1127 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { | 1127 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { |
| 1128 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index
, (void*&)pGlyphBitmap)) { | 1128 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index,
(void*&)pGlyphBitmap)) { |
| 1129 return pGlyphBitmap; | 1129 return pGlyphBitmap; |
| 1130 } | 1130 } |
| 1131 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); | 1131 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); |
| 1132 if (pGlyphBitmap) { | 1132 if (pGlyphBitmap) { |
| 1133 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index,
pGlyphBitmap); | 1133 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index,
pGlyphBitmap); |
| 1134 return pGlyphBitmap; | 1134 return pGlyphBitmap; |
| 1135 } | 1135 } |
| 1136 } else { | 1136 } else { |
| 1137 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); | 1137 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d
est_width, anti_alias); |
| 1138 if (pGlyphBitmap) { | 1138 if (pGlyphBitmap) { |
| 1139 pSizeCache = new CFX_SizeGlyphCache; | 1139 pSizeCache = new CFX_SizeGlyphCache; |
| 1140 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); | 1140 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); |
| 1141 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index,
pGlyphBitmap); | 1141 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index,
pGlyphBitmap); |
| 1142 return pGlyphBitmap; | 1142 return pGlyphBitmap; |
| 1143 } | 1143 } |
| 1144 } | 1144 } |
| 1145 if (pFont->GetSubstFont()) | 1145 if (pFont->GetSubstFont()) |
| 1146 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), | 1146 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), |
| 1147 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias, | 1147 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias, |
| 1148 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont
()->m_ItalicAngle, pFont->IsVertical()); | 1148 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont
()->m_ItalicAngle, pFont->IsVertical()); |
| 1149 else | 1149 else |
| 1150 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), | 1150 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100
00), |
| 1151 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias); | 1151 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000)
, dest_width, anti_alias); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 FXFT_Free(m_Face, pMasters); | 1202 FXFT_Free(m_Face, pMasters); |
| 1203 FXFT_Set_MM_Design_Coordinates(m_Face, 2, coords); | 1203 FXFT_Set_MM_Design_Coordinates(m_Face, 2, coords); |
| 1204 } | 1204 } |
| 1205 static const size_t ANGLESKEW_ARRAY_SIZE = 30; | 1205 static const size_t ANGLESKEW_ARRAY_SIZE = 30; |
| 1206 static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { | 1206 static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { |
| 1207 0, 2, 3, 5, 7, 9, 11, 12, 14, 16, | 1207 0, 2, 3, 5, 7, 9, 11, 12, 14, 16, |
| 1208 18, 19, 21, 23, 25, 27, 29, 31, 32, 34, | 1208 18, 19, 21, 23, 25, 27, 29, 31, 32, 34, |
| 1209 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, | 1209 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, |
| 1210 }; | 1210 }; |
| 1211 static const size_t WEIGHTPOW_ARRAY_SIZE = 100; | 1211 static const size_t WEIGHTPOW_ARRAY_SIZE = 100; |
| 1212 static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { | 1212 static const uint8_t g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { |
| 1213 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, | 1213 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, |
| 1214 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, | 1214 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, |
| 1215 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, | 1215 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, |
| 1216 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, | 1216 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, |
| 1217 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, | 1217 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, |
| 1218 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, | 1218 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, |
| 1219 }; | 1219 }; |
| 1220 static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { | 1220 static const uint8_t g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { |
| 1221 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, | 1221 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, |
| 1222 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, | 1222 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, |
| 1223 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, | 1223 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, |
| 1224 46, 43, 47, 47, 48, 48, 48, 48, 45, 50, 50, 50, 46, 51, 51, 51, 52, 52, | 1224 46, 43, 47, 47, 48, 48, 48, 48, 45, 50, 50, 50, 46, 51, 51, 51, 52, 52, |
| 1225 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, | 1225 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, |
| 1226 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, | 1226 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, |
| 1227 }; | 1227 }; |
| 1228 static const FX_BYTE g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { | 1228 static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { |
| 1229 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, | 1229 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, |
| 1230 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50,
50, | 1230 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50,
50, |
| 1231 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54,
55, 55, | 1231 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54,
55, 55, |
| 1232 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 5
8, 58, 58, | 1232 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 5
8, 58, 58, |
| 1233 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, | 1233 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, |
| 1234 }; | 1234 }; |
| 1235 static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_
LPCBYTE gammaTable) | 1235 static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_
LPCBYTE gammaTable) |
| 1236 { | 1236 { |
| 1237 int count = nHei * src_pitch; | 1237 int count = nHei * src_pitch; |
| 1238 for(int i = 0; i < count; i++) { | 1238 for(int i = 0; i < count; i++) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1268 for (row = 0; row < nHei; row ++) { | 1268 for (row = 0; row < nHei; row ++) { |
| 1269 FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; | 1269 FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; |
| 1270 FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; | 1270 FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; |
| 1271 for (col = 0; col < nWid; col ++) { | 1271 for (col = 0; col < nWid; col ++) { |
| 1272 temp = (int)((*(pSrcRow++) - min) * rate + 0.5); | 1272 temp = (int)((*(pSrcRow++) - min) * rate + 0.5); |
| 1273 if (temp > 255) { | 1273 if (temp > 255) { |
| 1274 temp = 255; | 1274 temp = 255; |
| 1275 } else if (temp < 0) { | 1275 } else if (temp < 0) { |
| 1276 temp = 0; | 1276 temp = 0; |
| 1277 } | 1277 } |
| 1278 *pDstRow ++ = (FX_BYTE)temp; | 1278 *pDstRow ++ = (uint8_t)temp; |
| 1279 } | 1279 } |
| 1280 } | 1280 } |
| 1281 } | 1281 } |
| 1282 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde
x, FX_BOOL bFontStyle, | 1282 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde
x, FX_BOOL bFontStyle, |
| 1283 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias) | 1283 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias) |
| 1284 { | 1284 { |
| 1285 if (m_Face == NULL) { | 1285 if (m_Face == NULL) { |
| 1286 return NULL; | 1286 return NULL; |
| 1287 } | 1287 } |
| 1288 FXFT_Matrix ft_matrix; | 1288 FXFT_Matrix ft_matrix; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 return NULL; | 1358 return NULL; |
| 1359 } | 1359 } |
| 1360 int dib_width = bmwidth; | 1360 int dib_width = bmwidth; |
| 1361 CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; | 1361 CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; |
| 1362 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, | 1362 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, |
| 1363 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b
ppMask : FXDIB_8bppMask); | 1363 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b
ppMask : FXDIB_8bppMask); |
| 1364 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); | 1364 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); |
| 1365 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); | 1365 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); |
| 1366 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); | 1366 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); |
| 1367 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); | 1367 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); |
| 1368 FX_BYTE* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); | 1368 uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); |
| 1369 FX_BYTE* pSrcBuf = (FX_BYTE*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_
Face)); | 1369 uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_
Face)); |
| 1370 if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Ge
t_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { | 1370 if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Ge
t_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { |
| 1371 int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; | 1371 int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; |
| 1372 for(int i = 0; i < bmheight; i++) | 1372 for(int i = 0; i < bmheight; i++) |
| 1373 for(int n = 0; n < bmwidth; n++) { | 1373 for(int n = 0; n < bmwidth; n++) { |
| 1374 FX_BYTE data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8
))) ? 255 : 0; | 1374 uint8_t data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8
))) ? 255 : 0; |
| 1375 for (int b = 0; b < bytes; b ++) { | 1375 for (int b = 0; b < bytes; b ++) { |
| 1376 pDestBuf[i * dest_pitch + n * bytes + b] = data; | 1376 pDestBuf[i * dest_pitch + n * bytes + b] = data; |
| 1377 } | 1377 } |
| 1378 } | 1378 } |
| 1379 } else { | 1379 } else { |
| 1380 FXSYS_memset32(pDestBuf, 0, dest_pitch * bmheight); | 1380 FXSYS_memset32(pDestBuf, 0, dest_pitch * bmheight); |
| 1381 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF
T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { | 1381 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF
T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { |
| 1382 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY
S_abs(src_pitch); | 1382 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY
S_abs(src_pitch); |
| 1383 for (int row = 0; row < bmheight; row ++) { | 1383 for (int row = 0; row < bmheight; row ++) { |
| 1384 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_
pitch, rowbytes); | 1384 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_
pitch, rowbytes); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1478 return ret; | 1478 return ret; |
| 1479 } | 1479 } |
| 1480 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph
_index, int dest_width) | 1480 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph
_index, int dest_width) |
| 1481 { | 1481 { |
| 1482 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) { | 1482 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) { |
| 1483 return NULL; | 1483 return NULL; |
| 1484 } | 1484 } |
| 1485 CFX_PathData* pGlyphPath = NULL; | 1485 CFX_PathData* pGlyphPath = NULL; |
| 1486 FX_LPVOID key; | 1486 FX_LPVOID key; |
| 1487 if (pFont->GetSubstFont()) | 1487 if (pFont->GetSubstFont()) |
| 1488 key = (FX_LPVOID)(FX_UINTPTR)(glyph_index + ((pFont->GetSubstFont()->m_W
eight / 16) << 15) + | 1488 key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_We
ight / 16) << 15) + |
| 1489 ((pFont->GetSubstFont()->m_ItalicAngle / 2
) << 21) + ((dest_width / 16) << 25) + | 1489 ((pFont->GetSubstFont()->m_ItalicAngle / 2
) << 21) + ((dest_width / 16) << 25) + |
| 1490 (pFont->IsVertical() << 31)); | 1490 (pFont->IsVertical() << 31)); |
| 1491 else { | 1491 else { |
| 1492 key = (FX_LPVOID)(FX_UINTPTR)glyph_index; | 1492 key = (FX_LPVOID)(uintptr_t)glyph_index; |
| 1493 } | 1493 } |
| 1494 if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { | 1494 if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { |
| 1495 return pGlyphPath; | 1495 return pGlyphPath; |
| 1496 } | 1496 } |
| 1497 pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); | 1497 pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); |
| 1498 m_PathMap.SetAt(key, pGlyphPath); | 1498 m_PathMap.SetAt(key, pGlyphPath); |
| 1499 return pGlyphPath; | 1499 return pGlyphPath; |
| 1500 } | 1500 } |
| 1501 typedef struct { | 1501 typedef struct { |
| 1502 FX_BOOL m_bCount; | 1502 FX_BOOL m_bCount; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 { | 1672 { |
| 1673 va_list argList; | 1673 va_list argList; |
| 1674 va_start(argList, count); | 1674 va_start(argList, count); |
| 1675 for (int i = 0; i < count; i ++) { | 1675 for (int i = 0; i < count; i ++) { |
| 1676 int p = va_arg(argList, int); | 1676 int p = va_arg(argList, int); |
| 1677 ((FX_DWORD*)m_Key)[i] = p; | 1677 ((FX_DWORD*)m_Key)[i] = p; |
| 1678 } | 1678 } |
| 1679 va_end(argList); | 1679 va_end(argList); |
| 1680 m_KeyLen = count * sizeof(FX_DWORD); | 1680 m_KeyLen = count * sizeof(FX_DWORD); |
| 1681 } | 1681 } |
| OLD | NEW |