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

Side by Side Diff: gm/drawfilter.cpp

Issue 2303033002: record drawfilters (Closed)
Patch Set: remove obsolete comment Created 4 years, 3 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 | « no previous file | src/core/SkLiteDL.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 kLow_SkBlurQuality); 50 kLow_SkBlurQuality);
51 } 51 }
52 52
53 void onDraw(SkCanvas* canvas) override { 53 void onDraw(SkCanvas* canvas) override {
54 SkPaint p; 54 SkPaint p;
55 p.setColor(SK_ColorBLUE); 55 p.setColor(SK_ColorBLUE);
56 p.setMaskFilter(fBlur); 56 p.setMaskFilter(fBlur);
57 SkRect r = { 20, 20, 100, 100 }; 57 SkRect r = { 20, 20, 100, 100 };
58 canvas->setDrawFilter(nullptr); 58 canvas->setDrawFilter(nullptr);
59 canvas->drawRect(r, p); 59 canvas->drawRect(r, p);
60 TestFilter redNoBlur; 60 canvas->setDrawFilter(new TestFilter)->unref();
61 canvas->setDrawFilter(&redNoBlur);
62 canvas->translate(120.0f, 40.0f); 61 canvas->translate(120.0f, 40.0f);
63 canvas->drawRect(r, p); 62 canvas->drawRect(r, p);
64
65 // Must unset if the DrawFilter is from the stack to avoid refcount erro rs!
66 canvas->setDrawFilter(nullptr); 63 canvas->setDrawFilter(nullptr);
67 } 64 }
68 65
69 private: 66 private:
70 typedef GM INHERITED; 67 typedef GM INHERITED;
71 }; 68 };
72 69
73 DEF_GM( return new DrawFilterGM; ) 70 DEF_GM( return new DrawFilterGM; )
74 71
75 #endif 72 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkLiteDL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698