OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkPaintImageFilter.h" | 8 #include "SkPaintImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 this->INHERITED::flatten(buffer); | 32 this->INHERITED::flatten(buffer); |
33 buffer.writePaint(fPaint); | 33 buffer.writePaint(fPaint); |
34 } | 34 } |
35 | 35 |
36 bool SkPaintImageFilter::onFilterImage(Proxy* proxy, | 36 bool SkPaintImageFilter::onFilterImage(Proxy* proxy, |
37 const SkBitmap& source, | 37 const SkBitmap& source, |
38 const Context& ctx, | 38 const Context& ctx, |
39 SkBitmap* result, | 39 SkBitmap* result, |
40 SkIPoint* offset) const { | 40 SkIPoint* offset) const { |
41 SkIRect bounds; | 41 SkIRect bounds; |
42 if (!this->applyCropRect(ctx, source, SkIPoint::Make(0, 0), &bounds)) { | 42 if (!this->applyCropRect(ctx, source.bounds(), &bounds)) { |
43 return false; | 43 return false; |
44 } | 44 } |
45 | 45 |
46 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), | 46 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), |
47 bounds.height())); | 47 bounds.height())); |
48 if (nullptr == device.get()) { | 48 if (nullptr == device.get()) { |
49 return false; | 49 return false; |
50 } | 50 } |
51 SkCanvas canvas(device.get()); | 51 SkCanvas canvas(device.get()); |
52 | 52 |
(...skipping 19 matching lines...) Expand all Loading... |
72 // so we can't compute it. If a full crop rect is set, we should return true
here. | 72 // so we can't compute it. If a full crop rect is set, we should return true
here. |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 #ifndef SK_IGNORE_TO_STRING | 76 #ifndef SK_IGNORE_TO_STRING |
77 void SkPaintImageFilter::toString(SkString* str) const { | 77 void SkPaintImageFilter::toString(SkString* str) const { |
78 str->appendf("SkPaintImageFilter: ("); | 78 str->appendf("SkPaintImageFilter: ("); |
79 str->append(")"); | 79 str->append(")"); |
80 } | 80 } |
81 #endif | 81 #endif |
OLD | NEW |