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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, | 37 sk_sp<SkSpecialImage> SkPaintImageFilter::onFilterImage(SkSpecialImage* source, |
38 const Context& ctx, | 38 const Context& ctx, |
39 SkIPoint* offset) const
{ | 39 SkIPoint* offset) const
{ |
40 SkIRect bounds; | 40 SkIRect bounds; |
41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height())
; | 41 const SkIRect srcBounds = SkIRect::MakeWH(source->width(), source->height())
; |
42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { | 42 if (!this->applyCropRect(ctx, srcBounds, &bounds)) { |
43 return nullptr; | 43 return nullptr; |
44 } | 44 } |
45 | 45 |
46 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); | 46 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
| 47 kPremul_SkAlphaType); |
| 48 |
| 49 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); |
47 if (!surf) { | 50 if (!surf) { |
48 return nullptr; | 51 return nullptr; |
49 } | 52 } |
50 | 53 |
51 SkCanvas* canvas = surf->getCanvas(); | 54 SkCanvas* canvas = surf->getCanvas(); |
52 SkASSERT(canvas); | 55 SkASSERT(canvas); |
53 | 56 |
54 canvas->clear(0x0); | 57 canvas->clear(0x0); |
55 | 58 |
56 SkMatrix matrix(ctx.ctm()); | 59 SkMatrix matrix(ctx.ctm()); |
(...skipping 15 matching lines...) Expand all Loading... |
72 return true; | 75 return true; |
73 } | 76 } |
74 | 77 |
75 #ifndef SK_IGNORE_TO_STRING | 78 #ifndef SK_IGNORE_TO_STRING |
76 void SkPaintImageFilter::toString(SkString* str) const { | 79 void SkPaintImageFilter::toString(SkString* str) const { |
77 str->appendf("SkPaintImageFilter: ("); | 80 str->appendf("SkPaintImageFilter: ("); |
78 fPaint.toString(str); | 81 fPaint.toString(str); |
79 str->append(")"); | 82 str->append(")"); |
80 } | 83 } |
81 #endif | 84 #endif |
OLD | NEW |