OLD | NEW |
1 | 1 |
2 | 2 |
3 /* | 3 /* |
4 * Copyright 2006 The Android Open Source Project | 4 * Copyright 2006 The Android Open Source Project |
5 * | 5 * |
6 * Use of this source code is governed by a BSD-style license that can be | 6 * Use of this source code is governed by a BSD-style license that can be |
7 * found in the LICENSE file. | 7 * found in the LICENSE file. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
11 #ifndef SkPaint_DEFINED | 11 #ifndef SkPaint_DEFINED |
12 #define SkPaint_DEFINED | 12 #define SkPaint_DEFINED |
13 | 13 |
14 #include "SkColor.h" | 14 #include "SkColor.h" |
15 #include "SkDrawLooper.h" | 15 #include "SkDrawLooper.h" |
| 16 #include "SkFont.h" |
16 #include "SkMatrix.h" | 17 #include "SkMatrix.h" |
17 #include "SkXfermode.h" | 18 #include "SkXfermode.h" |
18 #ifdef SK_BUILD_FOR_ANDROID | 19 #ifdef SK_BUILD_FOR_ANDROID |
19 #include "SkPaintOptionsAndroid.h" | 20 #include "SkPaintOptionsAndroid.h" |
20 #endif | 21 #endif |
21 | 22 |
22 class SkAnnotation; | 23 class SkAnnotation; |
23 class SkAutoGlyphCache; | 24 class SkAutoGlyphCache; |
24 class SkColorFilter; | 25 class SkColorFilter; |
25 class SkDescriptor; | 26 class SkDescriptor; |
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 return SetTextMatrix(matrix, fTextSize, fTextScaleX, fTextSkewX); | 1030 return SetTextMatrix(matrix, fTextSize, fTextScaleX, fTextSkewX); |
1030 } | 1031 } |
1031 | 1032 |
1032 SK_TO_STRING_NONVIRT() | 1033 SK_TO_STRING_NONVIRT() |
1033 | 1034 |
1034 struct FlatteningTraits { | 1035 struct FlatteningTraits { |
1035 static void Flatten(SkWriteBuffer& buffer, const SkPaint& paint); | 1036 static void Flatten(SkWriteBuffer& buffer, const SkPaint& paint); |
1036 static void Unflatten(SkReadBuffer& buffer, SkPaint* paint); | 1037 static void Unflatten(SkReadBuffer& buffer, SkPaint* paint); |
1037 }; | 1038 }; |
1038 | 1039 |
| 1040 SkFont* testing_getCachedFont() { return this->getCachedFont(); } |
| 1041 |
1039 private: | 1042 private: |
| 1043 SkFont* fCachedFont; |
| 1044 |
1040 SkTypeface* fTypeface; | 1045 SkTypeface* fTypeface; |
1041 SkPathEffect* fPathEffect; | 1046 SkPathEffect* fPathEffect; |
1042 SkShader* fShader; | 1047 SkShader* fShader; |
1043 SkXfermode* fXfermode; | 1048 SkXfermode* fXfermode; |
1044 SkMaskFilter* fMaskFilter; | 1049 SkMaskFilter* fMaskFilter; |
1045 SkColorFilter* fColorFilter; | 1050 SkColorFilter* fColorFilter; |
1046 SkRasterizer* fRasterizer; | 1051 SkRasterizer* fRasterizer; |
1047 SkDrawLooper* fLooper; | 1052 SkDrawLooper* fLooper; |
1048 SkImageFilter* fImageFilter; | 1053 SkImageFilter* fImageFilter; |
1049 SkAnnotation* fAnnotation; | 1054 SkAnnotation* fAnnotation; |
(...skipping 17 matching lines...) Expand all Loading... |
1067 unsigned fFilterLevel : 2; | 1072 unsigned fFilterLevel : 2; |
1068 //unsigned fFreeBits : 2; | 1073 //unsigned fFreeBits : 2; |
1069 }; | 1074 }; |
1070 uint32_t fBitfields; | 1075 uint32_t fBitfields; |
1071 }; | 1076 }; |
1072 uint32_t fDirtyBits; | 1077 uint32_t fDirtyBits; |
1073 | 1078 |
1074 uint32_t getBitfields() const { return fBitfields; } | 1079 uint32_t getBitfields() const { return fBitfields; } |
1075 void setBitfields(uint32_t bitfields); | 1080 void setBitfields(uint32_t bitfields); |
1076 | 1081 |
| 1082 SkFont* getCachedFont() { |
| 1083 if (NULL == fCachedFont) { |
| 1084 fCachedFont = SkFont::Testing_CreateFromPaint(*this); |
| 1085 } |
| 1086 return fCachedFont; |
| 1087 } |
| 1088 void dirtyCachedFont(bool somethingChanged) { |
| 1089 if (somethingChanged && fCachedFont) { |
| 1090 fCachedFont->unref(); |
| 1091 fCachedFont = NULL; |
| 1092 } |
| 1093 } |
| 1094 |
1077 SkDrawCacheProc getDrawCacheProc() const; | 1095 SkDrawCacheProc getDrawCacheProc() const; |
1078 SkMeasureCacheProc getMeasureCacheProc(TextBufferDirection dir, | 1096 SkMeasureCacheProc getMeasureCacheProc(TextBufferDirection dir, |
1079 bool needFullMetrics) const; | 1097 bool needFullMetrics) const; |
1080 | 1098 |
1081 SkScalar measure_text(SkGlyphCache*, const char* text, size_t length, | 1099 SkScalar measure_text(SkGlyphCache*, const char* text, size_t length, |
1082 int* count, SkRect* bounds) const; | 1100 int* count, SkRect* bounds) const; |
1083 | 1101 |
1084 SkGlyphCache* detachCache(const SkDeviceProperties* deviceProperties, const
SkMatrix*) const; | 1102 SkGlyphCache* detachCache(const SkDeviceProperties* deviceProperties, const
SkMatrix*) const; |
1085 | 1103 |
1086 void descriptorProc(const SkDeviceProperties* deviceProperties, const SkMatr
ix* deviceMatrix, | 1104 void descriptorProc(const SkDeviceProperties* deviceProperties, const SkMatr
ix* deviceMatrix, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 #ifdef SK_BUILD_FOR_ANDROID | 1161 #ifdef SK_BUILD_FOR_ANDROID |
1144 SkPaintOptionsAndroid fPaintOptionsAndroid; | 1162 SkPaintOptionsAndroid fPaintOptionsAndroid; |
1145 | 1163 |
1146 // In order for the == operator to work properly this must be the last field | 1164 // In order for the == operator to work properly this must be the last field |
1147 // in the struct so that we can do a memcmp to this field's offset. | 1165 // in the struct so that we can do a memcmp to this field's offset. |
1148 uint32_t fGenerationID; | 1166 uint32_t fGenerationID; |
1149 #endif | 1167 #endif |
1150 }; | 1168 }; |
1151 | 1169 |
1152 #endif | 1170 #endif |
OLD | NEW |