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 11 matching lines...) Expand all Loading... |
22 #include "SkXfermodeImageFilter.h" | 22 #include "SkXfermodeImageFilter.h" |
23 | 23 |
24 // More closely models how Blink's OffsetFilter works as of 10/23/13. SkOffsetIm
ageFilter doesn't | 24 // More closely models how Blink's OffsetFilter works as of 10/23/13. SkOffsetIm
ageFilter doesn't |
25 // perform a draw and this one does. | 25 // perform a draw and this one does. |
26 class SimpleOffsetFilter : public SkImageFilter { | 26 class SimpleOffsetFilter : public SkImageFilter { |
27 public: | 27 public: |
28 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) | 28 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) |
29 : SkImageFilter(input), fDX(dx), fDY(dy) {} | 29 : SkImageFilter(input), fDX(dx), fDY(dy) {} |
30 | 30 |
31 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix
& ctm, | 31 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const SkMatrix
& ctm, |
32 SkBitmap* dst, SkIPoint* offset) SK_OVERRIDE { | 32 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID
E { |
33 SkBitmap source = src; | 33 SkBitmap source = src; |
34 SkImageFilter* input = getInput(0); | 34 SkImageFilter* input = getInput(0); |
35 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 35 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
36 if (NULL != input && !input->filterImage(proxy, src, ctm, &source, &srcO
ffset)) { | 36 if (NULL != input && !input->filterImage(proxy, src, ctm, &source, &srcO
ffset)) { |
37 return false; | 37 return false; |
38 } | 38 } |
39 | 39 |
40 SkIRect bounds; | 40 SkIRect bounds; |
41 source.getBounds(&bounds); | 41 source.getBounds(&bounds); |
42 | 42 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 private: | 206 private: |
207 typedef GM INHERITED; | 207 typedef GM INHERITED; |
208 SkBitmap fBitmap; | 208 SkBitmap fBitmap; |
209 bool fInitialized; | 209 bool fInitialized; |
210 }; | 210 }; |
211 | 211 |
212 /////////////////////////////////////////////////////////////////////////////// | 212 /////////////////////////////////////////////////////////////////////////////// |
213 | 213 |
214 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } | 214 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } |
215 static skiagm::GMRegistry reg(MyFactory); | 215 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |