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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 for (int y = 0; y < src.height(); ++y) { | 257 for (int y = 0; y < src.height(); ++y) { |
258 const uint32_t* srcRow = src.getAddr32(0, y); | 258 const uint32_t* srcRow = src.getAddr32(0, y); |
259 uint32_t* dstRow = result.getAddr32(0, y); | 259 uint32_t* dstRow = result.getAddr32(0, y); |
260 for (int x = 0; x < src.width(); ++x) { | 260 for (int x = 0; x < src.width(); ++x) { |
261 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]); | 261 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]); |
262 } | 262 } |
263 } | 263 } |
264 return result; | 264 return result; |
265 } | 265 } |
266 | 266 |
267 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, | 267 bool SkMatrixConvolutionImageFilter::onFilterImageDeprecated(Proxy* proxy, |
268 const SkBitmap& source, | 268 const SkBitmap& sou
rce, |
269 const Context& ctx, | 269 const Context& ctx, |
270 SkBitmap* result, | 270 SkBitmap* result, |
271 SkIPoint* offset) const { | 271 SkIPoint* offset) c
onst { |
272 SkBitmap src = source; | 272 SkBitmap src = source; |
273 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 273 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
274 if (!this->filterInput(0, proxy, source, ctx, &src, &srcOffset)) { | 274 if (!this->filterInputDeprecated(0, proxy, source, ctx, &src, &srcOffset)) { |
275 return false; | 275 return false; |
276 } | 276 } |
277 | 277 |
278 if (src.colorType() != kN32_SkColorType) { | 278 if (src.colorType() != kN32_SkColorType) { |
279 return false; | 279 return false; |
280 } | 280 } |
281 | 281 |
282 SkIRect bounds; | 282 SkIRect bounds; |
283 if (!this->applyCropRect(this->mapContext(ctx), proxy, src, &srcOffset, &bou
nds, &src)) { | 283 if (!this->applyCropRectDeprecated(this->mapContext(ctx), proxy, src, &srcOf
fset, |
| 284 &bounds, &src)) { |
284 return false; | 285 return false; |
285 } | 286 } |
286 | 287 |
287 if (!fConvolveAlpha && !src.isOpaque()) { | 288 if (!fConvolveAlpha && !src.isOpaque()) { |
288 src = unpremultiplyBitmap(proxy, src); | 289 src = unpremultiplyBitmap(proxy, src); |
289 } | 290 } |
290 | 291 |
291 SkAutoLockPixels alp(src); | 292 SkAutoLockPixels alp(src); |
292 if (!src.getPixels()) { | 293 if (!src.getPixels()) { |
293 return false; | 294 return false; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 389 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
389 } | 390 } |
390 } | 391 } |
391 str->appendf(")"); | 392 str->appendf(")"); |
392 str->appendf("gain: %f bias: %f ", fGain, fBias); | 393 str->appendf("gain: %f bias: %f ", fGain, fBias); |
393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 394 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 395 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
395 str->append(")"); | 396 str->append(")"); |
396 } | 397 } |
397 #endif | 398 #endif |
OLD | NEW |