Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: core/src/fxge/ge/fx_ge_text.cpp

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxge/ge/fx_ge_ps.cpp ('k') | core/src/fxge/ge/text_int.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 src_scan += 3; 434 src_scan += 3;
435 } 435 }
436 } 436 }
437 } else { 437 } else {
438 if (x_subpixel == 0) { 438 if (x_subpixel == 0) {
439 for (int col = start_col; col < end_col; col ++) { 439 for (int col = start_col; col < end_col; col ++) {
440 if (bNormal) { 440 if (bNormal) {
441 int src_alpha1 = (src_scan[0] + src_scan[1] + sr c_scan[2]) / 3; 441 int src_alpha1 = (src_scan[0] + src_scan[1] + sr c_scan[2]) / 3;
442 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a); 442 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a);
443 src_alpha1 = src_alpha1 * a / 255; 443 src_alpha1 = src_alpha1 * a / 255;
444 FX_BYTE back_alpha = dest_scan[3]; 444 uint8_t back_alpha = dest_scan[3];
445 if (back_alpha == 0) { 445 if (back_alpha == 0) {
446 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b)); 446 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b));
447 dest_scan += 4; 447 dest_scan += 4;
448 src_scan += 3; 448 src_scan += 3;
449 continue; 449 continue;
450 } 450 }
451 if (src_alpha1 == 0) { 451 if (src_alpha1 == 0) {
452 dest_scan += 4; 452 dest_scan += 4;
453 src_scan += 3; 453 src_scan += 3;
454 continue; 454 continue;
455 } 455 }
456 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255; 456 uint8_t dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255;
457 dest_scan[3] = dest_alpha; 457 dest_scan[3] = dest_alpha;
458 int alpha_ratio = src_alpha1 * 255 / dest_alpha; 458 int alpha_ratio = src_alpha1 * 255 / dest_alpha;
459 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); 459 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio));
460 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); 460 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio));
461 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); 461 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio));
462 dest_scan += 4; 462 dest_scan += 4;
463 src_scan += 3; 463 src_scan += 3;
464 continue; 464 continue;
465 } 465 }
466 int src_alpha = src_scan[0]; 466 int src_alpha = src_scan[0];
(...skipping 14 matching lines...) Expand all
481 } 481 }
482 } else if (x_subpixel == 1) { 482 } else if (x_subpixel == 1) {
483 if (bNormal) { 483 if (bNormal) {
484 int src_alpha1 = start_col > left ? ((src_scan[-1] + src_scan[0] + src_scan[1]) / 3) : ((src_scan[0] + src_scan[1]) / 3); 484 int src_alpha1 = start_col > left ? ((src_scan[-1] + src_scan[0] + src_scan[1]) / 3) : ((src_scan[0] + src_scan[1]) / 3);
485 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext _flags, a); 485 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext _flags, a);
486 src_alpha1 = src_alpha1 * a / 255; 486 src_alpha1 = src_alpha1 * a / 255;
487 if (src_alpha1 == 0) { 487 if (src_alpha1 == 0) {
488 dest_scan += 4; 488 dest_scan += 4;
489 src_scan += 3; 489 src_scan += 3;
490 } else { 490 } else {
491 FX_BYTE back_alpha = dest_scan[3]; 491 uint8_t back_alpha = dest_scan[3];
492 if (back_alpha == 0) { 492 if (back_alpha == 0) {
493 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b)); 493 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b));
494 } else { 494 } else {
495 FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; 495 uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255;
496 dest_scan[3] = dest_alpha; 496 dest_scan[3] = dest_alpha;
497 int alpha_ratio = src_alpha1 * 255 / dest_al pha; 497 int alpha_ratio = src_alpha1 * 255 / dest_al pha;
498 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); 498 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio));
499 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); 499 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio));
500 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); 500 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio));
501 } 501 }
502 dest_scan += 4; 502 dest_scan += 4;
503 src_scan += 3; 503 src_scan += 3;
504 } 504 }
505 } else { 505 } else {
(...skipping 13 matching lines...) Expand all
519 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX _GAMMA(dest_scan[0]), b, src_alpha)); 519 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX _GAMMA(dest_scan[0]), b, src_alpha));
520 dest_scan[3] = 255; 520 dest_scan[3] = 255;
521 dest_scan += 4; 521 dest_scan += 4;
522 src_scan += 3; 522 src_scan += 3;
523 } 523 }
524 for (int col = start_col + 1; col < end_col; col ++) { 524 for (int col = start_col + 1; col < end_col; col ++) {
525 if (bNormal) { 525 if (bNormal) {
526 int src_alpha1 = (src_scan[-1] + src_scan[0] + s rc_scan[1]) / 3; 526 int src_alpha1 = (src_scan[-1] + src_scan[0] + s rc_scan[1]) / 3;
527 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a); 527 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a);
528 src_alpha1 = src_alpha1 * a / 255; 528 src_alpha1 = src_alpha1 * a / 255;
529 FX_BYTE back_alpha = dest_scan[3]; 529 uint8_t back_alpha = dest_scan[3];
530 if (back_alpha == 0) { 530 if (back_alpha == 0) {
531 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b)); 531 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b));
532 dest_scan += 4; 532 dest_scan += 4;
533 src_scan += 3; 533 src_scan += 3;
534 continue; 534 continue;
535 } 535 }
536 if (src_alpha1 == 0) { 536 if (src_alpha1 == 0) {
537 dest_scan += 4; 537 dest_scan += 4;
538 src_scan += 3; 538 src_scan += 3;
539 continue; 539 continue;
540 } 540 }
541 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255; 541 uint8_t dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255;
542 dest_scan[3] = dest_alpha; 542 dest_scan[3] = dest_alpha;
543 int alpha_ratio = src_alpha1 * 255 / dest_alpha; 543 int alpha_ratio = src_alpha1 * 255 / dest_alpha;
544 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); 544 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio));
545 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); 545 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio));
546 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); 546 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio));
547 dest_scan += 4; 547 dest_scan += 4;
548 src_scan += 3; 548 src_scan += 3;
549 continue; 549 continue;
550 } 550 }
551 int src_alpha = src_scan[-1]; 551 int src_alpha = src_scan[-1];
(...skipping 14 matching lines...) Expand all
566 } 566 }
567 } else { 567 } else {
568 if (bNormal) { 568 if (bNormal) {
569 int src_alpha1 = start_col > left ? ((src_scan[-2] + src_scan[-1] + src_scan[0]) / 3) : ((src_scan[0]) / 3); 569 int src_alpha1 = start_col > left ? ((src_scan[-2] + src_scan[-1] + src_scan[0]) / 3) : ((src_scan[0]) / 3);
570 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext _flags, a); 570 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, nativetext _flags, a);
571 src_alpha1 = src_alpha1 * a / 255; 571 src_alpha1 = src_alpha1 * a / 255;
572 if (src_alpha1 == 0) { 572 if (src_alpha1 == 0) {
573 dest_scan += 4; 573 dest_scan += 4;
574 src_scan += 3; 574 src_scan += 3;
575 } else { 575 } else {
576 FX_BYTE back_alpha = dest_scan[3]; 576 uint8_t back_alpha = dest_scan[3];
577 if (back_alpha == 0) { 577 if (back_alpha == 0) {
578 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b)); 578 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b));
579 } else { 579 } else {
580 FX_BYTE dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255; 580 uint8_t dest_alpha = back_alpha + src_alpha1 - back_alpha * src_alpha1 / 255;
581 dest_scan[3] = dest_alpha; 581 dest_scan[3] = dest_alpha;
582 int alpha_ratio = src_alpha1 * 255 / dest_al pha; 582 int alpha_ratio = src_alpha1 * 255 / dest_al pha;
583 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); 583 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[2]), r, alpha_ratio));
584 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); 584 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[1]), g, alpha_ratio));
585 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); 585 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_ MERGE(FX_GAMMA(dest_scan[0]), b, alpha_ratio));
586 } 586 }
587 dest_scan += 4; 587 dest_scan += 4;
588 src_scan += 3; 588 src_scan += 3;
589 } 589 }
590 } else { 590 } else {
(...skipping 13 matching lines...) Expand all
604 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX _GAMMA(dest_scan[0]), b, src_alpha)); 604 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERGE(FX _GAMMA(dest_scan[0]), b, src_alpha));
605 dest_scan[3] = 255; 605 dest_scan[3] = 255;
606 dest_scan += 4; 606 dest_scan += 4;
607 src_scan += 3; 607 src_scan += 3;
608 } 608 }
609 for (int col = start_col + 1; col < end_col; col ++) { 609 for (int col = start_col + 1; col < end_col; col ++) {
610 if (bNormal) { 610 if (bNormal) {
611 int src_alpha1 = (src_scan[-2] + src_scan[-1] + src_scan[0]) / 3; 611 int src_alpha1 = (src_scan[-2] + src_scan[-1] + src_scan[0]) / 3;
612 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a); 612 ADJUST_ALPHA(dest_scan[2], r, src_alpha1, native text_flags, a);
613 src_alpha1 = src_alpha1 * a / 255; 613 src_alpha1 = src_alpha1 * a / 255;
614 FX_BYTE back_alpha = dest_scan[3]; 614 uint8_t back_alpha = dest_scan[3];
615 if (back_alpha == 0) { 615 if (back_alpha == 0) {
616 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b)); 616 FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_alp ha1, r, g, b));
617 dest_scan += 4; 617 dest_scan += 4;
618 src_scan += 3; 618 src_scan += 3;
619 continue; 619 continue;
620 } 620 }
621 if (src_alpha1 == 0) { 621 if (src_alpha1 == 0) {
622 dest_scan += 4; 622 dest_scan += 4;
623 src_scan += 3; 623 src_scan += 3;
624 continue; 624 continue;
625 } 625 }
626 FX_BYTE dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255; 626 uint8_t dest_alpha = back_alpha + src_alpha1 - b ack_alpha * src_alpha1 / 255;
627 dest_scan[3] = dest_alpha; 627 dest_scan[3] = dest_alpha;
628 int alpha_ratio = src_alpha1 * 255 / dest_alpha; 628 int alpha_ratio = src_alpha1 * 255 / dest_alpha;
629 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio)); 629 dest_scan[2] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[2]), r, alpha_ratio));
630 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio)); 630 dest_scan[1] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[1]), g, alpha_ratio));
631 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio)); 631 dest_scan[0] = FX_GAMMA_INVERSE(FXDIB_ALPHA_MERG E(FX_GAMMA(dest_scan[0]), b, alpha_ratio));
632 dest_scan += 4; 632 dest_scan += 4;
633 src_scan += 3; 633 src_scan += 3;
634 continue; 634 continue;
635 } 635 }
636 int src_alpha = src_scan[-2]; 636 int src_alpha = src_scan[-2];
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 { 1074 {
1075 CFX_SizeGlyphCache* pSizeCache = NULL; 1075 CFX_SizeGlyphCache* pSizeCache = NULL;
1076 if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { 1076 if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
1077 pSizeCache = FX_NEW CFX_SizeGlyphCache; 1077 pSizeCache = FX_NEW CFX_SizeGlyphCache;
1078 if (pSizeCache == NULL) { 1078 if (pSizeCache == NULL) {
1079 return NULL; 1079 return NULL;
1080 } 1080 }
1081 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); 1081 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1082 } 1082 }
1083 CFX_GlyphBitmap* pGlyphBitmap = NULL; 1083 CFX_GlyphBitmap* pGlyphBitmap = NULL;
1084 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index, (void* &)pGlyphBitmap)) { 1084 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*& )pGlyphBitmap)) {
1085 return pGlyphBitmap; 1085 return pGlyphBitmap;
1086 } 1086 }
1087 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_wid th, anti_alias); 1087 pGlyphBitmap = RenderGlyph(pFont, glyph_index, bFontStyle, pMatrix, dest_wid th, anti_alias);
1088 if (pGlyphBitmap == NULL) { 1088 if (pGlyphBitmap == NULL) {
1089 return NULL; 1089 return NULL;
1090 } 1090 }
1091 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitma p); 1091 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap );
1092 return pGlyphBitmap; 1092 return pGlyphBitmap;
1093 } 1093 }
1094 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, 1094 const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix,
1095 int dest_width, int anti_alias, int& text_flags) 1095 int dest_width, int anti_alias, int& text_flags)
1096 { 1096 {
1097 if (glyph_index == (FX_DWORD) - 1) { 1097 if (glyph_index == (FX_DWORD) - 1) {
1098 return NULL; 1098 return NULL;
1099 } 1099 }
1100 _CFX_UniqueKeyGen keygen; 1100 _CFX_UniqueKeyGen keygen;
1101 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 1101 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
(...skipping 26 matching lines...) Expand all
1128 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); 1128 CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
1129 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ 1129 #if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
1130 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias); 1130 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontSt yle, dest_width, anti_alias);
1131 #else 1131 #else
1132 if (text_flags & FXTEXT_NO_NATIVETEXT) { 1132 if (text_flags & FXTEXT_NO_NATIVETEXT) {
1133 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias); 1133 return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFo ntStyle, dest_width, anti_alias);
1134 } else { 1134 } else {
1135 CFX_GlyphBitmap* pGlyphBitmap; 1135 CFX_GlyphBitmap* pGlyphBitmap;
1136 CFX_SizeGlyphCache* pSizeCache = NULL; 1136 CFX_SizeGlyphCache* pSizeCache = NULL;
1137 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { 1137 if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
1138 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(FX_UINTPTR)glyph_index , (void*&)pGlyphBitmap)) { 1138 if (pSizeCache->m_GlyphMap.Lookup((FX_LPVOID)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) {
1139 return pGlyphBitmap; 1139 return pGlyphBitmap;
1140 } 1140 }
1141 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias); 1141 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1142 if (pGlyphBitmap) { 1142 if (pGlyphBitmap) {
1143 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); 1143 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap);
1144 return pGlyphBitmap; 1144 return pGlyphBitmap;
1145 } 1145 }
1146 } else { 1146 } else {
1147 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias); 1147 pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, d est_width, anti_alias);
1148 if (pGlyphBitmap) { 1148 if (pGlyphBitmap) {
1149 pSizeCache = FX_NEW CFX_SizeGlyphCache; 1149 pSizeCache = FX_NEW CFX_SizeGlyphCache;
1150 if (pSizeCache == NULL) { 1150 if (pSizeCache == NULL) {
1151 return NULL; 1151 return NULL;
1152 } 1152 }
1153 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); 1153 m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
1154 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); 1154 pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(uintptr_t)glyph_index, pGlyphBitmap);
1155 return pGlyphBitmap; 1155 return pGlyphBitmap;
1156 } 1156 }
1157 } 1157 }
1158 if (pFont->GetSubstFont()) 1158 if (pFont->GetSubstFont())
1159 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00), 1159 keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1160 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias, 1160 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias,
1161 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont ()->m_ItalicAngle, pFont->IsVertical()); 1161 pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont ()->m_ItalicAngle, pFont->IsVertical());
1162 else 1162 else
1163 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00), 1163 keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 100 00),
1164 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias); 1164 (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000) , dest_width, anti_alias);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 FXFT_Free(m_Face, pMasters); 1215 FXFT_Free(m_Face, pMasters);
1216 FXFT_Set_MM_Design_Coordinates(m_Face, 2, coords); 1216 FXFT_Set_MM_Design_Coordinates(m_Face, 2, coords);
1217 } 1217 }
1218 static const size_t ANGLESKEW_ARRAY_SIZE = 30; 1218 static const size_t ANGLESKEW_ARRAY_SIZE = 30;
1219 static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = { 1219 static const char g_AngleSkew[ANGLESKEW_ARRAY_SIZE] = {
1220 0, 2, 3, 5, 7, 9, 11, 12, 14, 16, 1220 0, 2, 3, 5, 7, 9, 11, 12, 14, 16,
1221 18, 19, 21, 23, 25, 27, 29, 31, 32, 34, 1221 18, 19, 21, 23, 25, 27, 29, 31, 32, 34,
1222 36, 38, 40, 42, 45, 47, 49, 51, 53, 55, 1222 36, 38, 40, 42, 45, 47, 49, 51, 53, 55,
1223 }; 1223 };
1224 static const size_t WEIGHTPOW_ARRAY_SIZE = 100; 1224 static const size_t WEIGHTPOW_ARRAY_SIZE = 100;
1225 static const FX_BYTE g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = { 1225 static const uint8_t g_WeightPow[WEIGHTPOW_ARRAY_SIZE] = {
1226 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20, 1226 0, 3, 6, 7, 8, 9, 11, 12, 14, 15, 16, 17, 18, 19, 20,
1227 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36, 1227 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 35, 36, 36,
1228 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 1228 37, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42,
1229 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 1229 42, 43, 43, 43, 44, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47,
1230 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51, 1230 47, 47, 48, 48, 48, 48, 48, 49, 49, 49, 49, 50, 50, 50, 50, 50, 51, 51,
1231 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 1231 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53,
1232 }; 1232 };
1233 static const FX_BYTE g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = { 1233 static const uint8_t g_WeightPow_11[WEIGHTPOW_ARRAY_SIZE] = {
1234 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 1234 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22,
1235 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, 1235 23, 24, 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40,
1236 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, 1236 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46,
1237 46, 43, 47, 47, 48, 48, 48, 48, 45, 50, 50, 50, 46, 51, 51, 51, 52, 52, 1237 46, 43, 47, 47, 48, 48, 48, 48, 45, 50, 50, 50, 46, 51, 51, 51, 52, 52,
1238 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56, 1238 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, 56, 56,
1239 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 1239 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58,
1240 }; 1240 };
1241 static const FX_BYTE g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = { 1241 static const uint8_t g_WeightPow_SHIFTJIS[WEIGHTPOW_ARRAY_SIZE] = {
1242 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28, 1242 0, 0, 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 28,
1243 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50, 1243 30, 32, 33, 35, 37, 39, 41, 43, 45, 48, 48, 48, 48, 49, 49, 49, 50, 50, 50, 50,
1244 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55, 1244 51, 51, 51, 51, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 55, 55,
1245 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 5 8, 58, 58, 1245 55, 55, 55, 56, 56, 56, 56, 56 , 56, 57, 57, 57 , 57 , 57, 57, 57, 58, 58, 5 8, 58, 58,
1246 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60, 1246 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
1247 }; 1247 };
1248 static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_ LPCBYTE gammaTable) 1248 static void _GammaAdjust(FX_LPBYTE pData, int nWid, int nHei, int src_pitch, FX_ LPCBYTE gammaTable)
1249 { 1249 {
1250 int count = nHei * src_pitch; 1250 int count = nHei * src_pitch;
1251 for(int i = 0; i < count; i++) { 1251 for(int i = 0; i < count; i++) {
(...skipping 29 matching lines...) Expand all
1281 for (row = 0; row < nHei; row ++) { 1281 for (row = 0; row < nHei; row ++) {
1282 FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes; 1282 FX_LPBYTE pSrcRow = pDataIn + row * nSrcRowBytes;
1283 FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes; 1283 FX_LPBYTE pDstRow = pDataOut + row * nDstRowBytes;
1284 for (col = 0; col < nWid; col ++) { 1284 for (col = 0; col < nWid; col ++) {
1285 temp = (int)((*(pSrcRow++) - min) * rate + 0.5); 1285 temp = (int)((*(pSrcRow++) - min) * rate + 0.5);
1286 if (temp > 255) { 1286 if (temp > 255) {
1287 temp = 255; 1287 temp = 255;
1288 } else if (temp < 0) { 1288 } else if (temp < 0) {
1289 temp = 0; 1289 temp = 0;
1290 } 1290 }
1291 *pDstRow ++ = (FX_BYTE)temp; 1291 *pDstRow ++ = (uint8_t)temp;
1292 } 1292 }
1293 } 1293 }
1294 } 1294 }
1295 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde x, FX_BOOL bFontStyle, 1295 CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde x, FX_BOOL bFontStyle,
1296 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias) 1296 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias)
1297 { 1297 {
1298 if (m_Face == NULL) { 1298 if (m_Face == NULL) {
1299 return NULL; 1299 return NULL;
1300 } 1300 }
1301 FXFT_Matrix ft_matrix; 1301 FXFT_Matrix ft_matrix;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap; 1374 CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap;
1375 if (!pGlyphBitmap) { 1375 if (!pGlyphBitmap) {
1376 return NULL; 1376 return NULL;
1377 } 1377 }
1378 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, 1378 pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight,
1379 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b ppMask : FXDIB_8bppMask); 1379 anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1b ppMask : FXDIB_8bppMask);
1380 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); 1380 pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face);
1381 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face); 1381 pGlyphBitmap->m_Top = FXFT_Get_Glyph_BitmapTop(m_Face);
1382 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch(); 1382 int dest_pitch = pGlyphBitmap->m_Bitmap.GetPitch();
1383 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face)); 1383 int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face));
1384 FX_BYTE* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer(); 1384 uint8_t* pDestBuf = pGlyphBitmap->m_Bitmap.GetBuffer();
1385 FX_BYTE* pSrcBuf = (FX_BYTE*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_ Face)); 1385 uint8_t* pSrcBuf = (uint8_t*)FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_ Face));
1386 if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Ge t_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { 1386 if (anti_alias != FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Ge t_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) {
1387 int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1; 1387 int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1;
1388 for(int i = 0; i < bmheight; i++) 1388 for(int i = 0; i < bmheight; i++)
1389 for(int n = 0; n < bmwidth; n++) { 1389 for(int n = 0; n < bmwidth; n++) {
1390 FX_BYTE data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8 ))) ? 255 : 0; 1390 uint8_t data = (pSrcBuf[i * src_pitch + n / 8] & (0x80 >> (n % 8 ))) ? 255 : 0;
1391 for (int b = 0; b < bytes; b ++) { 1391 for (int b = 0; b < bytes; b ++) {
1392 pDestBuf[i * dest_pitch + n * bytes + b] = data; 1392 pDestBuf[i * dest_pitch + n * bytes + b] = data;
1393 } 1393 }
1394 } 1394 }
1395 } else { 1395 } else {
1396 FXSYS_memset32(pDestBuf, 0, dest_pitch * bmheight); 1396 FXSYS_memset32(pDestBuf, 0, dest_pitch * bmheight);
1397 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { 1397 if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXF T_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) {
1398 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY S_abs(src_pitch); 1398 int rowbytes = FXSYS_abs(src_pitch) > dest_pitch ? dest_pitch : FXSY S_abs(src_pitch);
1399 for (int row = 0; row < bmheight; row ++) { 1399 for (int row = 0; row < bmheight; row ++) {
1400 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_ pitch, rowbytes); 1400 FXSYS_memcpy32(pDestBuf + row * dest_pitch, pSrcBuf + row * src_ pitch, rowbytes);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 return ret; 1494 return ret;
1495 } 1495 }
1496 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph _index, int dest_width) 1496 const CFX_PathData* CFX_FaceCache::LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph _index, int dest_width)
1497 { 1497 {
1498 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) { 1498 if (m_Face == NULL || glyph_index == (FX_DWORD) - 1) {
1499 return NULL; 1499 return NULL;
1500 } 1500 }
1501 CFX_PathData* pGlyphPath = NULL; 1501 CFX_PathData* pGlyphPath = NULL;
1502 FX_LPVOID key; 1502 FX_LPVOID key;
1503 if (pFont->GetSubstFont()) 1503 if (pFont->GetSubstFont())
1504 key = (FX_LPVOID)(FX_UINTPTR)(glyph_index + ((pFont->GetSubstFont()->m_W eight / 16) << 15) + 1504 key = (FX_LPVOID)(uintptr_t)(glyph_index + ((pFont->GetSubstFont()->m_We ight / 16) << 15) +
1505 ((pFont->GetSubstFont()->m_ItalicAngle / 2 ) << 21) + ((dest_width / 16) << 25) + 1505 ((pFont->GetSubstFont()->m_ItalicAngle / 2 ) << 21) + ((dest_width / 16) << 25) +
1506 (pFont->IsVertical() << 31)); 1506 (pFont->IsVertical() << 31));
1507 else { 1507 else {
1508 key = (FX_LPVOID)(FX_UINTPTR)glyph_index; 1508 key = (FX_LPVOID)(uintptr_t)glyph_index;
1509 } 1509 }
1510 if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) { 1510 if (m_PathMap.Lookup(key, (FX_LPVOID&)pGlyphPath)) {
1511 return pGlyphPath; 1511 return pGlyphPath;
1512 } 1512 }
1513 pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width); 1513 pGlyphPath = pFont->LoadGlyphPath(glyph_index, dest_width);
1514 m_PathMap.SetAt(key, pGlyphPath); 1514 m_PathMap.SetAt(key, pGlyphPath);
1515 return pGlyphPath; 1515 return pGlyphPath;
1516 } 1516 }
1517 typedef struct { 1517 typedef struct {
1518 FX_BOOL m_bCount; 1518 FX_BOOL m_bCount;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 { 1691 {
1692 va_list argList; 1692 va_list argList;
1693 va_start(argList, count); 1693 va_start(argList, count);
1694 for (int i = 0; i < count; i ++) { 1694 for (int i = 0; i < count; i ++) {
1695 int p = va_arg(argList, int); 1695 int p = va_arg(argList, int);
1696 ((FX_DWORD*)m_Key)[i] = p; 1696 ((FX_DWORD*)m_Key)[i] = p;
1697 } 1697 }
1698 va_end(argList); 1698 va_end(argList);
1699 m_KeyLen = count * sizeof(FX_DWORD); 1699 m_KeyLen = count * sizeof(FX_DWORD);
1700 } 1700 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_ps.cpp ('k') | core/src/fxge/ge/text_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698