OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_PLAYBACK_RECORDING_SOURCE_H_ | |
6 #define CC_PLAYBACK_RECORDING_SOURCE_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/ref_counted.h" | |
14 #include "cc/base/cc_export.h" | |
15 #include "cc/base/invalidation_region.h" | |
16 #include "third_party/skia/include/core/SkColor.h" | |
17 #include "ui/gfx/geometry/rect.h" | |
18 #include "ui/gfx/geometry/size.h" | |
19 | |
20 namespace cc { | |
21 | |
22 class DisplayItemList; | |
23 class RasterSource; | |
24 class Region; | |
25 | |
26 class CC_EXPORT RecordingSource { | |
27 public: | |
28 enum RecordingMode { | |
29 RECORD_NORMALLY, | |
30 RECORD_WITH_PAINTING_DISABLED, | |
31 RECORD_WITH_CACHING_DISABLED, | |
32 RECORD_WITH_CONSTRUCTION_DISABLED, | |
33 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, | |
34 RECORD_WITH_PARTIAL_INVALIDATION, | |
35 RECORDING_MODE_COUNT, // Must be the last entry. | |
36 }; | |
37 | |
38 RecordingSource(); | |
39 virtual ~RecordingSource(); | |
40 | |
41 bool UpdateAndExpandInvalidation(Region* invalidation, | |
42 const gfx::Size& layer_size, | |
43 const gfx::Rect& new_recorded_viewport); | |
44 void UpdateDisplayItemList(const scoped_refptr<DisplayItemList>& display_list, | |
45 const size_t& painter_reported_memory_usage); | |
46 gfx::Size GetSize() const; | |
47 void SetEmptyBounds(); | |
48 void SetSlowdownRasterScaleFactor(int factor); | |
49 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | |
50 void SetBackgroundColor(SkColor background_color); | |
51 void SetRequiresClear(bool requires_clear); | |
52 | |
53 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); | |
54 | |
55 // These functions are virtual for testing. | |
56 virtual scoped_refptr<RasterSource> CreateRasterSource( | |
57 bool can_use_lcd_text) const; | |
58 | |
59 const DisplayItemList* GetDisplayItemList(); | |
60 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | |
61 | |
62 protected: | |
63 gfx::Rect recorded_viewport_; | |
64 gfx::Size size_; | |
65 int slow_down_raster_scale_factor_for_debug_; | |
66 bool generate_discardable_images_metadata_; | |
67 bool requires_clear_; | |
68 bool is_solid_color_; | |
69 bool clear_canvas_with_debug_color_; | |
70 SkColor solid_color_; | |
71 SkColor background_color_; | |
72 scoped_refptr<DisplayItemList> display_list_; | |
73 size_t painter_reported_memory_usage_; | |
74 | |
75 private: | |
76 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, | |
77 const gfx::Rect& new_recorded_viewport, | |
78 Region* invalidation); | |
79 | |
80 void FinishDisplayItemListUpdate(); | |
81 | |
82 friend class RasterSource; | |
83 | |
84 void DetermineIfSolidColor(); | |
85 | |
86 InvalidationRegion invalidation_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(RecordingSource); | |
89 }; | |
90 | |
91 } // namespace cc | |
92 | |
93 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ | |
OLD | NEW |