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

Side by Side Diff: src/core/SkPaint.cpp

Issue 621403002: remove unused TextBufferDirection enum (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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 | « samplecode/SampleText.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkAutoKern.h" 10 #include "SkAutoKern.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 /////////////////////////////////////////////////////////////////////////////// 601 ///////////////////////////////////////////////////////////////////////////////
602 602
603 static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache, 603 static const SkGlyph& sk_getMetrics_utf8_next(SkGlyphCache* cache,
604 const char** text) { 604 const char** text) {
605 SkASSERT(cache != NULL); 605 SkASSERT(cache != NULL);
606 SkASSERT(text != NULL); 606 SkASSERT(text != NULL);
607 607
608 return cache->getUnicharMetrics(SkUTF8_NextUnichar(text)); 608 return cache->getUnicharMetrics(SkUTF8_NextUnichar(text));
609 } 609 }
610 610
611 static const SkGlyph& sk_getMetrics_utf8_prev(SkGlyphCache* cache,
612 const char** text) {
613 SkASSERT(cache != NULL);
614 SkASSERT(text != NULL);
615
616 return cache->getUnicharMetrics(SkUTF8_PrevUnichar(text));
617 }
618
619 static const SkGlyph& sk_getMetrics_utf16_next(SkGlyphCache* cache, 611 static const SkGlyph& sk_getMetrics_utf16_next(SkGlyphCache* cache,
620 const char** text) { 612 const char** text) {
621 SkASSERT(cache != NULL); 613 SkASSERT(cache != NULL);
622 SkASSERT(text != NULL); 614 SkASSERT(text != NULL);
623 615
624 return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text)) ; 616 return cache->getUnicharMetrics(SkUTF16_NextUnichar((const uint16_t**)text)) ;
625 } 617 }
626 618
627 static const SkGlyph& sk_getMetrics_utf16_prev(SkGlyphCache* cache,
628 const char** text) {
629 SkASSERT(cache != NULL);
630 SkASSERT(text != NULL);
631
632 return cache->getUnicharMetrics(SkUTF16_PrevUnichar((const uint16_t**)text)) ;
633 }
634
635 static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache, 619 static const SkGlyph& sk_getMetrics_utf32_next(SkGlyphCache* cache,
636 const char** text) { 620 const char** text) {
637 SkASSERT(cache != NULL); 621 SkASSERT(cache != NULL);
638 SkASSERT(text != NULL); 622 SkASSERT(text != NULL);
639 623
640 const int32_t* ptr = *(const int32_t**)text; 624 const int32_t* ptr = *(const int32_t**)text;
641 SkUnichar uni = *ptr++; 625 SkUnichar uni = *ptr++;
642 *text = (const char*)ptr; 626 *text = (const char*)ptr;
643 return cache->getUnicharMetrics(uni); 627 return cache->getUnicharMetrics(uni);
644 } 628 }
645 629
646 static const SkGlyph& sk_getMetrics_utf32_prev(SkGlyphCache* cache,
647 const char** text) {
648 SkASSERT(cache != NULL);
649 SkASSERT(text != NULL);
650
651 const int32_t* ptr = *(const int32_t**)text;
652 SkUnichar uni = *--ptr;
653 *text = (const char*)ptr;
654 return cache->getUnicharMetrics(uni);
655 }
656
657 static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache, 630 static const SkGlyph& sk_getMetrics_glyph_next(SkGlyphCache* cache,
658 const char** text) { 631 const char** text) {
659 SkASSERT(cache != NULL); 632 SkASSERT(cache != NULL);
660 SkASSERT(text != NULL); 633 SkASSERT(text != NULL);
661 634
662 const uint16_t* ptr = *(const uint16_t**)text; 635 const uint16_t* ptr = *(const uint16_t**)text;
663 unsigned glyphID = *ptr; 636 unsigned glyphID = *ptr;
664 ptr += 1; 637 ptr += 1;
665 *text = (const char*)ptr; 638 *text = (const char*)ptr;
666 return cache->getGlyphIDMetrics(glyphID); 639 return cache->getGlyphIDMetrics(glyphID);
667 } 640 }
668 641
669 static const SkGlyph& sk_getMetrics_glyph_prev(SkGlyphCache* cache,
670 const char** text) {
671 SkASSERT(cache != NULL);
672 SkASSERT(text != NULL);
673
674 const uint16_t* ptr = *(const uint16_t**)text;
675 ptr -= 1;
676 unsigned glyphID = *ptr;
677 *text = (const char*)ptr;
678 return cache->getGlyphIDMetrics(glyphID);
679 }
680
681 static const SkGlyph& sk_getAdvance_utf8_next(SkGlyphCache* cache, 642 static const SkGlyph& sk_getAdvance_utf8_next(SkGlyphCache* cache,
682 const char** text) { 643 const char** text) {
683 SkASSERT(cache != NULL); 644 SkASSERT(cache != NULL);
684 SkASSERT(text != NULL); 645 SkASSERT(text != NULL);
685 646
686 return cache->getUnicharAdvance(SkUTF8_NextUnichar(text)); 647 return cache->getUnicharAdvance(SkUTF8_NextUnichar(text));
687 } 648 }
688 649
689 static const SkGlyph& sk_getAdvance_utf8_prev(SkGlyphCache* cache,
690 const char** text) {
691 SkASSERT(cache != NULL);
692 SkASSERT(text != NULL);
693
694 return cache->getUnicharAdvance(SkUTF8_PrevUnichar(text));
695 }
696
697 static const SkGlyph& sk_getAdvance_utf16_next(SkGlyphCache* cache, 650 static const SkGlyph& sk_getAdvance_utf16_next(SkGlyphCache* cache,
698 const char** text) { 651 const char** text) {
699 SkASSERT(cache != NULL); 652 SkASSERT(cache != NULL);
700 SkASSERT(text != NULL); 653 SkASSERT(text != NULL);
701 654
702 return cache->getUnicharAdvance(SkUTF16_NextUnichar((const uint16_t**)text)) ; 655 return cache->getUnicharAdvance(SkUTF16_NextUnichar((const uint16_t**)text)) ;
703 } 656 }
704 657
705 static const SkGlyph& sk_getAdvance_utf16_prev(SkGlyphCache* cache,
706 const char** text) {
707 SkASSERT(cache != NULL);
708 SkASSERT(text != NULL);
709
710 return cache->getUnicharAdvance(SkUTF16_PrevUnichar((const uint16_t**)text)) ;
711 }
712
713 static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache, 658 static const SkGlyph& sk_getAdvance_utf32_next(SkGlyphCache* cache,
714 const char** text) { 659 const char** text) {
715 SkASSERT(cache != NULL); 660 SkASSERT(cache != NULL);
716 SkASSERT(text != NULL); 661 SkASSERT(text != NULL);
717 662
718 const int32_t* ptr = *(const int32_t**)text; 663 const int32_t* ptr = *(const int32_t**)text;
719 SkUnichar uni = *ptr++; 664 SkUnichar uni = *ptr++;
720 *text = (const char*)ptr; 665 *text = (const char*)ptr;
721 return cache->getUnicharAdvance(uni); 666 return cache->getUnicharAdvance(uni);
722 } 667 }
723 668
724 static const SkGlyph& sk_getAdvance_utf32_prev(SkGlyphCache* cache,
725 const char** text) {
726 SkASSERT(cache != NULL);
727 SkASSERT(text != NULL);
728
729 const int32_t* ptr = *(const int32_t**)text;
730 SkUnichar uni = *--ptr;
731 *text = (const char*)ptr;
732 return cache->getUnicharAdvance(uni);
733 }
734
735 static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache, 669 static const SkGlyph& sk_getAdvance_glyph_next(SkGlyphCache* cache,
736 const char** text) { 670 const char** text) {
737 SkASSERT(cache != NULL); 671 SkASSERT(cache != NULL);
738 SkASSERT(text != NULL); 672 SkASSERT(text != NULL);
739 673
740 const uint16_t* ptr = *(const uint16_t**)text; 674 const uint16_t* ptr = *(const uint16_t**)text;
741 unsigned glyphID = *ptr; 675 unsigned glyphID = *ptr;
742 ptr += 1; 676 ptr += 1;
743 *text = (const char*)ptr; 677 *text = (const char*)ptr;
744 return cache->getGlyphIDAdvance(glyphID); 678 return cache->getGlyphIDAdvance(glyphID);
745 } 679 }
746 680
747 static const SkGlyph& sk_getAdvance_glyph_prev(SkGlyphCache* cache, 681 SkMeasureCacheProc SkPaint::getMeasureCacheProc(bool needFullMetrics) const {
748 const char** text) {
749 SkASSERT(cache != NULL);
750 SkASSERT(text != NULL);
751
752 const uint16_t* ptr = *(const uint16_t**)text;
753 ptr -= 1;
754 unsigned glyphID = *ptr;
755 *text = (const char*)ptr;
756 return cache->getGlyphIDAdvance(glyphID);
757 }
758
759 SkMeasureCacheProc SkPaint::getMeasureCacheProc(TextBufferDirection tbd,
760 bool needFullMetrics) const {
761 static const SkMeasureCacheProc gMeasureCacheProcs[] = { 682 static const SkMeasureCacheProc gMeasureCacheProcs[] = {
762 sk_getMetrics_utf8_next, 683 sk_getMetrics_utf8_next,
763 sk_getMetrics_utf16_next, 684 sk_getMetrics_utf16_next,
764 sk_getMetrics_utf32_next, 685 sk_getMetrics_utf32_next,
765 sk_getMetrics_glyph_next, 686 sk_getMetrics_glyph_next,
766 687
767 sk_getMetrics_utf8_prev,
768 sk_getMetrics_utf16_prev,
769 sk_getMetrics_utf32_prev,
770 sk_getMetrics_glyph_prev,
771
772 sk_getAdvance_utf8_next, 688 sk_getAdvance_utf8_next,
773 sk_getAdvance_utf16_next, 689 sk_getAdvance_utf16_next,
774 sk_getAdvance_utf32_next, 690 sk_getAdvance_utf32_next,
775 sk_getAdvance_glyph_next, 691 sk_getAdvance_glyph_next,
776
777 sk_getAdvance_utf8_prev,
778 sk_getAdvance_utf16_prev,
779 sk_getAdvance_utf32_prev,
780 sk_getAdvance_glyph_prev
781 }; 692 };
782 693
783 unsigned index = this->getTextEncoding(); 694 unsigned index = this->getTextEncoding();
784 695
785 if (kBackward_TextBufferDirection == tbd) { 696 if (!needFullMetrics && !this->isDevKernText()) {
786 index += 4; 697 index += 4;
787 } 698 }
788 if (!needFullMetrics && !this->isDevKernText()) {
789 index += 8;
790 }
791 699
792 SkASSERT(index < SK_ARRAY_COUNT(gMeasureCacheProcs)); 700 SkASSERT(index < SK_ARRAY_COUNT(gMeasureCacheProcs));
793 return gMeasureCacheProcs[index]; 701 return gMeasureCacheProcs[index];
794 } 702 }
795 703
796 /////////////////////////////////////////////////////////////////////////////// 704 ///////////////////////////////////////////////////////////////////////////////
797 705
798 static const SkGlyph& sk_getMetrics_utf8_00(SkGlyphCache* cache, 706 static const SkGlyph& sk_getMetrics_utf8_00(SkGlyphCache* cache,
799 const char** text, SkFixed, SkFixed) { 707 const char** text, SkFixed, SkFixed) {
800 SkASSERT(cache != NULL); 708 SkASSERT(cache != NULL);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 int* count, SkRect* bounds) const { 897 int* count, SkRect* bounds) const {
990 SkASSERT(count); 898 SkASSERT(count);
991 if (byteLength == 0) { 899 if (byteLength == 0) {
992 *count = 0; 900 *count = 0;
993 if (bounds) { 901 if (bounds) {
994 bounds->setEmpty(); 902 bounds->setEmpty();
995 } 903 }
996 return 0; 904 return 0;
997 } 905 }
998 906
999 SkMeasureCacheProc glyphCacheProc; 907 SkMeasureCacheProc glyphCacheProc = this->getMeasureCacheProc(NULL != bounds );
1000 glyphCacheProc = this->getMeasureCacheProc(kForward_TextBufferDirection,
1001 bounds);
1002 908
1003 int xyIndex; 909 int xyIndex;
1004 JoinBoundsProc joinBoundsProc; 910 JoinBoundsProc joinBoundsProc;
1005 if (this->isVerticalText()) { 911 if (this->isVerticalText()) {
1006 xyIndex = 1; 912 xyIndex = 1;
1007 joinBoundsProc = join_bounds_y; 913 joinBoundsProc = join_bounds_y;
1008 } else { 914 } else {
1009 xyIndex = 0; 915 xyIndex = 0;
1010 joinBoundsProc = join_bounds_x; 916 joinBoundsProc = join_bounds_x;
1011 } 917 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 bounds->fBottom = SkScalarMul(bounds->fBottom, scale); 990 bounds->fBottom = SkScalarMul(bounds->fBottom, scale);
1085 } 991 }
1086 } 992 }
1087 } else if (bounds) { 993 } else if (bounds) {
1088 // ensure that even if we don't measure_text we still update the bounds 994 // ensure that even if we don't measure_text we still update the bounds
1089 bounds->setEmpty(); 995 bounds->setEmpty();
1090 } 996 }
1091 return width; 997 return width;
1092 } 998 }
1093 999
1094 typedef bool (*SkTextBufferPred)(const char* text, const char* stop);
1095
1096 static bool forward_textBufferPred(const char* text, const char* stop) {
1097 return text < stop;
1098 }
1099
1100 static bool backward_textBufferPred(const char* text, const char* stop) {
1101 return text > stop;
1102 }
1103
1104 static SkTextBufferPred chooseTextBufferPred(SkPaint::TextBufferDirection tbd,
1105 const char** text, size_t length,
1106 const char** stop) {
1107 if (SkPaint::kForward_TextBufferDirection == tbd) {
1108 *stop = *text + length;
1109 return forward_textBufferPred;
1110 } else {
1111 // text should point to the end of the buffer, and stop to the beginning
1112 *stop = *text;
1113 *text += length;
1114 return backward_textBufferPred;
1115 }
1116 }
1117
1118 size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth, 1000 size_t SkPaint::breakText(const void* textD, size_t length, SkScalar maxWidth,
1119 SkScalar* measuredWidth, 1001 SkScalar* measuredWidth) const {
1120 TextBufferDirection tbd) const {
1121 if (0 == length || 0 >= maxWidth) { 1002 if (0 == length || 0 >= maxWidth) {
1122 if (measuredWidth) { 1003 if (measuredWidth) {
1123 *measuredWidth = 0; 1004 *measuredWidth = 0;
1124 } 1005 }
1125 return 0; 1006 return 0;
1126 } 1007 }
1127 1008
1128 if (0 == fTextSize) { 1009 if (0 == fTextSize) {
1129 if (measuredWidth) { 1010 if (measuredWidth) {
1130 *measuredWidth = 0; 1011 *measuredWidth = 0;
1131 } 1012 }
1132 return length; 1013 return length;
1133 } 1014 }
1134 1015
1135 SkASSERT(textD != NULL); 1016 SkASSERT(textD != NULL);
1136 const char* text = (const char*)textD; 1017 const char* text = (const char*)textD;
1018 const char* stop = text + length;
1137 1019
1138 SkCanonicalizePaint canon(*this); 1020 SkCanonicalizePaint canon(*this);
1139 const SkPaint& paint = canon.getPaint(); 1021 const SkPaint& paint = canon.getPaint();
1140 SkScalar scale = canon.getScale(); 1022 SkScalar scale = canon.getScale();
1141 1023
1142 // adjust max in case we changed the textSize in paint 1024 // adjust max in case we changed the textSize in paint
1143 if (scale) { 1025 if (scale) {
1144 maxWidth /= scale; 1026 maxWidth /= scale;
1145 } 1027 }
1146 1028
1147 SkAutoGlyphCache autoCache(paint, NULL, NULL); 1029 SkAutoGlyphCache autoCache(paint, NULL, NULL);
1148 SkGlyphCache* cache = autoCache.getCache(); 1030 SkGlyphCache* cache = autoCache.getCache();
1149 1031
1150 SkMeasureCacheProc glyphCacheProc = paint.getMeasureCacheProc(tbd, false); 1032 SkMeasureCacheProc glyphCacheProc = paint.getMeasureCacheProc(false);
1151 const char* stop;
1152 SkTextBufferPred pred = chooseTextBufferPred(tbd, &text, length, &stop);
1153 const int xyIndex = paint.isVerticalText() ? 1 : 0; 1033 const int xyIndex = paint.isVerticalText() ? 1 : 0;
1154 // use 64bits for our accumulator, to avoid overflowing 16.16 1034 // use 64bits for our accumulator, to avoid overflowing 16.16
1155 Sk48Dot16 max = SkScalarToFixed(maxWidth); 1035 Sk48Dot16 max = SkScalarToFixed(maxWidth);
1156 Sk48Dot16 width = 0; 1036 Sk48Dot16 width = 0;
1157 1037
1158 SkAutoKern autokern; 1038 SkAutoKern autokern;
1159 1039
1160 if (this->isDevKernText()) { 1040 if (this->isDevKernText()) {
1161 int rsb = 0; 1041 int rsb = 0;
1162 while (pred(text, stop)) { 1042 while (text < stop) {
1163 const char* curr = text; 1043 const char* curr = text;
1164 const SkGlyph& g = glyphCacheProc(cache, &text); 1044 const SkGlyph& g = glyphCacheProc(cache, &text);
1165 SkFixed x = SkAutoKern_AdjustF(rsb, g.fLsbDelta) + advance(g, xyInde x); 1045 SkFixed x = SkAutoKern_AdjustF(rsb, g.fLsbDelta) + advance(g, xyInde x);
1166 if ((width += x) > max) { 1046 if ((width += x) > max) {
1167 width -= x; 1047 width -= x;
1168 text = curr; 1048 text = curr;
1169 break; 1049 break;
1170 } 1050 }
1171 rsb = g.fRsbDelta; 1051 rsb = g.fRsbDelta;
1172 } 1052 }
1173 } else { 1053 } else {
1174 while (pred(text, stop)) { 1054 while (text < stop) {
1175 const char* curr = text; 1055 const char* curr = text;
1176 SkFixed x = advance(glyphCacheProc(cache, &text), xyIndex); 1056 SkFixed x = advance(glyphCacheProc(cache, &text), xyIndex);
1177 if ((width += x) > max) { 1057 if ((width += x) > max) {
1178 width -= x; 1058 width -= x;
1179 text = curr; 1059 text = curr;
1180 break; 1060 break;
1181 } 1061 }
1182 } 1062 }
1183 } 1063 }
1184 1064
1185 if (measuredWidth) { 1065 if (measuredWidth) {
1186 SkScalar scalarWidth = Sk48Dot16ToScalar(width); 1066 SkScalar scalarWidth = Sk48Dot16ToScalar(width);
1187 if (scale) { 1067 if (scale) {
1188 scalarWidth = SkScalarMul(scalarWidth, scale); 1068 scalarWidth = SkScalarMul(scalarWidth, scale);
1189 } 1069 }
1190 *measuredWidth = scalarWidth; 1070 *measuredWidth = scalarWidth;
1191 } 1071 }
1192 1072
1193 // return the number of bytes measured 1073 // return the number of bytes measured
1194 return (kForward_TextBufferDirection == tbd) ? 1074 return text - stop + length;
1195 text - stop + length : stop - text + length;
1196 } 1075 }
1197 1076
1198 /////////////////////////////////////////////////////////////////////////////// 1077 ///////////////////////////////////////////////////////////////////////////////
1199 1078
1200 static bool FontMetricsCacheProc(const SkGlyphCache* cache, void* context) { 1079 static bool FontMetricsCacheProc(const SkGlyphCache* cache, void* context) {
1201 *(SkPaint::FontMetrics*)context = cache->getFontMetrics(); 1080 *(SkPaint::FontMetrics*)context = cache->getFontMetrics();
1202 return false; // don't detach the cache 1081 return false; // don't detach the cache
1203 } 1082 }
1204 1083
1205 static void FontMetricsDescProc(SkTypeface* typeface, const SkDescriptor* desc, 1084 static void FontMetricsDescProc(SkTypeface* typeface, const SkDescriptor* desc,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 return this->countText(textData, byteLength); 1141 return this->countText(textData, byteLength);
1263 } 1142 }
1264 1143
1265 SkCanonicalizePaint canon(*this); 1144 SkCanonicalizePaint canon(*this);
1266 const SkPaint& paint = canon.getPaint(); 1145 const SkPaint& paint = canon.getPaint();
1267 SkScalar scale = canon.getScale(); 1146 SkScalar scale = canon.getScale();
1268 1147
1269 SkAutoGlyphCache autoCache(paint, NULL, NULL); 1148 SkAutoGlyphCache autoCache(paint, NULL, NULL);
1270 SkGlyphCache* cache = autoCache.getCache(); 1149 SkGlyphCache* cache = autoCache.getCache();
1271 SkMeasureCacheProc glyphCacheProc; 1150 SkMeasureCacheProc glyphCacheProc;
1272 glyphCacheProc = paint.getMeasureCacheProc(kForward_TextBufferDirection, 1151 glyphCacheProc = paint.getMeasureCacheProc(NULL != bounds);
1273 bounds);
1274 1152
1275 const char* text = (const char*)textData; 1153 const char* text = (const char*)textData;
1276 const char* stop = text + byteLength; 1154 const char* stop = text + byteLength;
1277 int count = 0; 1155 int count = 0;
1278 const int xyIndex = paint.isVerticalText() ? 1 : 0; 1156 const int xyIndex = paint.isVerticalText() ? 1 : 0;
1279 1157
1280 if (this->isDevKernText()) { 1158 if (this->isDevKernText()) {
1281 // we adjust the widths returned here through auto-kerning 1159 // we adjust the widths returned here through auto-kerning
1282 SkAutoKern autokern; 1160 SkAutoKern autokern;
1283 SkFixed prevWidth = 0; 1161 SkFixed prevWidth = 0;
(...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 2342
2465 static bool has_thick_frame(const SkPaint& paint) { 2343 static bool has_thick_frame(const SkPaint& paint) {
2466 return paint.getStrokeWidth() > 0 && 2344 return paint.getStrokeWidth() > 0 &&
2467 paint.getStyle() != SkPaint::kFill_Style; 2345 paint.getStyle() != SkPaint::kFill_Style;
2468 } 2346 }
2469 2347
2470 SkTextToPathIter::SkTextToPathIter( const char text[], size_t length, 2348 SkTextToPathIter::SkTextToPathIter( const char text[], size_t length,
2471 const SkPaint& paint, 2349 const SkPaint& paint,
2472 bool applyStrokeAndPathEffects) 2350 bool applyStrokeAndPathEffects)
2473 : fPaint(paint) { 2351 : fPaint(paint) {
2474 fGlyphCacheProc = paint.getMeasureCacheProc(SkPaint::kForward_TextBufferDire ction, 2352 fGlyphCacheProc = paint.getMeasureCacheProc(true);
2475 true);
2476 2353
2477 fPaint.setLinearText(true); 2354 fPaint.setLinearText(true);
2478 fPaint.setMaskFilter(NULL); // don't want this affecting our path-cache lo okup 2355 fPaint.setMaskFilter(NULL); // don't want this affecting our path-cache lo okup
2479 2356
2480 if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) { 2357 if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
2481 applyStrokeAndPathEffects = false; 2358 applyStrokeAndPathEffects = false;
2482 } 2359 }
2483 2360
2484 // can't use our canonical size if we need to apply patheffects 2361 // can't use our canonical size if we need to apply patheffects
2485 if (fPaint.getPathEffect() == NULL) { 2362 if (fPaint.getPathEffect() == NULL) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2576 return 0 == this->getAlpha(); 2453 return 0 == this->getAlpha();
2577 case SkXfermode::kDst_Mode: 2454 case SkXfermode::kDst_Mode:
2578 return true; 2455 return true;
2579 default: 2456 default:
2580 break; 2457 break;
2581 } 2458 }
2582 } 2459 }
2583 return false; 2460 return false;
2584 } 2461 }
2585 2462
OLDNEW
« no previous file with comments | « samplecode/SampleText.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698