OLD | NEW |
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 #ifndef SkPaint_DEFINED | 8 #ifndef SkPaint_DEFINED |
9 #define SkPaint_DEFINED | 9 #define SkPaint_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
12 #include "SkDrawLooper.h" | 12 #include "SkDrawLooper.h" |
| 13 #include "SkFilterQuality.h" |
13 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
14 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
15 | 16 |
| 17 // TODO: clean up Skia internals so we can remove this and only keep it for clie
nts |
| 18 #define SK_SUPPORT_LEGACY_FILTERLEVEL_ENUM |
| 19 |
16 class SkAnnotation; | 20 class SkAnnotation; |
17 class SkAutoGlyphCache; | 21 class SkAutoGlyphCache; |
18 class SkColorFilter; | 22 class SkColorFilter; |
19 class SkDescriptor; | 23 class SkDescriptor; |
20 struct SkDeviceProperties; | 24 struct SkDeviceProperties; |
21 class SkReadBuffer; | 25 class SkReadBuffer; |
22 class SkWriteBuffer; | 26 class SkWriteBuffer; |
23 struct SkGlyph; | 27 struct SkGlyph; |
24 struct SkRect; | 28 struct SkRect; |
25 class SkGlyphCache; | 29 class SkGlyphCache; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 bool isDistanceFieldTextTEMP() const { | 291 bool isDistanceFieldTextTEMP() const { |
288 return SkToBool(this->getFlags() & kDistanceFieldTextTEMP_Flag); | 292 return SkToBool(this->getFlags() & kDistanceFieldTextTEMP_Flag); |
289 } | 293 } |
290 | 294 |
291 /** Helper for setFlags(), setting or clearing the kDistanceFieldTextTEMP_Fl
ag bit | 295 /** Helper for setFlags(), setting or clearing the kDistanceFieldTextTEMP_Fl
ag bit |
292 @param distanceFieldText true to set the kDistanceFieldTextTEMP_Flag bit in
the paint's | 296 @param distanceFieldText true to set the kDistanceFieldTextTEMP_Flag bit in
the paint's |
293 flags, false to clear it. | 297 flags, false to clear it. |
294 */ | 298 */ |
295 void setDistanceFieldTextTEMP(bool distanceFieldText); | 299 void setDistanceFieldTextTEMP(bool distanceFieldText); |
296 | 300 |
| 301 #ifdef SK_SUPPORT_LEGACY_FILTERLEVEL_ENUM |
297 enum FilterLevel { | 302 enum FilterLevel { |
298 kNone_FilterLevel, | 303 kNone_FilterLevel = kNone_SkFilterQuality, |
299 kLow_FilterLevel, | 304 kLow_FilterLevel = kLow_SkFilterQuality, |
300 kMedium_FilterLevel, | 305 kMedium_FilterLevel = kMedium_SkFilterQuality, |
301 kHigh_FilterLevel | 306 kHigh_FilterLevel = kHigh_SkFilterQuality |
302 }; | 307 }; |
303 | 308 |
304 /** | 309 /** |
305 * Return the filter level. This affects the quality (and performance) of | 310 * Return the filter level. This affects the quality (and performance) of |
306 * drawing scaled images. | 311 * drawing scaled images. |
307 */ | 312 */ |
308 FilterLevel getFilterLevel() const { | 313 FilterLevel getFilterLevel() const { |
309 return (FilterLevel)fBitfields.fFilterLevel; | 314 return (FilterLevel)this->getFilterQuality(); |
310 } | 315 } |
311 | 316 |
312 /** | 317 /** |
313 * Set the filter level. This affects the quality (and performance) of | 318 * Set the filter level. This affects the quality (and performance) of |
314 * drawing scaled images. | 319 * drawing scaled images. |
315 */ | 320 */ |
316 void setFilterLevel(FilterLevel); | 321 void setFilterLevel(FilterLevel level) { |
| 322 this->setFilterQuality((SkFilterQuality)level); |
| 323 } |
| 324 #endif |
| 325 |
| 326 /** |
| 327 * Return the filter level. This affects the quality (and performance) of |
| 328 * drawing scaled images. |
| 329 */ |
| 330 SkFilterQuality getFilterQuality() const { |
| 331 return (SkFilterQuality)fBitfields.fFilterQuality; |
| 332 } |
| 333 |
| 334 /** |
| 335 * Set the filter quality. This affects the quality (and performance) of |
| 336 * drawing scaled images. |
| 337 */ |
| 338 void setFilterQuality(SkFilterQuality quality); |
317 | 339 |
318 /** | 340 /** |
319 * If the predicate is true, set the filterLevel to Low, else set it to | 341 * If the predicate is true, set the filterLevel to Low, else set it to |
320 * None. | 342 * None. |
321 */ | 343 */ |
322 SK_ATTR_DEPRECATED("use setFilterLevel") | 344 SK_ATTR_DEPRECATED("use setFilterLevel") |
323 void setFilterBitmap(bool doFilter) { | 345 void setFilterBitmap(bool doFilter) { |
324 this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel); | 346 this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel); |
325 } | 347 } |
326 | 348 |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 union { | 1055 union { |
1034 struct { | 1056 struct { |
1035 // all of these bitfields should add up to 32 | 1057 // all of these bitfields should add up to 32 |
1036 unsigned fFlags : 16; | 1058 unsigned fFlags : 16; |
1037 unsigned fTextAlign : 2; | 1059 unsigned fTextAlign : 2; |
1038 unsigned fCapType : 2; | 1060 unsigned fCapType : 2; |
1039 unsigned fJoinType : 2; | 1061 unsigned fJoinType : 2; |
1040 unsigned fStyle : 2; | 1062 unsigned fStyle : 2; |
1041 unsigned fTextEncoding : 2; // 3 values | 1063 unsigned fTextEncoding : 2; // 3 values |
1042 unsigned fHinting : 2; | 1064 unsigned fHinting : 2; |
1043 unsigned fFilterLevel : 2; | 1065 unsigned fFilterQuality : 2; |
1044 //unsigned fFreeBits : 2; | 1066 //unsigned fFreeBits : 2; |
1045 } fBitfields; | 1067 } fBitfields; |
1046 uint32_t fBitfieldsUInt; | 1068 uint32_t fBitfieldsUInt; |
1047 }; | 1069 }; |
1048 | 1070 |
1049 SkDrawCacheProc getDrawCacheProc() const; | 1071 SkDrawCacheProc getDrawCacheProc() const; |
1050 SkMeasureCacheProc getMeasureCacheProc(bool needFullMetrics) const; | 1072 SkMeasureCacheProc getMeasureCacheProc(bool needFullMetrics) const; |
1051 | 1073 |
1052 SkScalar measure_text(SkGlyphCache*, const char* text, size_t length, | 1074 SkScalar measure_text(SkGlyphCache*, const char* text, size_t length, |
1053 int* count, SkRect* bounds) const; | 1075 int* count, SkRect* bounds) const; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 friend class GrBitmapTextContext; | 1130 friend class GrBitmapTextContext; |
1109 friend class GrDistanceFieldTextContext; | 1131 friend class GrDistanceFieldTextContext; |
1110 friend class GrStencilAndCoverTextContext; | 1132 friend class GrStencilAndCoverTextContext; |
1111 friend class GrPathRendering; | 1133 friend class GrPathRendering; |
1112 friend class GrGLPathRendering; | 1134 friend class GrGLPathRendering; |
1113 friend class SkTextToPathIter; | 1135 friend class SkTextToPathIter; |
1114 friend class SkCanonicalizePaint; | 1136 friend class SkCanonicalizePaint; |
1115 }; | 1137 }; |
1116 | 1138 |
1117 #endif | 1139 #endif |
OLD | NEW |