diff options
-rw-r--r-- | gm/localmatriximagefilter.cpp | 3 | ||||
-rw-r--r-- | include/core/SkImageFilter.h | 13 | ||||
-rw-r--r-- | src/core/SkImageFilter.cpp | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/gm/localmatriximagefilter.cpp b/gm/localmatriximagefilter.cpp index 1bdc940d92..64ed6d7b8c 100644 --- a/gm/localmatriximagefilter.cpp +++ b/gm/localmatriximagefilter.cpp @@ -86,8 +86,7 @@ protected: canvas->save(); show_image(canvas, image0, filter); for (const auto& matrix : matrices) { - SkAutoTUnref<SkImageFilter> localFilter( - SkImageFilter::CreateLocalMatrixFilter(matrix, filter)); + SkAutoTUnref<SkImageFilter> localFilter(filter->newWithLocalMatrix(matrix)); canvas->translate(spacer, 0); show_image(canvas, image0, localFilter); } diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h index 0a3f7b8492..3a7cb23d5e 100644 --- a/include/core/SkImageFilter.h +++ b/include/core/SkImageFilter.h @@ -230,19 +230,18 @@ public: bool canComputeFastBounds() const; /** + * If this filter can be represented by another filter + a localMatrix, return that filter, + * else return null. + */ + SkImageFilter* newWithLocalMatrix(const SkMatrix& matrix) const; + + /** * Create an SkMatrixImageFilter, which transforms its input by the given matrix. */ static SkImageFilter* CreateMatrixFilter(const SkMatrix& matrix, SkFilterQuality, SkImageFilter* input = NULL); - /** - * Create an SkLocalMatrixImageFilter, which transform the filter parameters - * of its inputs by the given matrix. - */ - static SkImageFilter* CreateLocalMatrixFilter(const SkMatrix& matrix, - SkImageFilter* input); - #if SK_SUPPORT_GPU /** * Wrap the given texture in a texture-backed SkBitmap. diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 43adc2fad5..3f6ea9a12b 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -440,9 +440,11 @@ SkImageFilter* SkImageFilter::CreateMatrixFilter(const SkMatrix& matrix, return SkMatrixImageFilter::Create(matrix, filterQuality, input); } -SkImageFilter* SkImageFilter::CreateLocalMatrixFilter(const SkMatrix& matrix, - SkImageFilter* input) { - return SkLocalMatrixImageFilter::Create(matrix, input); +SkImageFilter* SkImageFilter::newWithLocalMatrix(const SkMatrix& matrix) const { + // SkLocalMatrixImageFilter takes SkImage* in its factory, but logically that parameter + // is *always* treated as a const ptr. Hence the const-cast here. + // + return SkLocalMatrixImageFilter::Create(matrix, const_cast<SkImageFilter*>(this)); } #if SK_SUPPORT_GPU |