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 21 matching lines...) Expand all Loading... |
32 Registrar() { | 32 Registrar() { |
33 SkFlattenable::Register("SimpleOffsetFilter", | 33 SkFlattenable::Register("SimpleOffsetFilter", |
34 SimpleOffsetFilter::CreateProc, | 34 SimpleOffsetFilter::CreateProc, |
35 SimpleOffsetFilter::GetFlattenableType()); | 35 SimpleOffsetFilter::GetFlattenableType()); |
36 } | 36 } |
37 }; | 37 }; |
38 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ | 38 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input)
{ |
39 return new SimpleOffsetFilter(dx, dy, input); | 39 return new SimpleOffsetFilter(dx, dy, input); |
40 } | 40 } |
41 | 41 |
42 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context&
ctx, | 42 bool onFilterImageDeprecated(Proxy* proxy, const SkBitmap& src, const Contex
t& ctx, |
43 SkBitmap* dst, SkIPoint* offset) const override { | 43 SkBitmap* dst, SkIPoint* offset) const override
{ |
44 SkBitmap source = src; | 44 SkBitmap source = src; |
45 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 45 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
46 if (!this->filterInput(0, proxy, src, ctx, &source, &srcOffset)) { | 46 if (!this->filterInputDeprecated(0, proxy, src, ctx, &source, &srcOffset
)) { |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 SkIRect bounds; | 50 SkIRect bounds; |
51 if (!this->applyCropRect(ctx, proxy, source, &srcOffset, &bounds, &sourc
e)) { | 51 if (!this->applyCropRectDeprecated(ctx, proxy, source, &srcOffset, &boun
ds, &source)) { |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); | 55 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bo
unds.height())); |
56 SkCanvas canvas(device); | 56 SkCanvas canvas(device); |
57 SkPaint paint; | 57 SkPaint paint; |
58 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 58 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
59 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain
t); | 59 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain
t); |
60 *dst = device->accessBitmap(false); | 60 *dst = device->accessBitmap(false); |
61 offset->fX += bounds.left(); | 61 offset->fX += bounds.left(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 246 } |
247 | 247 |
248 SkAutoTUnref<SkImage> fImage; | 248 SkAutoTUnref<SkImage> fImage; |
249 | 249 |
250 typedef GM INHERITED; | 250 typedef GM INHERITED; |
251 }; | 251 }; |
252 | 252 |
253 /////////////////////////////////////////////////////////////////////////////// | 253 /////////////////////////////////////////////////////////////////////////////// |
254 | 254 |
255 DEF_GM(return new ImageFiltersGraphGM;) | 255 DEF_GM(return new ImageFiltersGraphGM;) |
OLD | NEW |