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 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 46 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); |
47 kPremul_SkAlphaType); | |
48 | |
49 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); | |
50 if (!surf) { | 47 if (!surf) { |
51 return nullptr; | 48 return nullptr; |
52 } | 49 } |
53 | 50 |
54 SkCanvas* canvas = surf->getCanvas(); | 51 SkCanvas* canvas = surf->getCanvas(); |
55 SkASSERT(canvas); | 52 SkASSERT(canvas); |
56 | 53 |
57 canvas->clear(0x0); | 54 canvas->clear(0x0); |
58 | 55 |
59 SkMatrix matrix(ctx.ctm()); | 56 SkMatrix matrix(ctx.ctm()); |
(...skipping 15 matching lines...) Expand all Loading... |
75 return true; | 72 return true; |
76 } | 73 } |
77 | 74 |
78 #ifndef SK_IGNORE_TO_STRING | 75 #ifndef SK_IGNORE_TO_STRING |
79 void SkPaintImageFilter::toString(SkString* str) const { | 76 void SkPaintImageFilter::toString(SkString* str) const { |
80 str->appendf("SkPaintImageFilter: ("); | 77 str->appendf("SkPaintImageFilter: ("); |
81 fPaint.toString(str); | 78 fPaint.toString(str); |
82 str->append(")"); | 79 str->append(")"); |
83 } | 80 } |
84 #endif | 81 #endif |
OLD | NEW |