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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 fKernel, | 322 fKernel, |
323 fGain, | 323 fGain, |
324 fBias, | 324 fBias, |
325 fKernelOff
set, | 325 fKernelOff
set, |
326 convert_ti
lemodes(fTileMode), | 326 convert_ti
lemodes(fTileMode), |
327 fConvolveA
lpha)); | 327 fConvolveA
lpha)); |
328 if (!fp) { | 328 if (!fp) { |
329 return nullptr; | 329 return nullptr; |
330 } | 330 } |
331 | 331 |
332 return DrawWithFP(context, std::move(fp), bounds, source->internal_getPr
oxy()); | 332 return DrawWithFP(context, std::move(fp), bounds); |
333 } | 333 } |
334 #endif | 334 #endif |
335 | 335 |
336 SkBitmap inputBM; | 336 SkBitmap inputBM; |
337 | 337 |
338 if (!input->getROPixels(&inputBM)) { | 338 if (!input->getROPixels(&inputBM)) { |
339 return nullptr; | 339 return nullptr; |
340 } | 340 } |
341 | 341 |
342 if (inputBM.colorType() != kN32_SkColorType) { | 342 if (inputBM.colorType() != kN32_SkColorType) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 bounds.right(), bounds.bottom()); | 374 bounds.right(), bounds.bottom()); |
375 SkIRect left = SkIRect::MakeLTRB(bounds.left(), interior.top(), | 375 SkIRect left = SkIRect::MakeLTRB(bounds.left(), interior.top(), |
376 interior.left(), interior.bottom()); | 376 interior.left(), interior.bottom()); |
377 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), | 377 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), |
378 bounds.right(), interior.bottom()); | 378 bounds.right(), interior.bottom()); |
379 this->filterBorderPixels(inputBM, &dst, top, bounds); | 379 this->filterBorderPixels(inputBM, &dst, top, bounds); |
380 this->filterBorderPixels(inputBM, &dst, left, bounds); | 380 this->filterBorderPixels(inputBM, &dst, left, bounds); |
381 this->filterInteriorPixels(inputBM, &dst, interior, bounds); | 381 this->filterInteriorPixels(inputBM, &dst, interior, bounds); |
382 this->filterBorderPixels(inputBM, &dst, right, bounds); | 382 this->filterBorderPixels(inputBM, &dst, right, bounds); |
383 this->filterBorderPixels(inputBM, &dst, bottom, bounds); | 383 this->filterBorderPixels(inputBM, &dst, bottom, bounds); |
384 return SkSpecialImage::MakeFromRaster(source->internal_getProxy(), | 384 return SkSpecialImage::MakeFromRaster(SkIRect::MakeWH(bounds.width(), bounds
.height()), |
385 SkIRect::MakeWH(bounds.width(), bounds
.height()), | |
386 dst); | 385 dst); |
387 } | 386 } |
388 | 387 |
389 SkIRect SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, c
onst SkMatrix& ctm, | 388 SkIRect SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, c
onst SkMatrix& ctm, |
390 MapDirection directio
n) const { | 389 MapDirection directio
n) const { |
391 SkIRect dst = src; | 390 SkIRect dst = src; |
392 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1; | 391 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1; |
393 dst.fRight += w; | 392 dst.fRight += w; |
394 dst.fBottom += h; | 393 dst.fBottom += h; |
395 if (kReverse_MapDirection == direction) { | 394 if (kReverse_MapDirection == direction) { |
(...skipping 19 matching lines...) Expand all Loading... |
415 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 414 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
416 } | 415 } |
417 } | 416 } |
418 str->appendf(")"); | 417 str->appendf(")"); |
419 str->appendf("gain: %f bias: %f ", fGain, fBias); | 418 str->appendf("gain: %f bias: %f ", fGain, fBias); |
420 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 419 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
421 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 420 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
422 str->append(")"); | 421 str->append(")"); |
423 } | 422 } |
424 #endif | 423 #endif |
OLD | NEW |