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

Side by Side Diff: include/core/SkPaint.h

Issue 19769005: add FilterLevel API to SkPaint, replacing various Flag bits (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | 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 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
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 Hinting getHinting() const { 91 Hinting getHinting() const {
92 return static_cast<Hinting>(fHinting); 92 return static_cast<Hinting>(fHinting);
93 } 93 }
94 94
95 void setHinting(Hinting hintingLevel); 95 void setHinting(Hinting hintingLevel);
96 96
97 /** Specifies the bit values that are stored in the paint's flags. 97 /** Specifies the bit values that are stored in the paint's flags.
98 */ 98 */
99 enum Flags { 99 enum Flags {
100 kAntiAlias_Flag = 0x01, //!< mask to enable antialiasing 100 kAntiAlias_Flag = 0x01, //!< mask to enable antialiasing
101 kFilterBitmap_Flag = 0x02, //!< mask to enable bitmap filtering 101
102 // DEPRECATED -- use setFilterLevel instead
103 kFilterBitmap_Flag = 0x02, // temporary flag
104
102 kDither_Flag = 0x04, //!< mask to enable dithering 105 kDither_Flag = 0x04, //!< mask to enable dithering
103 kUnderlineText_Flag = 0x08, //!< mask to enable underline text 106 kUnderlineText_Flag = 0x08, //!< mask to enable underline text
104 kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text 107 kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text
105 kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text 108 kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text
106 kLinearText_Flag = 0x40, //!< mask to enable linear-text 109 kLinearText_Flag = 0x40, //!< mask to enable linear-text
107 kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positi oning 110 kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positi oning
108 kDevKernText_Flag = 0x100, //!< mask to enable device kerning text 111 kDevKernText_Flag = 0x100, //!< mask to enable device kerning text
109 kLCDRenderText_Flag = 0x200, //!< mask to enable subpixel glyph rende rering 112 kLCDRenderText_Flag = 0x200, //!< mask to enable subpixel glyph rende rering
110 kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap st rikes 113 kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap st rikes
111 kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter 114 kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter
112 kVerticalText_Flag = 0x1000, 115 kVerticalText_Flag = 0x1000,
113 kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it 116 kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
117
118 // DEPRECATED -- use setFilterLevel instead
114 kHighQualityFilterBitmap_Flag = 0x4000, // temporary flag 119 kHighQualityFilterBitmap_Flag = 0x4000, // temporary flag
120 // DEPRECATED -- use setFilterLevel instead
115 kHighQualityDownsampleBitmap_Flag = 0x8000, // temporary flag 121 kHighQualityDownsampleBitmap_Flag = 0x8000, // temporary flag
116 122
117 // when adding extra flags, note that the fFlags member is specified 123 // when adding extra flags, note that the fFlags member is specified
118 // with a bit-width and you'll have to expand it. 124 // with a bit-width and you'll have to expand it.
119 125
120 kAllFlags = 0xFFFF 126 kAllFlags = 0xFFFF
121 }; 127 };
122 128
123 /** Return the paint's flags. Use the Flag enum to test flag values. 129 /** Return the paint's flags. Use the Flag enum to test flag values.
124 @return the paint's flags (see enums ending in _Flag for bit masks) 130 @return the paint's flags (see enums ending in _Flag for bit masks)
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bool isDevKernText() const { 279 bool isDevKernText() const {
274 return SkToBool(this->getFlags() & kDevKernText_Flag); 280 return SkToBool(this->getFlags() & kDevKernText_Flag);
275 } 281 }
276 282
277 /** Helper for setFlags(), setting or clearing the kKernText_Flag bit 283 /** Helper for setFlags(), setting or clearing the kKernText_Flag bit
278 @param kernText true to set the kKernText_Flag bit in the paint's 284 @param kernText true to set the kKernText_Flag bit in the paint's
279 flags, false to clear it. 285 flags, false to clear it.
280 */ 286 */
281 void setDevKernText(bool devKernText); 287 void setDevKernText(bool devKernText);
282 288
283 bool isFilterBitmap() const { 289 enum FilterLevel {
284 return SkToBool(this->getFlags() & kFilterBitmap_Flag); 290 kNone_FilterLevel,
291 kLow_FilterLevel,
292 kMedium_FilterLevel,
293 kHigh_FilterLevel
294 };
295
296 /**
297 * Return the filter level. This affects the quality (and performance) of
298 * drawing scaled images.
299 */
300 FilterLevel getFilterLevel() const;
301
302 /**
303 * Set the filter level. This affects the quality (and performance) of
304 * drawing scaled images.
305 */
306 void setFilterLevel(FilterLevel);
307
308 /**
309 * DEPRECATED: use setFilterLevel instead.
310 * If the predicate is true, set the filterLevel to Low, else set it to
311 * None.
312 */
313 void setFilterBitmap(bool doFilter) {
314 this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel);
285 } 315 }
286 316
287 void setFilterBitmap(bool filterBitmap); 317 /**
318 * DEPRECATED: call getFilterLevel() instead.
319 * Returns true if getFilterLevel() returns anything other than None.
320 */
321 bool isFilterBitmap() const {
322 return kNone_FilterLevel != this->getFilterLevel();
323 }
288 324
289 /** Styles apply to rect, oval, path, and text. 325 /** Styles apply to rect, oval, path, and text.
290 Bitmaps are always drawn in "fill", and lines are always drawn in 326 Bitmaps are always drawn in "fill", and lines are always drawn in
291 "stroke". 327 "stroke".
292 328
293 Note: strokeandfill implicitly draws the result with 329 Note: strokeandfill implicitly draws the result with
294 SkPath::kWinding_FillType, so if the original path is even-odd, the 330 SkPath::kWinding_FillType, so if the original path is even-odd, the
295 results may not appear the same as if it was drawn twice, filled and 331 results may not appear the same as if it was drawn twice, filled and
296 then stroked. 332 then stroked.
297 */ 333 */
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 #ifdef SK_BUILD_FOR_ANDROID 1098 #ifdef SK_BUILD_FOR_ANDROID
1063 SkPaintOptionsAndroid fPaintOptionsAndroid; 1099 SkPaintOptionsAndroid fPaintOptionsAndroid;
1064 1100
1065 // In order for the == operator to work properly this must be the last field 1101 // In order for the == operator to work properly this must be the last field
1066 // in the struct so that we can do a memcmp to this field's offset. 1102 // in the struct so that we can do a memcmp to this field's offset.
1067 uint32_t fGenerationID; 1103 uint32_t fGenerationID;
1068 #endif 1104 #endif
1069 }; 1105 };
1070 1106
1071 #endif 1107 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698