summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorfmalita <fmalita@chromium.org>2016-03-22 06:32:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-22 13:33:15 +0000
commit2d743288889c7804e6431bf389cdc6084aaa49ef (patch)
tree95409a0d222e17f9e678b97040c0567ede58c4bc /skia
parentc2db76301d3eb61575d807d2897da86d637cbd34 (diff)
downloadchromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.zip
chromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.tar.gz
chromium_src-2d743288889c7804e6431bf389cdc6084aaa49ef.tar.bz2
Use sk_sp-based picture recording APIs
1) use SkPictureRecorder::finishRecordingAsPicture() over endRecordingAsPicture() 2) convert to sk_sp<SkPicture> fields/params where feasible BUG=skia:5077 R=reed@google.com,danakj@chromium.org,enne@chromium.org TBR=pdr@chromium.org,alekseys@chromium.org CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1819683002 Cr-Commit-Position: refs/heads/master@{#382563}
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/analysis_canvas_unittest.cc3
-rw-r--r--skia/ext/pixel_ref_utils_unittest.cc34
2 files changed, 13 insertions, 24 deletions
diff --git a/skia/ext/analysis_canvas_unittest.cc b/skia/ext/analysis_canvas_unittest.cc
index 5436b81..bac22b1 100644
--- a/skia/ext/analysis_canvas_unittest.cc
+++ b/skia/ext/analysis_canvas_unittest.cc
@@ -345,8 +345,7 @@ TEST(AnalysisCanvasTest, EarlyOutNotSolid) {
record_canvas->drawText(
text.c_str(), text.length(), point.fX, point.fY, paint);
- skia::RefPtr<SkPicture> picture =
- skia::AdoptRef(recorder.endRecordingAsPicture());
+ sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
// Draw the picture into the analysis canvas, using the canvas as a callback
// as well.
diff --git a/skia/ext/pixel_ref_utils_unittest.cc b/skia/ext/pixel_ref_utils_unittest.cc
index 7af706b..dc28cfe 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);