Remove dead code (and dead subclass)
note: our min picture-version dates from 2020 Change-Id: I5b9d2e8a13afd16fe5b3ae88f9747f0da4382d29 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428196 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
8837c919fb
commit
f02aa80ba9
@ -229,65 +229,7 @@ static sk_sp<SkColorFilter> MakeMatrix(const float array[20],
|
||||
if (!sk_floats_are_finite(array, 20)) {
|
||||
return nullptr;
|
||||
}
|
||||
#if 1
|
||||
return sk_make_sp<SkColorFilter_Matrix>(array, domain);
|
||||
#else
|
||||
const bool alphaUnchanged = SkScalarNearlyEqual(array[15], 0)
|
||||
&& SkScalarNearlyEqual(array[16], 0)
|
||||
&& SkScalarNearlyEqual(array[17], 0)
|
||||
&& SkScalarNearlyEqual(array[18], 1)
|
||||
&& SkScalarNearlyEqual(array[19], 0);
|
||||
|
||||
struct { SkM44 m; SkV4 b; } uniforms;
|
||||
SkString code {
|
||||
"uniform half4x4 m;"
|
||||
"uniform half4 b;"
|
||||
};
|
||||
if (domain == SkColorFilter_Matrix::Domain::kHSLA) {
|
||||
code += kRGB_to_HSL_sksl;
|
||||
code += kHSL_to_RGB_sksl;
|
||||
}
|
||||
|
||||
code += "half4 main(half4 inColor) {";
|
||||
if (true) {
|
||||
code += "half4 c = inColor;"; // unpremul
|
||||
}
|
||||
if (alphaUnchanged) {
|
||||
code += "half a = c.a;";
|
||||
}
|
||||
if (domain == SkColorFilter_Matrix::Domain::kHSLA) {
|
||||
code += "c.rgb = rgb_to_hsl(c.rgb);";
|
||||
}
|
||||
if (true) {
|
||||
uniforms.m = SkM44{array[ 0], array[ 1], array[ 2], array[ 3],
|
||||
array[ 5], array[ 6], array[ 7], array[ 8],
|
||||
array[10], array[11], array[12], array[13],
|
||||
array[15], array[16], array[17], array[18]};
|
||||
uniforms.b = SkV4{array[4], array[9], array[14], array[19]};
|
||||
code += "c = m*c + b;";
|
||||
}
|
||||
if (domain == SkColorFilter_Matrix::Domain::kHSLA) {
|
||||
code += "c.rgb = hsl_to_rgb(c.rgb);";
|
||||
}
|
||||
if (alphaUnchanged) {
|
||||
code += "return half4(saturate(c.rgb), a);";
|
||||
} else {
|
||||
code += "return saturate(c);";
|
||||
}
|
||||
code += "}";
|
||||
|
||||
sk_sp<SkRuntimeEffect> effect = SkMakeCachedRuntimeEffect(SkRuntimeEffect::MakeForColorFilter,
|
||||
std::move(code));
|
||||
SkASSERT(effect);
|
||||
|
||||
SkAlphaType unpremul = kUnpremul_SkAlphaType;
|
||||
return SkColorFilters::WithWorkingFormat(
|
||||
effect->makeColorFilter(SkData::MakeWithCopy(&uniforms,sizeof(uniforms))),
|
||||
nullptr/*keep dst TF encoding*/,
|
||||
nullptr/*stay in dst gamut*/,
|
||||
&unpremul);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
sk_sp<SkColorFilter> SkColorFilters::Matrix(const float array[20]) {
|
||||
@ -308,18 +250,4 @@ sk_sp<SkColorFilter> SkColorFilters::HSLAMatrix(const SkColorMatrix& cm) {
|
||||
|
||||
void SkColorFilter_Matrix::RegisterFlattenables() {
|
||||
SK_REGISTER_FLATTENABLE(SkColorFilter_Matrix);
|
||||
|
||||
// This subclass was removed 4/2019
|
||||
SkFlattenable::Register("SkColorMatrixFilterRowMajor255",
|
||||
[](SkReadBuffer& buffer) -> sk_sp<SkFlattenable> {
|
||||
float matrix[20];
|
||||
if (buffer.readScalarArray(matrix, 20)) {
|
||||
matrix[ 4] *= (1.0f/255);
|
||||
matrix[ 9] *= (1.0f/255);
|
||||
matrix[14] *= (1.0f/255);
|
||||
matrix[19] *= (1.0f/255);
|
||||
return SkColorFilters::Matrix(matrix);
|
||||
}
|
||||
return nullptr;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user