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

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp

Issue 1823133002: Use sk_sp-based picture recording APIs in Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android_webview 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: third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
index 28b31ff209fb98cfdd1606ba7efc242e3f281356..d8e3c5b70279e652d331be7f988efbdc8bd022e9 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoderTest.cpp
@@ -161,10 +161,10 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPicture)
SkPictureRecorder recorder;
SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
+ sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
- m_surface->getCanvas()->drawPicture(picture.get());
+ m_surface->getCanvas()->drawPicture(picture);
EXPECT_EQ(0, m_decodeRequestCount);
SkBitmap canvasBitmap;
@@ -185,8 +185,8 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive)
SkPictureRecorder recorder;
SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
- m_surface->getCanvas()->drawPicture(picture.get());
+ sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
tomhudson 2016/03/24 19:52:40 We can fold these (two) calls into the drawPicture
f(malita) 2016/03/24 20:22:41 Right, that's the optimal pattern - but with tests
+ m_surface->getCanvas()->drawPicture(picture);
// Fully received the file and draw the SkPicture again.
m_lazyDecoder->setData(*m_data, true);
@@ -194,8 +194,8 @@ TEST_F(DeferredImageDecoderTest, drawIntoSkPictureProgressive)
ASSERT_TRUE(image);
tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- picture = adoptRef(recorder.endRecording());
- m_surface->getCanvas()->drawPicture(picture.get());
+ picture = recorder.finishRecordingAsPicture();
+ m_surface->getCanvas()->drawPicture(picture);
SkBitmap canvasBitmap;
canvasBitmap.allocN32Pixels(100, 100);
@@ -220,7 +220,7 @@ TEST_F(DeferredImageDecoderTest, decodeOnOtherThread)
SkPictureRecorder recorder;
SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
+ sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
// Create a thread to rasterize SkPicture.
@@ -318,9 +318,9 @@ TEST_F(DeferredImageDecoderTest, decodedSize)
SkPictureRecorder recorder;
SkCanvas* tempCanvas = recorder.beginRecording(100, 100, 0, 0);
tempCanvas->drawImage(image.get(), 0, 0);
- RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
+ sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
EXPECT_EQ(0, m_decodeRequestCount);
- m_surface->getCanvas()->drawPicture(picture.get());
+ m_surface->getCanvas()->drawPicture(picture);
EXPECT_EQ(1, m_decodeRequestCount);
}

Powered by Google App Engine
This is Rietveld 408576698