Chromium Code Reviews| Index: src/effects/SkMorphologyImageFilter.cpp |
| diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp |
| index df015cac7356fb2cf4d9b1c67612cf9c155fb7aa..1ab35483dd4e5d18fa137a88a50e44923f4d92c5 100644 |
| --- a/src/effects/SkMorphologyImageFilter.cpp |
| +++ b/src/effects/SkMorphologyImageFilter.cpp |
| @@ -10,6 +10,7 @@ |
| #include "SkColorPriv.h" |
| #include "SkFlattenableBuffers.h" |
| #include "SkRect.h" |
| +#include "SkMorphology_opts.h" |
| #if SK_SUPPORT_GPU |
| #include "GrContext.h" |
| #include "GrTexture.h" |
| @@ -74,16 +75,33 @@ static void erode(const SkPMColor* src, SkPMColor* dst, |
| static void erodeX(const SkBitmap& src, SkBitmap* dst, int radiusX, const SkIRect& bounds) |
| { |
| - erode(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| - radiusX, bounds.width(), bounds.height(), |
| - 1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels()); |
| + if (SkMorphologyProc erodeXProc = SkErodeXGetPlatformProc()) { |
|
reed1
2013/10/30 15:15:04
can we change either the platformproc or your erod
Stephen White
2013/10/30 19:47:17
Done.
|
| + (*erodeXProc)(src.getAddr32(bounds.left(), bounds.top()), |
| + dst->getAddr32(0, 0), radiusX, |
| + bounds.width(), bounds.height(), |
| + src.rowBytesAsPixels(), |
| + dst->rowBytesAsPixels()); |
| + } else { |
| + erode(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| + radiusX, bounds.width(), bounds.height(), |
| + 1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels()); |
| + } |
| } |
| static void erodeY(const SkBitmap& src, SkBitmap* dst, int radiusY, const SkIRect& bounds) |
| { |
| - erode(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| - radiusY, bounds.height(), bounds.width(), |
| - src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1); |
| + if (SkMorphologyProc erodeYProc = SkErodeYGetPlatformProc()) { |
| + (*erodeYProc)(src.getAddr32(bounds.left(), bounds.top()), |
| + dst->getAddr32(0, 0), |
| + radiusY, |
| + bounds.width(), bounds.height(), |
| + src.rowBytesAsPixels(), |
| + dst->rowBytesAsPixels()); |
| + } else { |
| + erode(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| + radiusY, bounds.height(), bounds.width(), |
| + src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1); |
| + } |
| } |
| static void dilate(const SkPMColor* src, SkPMColor* dst, |
| @@ -122,16 +140,33 @@ static void dilate(const SkPMColor* src, SkPMColor* dst, |
| static void dilateX(const SkBitmap& src, SkBitmap* dst, int radiusX, const SkIRect& bounds) |
| { |
| - dilate(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| - radiusX, bounds.width(), bounds.height(), |
| - 1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels()); |
| + if (SkMorphologyProc erodeYProc = SkDilateXGetPlatformProc()) { |
| + (*erodeYProc)(src.getAddr32(bounds.left(), bounds.top()), |
| + dst->getAddr32(0, 0), radiusX, |
| + bounds.width(), bounds.height(), |
| + src.rowBytesAsPixels(), |
| + dst->rowBytesAsPixels()); |
| + } else { |
| + dilate(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| + radiusX, bounds.width(), bounds.height(), |
| + 1, src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels()); |
| + } |
| } |
| static void dilateY(const SkBitmap& src, SkBitmap* dst, int radiusY, const SkIRect& bounds) |
| { |
| - dilate(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| - radiusY, bounds.height(), bounds.width(), |
| - src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1); |
| + if (SkMorphologyProc dilateYProc = SkDilateYGetPlatformProc()) { |
| + (*dilateYProc)(src.getAddr32(bounds.left(), bounds.top()), |
| + dst->getAddr32(0, 0), |
| + radiusY, |
| + bounds.width(), bounds.height(), |
| + src.rowBytesAsPixels(), |
| + dst->rowBytesAsPixels()); |
| + } else { |
| + dilate(src.getAddr32(bounds.left(), bounds.top()), dst->getAddr32(0, 0), |
| + radiusY, bounds.height(), bounds.width(), |
| + src.rowBytesAsPixels(), 1, dst->rowBytesAsPixels(), 1); |
| + } |
| } |
| bool SkErodeImageFilter::onFilterImage(Proxy* proxy, |