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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkPaint.h ('k') | no next file » | 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 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkAnnotation.h" 10 #include "SkAnnotation.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 199
200 void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) { 200 void SkPaint::setPaintOptionsAndroid(const SkPaintOptionsAndroid& options) {
201 if (options != fPaintOptionsAndroid) { 201 if (options != fPaintOptionsAndroid) {
202 fPaintOptionsAndroid = options; 202 fPaintOptionsAndroid = options;
203 GEN_ID_INC; 203 GEN_ID_INC;
204 } 204 }
205 } 205 }
206 #endif 206 #endif
207 207
208 SkPaint::FilterLevel SkPaint::getFilterLevel() const {
209 int level = 0;
210 if (fFlags & kFilterBitmap_Flag) {
211 level |= 1;
212 }
213 if (fFlags & kHighQualityFilterBitmap_Flag) {
214 level |= 2;
215 }
216 return (FilterLevel)level;
217 }
218
219 void SkPaint::setFilterLevel(FilterLevel level) {
220 unsigned mask = kFilterBitmap_Flag | kHighQualityFilterBitmap_Flag;
221 unsigned flags = 0;
222 if (level & 1) {
223 flags |= kFilterBitmap_Flag;
224 }
225 if (level & 2) {
226 flags |= kHighQualityFilterBitmap_Flag;
227 }
228 this->setFlags((fFlags & ~mask) | flags);
229 }
230
208 void SkPaint::setHinting(Hinting hintingLevel) { 231 void SkPaint::setHinting(Hinting hintingLevel) {
209 GEN_ID_INC_EVAL((unsigned) hintingLevel != fHinting); 232 GEN_ID_INC_EVAL((unsigned) hintingLevel != fHinting);
210 fHinting = hintingLevel; 233 fHinting = hintingLevel;
211 } 234 }
212 235
213 void SkPaint::setFlags(uint32_t flags) { 236 void SkPaint::setFlags(uint32_t flags) {
214 GEN_ID_INC_EVAL(fFlags != flags); 237 GEN_ID_INC_EVAL(fFlags != flags);
215 fFlags = flags; 238 fFlags = flags;
216 } 239 }
217 240
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 279 }
257 280
258 void SkPaint::setFakeBoldText(bool doFakeBold) { 281 void SkPaint::setFakeBoldText(bool doFakeBold) {
259 this->setFlags(SkSetClearMask(fFlags, doFakeBold, kFakeBoldText_Flag)); 282 this->setFlags(SkSetClearMask(fFlags, doFakeBold, kFakeBoldText_Flag));
260 } 283 }
261 284
262 void SkPaint::setDevKernText(bool doDevKern) { 285 void SkPaint::setDevKernText(bool doDevKern) {
263 this->setFlags(SkSetClearMask(fFlags, doDevKern, kDevKernText_Flag)); 286 this->setFlags(SkSetClearMask(fFlags, doDevKern, kDevKernText_Flag));
264 } 287 }
265 288
266 void SkPaint::setFilterBitmap(bool doFilter) {
267 this->setFlags(SkSetClearMask(fFlags, doFilter, kFilterBitmap_Flag));
268 }
269
270 void SkPaint::setStyle(Style style) { 289 void SkPaint::setStyle(Style style) {
271 if ((unsigned)style < kStyleCount) { 290 if ((unsigned)style < kStyleCount) {
272 GEN_ID_INC_EVAL((unsigned)style != fStyle); 291 GEN_ID_INC_EVAL((unsigned)style != fStyle);
273 fStyle = style; 292 fStyle = style;
274 } else { 293 } else {
275 #ifdef SK_REPORT_API_RANGE_CHECK 294 #ifdef SK_REPORT_API_RANGE_CHECK
276 SkDebugf("SkPaint::setStyle(%d) out of range\n", style); 295 SkDebugf("SkPaint::setStyle(%d) out of range\n", style);
277 #endif 296 #endif
278 } 297 }
279 } 298 }
(...skipping 2303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2583 case SkXfermode::kPlus_Mode: 2602 case SkXfermode::kPlus_Mode:
2584 return 0 == this->getAlpha(); 2603 return 0 == this->getAlpha();
2585 case SkXfermode::kDst_Mode: 2604 case SkXfermode::kDst_Mode:
2586 return true; 2605 return true;
2587 default: 2606 default:
2588 break; 2607 break;
2589 } 2608 }
2590 } 2609 }
2591 return false; 2610 return false;
2592 } 2611 }
OLDNEW
« 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