OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 | 9 |
10 #include "SkArithmeticMode.h" | 10 #include "SkArithmeticMode.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) | 77 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) |
78 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {} | 78 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {} |
79 | 79 |
80 SkScalar fDX, fDY; | 80 SkScalar fDX, fDY; |
81 | 81 |
82 typedef SkImageFilter INHERITED; | 82 typedef SkImageFilter INHERITED; |
83 }; | 83 }; |
84 | 84 |
85 static SimpleOffsetFilter::Registrar gReg; | 85 static SimpleOffsetFilter::Registrar gReg; |
86 | 86 |
87 SkFlattenable* SimpleOffsetFilter::CreateProc(SkReadBuffer& buffer) { | 87 sk_sp<SkFlattenable> SimpleOffsetFilter::CreateProc(SkReadBuffer& buffer) { |
88 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 88 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
89 SkScalar dx = buffer.readScalar(); | 89 SkScalar dx = buffer.readScalar(); |
90 SkScalar dy = buffer.readScalar(); | 90 SkScalar dy = buffer.readScalar(); |
91 return Create(dx, dy, common.getInput(0).get()); | 91 return sk_sp<SkFlattenable>(Create(dx, dy, common.getInput(0).get())); |
92 } | 92 } |
93 | 93 |
94 #ifndef SK_IGNORE_TO_STRING | 94 #ifndef SK_IGNORE_TO_STRING |
95 void SimpleOffsetFilter::toString(SkString* str) const { | 95 void SimpleOffsetFilter::toString(SkString* str) const { |
96 str->appendf("SimpleOffsetFilter: ("); | 96 str->appendf("SimpleOffsetFilter: ("); |
97 str->append(")"); | 97 str->append(")"); |
98 } | 98 } |
99 #endif | 99 #endif |
100 | 100 |
101 class ImageFiltersGraphGM : public skiagm::GM { | 101 class ImageFiltersGraphGM : public skiagm::GM { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 sk_sp<SkImage> fImage; | 240 sk_sp<SkImage> fImage; |
241 | 241 |
242 typedef GM INHERITED; | 242 typedef GM INHERITED; |
243 }; | 243 }; |
244 | 244 |
245 /////////////////////////////////////////////////////////////////////////////// | 245 /////////////////////////////////////////////////////////////////////////////// |
246 | 246 |
247 DEF_GM(return new ImageFiltersGraphGM;) | 247 DEF_GM(return new ImageFiltersGraphGM;) |
OLD | NEW |