Delete compose image filter header

Bug: skia:11230
Change-Id: Ifa677319a04379dc36ff155590ba85d45790567e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368596
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Michael Ludwig 2021-02-09 18:39:12 -05:00 committed by Skia Commit-Bot
parent b66214e0be
commit bf43df6478
6 changed files with 23 additions and 54 deletions

View File

@ -16,7 +16,6 @@ skia_effects_imagefilter_sources = [
"$_src/effects/imagefilters/SkBlurImageFilter.cpp",
"$_src/effects/imagefilters/SkColorFilterImageFilter.cpp",
"$_src/effects/imagefilters/SkComposeImageFilter.cpp",
"$_src/effects/imagefilters/SkComposeImageFilter.h",
"$_src/effects/imagefilters/SkDisplacementMapEffect.cpp",
"$_src/effects/imagefilters/SkDisplacementMapEffect.h",
"$_src/effects/imagefilters/SkDropShadowImageFilter.cpp",

View File

@ -488,5 +488,6 @@ void SkRegisterArithmeticImageFilterFlattenable();
void SkRegisterBlendImageFilterFlattenable();
void SkRegisterBlurImageFilterFlattenable();
void SkRegisterColorFilterImageFilterFlattenable();
void SkRegisterComposeImageFilterFlattenable();
#endif // SkImageFilter_Base_DEFINED

View File

@ -5,8 +5,7 @@
* found in the LICENSE file.
*/
#include "src/effects/imagefilters/SkComposeImageFilter.h"
#include "include/effects/SkImageFilters.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkReadBuffer.h"
#include "src/core/SkSpecialImage.h"
@ -14,9 +13,9 @@
namespace {
class SkComposeImageFilterImpl final : public SkImageFilter_Base {
class SkComposeImageFilter final : public SkImageFilter_Base {
public:
explicit SkComposeImageFilterImpl(sk_sp<SkImageFilter> inputs[2])
explicit SkComposeImageFilter(sk_sp<SkImageFilter> inputs[2])
: INHERITED(inputs, 2, nullptr) {
SkASSERT(inputs[0].get());
SkASSERT(inputs[1].get());
@ -31,16 +30,16 @@ protected:
bool onCanHandleComplexCTM() const override { return true; }
private:
friend void SkComposeImageFilter::RegisterFlattenables();
SK_FLATTENABLE_HOOKS(SkComposeImageFilterImpl)
friend void ::SkRegisterComposeImageFilterFlattenable();
SK_FLATTENABLE_HOOKS(SkComposeImageFilter)
using INHERITED = SkImageFilter_Base;
};
} // end namespace
sk_sp<SkImageFilter> SkComposeImageFilter::Make(sk_sp<SkImageFilter> outer,
sk_sp<SkImageFilter> inner) {
sk_sp<SkImageFilter> SkImageFilters::Compose(sk_sp<SkImageFilter> outer,
sk_sp<SkImageFilter> inner) {
if (!outer) {
return inner;
}
@ -48,31 +47,31 @@ sk_sp<SkImageFilter> SkComposeImageFilter::Make(sk_sp<SkImageFilter> outer,
return outer;
}
sk_sp<SkImageFilter> inputs[2] = { std::move(outer), std::move(inner) };
return sk_sp<SkImageFilter>(new SkComposeImageFilterImpl(inputs));
return sk_sp<SkImageFilter>(new SkComposeImageFilter(inputs));
}
void SkComposeImageFilter::RegisterFlattenables() {
SK_REGISTER_FLATTENABLE(SkComposeImageFilterImpl);
void SkRegisterComposeImageFilterFlattenable() {
SK_REGISTER_FLATTENABLE(SkComposeImageFilter);
// TODO (michaelludwig) - Remove after grace period for SKPs to stop using old name
SkFlattenable::Register("SkComposeImageFilter", SkComposeImageFilterImpl::CreateProc);
SkFlattenable::Register("SkComposeImageFilterImpl", SkComposeImageFilter::CreateProc);
}
sk_sp<SkFlattenable> SkComposeImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
return SkImageFilters::Compose(common.getInput(0), common.getInput(1));
}
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkFlattenable> SkComposeImageFilterImpl::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 2);
return SkComposeImageFilter::Make(common.getInput(0), common.getInput(1));
}
SkRect SkComposeImageFilterImpl::computeFastBounds(const SkRect& src) const {
SkRect SkComposeImageFilter::computeFastBounds(const SkRect& src) const {
const SkImageFilter* outer = this->getInput(0);
const SkImageFilter* inner = this->getInput(1);
return outer->computeFastBounds(inner->computeFastBounds(src));
}
sk_sp<SkSpecialImage> SkComposeImageFilterImpl::onFilterImage(const Context& ctx,
SkIPoint* offset) const {
sk_sp<SkSpecialImage> SkComposeImageFilter::onFilterImage(const Context& ctx,
SkIPoint* offset) const {
// The bounds passed to the inner filter must be filtered by the outer
// filter, so that the inner filter produces the pixels that the outer
// filter requires as input. This matters if the outer filter moves pixels.
@ -111,8 +110,8 @@ sk_sp<SkSpecialImage> SkComposeImageFilterImpl::onFilterImage(const Context& ctx
return outer;
}
SkIRect SkComposeImageFilterImpl::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
MapDirection dir, const SkIRect* inputRect) const {
SkIRect SkComposeImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
MapDirection dir, const SkIRect* inputRect) const {
const SkImageFilter* outer = this->getInput(0);
const SkImageFilter* inner = this->getInput(1);

View File

@ -1,24 +0,0 @@
/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkComposeImageFilter_DEFINED
#define SkComposeImageFilter_DEFINED
#include "include/core/SkImageFilter.h"
// DEPRECATED: Use include/effects/SkImageFilters::Compose
class SK_API SkComposeImageFilter {
public:
static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilter> outer, sk_sp<SkImageFilter> inner);
static void RegisterFlattenables();
private:
SkComposeImageFilter() = delete;
};
#endif

View File

@ -9,7 +9,6 @@
#include "include/core/SkPaint.h"
#include "src/effects/imagefilters/SkComposeImageFilter.h"
#include "src/effects/imagefilters/SkDisplacementMapEffect.h"
#include "src/effects/imagefilters/SkDropShadowImageFilter.h"
#include "src/effects/imagefilters/SkImageSource.h"
@ -28,7 +27,6 @@
#include "src/core/SkMatrixImageFilter.h"
void SkImageFilters::RegisterFlattenables() {
SkComposeImageFilter::RegisterFlattenables();
SkDilateImageFilter::RegisterFlattenables();
SkDisplacementMapEffect::RegisterFlattenables();
SkDropShadowImageFilter::RegisterFlattenables();
@ -45,11 +43,6 @@ void SkImageFilters::RegisterFlattenables() {
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkImageFilter> SkImageFilters::Compose(
sk_sp<SkImageFilter> outer, sk_sp<SkImageFilter> inner) {
return SkComposeImageFilter::Make(std::move(outer), std::move(inner));
}
sk_sp<SkImageFilter> SkImageFilters::DisplacementMap(
SkColorChannel xChannelSelector, SkColorChannel yChannelSelector, SkScalar scale,
sk_sp<SkImageFilter> displacement, sk_sp<SkImageFilter> color, const CropRect& cropRect) {

View File

@ -121,6 +121,7 @@
SkRegisterBlendImageFilterFlattenable();
SkRegisterBlurImageFilterFlattenable();
SkRegisterColorFilterImageFilterFlattenable();
SkRegisterComposeImageFilterFlattenable();
SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
}