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

Side by Side Diff: cc/playback/drawing_display_item.cc

Issue 1484163002: Raster display item lists via a visual rect RTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head and flip for LayoutInline. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/playback/drawing_display_item.h" 5 #include "cc/playback/drawing_display_item.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 picture_->serialize(&stream, 75 picture_->serialize(&stream,
76 image_serialization_processor->GetPixelSerializer()); 76 image_serialization_processor->GetPixelSerializer());
77 if (stream.bytesWritten() > 0) { 77 if (stream.bytesWritten() > 0) {
78 SkAutoDataUnref data(stream.copyToData()); 78 SkAutoDataUnref data(stream.copyToData());
79 details->set_picture(data->data(), data->size()); 79 details->set_picture(data->data(), data->size());
80 } 80 }
81 } 81 }
82 } 82 }
83 83
84 void DrawingDisplayItem::Raster(SkCanvas* canvas, 84 void DrawingDisplayItem::Raster(SkCanvas* canvas,
85 const gfx::Rect& canvas_target_playback_rect,
86 SkPicture::AbortCallback* callback) const { 85 SkPicture::AbortCallback* callback) const {
87 // The canvas_playback_rect can be empty to signify no culling is desired.
88 if (!canvas_target_playback_rect.IsEmpty()) {
89 const SkMatrix& matrix = canvas->getTotalMatrix();
90 const SkRect& cull_rect = picture_->cullRect();
91 SkRect target_rect;
92 matrix.mapRect(&target_rect, cull_rect);
93 if (!target_rect.intersect(gfx::RectToSkRect(canvas_target_playback_rect)))
94 return;
95 }
96
97 // SkPicture always does a wrapping save/restore on the canvas, so it is not 86 // SkPicture always does a wrapping save/restore on the canvas, so it is not
98 // necessary here. 87 // necessary here.
99 if (callback) 88 if (callback)
100 picture_->playback(canvas, callback); 89 picture_->playback(canvas, callback);
101 else 90 else
102 canvas->drawPicture(picture_.get()); 91 canvas->drawPicture(picture_.get());
103 } 92 }
104 93
105 void DrawingDisplayItem::AsValueInto( 94 void DrawingDisplayItem::AsValueInto(
106 const gfx::Rect& visual_rect, 95 const gfx::Rect& visual_rect,
(...skipping 27 matching lines...) Expand all
134 123
135 size_t DrawingDisplayItem::ExternalMemoryUsage() const { 124 size_t DrawingDisplayItem::ExternalMemoryUsage() const {
136 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 125 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
137 } 126 }
138 127
139 int DrawingDisplayItem::ApproximateOpCount() const { 128 int DrawingDisplayItem::ApproximateOpCount() const {
140 return picture_->approximateOpCount(); 129 return picture_->approximateOpCount();
141 } 130 }
142 131
143 } // namespace cc 132 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698