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

Unified Diff: third_party/WebKit/Source/platform/graphics/PictureSnapshot.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: review comments 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/PictureSnapshot.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
index 7d322be9caf0a951dca06ff01ad53ab621f3833f..e5ff2251e58ae74c008b753f2787c56f743919e9 100644
--- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
+++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -71,21 +71,21 @@ static bool decodeBitmap(const void* data, size_t length, SkBitmap* result)
PassRefPtr<PictureSnapshot> PictureSnapshot::load(const Vector<RefPtr<TilePictureStream>>& tiles)
{
ASSERT(!tiles.isEmpty());
- Vector<RefPtr<SkPicture>> pictures;
+ Vector<sk_sp<SkPicture>> pictures;
pictures.reserveCapacity(tiles.size());
FloatRect unionRect;
for (const auto& tileStream : tiles) {
SkMemoryStream stream(tileStream->data.begin(), tileStream->data.size());
- RefPtr<SkPicture> picture = adoptRef(SkPicture::CreateFromStream(&stream, decodeBitmap));
+ sk_sp<SkPicture> picture = SkPicture::MakeFromStream(&stream, decodeBitmap);
if (!picture)
return nullptr;
FloatRect cullRect(picture->cullRect());
cullRect.moveBy(tileStream->layerOffset);
unionRect.unite(cullRect);
- pictures.append(picture);
+ pictures.append(std::move(picture));
}
if (tiles.size() == 1)
- return adoptRef(new PictureSnapshot(pictures[0]));
+ return adoptRef(new PictureSnapshot(fromSkSp(std::move(pictures[0]))));
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(unionRect.width(), unionRect.height(), 0, 0);
for (size_t i = 0; i < pictures.size(); ++i) {
@@ -94,7 +94,7 @@ PassRefPtr<PictureSnapshot> PictureSnapshot::load(const Vector<RefPtr<TilePictur
pictures[i]->playback(canvas, 0);
canvas->restore();
}
- return adoptRef(new PictureSnapshot(adoptRef(recorder.endRecordingAsPicture())));
+ return adoptRef(new PictureSnapshot(fromSkSp(recorder.finishRecordingAsPicture())));
}
bool PictureSnapshot::isEmpty() const

Powered by Google App Engine
This is Rietveld 408576698