| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 SkBitmap result = device->accessBitmap(false); | 255 SkBitmap result = device->accessBitmap(false); |
| 256 SkAutoLockPixels alp_result(result); | 256 SkAutoLockPixels alp_result(result); |
| 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 skstd::move(result); |
| 265 } | 265 } |
| 266 | 266 |
| 267 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, | 267 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, |
| 268 const SkBitmap& source, | 268 const SkBitmap& source, |
| 269 const Context& ctx, | 269 const Context& ctx, |
| 270 SkBitmap* result, | 270 SkBitmap* result, |
| 271 SkIPoint* offset) const { | 271 SkIPoint* offset) const { |
| 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->filterInput(0, proxy, source, ctx, &src, &srcOffset)) { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
| 389 } | 389 } |
| 390 } | 390 } |
| 391 str->appendf(")"); | 391 str->appendf(")"); |
| 392 str->appendf("gain: %f bias: %f ", fGain, fBias); | 392 str->appendf("gain: %f bias: %f ", fGain, fBias); |
| 393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
| 394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
| 395 str->append(")"); | 395 str->append(")"); |
| 396 } | 396 } |
| 397 #endif | 397 #endif |
| OLD | NEW |