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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 1854133002: Switch internal testing ImageFilters over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 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 | gm/imagefiltersgraph.cpp » ('j') | gm/imagefiltersgraph.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkShader.h" 12 #include "SkShader.h"
13 13
14 #include "SkBlurImageFilter.h" 14 #include "SkBlurImageFilter.h"
15 #include "SkColorFilterImageFilter.h" 15 #include "SkColorFilterImageFilter.h"
16 #include "SkDropShadowImageFilter.h" 16 #include "SkDropShadowImageFilter.h"
17 #include "SkSpecialImage.h"
17 #include "SkTestImageFilters.h" 18 #include "SkTestImageFilters.h"
18 19
19 class FailImageFilter : public SkImageFilter { 20 class FailImageFilter : public SkImageFilter {
20 public: 21 public:
21 class Registrar { 22 class Registrar {
22 public: 23 public:
23 Registrar() { 24 Registrar() {
24 SkFlattenable::Register("FailImageFilter", 25 SkFlattenable::Register("FailImageFilter",
25 FailImageFilter::CreateProc, 26 FailImageFilter::CreateProc,
26 FailImageFilter::GetFlattenableType()); 27 FailImageFilter::GetFlattenableType());
27 } 28 }
28 }; 29 };
29 static sk_sp<SkImageFilter> Make() { 30 static sk_sp<SkImageFilter> Make() {
30 return sk_sp<SkImageFilter>(new FailImageFilter); 31 return sk_sp<SkImageFilter>(new FailImageFilter);
31 } 32 }
32 33
33 SK_TO_STRING_OVERRIDE() 34 SK_TO_STRING_OVERRIDE()
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter) 35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(FailImageFilter)
35 36
36 protected: 37 protected:
37 FailImageFilter() : INHERITED(nullptr, 0, nullptr) {} 38 FailImageFilter() : INHERITED(nullptr, 0, nullptr) {}
38 39
39 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, 40 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
40 SkBitmap* result, SkIPoint* offset) const overr ide { 41 SkIPoint* offset) const override {
41 return false; 42 return nullptr;
42 } 43 }
43 44
44 private: 45 private:
45 typedef SkImageFilter INHERITED; 46 typedef SkImageFilter INHERITED;
46 }; 47 };
47 48
48 static FailImageFilter::Registrar gReg0; 49 static FailImageFilter::Registrar gReg0;
49 50
50 sk_sp<SkFlattenable> FailImageFilter::CreateProc(SkReadBuffer& buffer) { 51 sk_sp<SkFlattenable> FailImageFilter::CreateProc(SkReadBuffer& buffer) {
51 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); 52 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
(...skipping 18 matching lines...) Expand all
70 } 71 }
71 }; 72 };
72 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> input) { 73 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> input) {
73 return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input))); 74 return sk_sp<SkImageFilter>(new IdentityImageFilter(std::move(input)));
74 } 75 }
75 76
76 SK_TO_STRING_OVERRIDE() 77 SK_TO_STRING_OVERRIDE()
77 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter) 78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(IdentityImageFilter)
78 79
79 protected: 80 protected:
80 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, 81 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&,
81 SkBitmap* result, SkIPoint* offset) const overr ide { 82 SkIPoint* offset) const override {
82 *result = src;
83 offset->set(0, 0); 83 offset->set(0, 0);
84 return true; 84 return sk_ref_sp<SkSpecialImage>(source);
Stephen White 2016/04/04 17:02:42 Let's not do this until we get the null_ptr-as-tra
robertphillips 2016/04/04 18:08:31 I seems like this is actually what this test image
Stephen White 2016/04/04 18:43:15 Oh! Yeah, I guess it does. It's returning the sour
85 } 85 }
86 86
87 private: 87 private:
88 IdentityImageFilter(sk_sp<SkImageFilter> input) : INHERITED(&input, 1, nullp tr) {} 88 IdentityImageFilter(sk_sp<SkImageFilter> input) : INHERITED(&input, 1, nullp tr) {}
89 89
90 typedef SkImageFilter INHERITED; 90 typedef SkImageFilter INHERITED;
91 }; 91 };
92 92
93 static IdentityImageFilter::Registrar gReg1; 93 static IdentityImageFilter::Registrar gReg1;
94 94
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { 319 class ImageFiltersText_CF : public ImageFiltersTextBaseGM {
320 public: 320 public:
321 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} 321 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {}
322 322
323 void installFilter(SkPaint* paint) override { 323 void installFilter(SkPaint* paint) override {
324 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer mode::kSrcIn_Mode)); 324 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer mode::kSrcIn_Mode));
325 } 325 }
326 }; 326 };
327 DEF_GM( return new ImageFiltersText_CF; ) 327 DEF_GM( return new ImageFiltersText_CF; )
OLDNEW
« no previous file with comments | « no previous file | gm/imagefiltersgraph.cpp » ('j') | gm/imagefiltersgraph.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698