Index: src/core/SkCanvas.cpp |
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
index 08b09e8e2b6e970b06d93c0449b9af8859573173..9b54adf90f32bddcd0755fee0abe0d095ecdfeb8 100644 |
--- a/src/core/SkCanvas.cpp |
+++ b/src/core/SkCanvas.cpp |
@@ -356,7 +356,8 @@ public: |
} |
if (fLooper) { |
- fLooper->init(canvas); |
+ fLooperContext = fLooper->init(canvas, fLooperContextStorage, |
+ sizeof(fLooperContextStorage)); |
fIsSimple = false; |
} else { |
// can we be marked as simple? |
@@ -369,6 +370,10 @@ public: |
fCanvas->internalRestore(); |
} |
SkASSERT(fCanvas->getSaveCount() == fSaveCount); |
+ if (fLooper) { |
+ SkASSERT(fLooperContext); |
+ fLooperContext->cleanup(fLooperContextStorage); |
+ } |
} |
const SkPaint& paint() const { |
@@ -399,6 +404,8 @@ private: |
bool fDoClearImageFilter; |
bool fDone; |
bool fIsSimple; |
+ SkDrawLooper::DrawContext* fLooperContext; |
+ uint32_t fLooperContextStorage[kDrawLooperContextStorageLongCount]; |
bool doNext(SkDrawFilter::Type drawType); |
}; |
@@ -407,6 +414,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) { |
fPaint = NULL; |
SkASSERT(!fIsSimple); |
SkASSERT(fLooper || fFilter || fDoClearImageFilter); |
+ SkASSERT(!fLooper || fLooperContext); |
SkPaint* paint = fLazyPaint.set(fOrigPaint); |
@@ -414,7 +422,7 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) { |
paint->setImageFilter(NULL); |
} |
- if (fLooper && !fLooper->next(fCanvas, paint)) { |
+ if (fLooper && !fLooperContext->next(fCanvas, paint)) { |
fDone = true; |
return false; |
} |