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

Side by Side Diff: cc/playback/discardable_image_map.h

Issue 2656983006: cc: Add image to rect map in DiscardableImageMap. (Closed)
Patch Set: rebase Created 3 years, 10 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ 5 #ifndef CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_
6 #define CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ 6 #define CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_
7 7
8 #include <unordered_map>
8 #include <utility> 9 #include <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
12 #include "cc/base/rtree.h" 13 #include "cc/base/rtree.h"
13 #include "cc/playback/draw_image.h" 14 #include "cc/playback/draw_image.h"
15 #include "cc/playback/image_id.h"
14 #include "third_party/skia/include/core/SkCanvas.h" 16 #include "third_party/skia/include/core/SkCanvas.h"
15 #include "third_party/skia/include/core/SkRefCnt.h" 17 #include "third_party/skia/include/core/SkRefCnt.h"
16 #include "ui/gfx/geometry/rect.h" 18 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
18 20
19 namespace cc { 21 namespace cc {
20 22
21 // Helper function to apply the matrix to the rect and return the result. 23 // Helper function to apply the matrix to the rect and return the result.
22 SkRect MapRect(const SkMatrix& matrix, const SkRect& src); 24 SkRect MapRect(const SkMatrix& matrix, const SkRect& src);
23 25
(...skipping 15 matching lines...) Expand all
39 std::unique_ptr<SkCanvas> metadata_canvas_; 41 std::unique_ptr<SkCanvas> metadata_canvas_;
40 }; 42 };
41 43
42 DiscardableImageMap(); 44 DiscardableImageMap();
43 ~DiscardableImageMap(); 45 ~DiscardableImageMap();
44 46
45 bool empty() const { return all_images_.empty(); } 47 bool empty() const { return all_images_.empty(); }
46 void GetDiscardableImagesInRect(const gfx::Rect& rect, 48 void GetDiscardableImagesInRect(const gfx::Rect& rect,
47 float contents_scale, 49 float contents_scale,
48 std::vector<DrawImage>* images) const; 50 std::vector<DrawImage>* images) const;
51 gfx::Rect GetRectForImage(ImageId image_id) const;
49 52
50 private: 53 private:
51 friend class ScopedMetadataGenerator; 54 friend class ScopedMetadataGenerator;
52 friend class DiscardableImageMapTest; 55 friend class DiscardableImageMapTest;
53 56
54 std::unique_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds); 57 std::unique_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds);
55 void EndGeneratingMetadata(); 58 void EndGeneratingMetadata();
56 59
57 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_; 60 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_;
61 std::unordered_map<ImageId, gfx::Rect> image_id_to_rect_;
62
58 RTree images_rtree_; 63 RTree images_rtree_;
59 }; 64 };
60 65
61 } // namespace cc 66 } // namespace cc
62 67
63 #endif // CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_ 68 #endif // CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_
OLDNEW
« no previous file with comments | « cc/BUILD.gn ('k') | cc/playback/discardable_image_map.cc » ('j') | cc/playback/image_id.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698