aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkRasterPipeline.cpp8
-rw-r--r--src/core/SkRasterPipeline.h5
2 files changed, 11 insertions, 2 deletions
diff --git a/src/core/SkRasterPipeline.cpp b/src/core/SkRasterPipeline.cpp
index d307bdd118..ab404446e0 100644
--- a/src/core/SkRasterPipeline.cpp
+++ b/src/core/SkRasterPipeline.cpp
@@ -7,7 +7,13 @@
#include "SkRasterPipeline.h"
-SkRasterPipeline::SkRasterPipeline() {}
+SkRasterPipeline::SkRasterPipeline(int size_hint) {
+ fStages.reserve(size_hint);
+}
+
+void SkRasterPipeline::rewind() {
+ fStages.clear();
+}
void SkRasterPipeline::append(StockStage stage, void* ctx) {
SkASSERT(stage != from_srgb);
diff --git a/src/core/SkRasterPipeline.h b/src/core/SkRasterPipeline.h
index a5f47c2203..3b2d617c69 100644
--- a/src/core/SkRasterPipeline.h
+++ b/src/core/SkRasterPipeline.h
@@ -107,7 +107,7 @@
class SkRasterPipeline {
public:
- SkRasterPipeline();
+ SkRasterPipeline(int size_hint=0);
enum StockStage {
#define M(stage) stage,
@@ -136,6 +136,9 @@ public:
bool empty() const { return fStages.empty(); }
+ // Cheaply reset all state so that empty() returns true.
+ void rewind();
+
private:
std::vector<Stage> fStages;
};