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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), | 316 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), |
317 bounds.right(), interior.bottom()); | 317 bounds.right(), interior.bottom()); |
318 filterBorderPixels(src, result, top, bounds); | 318 filterBorderPixels(src, result, top, bounds); |
319 filterBorderPixels(src, result, left, bounds); | 319 filterBorderPixels(src, result, left, bounds); |
320 filterInteriorPixels(src, result, interior, bounds); | 320 filterInteriorPixels(src, result, interior, bounds); |
321 filterBorderPixels(src, result, right, bounds); | 321 filterBorderPixels(src, result, right, bounds); |
322 filterBorderPixels(src, result, bottom, bounds); | 322 filterBorderPixels(src, result, bottom, bounds); |
323 return true; | 323 return true; |
324 } | 324 } |
325 | 325 |
326 void SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, cons
t SkMatrix& ctm, | 326 SkIRect SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, c
onst SkMatrix& ctm, |
327 SkIRect* dst, MapDirection d
irection) const { | 327 MapDirection directio
n) const { |
328 *dst = src; | 328 SkIRect dst = src; |
329 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1; | 329 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1; |
330 dst->fRight += w; | 330 dst.fRight += w; |
331 dst->fBottom += h; | 331 dst.fBottom += h; |
332 if (kReverse_MapDirection == direction) { | 332 if (kReverse_MapDirection == direction) { |
333 dst->offset(-fKernelOffset); | 333 dst.offset(-fKernelOffset); |
334 } else { | 334 } else { |
335 dst->offset(fKernelOffset - SkIPoint::Make(w, h)); | 335 dst.offset(fKernelOffset - SkIPoint::Make(w, h)); |
336 } | 336 } |
| 337 return dst; |
337 } | 338 } |
338 | 339 |
339 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const { | 340 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const { |
340 // Because the kernel is applied in device-space, we have no idea what | 341 // Because the kernel is applied in device-space, we have no idea what |
341 // pixels it will affect in object-space. | 342 // pixels it will affect in object-space. |
342 return false; | 343 return false; |
343 } | 344 } |
344 | 345 |
345 #if SK_SUPPORT_GPU | 346 #if SK_SUPPORT_GPU |
346 | 347 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
390 } | 391 } |
391 } | 392 } |
392 str->appendf(")"); | 393 str->appendf(")"); |
393 str->appendf("gain: %f bias: %f ", fGain, fBias); | 394 str->appendf("gain: %f bias: %f ", fGain, fBias); |
394 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
395 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
396 str->append(")"); | 397 str->append(")"); |
397 } | 398 } |
398 #endif | 399 #endif |
OLD | NEW |