Revert "clean up after big refactor of SkColorFilter --> ...Base"

This reverts commit 6dc67b1538.

Reason for revert: tripping up asan

Original change's description:
> clean up after big refactor of SkColorFilter --> ...Base
> 
> Change-Id: I67ba7db1a1e4e0c8deb5299a6580a669cc08f38c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299056
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=reed@google.com,johnstiles@google.com

Change-Id: Id157fed27d517a33ae235307247ab57dc605eac6
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298979
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Michael Ludwig 2020-06-25 21:41:09 +00:00 committed by Skia Commit-Bot
parent 02616ea90b
commit a693a4704e
6 changed files with 10 additions and 6 deletions

View File

@ -103,7 +103,7 @@ skvm::Color SkColorFilterBase::program(skvm::Builder* p, skvm::Color c,
skvm::Uniforms* uniforms, SkArenaAlloc* alloc) const {
skvm::F32 original = c.a;
if ((c = this->onProgram(p,c, dstCS, uniforms,alloc))) {
if (this->isAlphaUnchanged()) {
if (this->getFlags() & kAlphaUnchanged_Flag) {
c.a = original;
}
return c;

View File

@ -26,7 +26,7 @@ static uint16_t ComputeFlags(const float matrix[20]) {
&& SkScalarNearlyZero (srcA[2])
&& SkScalarNearlyEqual(srcA[3], 1)
&& SkScalarNearlyZero (srcA[4])
? SkColorFilter::kAlphaUnchanged_Flag : 0;
? SkColorFilterBase::kAlphaUnchanged_Flag : 0;
}
SkColorFilter_Matrix::SkColorFilter_Matrix(const float array[20], Domain domain)

View File

@ -15,7 +15,7 @@
static bool changes_alpha(const SkPaint& paint) {
SkColorFilter* cf = paint.getColorFilter();
return cf && !as_CFB(cf)->isAlphaUnchanged();
return cf && !(as_CFB(cf)->getFlags() & SkColorFilterBase::kAlphaUnchanged_Flag);
}
bool SkPaintPriv::Overwrites(const SkPaint* paint, ShaderOverrideOpacity overrideOpacity) {

View File

@ -185,7 +185,8 @@ SkBlitter* SkRasterPipelineBlitter::Create(const SkPixmap& dst,
colorPipeline, alloc, dst.colorType(), dst.colorSpace(), paint, nullptr, matrixProvider
};
as_CFB(colorFilter)->appendStages(rec, is_opaque);
is_opaque = is_opaque && as_CFB(colorFilter)->isAlphaUnchanged();
is_opaque = is_opaque
&& (as_CFB(colorFilter)->getFlags() & SkColorFilterBase::kAlphaUnchanged_Flag);
}
#if defined(SK_LATE_DITHER)

View File

@ -1546,7 +1546,7 @@ DEF_TEST(ImageFilterCanComputeFastBounds, reporter) {
sk_sp<SkColorFilter> greenCF(SkColorFilters::Matrix(greenMatrix));
sk_sp<SkImageFilter> green(SkImageFilters::ColorFilter(greenCF, nullptr));
REPORTER_ASSERT(reporter, as_CFB(greenCF)->affectsTransparentBlack());
REPORTER_ASSERT(reporter,as_CFB( greenCF)->affectsTransparentBlack());
REPORTER_ASSERT(reporter, !green->canComputeFastBounds());
sk_sp<SkImageFilter> greenBlur(SkImageFilters::Blur(SK_Scalar1, SK_Scalar1,

View File

@ -302,7 +302,10 @@ static void TestColorFilterSerialization(skiatest::Reporter* reporter) {
for (int i = 0; i < 256; ++i) {
table[i] = (i * 41) % 256;
}
TestFlattenableSerialization(as_CFB(SkTableColorFilter::Make(table).get()), true, reporter);
auto colorFilter(SkTableColorFilter::Make(table));
sk_sp<SkColorFilter> copy(
TestFlattenableSerialization<SkColorFilterBase>((SkColorFilterBase*)colorFilter.get(),
true, reporter));
}
static SkBitmap draw_picture(SkPicture& picture) {