Revert[2] "Change SkCanvas to *not* inherit from SkRefCnt"
Changes over original:
- conditionalize ownership in SkPictureRecorder
- conditionalize ownership in SkCanvasStateUtils
This reverts commit b613c266df48cf45296ecc23d1bd7098c84bb7ba.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4742
Change-Id: Ib25514d6f546c69b6650b5c957403b04f7380dc2
Reviewed-on: https://skia-review.googlesource.com/4742
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/tests/CanvasStateHelpers.cpp b/tests/CanvasStateHelpers.cpp
index 801eaea..98b5d23 100644
--- a/tests/CanvasStateHelpers.cpp
+++ b/tests/CanvasStateHelpers.cpp
@@ -27,12 +27,11 @@
extern "C" bool complex_layers_draw_from_canvas_state(SkCanvasState* state,
float left, float top, float right, float bottom, int32_t spacer) {
- SkCanvas* canvas = SkCanvasStateUtils::CreateFromCanvasState(state);
+ std::unique_ptr<SkCanvas> canvas = SkCanvasStateUtils::MakeFromCanvasState(state);
if (!canvas) {
return false;
}
- complex_layers_draw(canvas, left, top, right, bottom, spacer);
- canvas->unref();
+ complex_layers_draw(canvas.get(), left, top, right, bottom, spacer);
return true;
}
@@ -52,7 +51,7 @@
extern "C" bool complex_clips_draw_from_canvas_state(SkCanvasState* state,
int32_t left, int32_t top, int32_t right, int32_t bottom, int32_t clipOp,
int32_t regionRects, int32_t* rectCoords) {
- SkCanvas* canvas = SkCanvasStateUtils::CreateFromCanvasState(state);
+ std::unique_ptr<SkCanvas> canvas = SkCanvasStateUtils::MakeFromCanvasState(state);
if (!canvas) {
return false;
}
@@ -64,8 +63,7 @@
rectCoords += 4;
}
- complex_clips_draw(canvas, left, top, right, bottom, clipOp, localRegion);
- canvas->unref();
+ complex_clips_draw(canvas.get(), left, top, right, bottom, clipOp, localRegion);
return true;
}
#endif // SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG