aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-05-09 14:57:58 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-09 20:04:44 +0000
commitfdf31035a9639c2d377bdf2ddb404d269f8ca42a (patch)
tree1243f154d371f25971833443e24c2136728c3340
parentb8fbab2a1c79764e490e65ebc80288cdc0494237 (diff)
void SkColorFilter::onAppendStages(...)
SkColorFilter::onAppendStages() can't actually fail today. Let's enforce that. This means the fallback is now used only for color filters that have not implemented onAppendStages(). Change-Id: Ica3939685694f6186727766b54914b9ba05ca68c Reviewed-on: https://skia-review.googlesource.com/16231 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
-rw-r--r--include/core/SkColorFilter.h2
-rw-r--r--include/effects/SkLumaColorFilter.h2
-rw-r--r--src/core/SkColorFilter.cpp18
-rw-r--r--src/core/SkColorMatrixFilterRowMajor255.cpp3
-rw-r--r--src/core/SkColorMatrixFilterRowMajor255.h2
-rw-r--r--src/core/SkModeColorFilter.cpp3
-rw-r--r--src/core/SkModeColorFilter.h2
-rw-r--r--src/effects/SkColorMatrixFilter.cpp3
-rw-r--r--src/effects/SkHighContrastFilter.cpp6
-rw-r--r--src/effects/SkLumaColorFilter.cpp3
-rw-r--r--src/effects/SkTableColorFilter.cpp3
11 files changed, 18 insertions, 29 deletions
diff --git a/include/core/SkColorFilter.h b/include/core/SkColorFilter.h
index 16375499e5..2e3662701d 100644
--- a/include/core/SkColorFilter.h
+++ b/include/core/SkColorFilter.h
@@ -185,7 +185,7 @@ private:
return false;
}
- virtual bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
+ virtual void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
bool shaderIsOpaque) const;
diff --git a/include/effects/SkLumaColorFilter.h b/include/effects/SkLumaColorFilter.h
index cab675e5bc..94bf51da2d 100644
--- a/include/effects/SkLumaColorFilter.h
+++ b/include/effects/SkLumaColorFilter.h
@@ -43,7 +43,7 @@ protected:
private:
SkLumaColorFilter();
- bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
+ void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
bool shaderIsOpaque) const override;
typedef SkColorFilter INHERITED;
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index cdae4704f3..a1b4043f49 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -45,12 +45,13 @@ void SkColorFilter::appendStages(SkRasterPipeline* p,
SkColorSpace* dstCS,
SkArenaAlloc* alloc,
bool shaderIsOpaque) const {
- SkRasterPipeline subclass;
- if (this->onAppendStages(&subclass, dstCS, alloc, shaderIsOpaque)) {
- p->extend(subclass);
- return;
- }
+ this->onAppendStages(p, dstCS, alloc, shaderIsOpaque);
+}
+void SkColorFilter::onAppendStages(SkRasterPipeline* p,
+ SkColorSpace* dstCS,
+ SkArenaAlloc* alloc,
+ bool) const {
struct Ctx : SkJumper_CallbackCtx {
sk_sp<SkColorFilter> cf;
};
@@ -65,10 +66,6 @@ void SkColorFilter::appendStages(SkRasterPipeline* p,
p->append(SkRasterPipeline::callback, ctx);
}
-bool SkColorFilter::onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*, bool) const {
- return false;
-}
-
SkColor SkColorFilter::filterColor(SkColor c) const {
SkPMColor dst, src = SkPreMultiplyColor(c);
this->filterSpan(&src, 1, &dst);
@@ -121,7 +118,7 @@ public:
}
#endif
- bool onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, SkArenaAlloc* scratch,
+ void onAppendStages(SkRasterPipeline* p, SkColorSpace* dst, SkArenaAlloc* scratch,
bool shaderIsOpaque) const override {
bool innerIsOpaque = shaderIsOpaque;
if (!(fInner->getFlags() & kAlphaUnchanged_Flag)) {
@@ -129,7 +126,6 @@ public:
}
fInner->appendStages(p, dst, scratch, shaderIsOpaque);
fOuter->appendStages(p, dst, scratch, innerIsOpaque);
- return true;
}
#if SK_SUPPORT_GPU
diff --git a/src/core/SkColorMatrixFilterRowMajor255.cpp b/src/core/SkColorMatrixFilterRowMajor255.cpp
index f3dc41f0fe..bd88c927d1 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.cpp
+++ b/src/core/SkColorMatrixFilterRowMajor255.cpp
@@ -231,7 +231,7 @@ static void set_concat(SkScalar result[20], const SkScalar outer[20], const SkSc
// End duplication
//////
-bool SkColorMatrixFilterRowMajor255::onAppendStages(SkRasterPipeline* p,
+void SkColorMatrixFilterRowMajor255::onAppendStages(SkRasterPipeline* p,
SkColorSpace* dst,
SkArenaAlloc* scratch,
bool shaderIsOpaque) const {
@@ -254,7 +254,6 @@ bool SkColorMatrixFilterRowMajor255::onAppendStages(SkRasterPipeline* p,
if (!willStayOpaque) { p->append(SkRasterPipeline::premul); }
if ( needsClamp0) { p->append(SkRasterPipeline::clamp_0); }
if ( needsClamp1) { p->append(SkRasterPipeline::clamp_a); }
- return true;
}
sk_sp<SkColorFilter>
diff --git a/src/core/SkColorMatrixFilterRowMajor255.h b/src/core/SkColorMatrixFilterRowMajor255.h
index 5c2d616ba0..57201f041c 100644
--- a/src/core/SkColorMatrixFilterRowMajor255.h
+++ b/src/core/SkColorMatrixFilterRowMajor255.h
@@ -36,7 +36,7 @@ protected:
void flatten(SkWriteBuffer&) const override;
private:
- bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
+ void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
bool shaderIsOpaque) const override;
SkScalar fMatrix[20];
diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp
index 33d7977592..3efcc81ec7 100644
--- a/src/core/SkModeColorFilter.cpp
+++ b/src/core/SkModeColorFilter.cpp
@@ -89,7 +89,7 @@ sk_sp<SkFlattenable> SkModeColorFilter::CreateProc(SkReadBuffer& buffer) {
return SkColorFilter::MakeModeFilter(color, mode);
}
-bool SkModeColorFilter::onAppendStages(SkRasterPipeline* p,
+void SkModeColorFilter::onAppendStages(SkRasterPipeline* p,
SkColorSpace* dst,
SkArenaAlloc* scratch,
bool shaderIsOpaque) const {
@@ -102,7 +102,6 @@ bool SkModeColorFilter::onAppendStages(SkRasterPipeline* p,
if (SkBlendMode_CanOverflow(mode)) {
p->append(SkRasterPipeline::clamp_a);
}
- return true;
}
sk_sp<SkColorFilter> SkModeColorFilter::onMakeColorSpace(SkColorSpaceXformer* xformer) const {
diff --git a/src/core/SkModeColorFilter.h b/src/core/SkModeColorFilter.h
index 3c6c728783..e3408d8bf5 100644
--- a/src/core/SkModeColorFilter.h
+++ b/src/core/SkModeColorFilter.h
@@ -44,7 +44,7 @@ protected:
void flatten(SkWriteBuffer&) const override;
- bool onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
+ void onAppendStages(SkRasterPipeline*, SkColorSpace*, SkArenaAlloc*,
bool shaderIsOpaque) const override;
sk_sp<SkColorFilter> onMakeColorSpace(SkColorSpaceXformer*) const override;
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index ebd806e3c0..6326590721 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -56,10 +56,9 @@ public:
bool asColorMatrix(SkScalar matrix[20]) const override {
return fMatrixFilter->asColorMatrix(matrix);
}
- bool onAppendStages(SkRasterPipeline* p, SkColorSpace* cs, SkArenaAlloc* alloc,
+ void onAppendStages(SkRasterPipeline* p, SkColorSpace* cs, SkArenaAlloc* alloc,
bool shaderIsOpaque) const override {
fMatrixFilter->appendStages(p, cs, alloc, shaderIsOpaque);
- return true;
}
// TODO: might want to remember we're a lighting color filter through serialization?
diff --git a/src/effects/SkHighContrastFilter.cpp b/src/effects/SkHighContrastFilter.cpp
index 2d827db751..2715fd04da 100644
--- a/src/effects/SkHighContrastFilter.cpp
+++ b/src/effects/SkHighContrastFilter.cpp
@@ -144,7 +144,7 @@ public:
void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const override;
void filterSpan4f(const SkPM4f src[], int count, SkPM4f result[]) const override;
- bool onAppendStages(SkRasterPipeline* p,
+ void onAppendStages(SkRasterPipeline* p,
SkColorSpace* dst,
SkArenaAlloc* scratch,
bool shaderIsOpaque) const override;
@@ -184,7 +184,7 @@ void SkHighContrast_Filter::filterSpan4f(const SkPM4f src[], int count, SkPM4f d
}
}
-bool SkHighContrast_Filter::onAppendStages(SkRasterPipeline* p,
+void SkHighContrast_Filter::onAppendStages(SkRasterPipeline* p,
SkColorSpace* dst,
SkArenaAlloc* scratch,
bool shaderIsOpaque) const {
@@ -233,8 +233,6 @@ bool SkHighContrast_Filter::onAppendStages(SkRasterPipeline* p,
if (!shaderIsOpaque) {
p->append(SkRasterPipeline::premul);
}
-
- return true;
}
void SkHighContrast_Filter::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index b2f6b47a69..f0e58c06f8 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -55,12 +55,11 @@ void SkLumaColorFilter::filterSpan4f(const SkPM4f src[], int count, SkPM4f dst[]
}
}
-bool SkLumaColorFilter::onAppendStages(SkRasterPipeline* p,
+void SkLumaColorFilter::onAppendStages(SkRasterPipeline* p,
SkColorSpace* dst,
SkArenaAlloc* scratch,
bool shaderIsOpaque) const {
p->append(SkRasterPipeline::luminance_to_alpha);
- return true;
}
sk_sp<SkColorFilter> SkLumaColorFilter::Make() {
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index d9ce98a7d8..b5156ae5bf 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -103,7 +103,7 @@ public:
kB_Flag = 1 << 3,
};
- bool onAppendStages(SkRasterPipeline* p, SkColorSpace*, SkArenaAlloc* alloc,
+ void onAppendStages(SkRasterPipeline* p, SkColorSpace*, SkArenaAlloc* alloc,
bool shaderIsOpaque) const override {
const uint8_t *r = gIdentityTable,
*g = gIdentityTable,
@@ -126,7 +126,6 @@ public:
if (!definitelyOpaque) {
p->append(SkRasterPipeline::premul);
}
- return true;
}
protected: