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 SkImageInfo info = SkImageInfo::MakeN32(bounds.width(), bounds.height(), | 116 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), bou
nds.size())); |
117 kPremul_SkAlphaType); | |
118 | |
119 sk_sp<SkSpecialSurface> surf(source->makeSurface(info)); | |
120 if (!surf) { | 117 if (!surf) { |
121 return nullptr; | 118 return nullptr; |
122 } | 119 } |
123 | 120 |
124 SkCanvas* canvas = surf->getCanvas(); | 121 SkCanvas* canvas = surf->getCanvas(); |
125 SkASSERT(canvas); | 122 SkASSERT(canvas); |
126 | 123 |
127 canvas->clear(0x0); | 124 canvas->clear(0x0); |
128 | 125 |
129 // Composite all of the filter inputs. | 126 // Composite all of the filter inputs. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 for (int i = 0; i < this->countInputs(); ++i) { | 185 for (int i = 0; i < this->countInputs(); ++i) { |
189 SkImageFilter* filter = this->getInput(i); | 186 SkImageFilter* filter = this->getInput(i); |
190 str->appendf("%d: (", i); | 187 str->appendf("%d: (", i); |
191 filter->toString(str); | 188 filter->toString(str); |
192 str->appendf(")"); | 189 str->appendf(")"); |
193 } | 190 } |
194 | 191 |
195 str->append(")"); | 192 str->append(")"); |
196 } | 193 } |
197 #endif | 194 #endif |
OLD | NEW |