Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(111)

Unified Diff: src/core/SkColorFilterShader.cpp

Issue 1625263002: add 4f support to colorfiltershader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkColorFilterShader.h ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorFilterShader.cpp
diff --git a/src/core/SkColorFilterShader.cpp b/src/core/SkColorFilterShader.cpp
index dc90f95762a3398c5f2a964510e75c2803aa4491..81123f6dffc8425da3d6a122bb6b7e72bbd1958e 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -43,10 +43,15 @@ uint32_t SkColorFilterShader::FilterShaderContext::getFlags() const {
uint32_t shaderF = fShaderContext->getFlags();
uint32_t filterF = filterShader.fFilter->getFlags();
- // if the filter might change alpha, clear the opaque flag in the shader
+ // If the filter does not support a given feature, but sure to clear the corresponding flag
+ // in the shader flags.
+ //
if (!(filterF & SkColorFilter::kAlphaUnchanged_Flag)) {
shaderF &= ~SkShader::kOpaqueAlpha_Flag;
}
+ if (!(filterF & SkColorFilter::kSupports4f_Flag)) {
+ shaderF &= ~SkShader::kSupports4f_Flag;
+ }
return shaderF;
}
@@ -84,6 +89,14 @@ void SkColorFilterShader::FilterShaderContext::shadeSpan(int x, int y, SkPMColor
filterShader.fFilter->filterSpan(result, count, result);
}
+void SkColorFilterShader::FilterShaderContext::shadeSpan4f(int x, int y, SkPM4f result[],
+ int count) {
+ const SkColorFilterShader& filterShader = static_cast<const SkColorFilterShader&>(fShader);
+
+ fShaderContext->shadeSpan4f(x, y, result, count);
+ filterShader.fFilter->filterSpan4f(result, count, result);
+}
+
#if SK_SUPPORT_GPU
/////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/core/SkColorFilterShader.h ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698