Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: src/core/SkDrawLooper.cpp

Issue 155513012: [WIP] Add Context to SkDrawLooper. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make methods const. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698