Chromium Code Reviews| Index: src/core/SkDrawLooper.cpp |
| diff --git a/src/core/SkDrawLooper.cpp b/src/core/SkDrawLooper.cpp |
| index bac2d969c0505d318fe7881c638c1a4750544fd3..90b3434c512c198e3949888345003b883db7cb12 100644 |
| --- a/src/core/SkDrawLooper.cpp |
| +++ b/src/core/SkDrawLooper.cpp |
| @@ -11,13 +11,21 @@ |
| #include "SkPaint.h" |
| #include "SkRect.h" |
| +bool SkDrawLooper::next(SkCanvas* canvas, SkPaint* paint, |
| + DrawContext* context) const { |
| + bool ret = next_internal(canvas, paint, context); |
|
scroggo
2014/02/06 17:57:13
this->next_internal (or onNext)
|
| + if (!ret) |
| + delete context; |
|
scroggo
2014/02/06 17:57:13
SkDELETE
|
| + return ret; |
| +} |
| + |
| bool SkDrawLooper::canComputeFastBounds(const SkPaint& paint) { |
| SkCanvas canvas; |
| - this->init(&canvas); |
| + SkDrawLooper::DrawContext* context = this->init(&canvas); |
| for (;;) { |
| SkPaint p(paint); |
| - if (this->next(&canvas, &p)) { |
| + if (this->next(&canvas, &p, context)) { |
| p.setLooper(NULL); |
| if (!p.canComputeFastBounds()) { |
| return false; |
| @@ -34,10 +42,10 @@ void SkDrawLooper::computeFastBounds(const SkPaint& paint, const SkRect& src, |
| SkCanvas canvas; |
| *dst = src; // catch case where there are no loops |
| - this->init(&canvas); |
| + SkDrawLooper::DrawContext* context = this->init(&canvas); |
| for (bool firstTime = true;; firstTime = false) { |
| SkPaint p(paint); |
| - if (this->next(&canvas, &p)) { |
| + if (this->next(&canvas, &p, context)) { |
| SkRect r(src); |
| p.setLooper(NULL); |