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

Unified Diff: cc/playback/display_item_list.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build 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: cc/playback/display_item_list.cc
diff --git a/cc/playback/display_item_list.cc b/cc/playback/display_item_list.cc
index ed0c178f4e7c993428292184771998a9e9a4e450..4134254205e88fa4f09bab1439678a6ecb2eaa88 100644
--- a/cc/playback/display_item_list.cc
+++ b/cc/playback/display_item_list.cc
@@ -16,6 +16,7 @@
#include "cc/debug/picture_debug_util.h"
#include "cc/debug/traced_display_item_list.h"
#include "cc/debug/traced_value.h"
+#include "cc/paint/paint_recorder.h"
#include "cc/playback/clip_display_item.h"
#include "cc/playback/clip_path_display_item.h"
#include "cc/playback/compositing_display_item.h"
@@ -28,9 +29,6 @@
#include "cc/playback/transform_display_item.h"
#include "cc/proto/display_item.pb.h"
#include "cc/proto/gfx_conversions.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkPictureRecorder.h"
-#include "third_party/skia/include/utils/SkPictureUtils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/skia_util.h"
@@ -50,7 +48,7 @@ bool DisplayItemsTracingEnabled() {
return tracing_enabled;
}
-bool GetCanvasClipBounds(SkCanvas* canvas, gfx::Rect* clip_bounds) {
+bool GetCanvasClipBounds(PaintCanvas* canvas, gfx::Rect* clip_bounds) {
SkRect canvas_clip_bounds;
if (!canvas->getClipBounds(&canvas_clip_bounds))
return false;
@@ -101,7 +99,7 @@ DisplayItemList::~DisplayItemList() {
}
void DisplayItemList::ToProtobuf(proto::DisplayItemList* proto) {
- // The flattened SkPicture approach is going away, and the proto
+ // The flattened PaintRecord approach is going away, and the proto
danakj 2017/01/20 23:34:13 can rebase this away
// doesn't currently support serializing that flattened picture.
inputs_.settings.ToProtobuf(proto->mutable_settings());
@@ -117,8 +115,8 @@ void DisplayItemList::ToProtobuf(proto::DisplayItemList* proto) {
}
}
-void DisplayItemList::Raster(SkCanvas* canvas,
- SkPicture::AbortCallback* callback,
+void DisplayItemList::Raster(PaintCanvas* canvas,
+ PaintRecord::AbortCallback* callback,
const gfx::Rect& canvas_target_playback_rect,
float contents_scale) const {
canvas->save();
@@ -136,8 +134,8 @@ void DisplayItemList::Raster(SkCanvas* canvas,
}
DISABLE_CFI_PERF
-void DisplayItemList::Raster(SkCanvas* canvas,
- SkPicture::AbortCallback* callback) const {
+void DisplayItemList::Raster(PaintCanvas* canvas,
+ PaintRecord::AbortCallback* callback) const {
gfx::Rect canvas_playback_rect;
if (!GetCanvasClipBounds(canvas, &canvas_playback_rect))
return;
@@ -193,7 +191,7 @@ size_t DisplayItemList::ApproximateMemoryUsage() const {
size_t memory_usage = sizeof(*this);
size_t external_memory_usage = 0;
- // Warning: this double-counts SkPicture data if use_cached_picture is
+ // Warning: this double-counts PaintRecord data if use_cached_picture is
// also true.
for (const auto& item : inputs_.items) {
size_t bytes = 0;
@@ -271,13 +269,14 @@ DisplayItemList::AsValue(bool include_items) const {
state->SetValue("layer_rect", MathUtil::AsValue(rtree_.GetBounds()));
state->EndDictionary(); // "params".
- SkPictureRecorder recorder;
+ PaintRecorder recorder;
gfx::Rect bounds = rtree_.GetBounds();
- SkCanvas* canvas = recorder.beginRecording(bounds.width(), bounds.height());
+ PaintCanvas* canvas =
+ recorder.beginRecording(bounds.width(), bounds.height());
canvas->translate(-bounds.x(), -bounds.y());
canvas->clipRect(gfx::RectToSkRect(bounds));
Raster(canvas, nullptr, gfx::Rect(), 1.f);
- sk_sp<SkPicture> picture = recorder.finishRecordingAsPicture();
+ sk_sp<PaintRecord> picture = recorder.finishRecordingAsPicture();
std::string b64_picture;
PictureDebugUtil::SerializeAsBase64(picture.get(), &b64_picture);
@@ -297,7 +296,7 @@ void DisplayItemList::EmitTraceSnapshot() const {
}
void DisplayItemList::GenerateDiscardableImagesMetadata() {
- // This should be only called once, and only after CreateAndCacheSkPicture.
+ // This should be only called once.
DCHECK(image_map_.empty());
gfx::Rect bounds = rtree_.GetBounds();

Powered by Google App Engine
This is Rietveld 408576698