aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2017-10-17 14:22:58 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-18 16:17:55 +0000
commit85f8536ca2dd446f2f68d82b0e69134a3e7a88b7 (patch)
treef09aa8f7eb3f7f7f6018f8b4c672046a95a62d75 /src/core
parente4442cb0b537720ab32106b3b5353dbb78f11b26 (diff)
Feed seed_shader() iota through a context pointer.
As this array grows longer it causes troublesome code generation when we're compiling offline, but it's easy as an argument. Change-Id: I53526443f534f29d3bff17c3aec24a9e916c9b86 Reviewed-on: https://skia-review.googlesource.com/60564 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkDraw_vertices.cpp2
-rw-r--r--src/core/SkRasterPipeline.cpp9
-rw-r--r--src/core/SkRasterPipeline.h3
3 files changed, 13 insertions, 1 deletions
diff --git a/src/core/SkDraw_vertices.cpp b/src/core/SkDraw_vertices.cpp
index c7d439d123..004575ea99 100644
--- a/src/core/SkDraw_vertices.cpp
+++ b/src/core/SkDraw_vertices.cpp
@@ -87,7 +87,7 @@ protected:
return nullptr;
}
bool onAppendStages(const StageRec& rec) const override {
- rec.fPipeline->append(SkRasterPipeline::seed_shader);
+ rec.fPipeline->append_seed_shader();
rec.fPipeline->append(SkRasterPipeline::matrix_4x3, &fM43);
// In theory we should never need to clamp. However, either due to imprecision in our
// matrix43, or the scan converter passing us pixel centers that in fact are not within
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp
index 0e56fc4810..73105b4d7b 100644
--- a/src/core/SkRasterPipeline.cpp
+++ b/src/core/SkRasterPipeline.cpp
@@ -23,6 +23,7 @@ void SkRasterPipeline::reset() {
void SkRasterPipeline::append(StockStage stage, void* ctx) {
SkASSERT(stage != from_srgb); // Please use append_from_srgb().
SkASSERT(stage != uniform_color); // Please use append_constant_color().
+ SkASSERT(stage != seed_shader); // Please use append_seed_shader().
this->unchecked_append(stage, ctx);
}
void SkRasterPipeline::unchecked_append(StockStage stage, void* ctx) {
@@ -190,3 +191,11 @@ void SkRasterPipeline::clamp_if_unclamped(SkAlphaType alphaType) {
fClamped = true;
}
}
+
+void SkRasterPipeline::append_seed_shader() {
+ static const float iota[] = {
+ 0.5f, 1.5f, 2.5f, 3.5f, 4.5f, 5.5f, 6.5f, 7.5f,
+ 8.5f, 9.5f,10.5f,11.5f,12.5f,13.5f,14.5f,15.5f,
+ };
+ this->unchecked_append(SkRasterPipeline::seed_shader, const_cast<float*>(iota));
+}
diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h
index f5fad0086f..f9fa80f837 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -144,6 +144,9 @@ public:
this->append_constant_color(alloc, color.vec());
}
+ // Helper to append(seed_shader) with the normal {+0.5,+1.5,+2.5,...} argument it expects.
+ void append_seed_shader();
+
bool empty() const { return fStages == nullptr; }
// Used to track if we're handling values outside [0.0f, 1.0f],