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

Unified Diff: skia/ext/pixel_ref_utils_unittest.cc

Issue 1819683002: Use sk_sp-based picture recording APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skspify GetPicture/GetFlattenedPicture Created 4 years, 9 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: skia/ext/pixel_ref_utils_unittest.cc
diff --git a/skia/ext/pixel_ref_utils_unittest.cc b/skia/ext/pixel_ref_utils_unittest.cc
index 7af706b73cfaf9b0ea2da9062bde1eef7cf9b5dc..dc28cfe22721a9c6ebbd2e9488a02d74438fff90 100644
--- a/skia/ext/pixel_ref_utils_unittest.cc
+++ b/skia/ext/pixel_ref_utils_unittest.cc
@@ -58,9 +58,9 @@ SkCanvas* StartRecording(SkPictureRecorder* recorder, gfx::Rect layer_rect) {
return canvas;
}
-SkPicture* StopRecording(SkPictureRecorder* recorder, SkCanvas* canvas) {
+sk_sp<SkPicture> StopRecording(SkPictureRecorder* recorder, SkCanvas* canvas) {
canvas->restore();
- return recorder->endRecordingAsPicture();
+ return recorder->finishRecordingAsPicture();
}
} // namespace
@@ -104,8 +104,7 @@ TEST(PixelRefUtilsTest, DrawPaint) {
canvas->clipRect(SkRect::MakeWH(100, 100));
canvas->drawPaint(third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -164,8 +163,7 @@ TEST(PixelRefUtilsTest, DrawPoints) {
// (50, 55, 150, 145).
canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, points, third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -216,8 +214,7 @@ TEST(PixelRefUtilsTest, DrawRect) {
// (20, 20, 100, 100)
canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -273,8 +270,7 @@ TEST(PixelRefUtilsTest, DrawRRect) {
// (20, 20, 100, 100)
canvas->drawRRect(rrect, third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -329,8 +325,7 @@ TEST(PixelRefUtilsTest, DrawOval) {
// (20, 20, 100, 100).
canvas->drawRect(SkRect::MakeXYWH(0, 0, 100, 100), third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -379,8 +374,7 @@ TEST(PixelRefUtilsTest, DrawPath) {
canvas->restore();
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -422,8 +416,7 @@ TEST(PixelRefUtilsTest, DrawText) {
canvas->drawPosText("text", 4, points, first_paint);
canvas->drawTextOnPath("text", 4, path, NULL, first_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -494,8 +487,7 @@ TEST(PixelRefUtilsTest, DrawVertices) {
3,
third_paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -563,8 +555,7 @@ TEST(PixelRefUtilsTest, DrawImage) {
canvas->restore();
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
@@ -627,8 +618,7 @@ TEST(PixelRefUtilsTest, DrawImageRect) {
canvas->restore();
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(StopRecording(&recorder, canvas));
+ sk_sp<SkPicture> picture = StopRecording(&recorder, canvas);
std::vector<skia::PixelRefUtils::PositionPixelRef> pixel_refs;
skia::PixelRefUtils::GatherDiscardablePixelRefs(picture.get(), &pixel_refs);
« no previous file with comments | « skia/ext/analysis_canvas_unittest.cc ('k') | third_party/WebKit/Source/platform/graphics/ContentLayerDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698