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

Unified Diff: src/core/SkPaint.cpp

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 | « include/core/SkPaint.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPaint.cpp
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 886794c479702e18a9c7cc3c0de2df6c69f3ae38..372e68051e76b90b62c0d9c1598cfd30d7ee882c 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -205,6 +205,29 @@ void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) {
}
#endif
+SkPaint::FilterLevel SkPaint::getFilterLevel() const {
+ int level = 0;
+ if (fFlags & kFilterBitmap_Flag) {
+ level |= 1;
+ }
+ if (fFlags & kHighQualityFilterBitmap_Flag) {
+ level |= 2;
+ }
+ return (FilterLevel)level;
+}
+
+void SkPaint::setFilterLevel(FilterLevel level) {
+ unsigned mask = kFilterBitmap_Flag | kHighQualityFilterBitmap_Flag;
+ unsigned flags = 0;
+ if (level & 1) {
+ flags |= kFilterBitmap_Flag;
+ }
+ if (level & 2) {
+ flags |= kHighQualityFilterBitmap_Flag;
+ }
+ this->setFlags((fFlags & ~mask) | flags);
+}
+
void SkPaint::setHinting(Hinting hintingLevel) {
GEN_ID_INC_EVAL((unsigned) hintingLevel != fHinting);
fHinting = hintingLevel;
@@ -263,10 +286,6 @@ void SkPaint::setDevKernText(bool doDevKern) {
this->setFlags(SkSetClearMask(fFlags, doDevKern, kDevKernText_Flag));
}
-void SkPaint::setFilterBitmap(bool doFilter) {
- this->setFlags(SkSetClearMask(fFlags, doFilter, kFilterBitmap_Flag));
-}
-
void SkPaint::setStyle(Style style) {
if ((unsigned)style < kStyleCount) {
GEN_ID_INC_EVAL((unsigned)style != fStyle);
« no previous file with comments | « include/core/SkPaint.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698