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

Side by Side Diff: gm/drawfilter.cpp

Issue 1079813002: use anon namespace to avoid (silent) collisions between local test classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | tests/DrawFilterTest.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 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"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkDrawFilter.h" 12 #include "SkDrawFilter.h"
13 #include "SkPaint.h" 13 #include "SkPaint.h"
14 14
15 /** 15 /**
16 * Initial test coverage for SkDrawFilter. 16 * Initial test coverage for SkDrawFilter.
17 * Draws two rectangles; if draw filters are broken, they will match. 17 * Draws two rectangles; if draw filters are broken, they will match.
18 * If draw filters are working correctly, the first will be blue and blurred, 18 * If draw filters are working correctly, the first will be blue and blurred,
19 * the second red and sharp. 19 * the second red and sharp.
20 */ 20 */
21 21
22 namespace {
22 class TestFilter : public SkDrawFilter { 23 class TestFilter : public SkDrawFilter {
23 public: 24 public:
24 bool filter(SkPaint* p, Type) override { 25 bool filter(SkPaint* p, Type) override {
25 p->setColor(SK_ColorRED); 26 p->setColor(SK_ColorRED);
26 p->setMaskFilter(NULL); 27 p->setMaskFilter(NULL);
27 return true; 28 return true;
28 } 29 }
29 }; 30 };
31 }
30 32
31 class DrawFilterGM : public skiagm::GM { 33 class DrawFilterGM : public skiagm::GM {
32 SkAutoTUnref<SkMaskFilter> fBlur; 34 SkAutoTUnref<SkMaskFilter> fBlur;
33 35
34 protected: 36 protected:
35 SkISize onISize() override { 37 SkISize onISize() override {
36 return SkISize::Make(320, 240); 38 return SkISize::Make(320, 240);
37 } 39 }
38 40
39 SkString onShortName() override { 41 SkString onShortName() override {
(...skipping 22 matching lines...) Expand all
62 canvas->setDrawFilter(NULL); 64 canvas->setDrawFilter(NULL);
63 } 65 }
64 66
65 private: 67 private:
66 typedef GM INHERITED; 68 typedef GM INHERITED;
67 }; 69 };
68 70
69 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; } 71 static skiagm::GM* MyFactory(void*) { return new DrawFilterGM; }
70 static skiagm::GMRegistry reg(MyFactory); 72 static skiagm::GMRegistry reg(MyFactory);
71 73
OLDNEW
« no previous file with comments | « no previous file | tests/DrawFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698