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

Unified Diff: cc/paint/display_item_list.cc

Issue 2842333003: cc: Update discardable image metadata generation to get PaintImages. (Closed)
Patch Set: win Created 3 years, 7 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
« no previous file with comments | « cc/paint/display_item_list.h ('k') | cc/paint/paint_op_buffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/paint/display_item_list.cc
diff --git a/cc/paint/display_item_list.cc b/cc/paint/display_item_list.cc
index 6a6b110b752aea5a1ca996b5a6bd697d50d86a62..88e11106bacfca1789eaefb3de1ed9f925ace7ac 100644
--- a/cc/paint/display_item_list.cc
+++ b/cc/paint/display_item_list.cc
@@ -19,6 +19,7 @@
#include "cc/paint/clip_display_item.h"
#include "cc/paint/clip_path_display_item.h"
#include "cc/paint/compositing_display_item.h"
+#include "cc/paint/discardable_image_store.h"
#include "cc/paint/drawing_display_item.h"
#include "cc/paint/filter_display_item.h"
#include "cc/paint/float_clip_display_item.h"
@@ -532,9 +533,22 @@ void DisplayItemList::GenerateDiscardableImagesMetadata() {
gfx::Rect bounds = rtree_.GetBounds();
DiscardableImageMap::ScopedMetadataGenerator generator(
&image_map_, gfx::Size(bounds.right(), bounds.bottom()));
- auto* canvas = generator.canvas();
- for (const auto& item : items_)
- RasterItem(item, canvas, nullptr);
+ GatherDiscardableImages(generator.image_store());
+}
+
+void DisplayItemList::GatherDiscardableImages(
+ DiscardableImageStore* image_store) const {
+ // TODO(khushalsagar): Could we avoid this if the data was already stored in
+ // the |image_map_|?
+ SkCanvas* canvas = image_store->GetNoDrawCanvas();
+ for (const auto& item : items_) {
+ if (item.type == DisplayItem::DRAWING) {
+ const auto& drawing_item = static_cast<const DrawingDisplayItem&>(item);
+ image_store->GatherDiscardableImages(drawing_item.picture.get());
+ } else {
+ RasterItem(item, canvas, nullptr);
+ }
+ }
}
void DisplayItemList::GetDiscardableImagesInRect(
« no previous file with comments | « cc/paint/display_item_list.h ('k') | cc/paint/paint_op_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698