Remove SkTableColorFilter from public API
Client CLs:
- http://cl/535621706
- https://crrev.com/c/4566410
This allows us to refactor colorfilters to have a more internal
naming convention as we decouple the Ganesh backend from them.
Change-Id: I1630c263c6a6b66b0b29a94340936252840bcc85
Bug: skia:14317
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/703936
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
diff --git a/gn/effects.gni b/gn/effects.gni
index 190176c..3ce20a9 100644
--- a/gn/effects.gni
+++ b/gn/effects.gni
@@ -31,7 +31,6 @@
"$_include/effects/SkRuntimeEffect.h",
"$_include/effects/SkShaderMaskFilter.h",
"$_include/effects/SkStrokeAndFillPathEffect.h",
- "$_include/effects/SkTableColorFilter.h",
"$_include/effects/SkTableMaskFilter.h",
"$_include/effects/SkTrimPathEffect.h",
]
diff --git a/include/effects/BUILD.bazel b/include/effects/BUILD.bazel
index 4c77867..9316150 100644
--- a/include/effects/BUILD.bazel
+++ b/include/effects/BUILD.bazel
@@ -36,7 +36,6 @@
"SkRuntimeEffect.h",
"SkShaderMaskFilter.h",
"SkStrokeAndFillPathEffect.h",
- "SkTableColorFilter.h",
"SkTableMaskFilter.h",
"SkTrimPathEffect.h",
":public_imagefilters_hdrs",
diff --git a/include/effects/SkTableColorFilter.h b/include/effects/SkTableColorFilter.h
deleted file mode 100644
index 9a6ce325..0000000
--- a/include/effects/SkTableColorFilter.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-* Copyright 2015 Google Inc.
-*
-* Use of this source code is governed by a BSD-style license that can be
-* found in the LICENSE file.
-*/
-
-#ifndef SkTableColorFilter_DEFINED
-#define SkTableColorFilter_DEFINED
-
-#include "include/core/SkColorFilter.h"
-
-// (DEPRECATED) These factory functions are deprecated. Please use the ones in
-// SkColorFilters (i.e., Table and TableARGB).
-class SK_API SkTableColorFilter {
-public:
- static sk_sp<SkColorFilter> Make(const uint8_t table[256]) {
- return SkColorFilters::Table(table);
- }
-
- static sk_sp<SkColorFilter> MakeARGB(const uint8_t tableA[256],
- const uint8_t tableR[256],
- const uint8_t tableG[256],
- const uint8_t tableB[256]) {
- return SkColorFilters::TableARGB(tableA, tableR, tableG, tableB);
- }
-};
-
-#endif
diff --git a/public.bzl b/public.bzl
index dca01bc..d6db767 100644
--- a/public.bzl
+++ b/public.bzl
@@ -137,7 +137,6 @@
"include/effects/SkRuntimeEffect.h",
"include/effects/SkShaderMaskFilter.h",
"include/effects/SkStrokeAndFillPathEffect.h",
- "include/effects/SkTableColorFilter.h",
"include/effects/SkTableMaskFilter.h",
"include/effects/SkTrimPathEffect.h",
"include/encode/SkEncoder.h",
diff --git a/relnotes/sktablecolorfilter.md b/relnotes/sktablecolorfilter.md
new file mode 100644
index 0000000..fc3658f
--- /dev/null
+++ b/relnotes/sktablecolorfilter.md
@@ -0,0 +1,2 @@
+The deprecated `SkTableColorFilter` class and its methods have been removed. Clients should use
+`SkColorFilters::Table` and `SkColorFilters::TableARGB` (defined in include/core/SkColorFilter.h).
\ No newline at end of file
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index c322cc0..7b869e0 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -72,10 +72,12 @@
#include "src/core/SkVM.h"
#endif
-class SkTable_ColorFilter final : public SkColorFilterBase {
+class SkTableColorFilter final : public SkColorFilterBase {
public:
- SkTable_ColorFilter(const uint8_t tableA[], const uint8_t tableR[],
- const uint8_t tableG[], const uint8_t tableB[]) {
+ SkTableColorFilter(const uint8_t tableA[],
+ const uint8_t tableR[],
+ const uint8_t tableG[],
+ const uint8_t tableB[]) {
fBitmap.allocPixels(SkImageInfo::MakeA8(256, 4));
uint8_t *a = fBitmap.getAddr8(0,0),
*r = fBitmap.getAddr8(0,1),
@@ -148,12 +150,12 @@
private:
friend void ::SkRegisterTableColorFilterFlattenable();
- SK_FLATTENABLE_HOOKS(SkTable_ColorFilter)
+ SK_FLATTENABLE_HOOKS(SkTableColorFilter)
SkBitmap fBitmap;
};
-sk_sp<SkFlattenable> SkTable_ColorFilter::CreateProc(SkReadBuffer& buffer) {
+sk_sp<SkFlattenable> SkTableColorFilter::CreateProc(SkReadBuffer& buffer) {
uint8_t argb[4*256];
if (buffer.readByteArray(argb, sizeof(argb))) {
return SkColorFilters::TableARGB(argb+0*256, argb+1*256, argb+2*256, argb+3*256);
@@ -286,10 +288,10 @@
}
#endif
-GrFPResult SkTable_ColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
- GrRecordingContext* context,
- const GrColorInfo&,
- const SkSurfaceProps&) const {
+GrFPResult SkTableColorFilter::asFragmentProcessor(std::unique_ptr<GrFragmentProcessor> inputFP,
+ GrRecordingContext* context,
+ const GrColorInfo&,
+ const SkSurfaceProps&) const {
auto cte = ColorTableEffect::Make(std::move(inputFP), context, fBitmap);
return cte ? GrFPSuccess(std::move(cte)) : GrFPFailure(nullptr);
}
@@ -298,9 +300,9 @@
#if defined(SK_GRAPHITE)
-void SkTable_ColorFilter::addToKey(const skgpu::graphite::KeyContext& keyContext,
- skgpu::graphite::PaintParamsKeyBuilder* builder,
- skgpu::graphite::PipelineDataGatherer* gatherer) const {
+void SkTableColorFilter::addToKey(const skgpu::graphite::KeyContext& keyContext,
+ skgpu::graphite::PaintParamsKeyBuilder* builder,
+ skgpu::graphite::PipelineDataGatherer* gatherer) const {
using namespace skgpu::graphite;
sk_sp<TextureProxy> proxy = RecorderPriv::CreateCachedProxy(keyContext.recorder(), fBitmap);
@@ -324,7 +326,7 @@
///////////////////////////////////////////////////////////////////////////////
sk_sp<SkColorFilter> SkColorFilters::Table(const uint8_t table[256]) {
- return sk_make_sp<SkTable_ColorFilter>(table, table, table, table);
+ return sk_make_sp<SkTableColorFilter>(table, table, table, table);
}
sk_sp<SkColorFilter> SkColorFilters::TableARGB(const uint8_t tableA[256],
@@ -335,9 +337,10 @@
return nullptr;
}
- return sk_make_sp<SkTable_ColorFilter>(tableA, tableR, tableG, tableB);
+ return sk_make_sp<SkTableColorFilter>(tableA, tableR, tableG, tableB);
}
void SkRegisterTableColorFilterFlattenable() {
- SK_REGISTER_FLATTENABLE(SkTable_ColorFilter);
+ SK_REGISTER_FLATTENABLE(SkTableColorFilter);
+ SkFlattenable::Register("SkTable_ColorFilter", SkTableColorFilter::CreateProc);
}