OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkAlphaThresholdFilter.h" | 8 #include "SkAlphaThresholdFilter.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 sk_sp<GrFragmentProcessor> fp(GrAlphaThresholdFragmentProcessor::Make( | 180 sk_sp<GrFragmentProcessor> fp(GrAlphaThresholdFragmentProcessor::Make( |
181 inputTexture.
get(), | 181 inputTexture.
get(), |
182 maskTexture.g
et(), | 182 maskTexture.g
et(), |
183 fInnerThresho
ld, | 183 fInnerThresho
ld, |
184 fOuterThresho
ld, | 184 fOuterThresho
ld, |
185 bounds)); | 185 bounds)); |
186 if (!fp) { | 186 if (!fp) { |
187 return nullptr; | 187 return nullptr; |
188 } | 188 } |
189 | 189 |
190 return DrawWithFP(context, std::move(fp), bounds, source->internal_getPr
oxy()); | 190 return DrawWithFP(context, std::move(fp), bounds); |
191 } | 191 } |
192 #endif | 192 #endif |
193 | 193 |
194 SkBitmap inputBM; | 194 SkBitmap inputBM; |
195 | 195 |
196 if (!input->getROPixels(&inputBM)) { | 196 if (!input->getROPixels(&inputBM)) { |
197 return nullptr; | 197 return nullptr; |
198 } | 198 } |
199 | 199 |
200 if (inputBM.colorType() != kN32_SkColorType) { | 200 if (inputBM.colorType() != kN32_SkColorType) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 (U8CPU)(SkColorGetG(source) *
scale), | 255 (U8CPU)(SkColorGetG(source) *
scale), |
256 (U8CPU)(SkColorGetB(source) *
scale)); | 256 (U8CPU)(SkColorGetB(source) *
scale)); |
257 } | 257 } |
258 } | 258 } |
259 dptr[y * dstWidth + x] = outputColor; | 259 dptr[y * dstWidth + x] = outputColor; |
260 } | 260 } |
261 } | 261 } |
262 | 262 |
263 offset->fX = bounds.left(); | 263 offset->fX = bounds.left(); |
264 offset->fY = bounds.top(); | 264 offset->fY = bounds.top(); |
265 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 265 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), |
266 SkIRect::MakeWH(bounds.width(), bounds
.height()), | |
267 dst); | 266 dst); |
268 } | 267 } |
269 | 268 |
270 #ifndef SK_IGNORE_TO_STRING | 269 #ifndef SK_IGNORE_TO_STRING |
271 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { | 270 void SkAlphaThresholdFilterImpl::toString(SkString* str) const { |
272 str->appendf("SkAlphaThresholdImageFilter: ("); | 271 str->appendf("SkAlphaThresholdImageFilter: ("); |
273 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); | 272 str->appendf("inner: %f outer: %f", fInnerThreshold, fOuterThreshold); |
274 str->append(")"); | 273 str->append(")"); |
275 } | 274 } |
276 #endif | 275 #endif |
OLD | NEW |