| OLD | NEW |
| 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_PAINT_DISCARDABLE_IMAGE_MAP_H_ | 5 #ifndef CC_PAINT_DISCARDABLE_IMAGE_MAP_H_ |
| 6 #define CC_PAINT_DISCARDABLE_IMAGE_MAP_H_ | 6 #define CC_PAINT_DISCARDABLE_IMAGE_MAP_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | |
| 9 #include <utility> | 8 #include <utility> |
| 10 #include <vector> | 9 #include <vector> |
| 11 | 10 |
| 11 #include "base/containers/flat_map.h" |
| 12 #include "cc/base/rtree.h" | 12 #include "cc/base/rtree.h" |
| 13 #include "cc/paint/draw_image.h" | 13 #include "cc/paint/draw_image.h" |
| 14 #include "cc/paint/image_id.h" | 14 #include "cc/paint/image_id.h" |
| 15 #include "cc/paint/paint_export.h" | 15 #include "cc/paint/paint_export.h" |
| 16 #include "third_party/skia/include/core/SkCanvas.h" | 16 #include "third_party/skia/include/core/SkCanvas.h" |
| 17 #include "third_party/skia/include/core/SkRefCnt.h" | 17 #include "third_party/skia/include/core/SkRefCnt.h" |
| 18 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
| 19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 52 gfx::Rect GetRectForImage(ImageId image_id) const; | 52 gfx::Rect GetRectForImage(ImageId image_id) const; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class ScopedMetadataGenerator; | 55 friend class ScopedMetadataGenerator; |
| 56 friend class DiscardableImageMapTest; | 56 friend class DiscardableImageMapTest; |
| 57 | 57 |
| 58 std::unique_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds); | 58 std::unique_ptr<SkCanvas> BeginGeneratingMetadata(const gfx::Size& bounds); |
| 59 void EndGeneratingMetadata(); | 59 void EndGeneratingMetadata(); |
| 60 | 60 |
| 61 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_; | 61 std::vector<std::pair<DrawImage, gfx::Rect>> all_images_; |
| 62 std::unordered_map<ImageId, gfx::Rect> image_id_to_rect_; | 62 base::flat_map<ImageId, gfx::Rect> image_id_to_rect_; |
| 63 | 63 |
| 64 RTree images_rtree_; | 64 RTree images_rtree_; |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace cc | 67 } // namespace cc |
| 68 | 68 |
| 69 #endif // CC_PAINT_DISCARDABLE_IMAGE_MAP_H_ | 69 #endif // CC_PAINT_DISCARDABLE_IMAGE_MAP_H_ |
| OLD | NEW |