| OLD | NEW |
| 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 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ |
| 6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ | 6 #define CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
| 18 #include "cc/base/contiguous_container.h" | 18 #include "cc/base/contiguous_container.h" |
| 19 #include "cc/base/rtree.h" | 19 #include "cc/base/rtree.h" |
| 20 #include "cc/playback/discardable_image_map.h" | 20 #include "cc/playback/discardable_image_map.h" |
| 21 #include "cc/playback/display_item.h" | 21 #include "cc/playback/display_item.h" |
| 22 #include "cc/playback/display_item_list_settings.h" | 22 #include "cc/playback/display_item_list_settings.h" |
| 23 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
| 24 #include "ui/gfx/color_space.h" |
| 24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 25 #include "ui/gfx/geometry/rect_conversions.h" | 26 #include "ui/gfx/geometry/rect_conversions.h" |
| 26 | 27 |
| 27 class SkCanvas; | 28 class SkCanvas; |
| 28 | 29 |
| 29 namespace cc { | 30 namespace cc { |
| 30 class ClientPictureCache; | 31 class ClientPictureCache; |
| 31 class DisplayItem; | 32 class DisplayItem; |
| 32 | 33 |
| 33 namespace proto { | 34 namespace proto { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 } | 136 } |
| 136 | 137 |
| 137 // Called after all items are appended, to process the items and, if | 138 // Called after all items are appended, to process the items and, if |
| 138 // applicable, create an internally cached SkPicture. | 139 // applicable, create an internally cached SkPicture. |
| 139 void Finalize(); | 140 void Finalize(); |
| 140 | 141 |
| 141 void SetIsSuitableForGpuRasterization(bool is_suitable) { | 142 void SetIsSuitableForGpuRasterization(bool is_suitable) { |
| 142 inputs_.all_items_are_suitable_for_gpu_rasterization = is_suitable; | 143 inputs_.all_items_are_suitable_for_gpu_rasterization = is_suitable; |
| 143 } | 144 } |
| 144 bool IsSuitableForGpuRasterization() const; | 145 bool IsSuitableForGpuRasterization() const; |
| 146 |
| 147 void SetImpliedColorSpace(const gfx::ColorSpace& implied_color_space) { |
| 148 inputs_.implied_color_space_specified = true; |
| 149 inputs_.implied_color_space = implied_color_space; |
| 150 } |
| 151 bool HasImpliedColorSpace() const { |
| 152 return inputs_.implied_color_space_specified; |
| 153 } |
| 154 const gfx::ColorSpace& GetImpliedColorSpace() const { |
| 155 return inputs_.implied_color_space; |
| 156 } |
| 157 |
| 145 int ApproximateOpCount() const; | 158 int ApproximateOpCount() const; |
| 146 size_t ApproximateMemoryUsage() const; | 159 size_t ApproximateMemoryUsage() const; |
| 147 bool ShouldBeAnalyzedForSolidColor() const; | 160 bool ShouldBeAnalyzedForSolidColor() const; |
| 148 | 161 |
| 149 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue( | 162 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> AsValue( |
| 150 bool include_items) const; | 163 bool include_items) const; |
| 151 | 164 |
| 152 void EmitTraceSnapshot() const; | 165 void EmitTraceSnapshot() const; |
| 153 | 166 |
| 154 void GenerateDiscardableImagesMetadata(); | 167 void GenerateDiscardableImagesMetadata(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 ContiguousContainer<DisplayItem> items; | 221 ContiguousContainer<DisplayItem> items; |
| 209 // The visual rects associated with each of the display items in the | 222 // The visual rects associated with each of the display items in the |
| 210 // display item list. There is one rect per display item, and the | 223 // display item list. There is one rect per display item, and the |
| 211 // position in |visual_rects| matches the position of the item in | 224 // position in |visual_rects| matches the position of the item in |
| 212 // |items| . These rects are intentionally kept separate | 225 // |items| . These rects are intentionally kept separate |
| 213 // because they are not needed while walking the |items| for raster. | 226 // because they are not needed while walking the |items| for raster. |
| 214 std::vector<gfx::Rect> visual_rects; | 227 std::vector<gfx::Rect> visual_rects; |
| 215 std::vector<size_t> begin_item_indices; | 228 std::vector<size_t> begin_item_indices; |
| 216 const DisplayItemListSettings settings; | 229 const DisplayItemListSettings settings; |
| 217 bool all_items_are_suitable_for_gpu_rasterization = true; | 230 bool all_items_are_suitable_for_gpu_rasterization = true; |
| 231 bool implied_color_space_specified = false; |
| 232 gfx::ColorSpace implied_color_space; |
| 218 }; | 233 }; |
| 219 | 234 |
| 220 Inputs inputs_; | 235 Inputs inputs_; |
| 221 | 236 |
| 222 friend class base::RefCountedThreadSafe<DisplayItemList>; | 237 friend class base::RefCountedThreadSafe<DisplayItemList>; |
| 223 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); | 238 FRIEND_TEST_ALL_PREFIXES(DisplayItemListTest, ApproximateMemoryUsage); |
| 224 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); | 239 DISALLOW_COPY_AND_ASSIGN(DisplayItemList); |
| 225 }; | 240 }; |
| 226 | 241 |
| 227 } // namespace cc | 242 } // namespace cc |
| 228 | 243 |
| 229 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ | 244 #endif // CC_PLAYBACK_DISPLAY_ITEM_LIST_H_ |
| OLD | NEW |