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

Side by Side Diff: gm/matriximagefilter.cpp

Issue 1014533004: SkPaint::FilterLevel -> SkFilterQuality (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « gm/imageresizetiled.cpp ('k') | gm/mipmap.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkColor.h" 9 #include "SkColor.h"
10 #include "SkMatrixImageFilter.h" 10 #include "SkMatrixImageFilter.h"
11 11
12 namespace skiagm { 12 namespace skiagm {
13 13
14 class MatrixImageFilterGM : public GM { 14 class MatrixImageFilterGM : public GM {
15 public: 15 public:
16 MatrixImageFilterGM() { 16 MatrixImageFilterGM() {
17 this->setBGColor(0x00000000); 17 this->setBGColor(0x00000000);
18 } 18 }
19 19
20 protected: 20 protected:
21 virtual SkString onShortName() { 21 virtual SkString onShortName() {
22 return SkString("matriximagefilter"); 22 return SkString("matriximagefilter");
23 } 23 }
24 24
25 void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap, 25 void draw(SkCanvas* canvas, const SkRect& rect, const SkBitmap& bitmap,
26 const SkMatrix& matrix, SkPaint::FilterLevel filterLevel) { 26 const SkMatrix& matrix, SkFilterQuality filter) {
27 SkAutoTUnref<SkImageFilter> imageFilter( 27 SkAutoTUnref<SkImageFilter> imageFilter(
28 SkMatrixImageFilter::Create(matrix, filterLevel)); 28 SkMatrixImageFilter::Create(matrix, filter));
29 SkPaint paint; 29 SkPaint paint;
30 paint.setImageFilter(imageFilter.get()); 30 paint.setImageFilter(imageFilter.get());
31 canvas->saveLayer(&rect, &paint); 31 canvas->saveLayer(&rect, &paint);
32 canvas->drawBitmap(bitmap, 0, 0); 32 canvas->drawBitmap(bitmap, 0, 0);
33 canvas->restore(); 33 canvas->restore();
34 } 34 }
35 35
36 virtual SkISize onISize() { 36 virtual SkISize onISize() {
37 return SkISize::Make(420, 100); 37 return SkISize::Make(420, 100);
38 } 38 }
(...skipping 22 matching lines...) Expand all
61 canvas->clear(0x00000000); 61 canvas->clear(0x00000000);
62 SkMatrix matrix; 62 SkMatrix matrix;
63 SkScalar margin = SkIntToScalar(10); 63 SkScalar margin = SkIntToScalar(10);
64 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2)); 64 matrix.setSkew(SkDoubleToScalar(0.5), SkDoubleToScalar(0.2));
65 SkBitmap checkerboard; 65 SkBitmap checkerboard;
66 make_checkerboard(&checkerboard); 66 make_checkerboard(&checkerboard);
67 67
68 SkRect srcRect = SkRect::MakeWH(96, 96); 68 SkRect srcRect = SkRect::MakeWH(96, 96);
69 69
70 canvas->translate(margin, margin); 70 canvas->translate(margin, margin);
71 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kNone_FilterLevel); 71 draw(canvas, srcRect, checkerboard, matrix, kNone_SkFilterQuality);
72 72
73 canvas->translate(srcRect.width() + margin, 0); 73 canvas->translate(srcRect.width() + margin, 0);
74 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kLow_FilterLevel); 74 draw(canvas, srcRect, checkerboard, matrix, kLow_SkFilterQuality);
75 75
76 #if 0 76 #if 0
77 // This may be causing Mac 10.6 to barf. 77 // This may be causing Mac 10.6 to barf.
78 canvas->translate(srcRect.width() + margin, 0); 78 canvas->translate(srcRect.width() + margin, 0);
79 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kMedium_FilterLevel ); 79 draw(canvas, srcRect, checkerboard, matrix, kMedium_SkFilterQuality);
80 80
81 canvas->translate(srcRect.width() + margin, 0); 81 canvas->translate(srcRect.width() + margin, 0);
82 draw(canvas, srcRect, checkerboard, matrix, SkPaint::kHigh_FilterLevel); 82 draw(canvas, srcRect, checkerboard, matrix, kHigh_SkFilterQuality);
83 #endif 83 #endif
84 } 84 }
85 85
86 private: 86 private:
87 typedef GM INHERITED; 87 typedef GM INHERITED;
88 }; 88 };
89 89
90 ////////////////////////////////////////////////////////////////////////////// 90 //////////////////////////////////////////////////////////////////////////////
91 91
92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; } 92 static GM* MyFactory(void*) { return new MatrixImageFilterGM; }
93 static GMRegistry reg(MyFactory); 93 static GMRegistry reg(MyFactory);
94 94
95 } 95 }
OLDNEW
« no previous file with comments | « gm/imageresizetiled.cpp ('k') | gm/mipmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698