From 1f57a0f1ae0b30dd8b19963daf2136d6f150d388 Mon Sep 17 00:00:00 2001 From: Michael Ludwig Date: Thu, 18 Feb 2021 14:04:55 -0500 Subject: [PATCH] Remove unnecessary SkImageFilters.cpp After having moved all other filter factory definitions into their per-filter implementation files, all that remained was the MatrixTransform factory, which is just moved into the SkMatrixImageFilter CPP file. Bug: skia:11230 Change-Id: Ifd7f3eb58ef1d05ed6d0aef0517ca9caa01436d8 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372121 Reviewed-by: Robert Phillips Commit-Queue: Michael Ludwig --- gn/effects_imagefilters.gni | 1 - src/core/SkMatrixImageFilter.cpp | 17 ++++++++++++ src/core/SkMatrixImageFilter.h | 3 +++ src/effects/imagefilters/SkImageFilters.cpp | 30 --------------------- 4 files changed, 20 insertions(+), 31 deletions(-) delete mode 100644 src/effects/imagefilters/SkImageFilters.cpp diff --git a/gn/effects_imagefilters.gni b/gn/effects_imagefilters.gni index c58ba16980..178bd49a79 100644 --- a/gn/effects_imagefilters.gni +++ b/gn/effects_imagefilters.gni @@ -18,7 +18,6 @@ skia_effects_imagefilter_sources = [ "$_src/effects/imagefilters/SkComposeImageFilter.cpp", "$_src/effects/imagefilters/SkDisplacementMapImageFilter.cpp", "$_src/effects/imagefilters/SkDropShadowImageFilter.cpp", - "$_src/effects/imagefilters/SkImageFilters.cpp", "$_src/effects/imagefilters/SkImageImageFilter.cpp", "$_src/effects/imagefilters/SkLightingImageFilter.cpp", "$_src/effects/imagefilters/SkMagnifierImageFilter.cpp", diff --git a/src/core/SkMatrixImageFilter.cpp b/src/core/SkMatrixImageFilter.cpp index 1f80a6c9c8..0b27a27517 100644 --- a/src/core/SkMatrixImageFilter.cpp +++ b/src/core/SkMatrixImageFilter.cpp @@ -9,6 +9,7 @@ #include "include/core/SkCanvas.h" #include "include/core/SkRect.h" +#include "include/effects/SkImageFilters.h" #include "src/core/SkReadBuffer.h" #include "src/core/SkSamplingPriv.h" #include "src/core/SkSpecialImage.h" @@ -31,6 +32,20 @@ sk_sp SkMatrixImageFilter::Make(const SkMatrix& transform, std::move(input))); } +sk_sp SkImageFilters::MatrixTransform( + const SkMatrix& transform, const SkSamplingOptions& sampling, sk_sp input) { + return SkMatrixImageFilter::Make(transform, sampling, std::move(input)); +} + +#ifdef SK_SUPPORT_LEGACY_MATRIX_IMAGEFILTER +sk_sp SkImageFilters::MatrixTransform( + const SkMatrix& transform, SkFilterQuality filterQuality, sk_sp input) { + auto sampling = SkSamplingOptions(filterQuality, + SkSamplingOptions::kMedium_asMipmapLinear); + return SkMatrixImageFilter::Make(transform, sampling, std::move(input)); +} +#endif + sk_sp SkMatrixImageFilter::CreateProc(SkReadBuffer& buffer) { SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); SkMatrix matrix; @@ -53,6 +68,8 @@ void SkMatrixImageFilter::flatten(SkWriteBuffer& buffer) const { SkSamplingPriv::Write(buffer, fSampling); } +/////////////////////////////////////////////////////////////////////////////////////////////////// + sk_sp SkMatrixImageFilter::onFilterImage(const Context& ctx, SkIPoint* offset) const { diff --git a/src/core/SkMatrixImageFilter.h b/src/core/SkMatrixImageFilter.h index 72e95800e3..b6378097bc 100644 --- a/src/core/SkMatrixImageFilter.h +++ b/src/core/SkMatrixImageFilter.h @@ -17,6 +17,9 @@ input transformed by the given matrix. */ +// TODO(michaelludwig): Once SkCanvas no longer relies on this for handling complex CTMs with +// filters, this class declaration can be hidden in its cpp file, header deleted, and cpp moved +// into src/effects/imagefilters along with all the other image filters. class SkMatrixImageFilter : public SkImageFilter_Base { public: /** Construct a 2D transformation image filter. diff --git a/src/effects/imagefilters/SkImageFilters.cpp b/src/effects/imagefilters/SkImageFilters.cpp deleted file mode 100644 index 71adc3d879..0000000000 --- a/src/effects/imagefilters/SkImageFilters.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/effects/SkImageFilters.h" - -#include "include/core/SkPaint.h" - -// TODO (michaelludwig) - Once SkCanvas can draw the results of a filter with any transform, this -// filter can be moved out of core -#include "src/core/SkMatrixImageFilter.h" - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -sk_sp SkImageFilters::MatrixTransform( - const SkMatrix& transform, const SkSamplingOptions& sampling, sk_sp input) { - return SkMatrixImageFilter::Make(transform, sampling, std::move(input)); -} - -#ifdef SK_SUPPORT_LEGACY_MATRIX_IMAGEFILTER -sk_sp SkImageFilters::MatrixTransform( - const SkMatrix& transform, SkFilterQuality filterQuality, sk_sp input) { - auto sampling = SkSamplingOptions(filterQuality, - SkSamplingOptions::kMedium_asMipmapLinear); - return SkMatrixImageFilter::Make(transform, sampling, std::move(input)); -} -#endif