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

Unified Diff: src/core/SkShader.cpp

Issue 1617813002: experiment: float color components (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 'nother warning 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/SkMathPriv.h ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkShader.cpp
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index bd3876a69b988a0d329e7e1e9abed02052223d12..856b6592134ff01451919c48383976fac6cd9a32 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -117,6 +117,10 @@ SkShader::Context::ShadeProc SkShader::Context::asAShadeProc(void** ctx) {
return nullptr;
}
+void SkShader::Context::shadeSpan4f(int x, int y, SkPM4f[], int count) {
+ SkASSERT(false && "shadeSpan4f called but not implemented");
+}
+
#include "SkColorPriv.h"
#define kTempColorQuadCount 6 // balance between speed (larger) and saving stack-space
@@ -279,7 +283,11 @@ SkColorShader::ColorShaderContext::ColorShaderContext(const SkColorShader& shade
}
fPMColor = SkPackARGB32(a, r, g, b);
- fFlags = kConstInY32_Flag;
+ SkColor4f c4 = SkColor4f::FromColor(shader.fColor);
+ c4.fA *= rec.fPaint->getAlpha() / 255.0f;
+ fPM4f = c4.premul();
+
+ fFlags = kConstInY32_Flag | kSupports4f_Flag;
if (255 == a) {
fFlags |= kOpaqueAlpha_Flag;
}
@@ -293,6 +301,12 @@ void SkColorShader::ColorShaderContext::shadeSpanAlpha(int x, int y, uint8_t alp
memset(alpha, SkGetPackedA32(fPMColor), count);
}
+void SkColorShader::ColorShaderContext::shadeSpan4f(int x, int y, SkPM4f span[], int count) {
+ for (int i = 0; i < count; ++i) {
+ span[i] = fPM4f;
+ }
+}
+
SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
if (info) {
if (info->fColors && info->fColorCount >= 1) {
« no previous file with comments | « src/core/SkMathPriv.h ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698