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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 11 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 e3b2240f07d9fc15d6c19232dc5c56d45a5a13db..b217f574103b0d4f600c030251352bdadb751abd 100644
--- a/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
+++ b/third_party/WebKit/Source/platform/graphics/PictureSnapshot.cpp
@@ -43,7 +43,6 @@
#include "third_party/skia/include/core/SkData.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageDeserializer.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/core/SkStream.h"
#include "wtf/CurrentTime.h"
#include "wtf/HexNumber.h"
@@ -54,7 +53,7 @@
namespace blink {
-PictureSnapshot::PictureSnapshot(sk_sp<const SkPicture> picture)
+PictureSnapshot::PictureSnapshot(sk_sp<const PaintRecord> picture)
: m_picture(std::move(picture)) {}
class SkiaImageDecoder final : public SkImageDeserializer {
@@ -84,13 +83,13 @@ class SkiaImageDecoder final : public SkImageDeserializer {
PassRefPtr<PictureSnapshot> PictureSnapshot::load(
const Vector<RefPtr<TilePictureStream>>& tiles) {
ASSERT(!tiles.isEmpty());
- Vector<sk_sp<SkPicture>> pictures;
+ Vector<sk_sp<PaintRecord>> pictures;
pictures.reserveCapacity(tiles.size());
FloatRect unionRect;
for (const auto& tileStream : tiles) {
SkMemoryStream stream(tileStream->data.begin(), tileStream->data.size());
SkiaImageDecoder factory;
- sk_sp<SkPicture> picture = SkPicture::MakeFromStream(&stream, &factory);
+ sk_sp<PaintRecord> picture = PaintRecord::MakeFromStream(&stream, &factory);
if (!picture)
return nullptr;
FloatRect cullRect(picture->cullRect());
@@ -100,8 +99,8 @@ PassRefPtr<PictureSnapshot> PictureSnapshot::load(
}
if (tiles.size() == 1)
return adoptRef(new PictureSnapshot(std::move(pictures[0])));
- SkPictureRecorder recorder;
- SkCanvas* canvas =
+ PaintRecorder recorder;
+ PaintCanvas* canvas =
recorder.beginRecording(unionRect.width(), unionRect.height(), 0, 0);
for (size_t i = 0; i < pictures.size(); ++i) {
canvas->save();
@@ -140,7 +139,10 @@ std::unique_ptr<Vector<char>> PictureSnapshot::replay(unsigned fromStep,
canvas.scale(scale, scale);
canvas.resetStepCount();
- m_picture->playback(&canvas, &canvas);
+
+ // TODO(enne): Handle this abort callback in PaintRecord::playback.
+ PaintCanvasPassThrough passthrough(&canvas);
+ m_picture->playback(&passthrough, &canvas);
}
std::unique_ptr<Vector<char>> base64Data = WTF::makeUnique<Vector<char>>();
Vector<char> encodedImage;
@@ -198,7 +200,8 @@ std::unique_ptr<PictureSnapshot::Timings> PictureSnapshot::profile(
std::unique_ptr<JSONArray> PictureSnapshot::snapshotCommandLog() const {
const SkIRect bounds = m_picture->cullRect().roundOut();
LoggingCanvas canvas(bounds.width(), bounds.height());
- m_picture->playback(&canvas);
+ PaintCanvasPassThrough passthrough(&canvas);
+ m_picture->playback(&passthrough);
return canvas.log();
}

Powered by Google App Engine
This is Rietveld 408576698