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 28 matching lines...) Expand all Loading... |
39 }; | 39 }; |
40 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ | 40 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ |
41 return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input)); | 41 return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input)); |
42 } | 42 } |
43 | 43 |
44 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context&
ctx, | 44 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context&
ctx, |
45 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID
E { | 45 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID
E { |
46 SkBitmap source = src; | 46 SkBitmap source = src; |
47 SkImageFilter* input = getInput(0); | 47 SkImageFilter* input = getInput(0); |
48 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 48 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
49 if (NULL != input && !input->filterImage(proxy, src, ctx, &source, &srcO
ffset)) { | 49 if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset))
{ |
50 return false; | 50 return false; |
51 } | 51 } |
52 | 52 |
53 SkIRect bounds; | 53 SkIRect bounds; |
54 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc
e)) { | 54 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc
e)) { |
55 return false; | 55 return false; |
56 } | 56 } |
57 | 57 |
58 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); | 58 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); |
59 SkCanvas canvas(device); | 59 SkCanvas canvas(device); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 private: | 232 private: |
233 typedef GM INHERITED; | 233 typedef GM INHERITED; |
234 SkBitmap fBitmap; | 234 SkBitmap fBitmap; |
235 }; | 235 }; |
236 | 236 |
237 /////////////////////////////////////////////////////////////////////////////// | 237 /////////////////////////////////////////////////////////////////////////////// |
238 | 238 |
239 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } | 239 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } |
240 static skiagm::GMRegistry reg(MyFactory); | 240 static skiagm::GMRegistry reg(MyFactory); |
OLD | NEW |