add FilterLevel API to SkPaint, replacing various Flag bits
BUG=
R=bsalomon@google.com
Review URL: https://codereview.chromium.org/19769005
git-svn-id: http://skia.googlecode.com/svn/trunk@10138 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 2d7b3fa..e39f499 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -98,7 +98,10 @@
*/
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 @@
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 @@
*/
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