Delete deprecated alpha threshold header
Bug: skia:11230 Change-Id: Icd927cfdcca71a48dce16bcd6c40489dad92a259 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368238 Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
c501857188
commit
5441188637
@ -10,8 +10,7 @@ _include = get_path_info("../include", "abspath")
|
||||
skia_effects_imagefilter_public = [ "$_include/effects/SkImageFilters.h" ]
|
||||
|
||||
skia_effects_imagefilter_sources = [
|
||||
"$_src/effects/imagefilters/SkAlphaThresholdFilter.cpp",
|
||||
"$_src/effects/imagefilters/SkAlphaThresholdFilter.h",
|
||||
"$_src/effects/imagefilters/SkAlphaThresholdImageFilter.cpp",
|
||||
"$_src/effects/imagefilters/SkArithmeticImageFilter.cpp",
|
||||
"$_src/effects/imagefilters/SkArithmeticImageFilter.h",
|
||||
"$_src/effects/imagefilters/SkBlurImageFilter.cpp",
|
||||
|
@ -477,4 +477,12 @@ static inline const SkImageFilter_Base* as_IFB(const SkImageFilter* filter) {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
/**
|
||||
* All image filter implementations defined for the include/effects/SkImageFilters.h factories
|
||||
* are entirely encapsulated within their own CPP files. SkFlattenable deserialization needs a hook
|
||||
* into these types, so their registration functions are exposed here.
|
||||
*/
|
||||
void SkRegisterAlphaThresholdImageFilterFlattenable();
|
||||
|
||||
#endif // SkImageFilter_Base_DEFINED
|
||||
|
@ -1,36 +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 SkAlphaThresholdFilter_DEFINED
|
||||
#define SkAlphaThresholdFilter_DEFINED
|
||||
|
||||
#include "include/core/SkImageFilter.h"
|
||||
|
||||
class SkRegion;
|
||||
|
||||
// DEPRECATED: Use include/effects/SkImageFilters::AlphaThreshold
|
||||
class SK_API SkAlphaThresholdFilter {
|
||||
public:
|
||||
/**
|
||||
* Creates an image filter that samples a region. If the sample is inside the
|
||||
* region the alpha of the image is boosted up to a threshold value. If it is
|
||||
* outside the region then the alpha is decreased to the threshold value.
|
||||
* The 0,0 point of the region corresponds to the upper left corner of the
|
||||
* source image.
|
||||
*/
|
||||
static sk_sp<SkImageFilter> Make(const SkRegion& region, SkScalar innerMin,
|
||||
SkScalar outerMax, sk_sp<SkImageFilter> input,
|
||||
const SkRect* cropRect = nullptr);
|
||||
|
||||
|
||||
static void RegisterFlattenables();
|
||||
|
||||
private:
|
||||
SkAlphaThresholdFilter() = delete;
|
||||
};
|
||||
|
||||
#endif
|
@ -5,10 +5,9 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "src/effects/imagefilters/SkAlphaThresholdFilter.h"
|
||||
|
||||
#include "include/core/SkBitmap.h"
|
||||
#include "include/core/SkRegion.h"
|
||||
#include "include/effects/SkImageFilters.h"
|
||||
#include "include/private/SkTPin.h"
|
||||
#include "src/core/SkImageFilter_Base.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
@ -28,11 +27,11 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class SkAlphaThresholdFilterImpl final : public SkImageFilter_Base {
|
||||
class SkAlphaThresholdImageFilter final : public SkImageFilter_Base {
|
||||
public:
|
||||
SkAlphaThresholdFilterImpl(const SkRegion& region, SkScalar innerThreshold,
|
||||
SkScalar outerThreshold, sk_sp<SkImageFilter> input,
|
||||
const SkRect* cropRect = nullptr)
|
||||
SkAlphaThresholdImageFilter(const SkRegion& region, SkScalar innerThreshold,
|
||||
SkScalar outerThreshold, sk_sp<SkImageFilter> input,
|
||||
const SkRect* cropRect = nullptr)
|
||||
: INHERITED(&input, 1, cropRect)
|
||||
, fRegion(region)
|
||||
, fInnerThreshold(innerThreshold)
|
||||
@ -50,8 +49,8 @@ protected:
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend void SkAlphaThresholdFilter::RegisterFlattenables();
|
||||
SK_FLATTENABLE_HOOKS(SkAlphaThresholdFilterImpl)
|
||||
friend void ::SkRegisterAlphaThresholdImageFilterFlattenable();
|
||||
SK_FLATTENABLE_HOOKS(SkAlphaThresholdImageFilter)
|
||||
|
||||
SkRegion fRegion;
|
||||
SkScalar fInnerThreshold;
|
||||
@ -62,46 +61,45 @@ private:
|
||||
|
||||
}; // end namespace
|
||||
|
||||
sk_sp<SkImageFilter> SkAlphaThresholdFilter::Make(const SkRegion& region, SkScalar innerThreshold,
|
||||
SkScalar outerThreshold,
|
||||
sk_sp<SkImageFilter> input,
|
||||
const SkRect* cropRect) {
|
||||
innerThreshold = SkTPin(innerThreshold, 0.f, 1.f);
|
||||
outerThreshold = SkTPin(outerThreshold, 0.f, 1.f);
|
||||
if (!SkScalarIsFinite(innerThreshold) || !SkScalarIsFinite(outerThreshold)) {
|
||||
sk_sp<SkImageFilter> SkImageFilters::AlphaThreshold(
|
||||
const SkRegion& region, SkScalar innerMin, SkScalar outerMax, sk_sp<SkImageFilter> input,
|
||||
const CropRect& cropRect) {
|
||||
innerMin = SkTPin(innerMin, 0.f, 1.f);
|
||||
outerMax = SkTPin(outerMax, 0.f, 1.f);
|
||||
if (!SkScalarIsFinite(innerMin) || !SkScalarIsFinite(outerMax)) {
|
||||
return nullptr;
|
||||
}
|
||||
return sk_sp<SkImageFilter>(new SkAlphaThresholdFilterImpl(
|
||||
region, innerThreshold, outerThreshold, std::move(input), cropRect));
|
||||
}
|
||||
|
||||
void SkAlphaThresholdFilter::RegisterFlattenables() {
|
||||
SK_REGISTER_FLATTENABLE(SkAlphaThresholdFilterImpl);
|
||||
return sk_sp<SkImageFilter>(new SkAlphaThresholdImageFilter(
|
||||
region, innerMin, outerMax, std::move(input), cropRect));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void SkRegisterAlphaThresholdImageFilterFlattenable() {
|
||||
SK_REGISTER_FLATTENABLE(SkAlphaThresholdImageFilter);
|
||||
SkFlattenable::Register("SkAlphaThresholdFilterImpl", SkAlphaThresholdImageFilter::CreateProc);
|
||||
}
|
||||
|
||||
sk_sp<SkFlattenable> SkAlphaThresholdFilterImpl::CreateProc(SkReadBuffer& buffer) {
|
||||
sk_sp<SkFlattenable> SkAlphaThresholdImageFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1);
|
||||
SkScalar inner = buffer.readScalar();
|
||||
SkScalar outer = buffer.readScalar();
|
||||
SkRegion rgn;
|
||||
buffer.readRegion(&rgn);
|
||||
return SkAlphaThresholdFilter::Make(rgn, inner, outer, common.getInput(0),
|
||||
common.cropRect());
|
||||
return SkImageFilters::AlphaThreshold(rgn, inner, outer, common.getInput(0), common.cropRect());
|
||||
}
|
||||
|
||||
void SkAlphaThresholdFilterImpl::flatten(SkWriteBuffer& buffer) const {
|
||||
void SkAlphaThresholdImageFilter::flatten(SkWriteBuffer& buffer) const {
|
||||
this->INHERITED::flatten(buffer);
|
||||
buffer.writeScalar(fInnerThreshold);
|
||||
buffer.writeScalar(fOuterThreshold);
|
||||
buffer.writeRegion(fRegion);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
GrSurfaceProxyView SkAlphaThresholdFilterImpl::createMaskTexture(GrRecordingContext* context,
|
||||
const SkMatrix& inMatrix,
|
||||
const SkIRect& bounds) const {
|
||||
GrSurfaceProxyView SkAlphaThresholdImageFilter::createMaskTexture(GrRecordingContext* context,
|
||||
const SkMatrix& inMatrix,
|
||||
const SkIRect& bounds) const {
|
||||
auto rtContext = GrSurfaceDrawContext::MakeWithFallback(
|
||||
context, GrColorType::kAlpha_8, nullptr, SkBackingFit::kApprox, bounds.size());
|
||||
if (!rtContext) {
|
||||
@ -126,8 +124,8 @@ GrSurfaceProxyView SkAlphaThresholdFilterImpl::createMaskTexture(GrRecordingCont
|
||||
}
|
||||
#endif
|
||||
|
||||
sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(const Context& ctx,
|
||||
SkIPoint* offset) const {
|
||||
sk_sp<SkSpecialImage> SkAlphaThresholdImageFilter::onFilterImage(const Context& ctx,
|
||||
SkIPoint* offset) const {
|
||||
SkIPoint inputOffset = SkIPoint::Make(0, 0);
|
||||
sk_sp<SkSpecialImage> input(this->filterInput(0, ctx, &inputOffset));
|
||||
if (!input) {
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/core/SkPaint.h"
|
||||
|
||||
#include "src/effects/imagefilters/SkAlphaThresholdFilter.h"
|
||||
#include "src/effects/imagefilters/SkArithmeticImageFilter.h"
|
||||
#include "src/effects/imagefilters/SkBlurImageFilter.h"
|
||||
#include "src/effects/imagefilters/SkColorFilterImageFilter.h"
|
||||
@ -37,7 +36,6 @@
|
||||
constexpr SkRect SkImageFilters::CropRect::kNoCropRect;
|
||||
|
||||
void SkImageFilters::RegisterFlattenables() {
|
||||
SkAlphaThresholdFilter::RegisterFlattenables();
|
||||
SkArithmeticImageFilter::RegisterFlattenables();
|
||||
SkBlurImageFilter::RegisterFlattenables();
|
||||
SkColorFilterImageFilter::RegisterFlattenables();
|
||||
@ -59,12 +57,6 @@ void SkImageFilters::RegisterFlattenables() {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<SkImageFilter> SkImageFilters::AlphaThreshold(
|
||||
const SkRegion& region, SkScalar innerMin, SkScalar outerMax, sk_sp<SkImageFilter> input,
|
||||
const CropRect& cropRect) {
|
||||
return SkAlphaThresholdFilter::Make(region, innerMin, outerMax, std::move(input), cropRect);
|
||||
}
|
||||
|
||||
sk_sp<SkImageFilter> SkImageFilters::Arithmetic(
|
||||
SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, bool enforcePMColor,
|
||||
sk_sp<SkImageFilter> background, sk_sp<SkImageFilter> foreground,
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "include/effects/SkShaderMaskFilter.h"
|
||||
#include "include/effects/SkTableColorFilter.h"
|
||||
#include "src/core/SkColorFilter_Matrix.h"
|
||||
#include "src/core/SkImageFilter_Base.h"
|
||||
#include "src/core/SkRecordedDrawable.h"
|
||||
#include "src/effects/SkDashImpl.h"
|
||||
#include "src/effects/SkEmbossMaskFilter.h"
|
||||
@ -119,6 +120,7 @@
|
||||
*/
|
||||
void SkFlattenable::PrivateInitializer::InitImageFilters() {
|
||||
SkImageFilters::RegisterFlattenables();
|
||||
SkRegisterAlphaThresholdImageFilterFlattenable();
|
||||
SK_REGISTER_FLATTENABLE(SkLocalMatrixImageFilter);
|
||||
SK_REGISTER_FLATTENABLE(SkMatrixImageFilter);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user