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 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDevice.h" | 10 #include "SkDevice.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (nullptr == dst) { | 74 if (nullptr == dst) { |
75 return false; | 75 return false; |
76 } | 76 } |
77 SkCanvas canvas(dst); | 77 SkCanvas canvas(dst); |
78 SkPaint paint; | 78 SkPaint paint; |
79 | 79 |
80 bool didProduceResult = false; | 80 bool didProduceResult = false; |
81 int inputCount = countInputs(); | 81 int inputCount = countInputs(); |
82 for (int i = 0; i < inputCount; ++i) { | 82 for (int i = 0; i < inputCount; ++i) { |
83 SkBitmap tmp; | 83 SkBitmap tmp; |
84 const SkBitmap* srcPtr; | 84 SkBitmap input = src; |
85 SkIPoint pos = SkIPoint::Make(0, 0); | 85 SkIPoint pos = SkIPoint::Make(0, 0); |
86 SkImageFilter* filter = getInput(i); | 86 if (!this->filterInput(i, proxy, src, ctx, &input, &pos)) { |
87 if (filter) { | 87 continue; |
88 if (!filter->filterImage(proxy, src, ctx, &tmp, &pos)) { | |
89 continue; | |
90 } | |
91 srcPtr = &tmp; | |
92 } else { | |
93 srcPtr = &src; | |
94 } | 88 } |
95 | |
96 if (fModes) { | 89 if (fModes) { |
97 paint.setXfermodeMode((SkXfermode::Mode)fModes[i]); | 90 paint.setXfermodeMode((SkXfermode::Mode)fModes[i]); |
98 } else { | 91 } else { |
99 paint.setXfermode(nullptr); | 92 paint.setXfermode(nullptr); |
100 } | 93 } |
101 canvas.drawSprite(*srcPtr, pos.x() - x0, pos.y() - y0, &paint); | 94 canvas.drawSprite(input, pos.x() - x0, pos.y() - y0, &paint); |
102 didProduceResult = true; | 95 didProduceResult = true; |
103 } | 96 } |
104 | 97 |
105 if (!didProduceResult) | 98 if (!didProduceResult) |
106 return false; | 99 return false; |
107 | 100 |
108 offset->fX = bounds.left(); | 101 offset->fX = bounds.left(); |
109 offset->fY = bounds.top(); | 102 offset->fY = bounds.top(); |
110 *result = dst->accessBitmap(false); | 103 *result = dst->accessBitmap(false); |
111 return true; | 104 return true; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 for (int i = 0; i < this->countInputs(); ++i) { | 145 for (int i = 0; i < this->countInputs(); ++i) { |
153 SkImageFilter* filter = this->getInput(i); | 146 SkImageFilter* filter = this->getInput(i); |
154 str->appendf("%d: (", i); | 147 str->appendf("%d: (", i); |
155 filter->toString(str); | 148 filter->toString(str); |
156 str->appendf(")"); | 149 str->appendf(")"); |
157 } | 150 } |
158 | 151 |
159 str->append(")"); | 152 str->append(")"); |
160 } | 153 } |
161 #endif | 154 #endif |
OLD | NEW |