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

Side by Side Diff: gm/imagefiltersbase.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « gm/dcshader.cpp ('k') | gm/imagefiltersgraph.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 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"
(...skipping 27 matching lines...) Expand all
38 SkBitmap* result, SkIPoint* offset) const overr ide { 38 SkBitmap* result, SkIPoint* offset) const overr ide {
39 return false; 39 return false;
40 } 40 }
41 41
42 private: 42 private:
43 typedef SkImageFilter INHERITED; 43 typedef SkImageFilter INHERITED;
44 }; 44 };
45 45
46 static FailImageFilter::Registrar gReg0; 46 static FailImageFilter::Registrar gReg0;
47 47
48 SkFlattenable* FailImageFilter::CreateProc(SkReadBuffer& buffer) { 48 sk_sp<SkFlattenable> FailImageFilter::CreateProc(SkReadBuffer& buffer) {
49 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0); 49 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
50 return FailImageFilter::Create(); 50 return sk_sp<SkFlattenable>(FailImageFilter::Create());
51 } 51 }
52 52
53 #ifndef SK_IGNORE_TO_STRING 53 #ifndef SK_IGNORE_TO_STRING
54 void FailImageFilter::toString(SkString* str) const { 54 void FailImageFilter::toString(SkString* str) const {
55 str->appendf("FailImageFilter: ("); 55 str->appendf("FailImageFilter: (");
56 str->append(")"); 56 str->append(")");
57 } 57 }
58 #endif 58 #endif
59 59
60 class IdentityImageFilter : public SkImageFilter { 60 class IdentityImageFilter : public SkImageFilter {
(...skipping 21 matching lines...) Expand all
82 offset->set(0, 0); 82 offset->set(0, 0);
83 return true; 83 return true;
84 } 84 }
85 85
86 private: 86 private:
87 typedef SkImageFilter INHERITED; 87 typedef SkImageFilter INHERITED;
88 }; 88 };
89 89
90 static IdentityImageFilter::Registrar gReg1; 90 static IdentityImageFilter::Registrar gReg1;
91 91
92 SkFlattenable* IdentityImageFilter::CreateProc(SkReadBuffer& buffer) { 92 sk_sp<SkFlattenable> IdentityImageFilter::CreateProc(SkReadBuffer& buffer) {
93 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); 93 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
94 return IdentityImageFilter::Create(common.getInput(0).get()); 94 return sk_sp<SkFlattenable>(IdentityImageFilter::Create(common.getInput(0).g et()));
95 } 95 }
96 96
97 #ifndef SK_IGNORE_TO_STRING 97 #ifndef SK_IGNORE_TO_STRING
98 void IdentityImageFilter::toString(SkString* str) const { 98 void IdentityImageFilter::toString(SkString* str) const {
99 str->appendf("IdentityImageFilter: ("); 99 str->appendf("IdentityImageFilter: (");
100 str->append(")"); 100 str->append(")");
101 } 101 }
102 #endif 102 #endif
103 103
104 /////////////////////////////////////////////////////////////////////////////// 104 ///////////////////////////////////////////////////////////////////////////////
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 class ImageFiltersText_CF : public ImageFiltersTextBaseGM { 316 class ImageFiltersText_CF : public ImageFiltersTextBaseGM {
317 public: 317 public:
318 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {} 318 ImageFiltersText_CF() : ImageFiltersTextBaseGM("color") {}
319 319
320 void installFilter(SkPaint* paint) override { 320 void installFilter(SkPaint* paint) override {
321 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer mode::kSrcIn_Mode)); 321 paint->setColorFilter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfer mode::kSrcIn_Mode));
322 } 322 }
323 }; 323 };
324 DEF_GM( return new ImageFiltersText_CF; ) 324 DEF_GM( return new ImageFiltersText_CF; )
OLDNEW
« no previous file with comments | « gm/dcshader.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698