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

Unified Diff: cc/paint/discardable_image_store.h

Issue 2842333003: cc: Update discardable image metadata generation to get PaintImages. (Closed)
Patch Set: addressed comments Created 3 years, 8 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/paint/discardable_image_store.h
diff --git a/cc/paint/discardable_image_store.h b/cc/paint/discardable_image_store.h
new file mode 100644
index 0000000000000000000000000000000000000000..dec133a14489c8c9802490241d4dd528ec29cd99
--- /dev/null
+++ b/cc/paint/discardable_image_store.h
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_PAINT_DISCARDABLE_IMAGE_STORE_H_
+#define CC_PAINT_DISCARDABLE_IMAGE_STORE_H_
+
+#include "cc/paint/paint_export.h"
+#include "cc/paint/paint_op_buffer.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "third_party/skia/include/core/SkMatrix.h"
+#include "third_party/skia/include/core/SkRect.h"
+
+namespace cc {
+class PaintFlags;
+class PaintImage;
+
+class CC_PAINT_EXPORT DiscardableImageStore {
+ public:
+ DiscardableImageStore(
+ int width,
+ int height,
+ std::vector<std::pair<DrawImage, gfx::Rect>>* image_set,
+ std::unordered_map<ImageId, gfx::Rect>* image_id_to_rect);
+ ~DiscardableImageStore();
+
+ void GatherDiscardableImages(const PaintOpBuffer* buffer);
+ SkCanvas* NoDrawCanvas();
vmpstr 2017/04/28 16:40:11 nit: GetNoDrawCanvas() or just GetCanvas()? or can
Khushal 2017/05/03 21:07:07 The no draw part was just to make it clear that it
vmpstr 2017/05/05 18:56:20 I think we can do that second step as a follow up.
Khushal 2017/05/05 21:54:12 Done.
+
+ private:
+ class PaintTrackingCanvas;
+
+ void AddImageFromFlags(const SkRect& rect, const PaintFlags& flags);
+ void AddImage(const PaintImage& paint_image,
+ const SkRect& src_rect,
+ const SkRect& rect,
+ const SkMatrix* local_matrix,
+ const PaintFlags& flags);
+
+ // This canvas is used only for tracking transform/clip/filter state from the
+ // non-drawing ops.
+ std::unique_ptr<PaintTrackingCanvas> canvas_;
+ std::vector<std::pair<DrawImage, gfx::Rect>>* image_set_;
+ std::unordered_map<ImageId, gfx::Rect>* image_id_to_rect_;
+};
+
+} // namespace cc
+
+#endif // CC_PAINT_DISCARDABLE_IMAGE_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698