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

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 // DEPRECATED -- use setFilterLevel instead
101 kFilterBitmap_Flag = 0x02, //!< mask to enable bitmap filtering 102 kFilterBitmap_Flag = 0x02, //!< mask to enable bitmap filtering
102 kDither_Flag = 0x04, //!< mask to enable dithering 103 kDither_Flag = 0x04, //!< mask to enable dithering
bsalomon 2013/07/18 13:42:12 maybe put a newline here.. just so it's obvious th
103 kUnderlineText_Flag = 0x08, //!< mask to enable underline text 104 kUnderlineText_Flag = 0x08, //!< mask to enable underline text
104 kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text 105 kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text
105 kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text 106 kFakeBoldText_Flag = 0x20, //!< mask to enable fake-bold text
106 kLinearText_Flag = 0x40, //!< mask to enable linear-text 107 kLinearText_Flag = 0x40, //!< mask to enable linear-text
107 kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positi oning 108 kSubpixelText_Flag = 0x80, //!< mask to enable subpixel text positi oning
108 kDevKernText_Flag = 0x100, //!< mask to enable device kerning text 109 kDevKernText_Flag = 0x100, //!< mask to enable device kerning text
109 kLCDRenderText_Flag = 0x200, //!< mask to enable subpixel glyph rende rering 110 kLCDRenderText_Flag = 0x200, //!< mask to enable subpixel glyph rende rering
110 kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap st rikes 111 kEmbeddedBitmapText_Flag = 0x400, //!< mask to enable embedded bitmap st rikes
111 kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter 112 kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter
112 kVerticalText_Flag = 0x1000, 113 kVerticalText_Flag = 0x1000,
113 kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it 114 kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
115
116 // DEPRECATED -- use setFilterLevel instead
114 kHighQualityFilterBitmap_Flag = 0x4000, // temporary flag 117 kHighQualityFilterBitmap_Flag = 0x4000, // temporary flag
118 // DEPRECATED -- use setFilterLevel instead
115 kHighQualityDownsampleBitmap_Flag = 0x8000, // temporary flag 119 kHighQualityDownsampleBitmap_Flag = 0x8000, // temporary flag
116 120
117 // when adding extra flags, note that the fFlags member is specified 121 // when adding extra flags, note that the fFlags member is specified
118 // with a bit-width and you'll have to expand it. 122 // with a bit-width and you'll have to expand it.
119 123
120 kAllFlags = 0xFFFF 124 kAllFlags = 0xFFFF
121 }; 125 };
122 126
123 /** Return the paint's flags. Use the Flag enum to test flag values. 127 /** 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) 128 @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 { 277 bool isDevKernText() const {
274 return SkToBool(this->getFlags() & kDevKernText_Flag); 278 return SkToBool(this->getFlags() & kDevKernText_Flag);
275 } 279 }
276 280
277 /** Helper for setFlags(), setting or clearing the kKernText_Flag bit 281 /** Helper for setFlags(), setting or clearing the kKernText_Flag bit
278 @param kernText true to set the kKernText_Flag bit in the paint's 282 @param kernText true to set the kKernText_Flag bit in the paint's
279 flags, false to clear it. 283 flags, false to clear it.
280 */ 284 */
281 void setDevKernText(bool devKernText); 285 void setDevKernText(bool devKernText);
282 286
283 bool isFilterBitmap() const { 287 enum FilterLevel {
284 return SkToBool(this->getFlags() & kFilterBitmap_Flag); 288 kNone_FilterLevel,
289 kLow_FilterLevel,
290 kMedium_FilterLevel,
291 kHigh_FilterLevel
292 };
293
294 /**
295 * Return the filter level. This affects the quality (and performance) of
296 * drawing scaled images.
297 */
298 FilterLevel getFilterLevel() const;
299
300 /**
301 * Set the filter level. This affects the quality (and performance) of
302 * drawing scaled images.
303 */
304 void setFilterLevel(FilterLevel);
305
306 /**
307 * DEPRECATED: use setFilterLevel instead.
308 * If the predicate is true, set the filterLevel to Low, else set it to
309 * None.
310 */
311 void setFilterBitmap(bool doFilter) {
312 this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel);
285 } 313 }
286 314
287 void setFilterBitmap(bool filterBitmap); 315 /**
316 * DEPRECATED: call getFilterLevel() instead.
317 * Returns true if getFilterLevel() returns anything other than None.
318 */
319 bool isFilterBitmap() const {
320 return kNone_FilterLevel != this->getFilterLevel();
321 }
288 322
289 /** Styles apply to rect, oval, path, and text. 323 /** Styles apply to rect, oval, path, and text.
290 Bitmaps are always drawn in "fill", and lines are always drawn in 324 Bitmaps are always drawn in "fill", and lines are always drawn in
291 "stroke". 325 "stroke".
292 326
293 Note: strokeandfill implicitly draws the result with 327 Note: strokeandfill implicitly draws the result with
294 SkPath::kWinding_FillType, so if the original path is even-odd, the 328 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 329 results may not appear the same as if it was drawn twice, filled and
296 then stroked. 330 then stroked.
297 */ 331 */
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 #ifdef SK_BUILD_FOR_ANDROID 1096 #ifdef SK_BUILD_FOR_ANDROID
1063 SkPaintOptionsAndroid fPaintOptionsAndroid; 1097 SkPaintOptionsAndroid fPaintOptionsAndroid;
1064 1098
1065 // In order for the == operator to work properly this must be the last field 1099 // 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. 1100 // in the struct so that we can do a memcmp to this field's offset.
1067 uint32_t fGenerationID; 1101 uint32_t fGenerationID;
1068 #endif 1102 #endif
1069 }; 1103 };
1070 1104
1071 #endif 1105 #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