| 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 23 matching lines...) Expand all Loading... |
| 34 SimpleOffsetFilter::GetFlattenableType()); | 34 SimpleOffsetFilter::GetFlattenableType()); |
| 35 } | 35 } |
| 36 }; | 36 }; |
| 37 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ | 37 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ |
| 38 return new SimpleOffsetFilter(dx, dy, input); | 38 return new SimpleOffsetFilter(dx, dy, input); |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context&
ctx, | 41 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context&
ctx, |
| 42 SkBitmap* dst, SkIPoint* offset) const override { | 42 SkBitmap* dst, SkIPoint* offset) const override { |
| 43 SkBitmap source = src; | 43 SkBitmap source = src; |
| 44 SkImageFilter* input = getInput(0); | |
| 45 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 44 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
| 46 if (input && !input->filterImage(proxy, src, ctx, &source, &srcOffset))
{ | 45 if (!this->filterInput(0, proxy, src, ctx, &source, &srcOffset)) { |
| 47 return false; | 46 return false; |
| 48 } | 47 } |
| 49 | 48 |
| 50 SkIRect bounds; | 49 SkIRect bounds; |
| 51 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc
e)) { | 50 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc
e)) { |
| 52 return false; | 51 return false; |
| 53 } | 52 } |
| 54 | 53 |
| 55 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); | 54 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); |
| 56 SkCanvas canvas(device); | 55 SkCanvas canvas(device); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 } | 211 } |
| 213 | 212 |
| 214 SkAutoTUnref<SkImage> fImage; | 213 SkAutoTUnref<SkImage> fImage; |
| 215 | 214 |
| 216 typedef GM INHERITED; | 215 typedef GM INHERITED; |
| 217 }; | 216 }; |
| 218 | 217 |
| 219 /////////////////////////////////////////////////////////////////////////////// | 218 /////////////////////////////////////////////////////////////////////////////// |
| 220 | 219 |
| 221 DEF_GM(return new ImageFiltersGraphGM;) | 220 DEF_GM(return new ImageFiltersGraphGM;) |
| OLD | NEW |