Remove deprecated magnifier filter header

Bug: skia:11230
Change-Id: I54f3ca4b0a8e492c18986f760f2a2b077a05e68a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371960
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Michael Ludwig 2021-02-18 13:46:34 -05:00 committed by Skia Commit-Bot
parent 6a60b8046d
commit b7218c1e04
6 changed files with 24 additions and 60 deletions

View File

@ -22,7 +22,6 @@ skia_effects_imagefilter_sources = [
"$_src/effects/imagefilters/SkImageImageFilter.cpp",
"$_src/effects/imagefilters/SkLightingImageFilter.cpp",
"$_src/effects/imagefilters/SkMagnifierImageFilter.cpp",
"$_src/effects/imagefilters/SkMagnifierImageFilter.h",
"$_src/effects/imagefilters/SkMatrixConvolutionImageFilter.cpp",
"$_src/effects/imagefilters/SkMatrixConvolutionImageFilter.h",
"$_src/effects/imagefilters/SkMergeImageFilter.cpp",

View File

@ -493,5 +493,6 @@ void SkRegisterDisplacementMapImageFilterFlattenable();
void SkRegisterDropShadowImageFilterFlattenable();
void SkRegisterImageImageFilterFlattenable();
void SkRegisterLightingImageFilterFlattenables();
void SkRegisterMagnifierImageFilterFlattenable();
#endif // SkImageFilter_Base_DEFINED

View File

@ -9,7 +9,6 @@
#include "include/core/SkPaint.h"
#include "src/effects/imagefilters/SkMagnifierImageFilter.h"
#include "src/effects/imagefilters/SkMatrixConvolutionImageFilter.h"
#include "src/effects/imagefilters/SkMergeImageFilter.h"
#include "src/effects/imagefilters/SkMorphologyImageFilter.h"
@ -24,7 +23,6 @@
void SkImageFilters::RegisterFlattenables() {
SkDilateImageFilter::RegisterFlattenables();
SkMagnifierImageFilter::RegisterFlattenables();
SkMatrixConvolutionImageFilter::RegisterFlattenables();
SkMergeImageFilter::RegisterFlattenables();
SkOffsetImageFilter::RegisterFlattenables();
@ -35,12 +33,6 @@ void SkImageFilters::RegisterFlattenables() {
///////////////////////////////////////////////////////////////////////////////////////////////////
sk_sp<SkImageFilter> SkImageFilters::Magnifier(
const SkRect& srcRect, SkScalar inset, sk_sp<SkImageFilter> input,
const CropRect& cropRect) {
return SkMagnifierImageFilter::Make(srcRect, inset, std::move(input), cropRect);
}
sk_sp<SkImageFilter> SkImageFilters::MatrixConvolution(
const SkISize& kernelSize, const SkScalar kernel[], SkScalar gain, SkScalar bias,
const SkIPoint& kernelOffset, SkTileMode tileMode, bool convolveAlpha,

View File

@ -5,9 +5,8 @@
* found in the LICENSE file.
*/
#include "src/effects/imagefilters/SkMagnifierImageFilter.h"
#include "include/core/SkBitmap.h"
#include "include/effects/SkImageFilters.h"
#include "include/private/SkColorData.h"
#include "include/private/SkTPin.h"
#include "src/core/SkImageFilter_Base.h"
@ -29,10 +28,10 @@
namespace {
class SkMagnifierImageFilterImpl final : public SkImageFilter_Base {
class SkMagnifierImageFilter final : public SkImageFilter_Base {
public:
SkMagnifierImageFilterImpl(const SkRect& srcRect, SkScalar inset, sk_sp<SkImageFilter> input,
const SkRect* cropRect)
SkMagnifierImageFilter(const SkRect& srcRect, SkScalar inset, sk_sp<SkImageFilter> input,
const SkRect* cropRect)
: INHERITED(&input, 1, cropRect)
, fSrcRect(srcRect)
, fInset(inset) {
@ -45,8 +44,8 @@ protected:
sk_sp<SkSpecialImage> onFilterImage(const Context&, SkIPoint* offset) const override;
private:
friend void SkMagnifierImageFilter::RegisterFlattenables();
SK_FLATTENABLE_HOOKS(SkMagnifierImageFilterImpl)
friend void ::SkRegisterMagnifierImageFilterFlattenable();
SK_FLATTENABLE_HOOKS(SkMagnifierImageFilter)
SkRect fSrcRect;
SkScalar fInset;
@ -56,9 +55,9 @@ private:
} // end namespace
sk_sp<SkImageFilter> SkMagnifierImageFilter::Make(const SkRect& srcRect, SkScalar inset,
sk_sp<SkImageFilter> input,
const SkRect* cropRect) {
sk_sp<SkImageFilter> SkImageFilters::Magnifier(
const SkRect& srcRect, SkScalar inset, sk_sp<SkImageFilter> input,
const CropRect& cropRect) {
if (!SkScalarIsFinite(inset) || !SkIsValidRect(srcRect)) {
return nullptr;
}
@ -69,34 +68,34 @@ sk_sp<SkImageFilter> SkMagnifierImageFilter::Make(const SkRect& srcRect, SkScala
if (srcRect.fLeft < 0 || srcRect.fTop < 0) {
return nullptr;
}
return sk_sp<SkImageFilter>(new SkMagnifierImageFilterImpl(srcRect, inset, std::move(input),
cropRect));
return sk_sp<SkImageFilter>(new SkMagnifierImageFilter(srcRect, inset, std::move(input),
cropRect));
}
void SkMagnifierImageFilter::RegisterFlattenables() {
SK_REGISTER_FLATTENABLE(SkMagnifierImageFilterImpl);
void SkRegisterMagnifierImageFilterFlattenable() {
SK_REGISTER_FLATTENABLE(SkMagnifierImageFilter);
// TODO (michaelludwig) - Remove after grace period for SKPs to stop using old name
SkFlattenable::Register("SkMagnifierImageFilter", SkMagnifierImageFilterImpl::CreateProc);
SkFlattenable::Register("SkMagnifierImageFilterImpl", SkMagnifierImageFilter::CreateProc);
}
////////////////////////////////////////////////////////////////////////////////
sk_sp<SkFlattenable> SkMagnifierImageFilterImpl::CreateProc(SkReadBuffer& buffer) {
sk_sp<SkFlattenable> SkMagnifierImageFilter::CreateProc(SkReadBuffer& buffer) {
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
SkRect src;
buffer.readRect(&src);
return SkMagnifierImageFilter::Make(src, buffer.readScalar(), common.getInput(0),
common.cropRect());
return SkImageFilters::Magnifier(src, buffer.readScalar(), common.getInput(0),
common.cropRect());
}
void SkMagnifierImageFilterImpl::flatten(SkWriteBuffer& buffer) const {
void SkMagnifierImageFilter::flatten(SkWriteBuffer& buffer) const {
this->INHERITED::flatten(buffer);
buffer.writeRect(fSrcRect);
buffer.writeScalar(fInset);
}
sk_sp<SkSpecialImage> SkMagnifierImageFilterImpl::onFilterImage(const Context& ctx,
SkIPoint* offset) const {
////////////////////////////////////////////////////////////////////////////////
sk_sp<SkSpecialImage> SkMagnifierImageFilter::onFilterImage(const Context& ctx,
SkIPoint* offset) const {
SkIPoint inputOffset = SkIPoint::Make(0, 0);
sk_sp<SkSpecialImage> input(this->filterInput(0, ctx, &inputOffset));
if (!input) {

View File

@ -1,28 +0,0 @@
/*
* Copyright 2012 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkMagnifierImageFilter_DEFINED
#define SkMagnifierImageFilter_DEFINED
#include "include/core/SkImageFilter.h"
#include "include/core/SkRect.h"
// DEPRECATED: Use include/effects/SkImageFilters::Magnifier
class SK_API SkMagnifierImageFilter {
public:
static sk_sp<SkImageFilter> Make(const SkRect& srcRect, SkScalar inset,
sk_sp<SkImageFilter> input,
const SkRect* cropRect = nullptr);
static void RegisterFlattenables();
private:
SkMagnifierImageFilter() = delete;
};
#endif

View File

@ -126,6 +126,7 @@
SkRegisterDropShadowImageFilterFlattenable();
SkRegisterImageImageFilterFlattenable();
SkRegisterLightingImageFilterFlattenables();
SkRegisterMagnifierImageFilterFlattenable();
SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
}