OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 "SkMergeImageFilter.h" | 8 #include "SkMergeImageFilter.h" |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // filter does not affect transparent black. | 106 // filter does not affect transparent black. |
107 bool embiggen = false; | 107 bool embiggen = false; |
108 this->getCropRect().applyTo(bounds, ctx.ctm(), embiggen, &bounds); | 108 this->getCropRect().applyTo(bounds, ctx.ctm(), embiggen, &bounds); |
109 if (!bounds.intersect(ctx.clipBounds())) { | 109 if (!bounds.intersect(ctx.clipBounds())) { |
110 return nullptr; | 110 return nullptr; |
111 } | 111 } |
112 | 112 |
113 const int x0 = bounds.left(); | 113 const int x0 = bounds.left(); |
114 const int y0 = bounds.top(); | 114 const int y0 = bounds.top(); |
115 | 115 |
116 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); | 116 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), |
| 117 kPremul_SkAlphaType); |
| 118 |
| 119 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); |
117 if (!surf) { | 120 if (!surf) { |
118 return nullptr; | 121 return nullptr; |
119 } | 122 } |
120 | 123 |
121 SkCanvas* canvas = surf->getCanvas(); | 124 SkCanvas* canvas = surf->getCanvas(); |
122 SkASSERT(canvas); | 125 SkASSERT(canvas); |
123 | 126 |
124 canvas->clear(0x0); | 127 canvas->clear(0x0); |
125 | 128 |
126 // Composite all of the filter inputs. | 129 // Composite all of the filter inputs. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 for (int i = 0; i < this->countInputs(); ++i) { | 188 for (int i = 0; i < this->countInputs(); ++i) { |
186 SkImageFilter* filter = this->getInput(i); | 189 SkImageFilter* filter = this->getInput(i); |
187 str->appendf("%d: (", i); | 190 str->appendf("%d: (", i); |
188 filter->toString(str); | 191 filter->toString(str); |
189 str->appendf(")"); | 192 str->appendf(")"); |
190 } | 193 } |
191 | 194 |
192 str->append(")"); | 195 str->append(")"); |
193 } | 196 } |
194 #endif | 197 #endif |
OLD | NEW |