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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 2d7b3fa542817e4fdc28652113a6ddf4c83f8086..e39f49942e0770ff6701dcd6be33c2b6d33122d2 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -98,7 +98,10 @@ public:
*/
enum Flags {
kAntiAlias_Flag = 0x01, //!< mask to enable antialiasing
- kFilterBitmap_Flag = 0x02, //!< mask to enable bitmap filtering
+
+ // DEPRECATED -- use setFilterLevel instead
+ kFilterBitmap_Flag = 0x02, // temporary flag
+
kDither_Flag = 0x04, //!< mask to enable dithering
kUnderlineText_Flag = 0x08, //!< mask to enable underline text
kStrikeThruText_Flag = 0x10, //!< mask to enable strike-thru text
@@ -111,7 +114,10 @@ public:
kAutoHinting_Flag = 0x800, //!< mask to force Freetype's autohinter
kVerticalText_Flag = 0x1000,
kGenA8FromLCD_Flag = 0x2000, // hack for GDI -- do not use if you can help it
+
+ // DEPRECATED -- use setFilterLevel instead
kHighQualityFilterBitmap_Flag = 0x4000, // temporary flag
+ // DEPRECATED -- use setFilterLevel instead
kHighQualityDownsampleBitmap_Flag = 0x8000, // temporary flag
// when adding extra flags, note that the fFlags member is specified
@@ -280,11 +286,41 @@ public:
*/
void setDevKernText(bool devKernText);
- bool isFilterBitmap() const {
- return SkToBool(this->getFlags() & kFilterBitmap_Flag);
+ enum FilterLevel {
+ kNone_FilterLevel,
+ kLow_FilterLevel,
+ kMedium_FilterLevel,
+ kHigh_FilterLevel
+ };
+
+ /**
+ * Return the filter level. This affects the quality (and performance) of
+ * drawing scaled images.
+ */
+ FilterLevel getFilterLevel() const;
+
+ /**
+ * Set the filter level. This affects the quality (and performance) of
+ * drawing scaled images.
+ */
+ void setFilterLevel(FilterLevel);
+
+ /**
+ * DEPRECATED: use setFilterLevel instead.
+ * If the predicate is true, set the filterLevel to Low, else set it to
+ * None.
+ */
+ void setFilterBitmap(bool doFilter) {
+ this->setFilterLevel(doFilter ? kLow_FilterLevel : kNone_FilterLevel);
}
- void setFilterBitmap(bool filterBitmap);
+ /**
+ * DEPRECATED: call getFilterLevel() instead.
+ * Returns true if getFilterLevel() returns anything other than None.
+ */
+ bool isFilterBitmap() const {
+ return kNone_FilterLevel != this->getFilterLevel();
+ }
/** Styles apply to rect, oval, path, and text.
Bitmaps are always drawn in "fill", and lines are always drawn in
« 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