aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkRasterPipeline.cpp24
-rw-r--r--src/core/SkRasterPipeline.h7
-rw-r--r--src/opts/SkRasterPipeline_opts.h8
3 files changed, 14 insertions, 25 deletions
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp
index a9164d342d..6d31a55f28 100644
--- a/src/core/SkRasterPipeline.cpp
+++ b/src/core/SkRasterPipeline.cpp
@@ -11,35 +11,27 @@
SkRasterPipeline::SkRasterPipeline() {}
void SkRasterPipeline::append(StockStage stage, void* ctx) {
-#ifdef SK_DEBUG
- if (fNum == (int)SK_ARRAY_COUNT(fStages)) {
- this->dump();
- }
-#endif
- SkASSERT(fNum < (int)SK_ARRAY_COUNT(fStages));
- fStages[fNum++] = { stage, ctx };
+ fStages.push_back({stage, ctx});
}
void SkRasterPipeline::extend(const SkRasterPipeline& src) {
- for (int i = 0; i < src.fNum; i++) {
- const Stage& s = src.fStages[i];
- this->append(s.stage, s.ctx);
- }
+ fStages.insert(fStages.end(),
+ src.fStages.begin(), src.fStages.end());
}
void SkRasterPipeline::run(size_t x, size_t y, size_t n) const {
- SkOpts::run_pipeline(x,y,n, fStages, fNum);
+ SkOpts::run_pipeline(x,y,n, fStages.data(), SkToInt(fStages.size()));
}
std::function<void(size_t, size_t, size_t)> SkRasterPipeline::compile() const {
- return SkOpts::compile_pipeline(fStages, fNum);
+ return SkOpts::compile_pipeline(fStages.data(), SkToInt(fStages.size()));
}
void SkRasterPipeline::dump() const {
- SkDebugf("SkRasterPipeline, %d stages\n", fNum);
- for (int i = 0; i < fNum; i++) {
+ SkDebugf("SkRasterPipeline, %d stages\n", SkToInt(fStages.size()));
+ for (auto&& st : fStages) {
const char* name = "";
- switch (fStages[i].stage) {
+ switch (st.stage) {
#define M(x) case x: name = #x; break;
SK_RASTER_PIPELINE_STAGES(M)
#undef M
diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h
index 8762386f58..179bfb531d 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -12,6 +12,7 @@
#include "SkTArray.h"
#include "SkTypes.h"
#include <functional>
+#include <vector>
/**
* SkRasterPipeline provides a cheap way to chain together a pixel processing pipeline.
@@ -90,9 +91,6 @@
class SkRasterPipeline {
public:
- // No pipeline may be more than kMaxStages long.
- static const int kMaxStages = 48;
-
SkRasterPipeline();
enum StockStage {
@@ -120,8 +118,7 @@ public:
};
private:
- int fNum = 0;
- Stage fStages[kMaxStages];
+ std::vector<Stage> fStages;
};
#endif//SkRasterPipeline_DEFINED
diff --git a/src/opts/SkRasterPipeline_opts.h b/src/opts/SkRasterPipeline_opts.h
index 07f6323673..e73d56cc8b 100644
--- a/src/opts/SkRasterPipeline_opts.h
+++ b/src/opts/SkRasterPipeline_opts.h
@@ -944,7 +944,7 @@ SI Fn enum_to_Fn(SkRasterPipeline::StockStage st) {
namespace {
struct Compiled {
- Compiled(const SkRasterPipeline::Stage* stages, int nstages) {
+ Compiled(const SkRasterPipeline::Stage* stages, int nstages) : fStages(nstages) {
if (nstages == 0) {
return;
}
@@ -965,18 +965,18 @@ namespace {
_1 = SkNf(1);
while (n >= N) {
- fStart(fStages, x*N, X,Y,_1,_0, _0,_0,_0,_0);
+ fStart(fStages.data(), x*N, X,Y,_1,_0, _0,_0,_0,_0);
X += (float)N;
x += N;
n -= N;
}
if (n) {
- fStart(fStages, x*N+n, X,Y,_1,_0, _0,_0,_0,_0);
+ fStart(fStages.data(), x*N+n, X,Y,_1,_0, _0,_0,_0,_0);
}
}
Fn fStart = just_return;
- Stage fStages[SkRasterPipeline::kMaxStages];
+ std::vector<Stage> fStages;
};
}