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_LIST_RECORDING_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
6 #define CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ | 6 #define CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void SetSlowdownRasterScaleFactor(int factor); | 45 void SetSlowdownRasterScaleFactor(int factor); |
46 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | 46 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); |
47 void SetBackgroundColor(SkColor background_color); | 47 void SetBackgroundColor(SkColor background_color); |
48 void SetRequiresClear(bool requires_clear); | 48 void SetRequiresClear(bool requires_clear); |
49 | 49 |
50 // These functions are virtual for testing. | 50 // These functions are virtual for testing. |
51 virtual scoped_refptr<DisplayListRasterSource> CreateRasterSource( | 51 virtual scoped_refptr<DisplayListRasterSource> CreateRasterSource( |
52 bool can_use_lcd_text) const; | 52 bool can_use_lcd_text) const; |
53 virtual bool IsSuitableForGpuRasterization() const; | 53 virtual bool IsSuitableForGpuRasterization() const; |
54 | 54 |
55 // Returns true if the new recorded viewport exposes enough new area to be | |
56 // worth re-recording. | |
57 static bool ExposesEnoughNewArea( | |
58 const gfx::Rect& current_recorded_viewport, | |
59 const gfx::Rect& potential_new_recorded_viewport, | |
60 const gfx::Size& layer_size); | |
61 | |
62 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 55 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
63 | 56 |
64 protected: | 57 protected: |
65 void Clear(); | 58 void Clear(); |
66 | 59 |
67 gfx::Rect recorded_viewport_; | 60 gfx::Rect recorded_viewport_; |
68 gfx::Size size_; | 61 gfx::Size size_; |
69 int slow_down_raster_scale_factor_for_debug_; | 62 int slow_down_raster_scale_factor_for_debug_; |
70 bool generate_discardable_images_metadata_; | 63 bool generate_discardable_images_metadata_; |
71 bool requires_clear_; | 64 bool requires_clear_; |
72 bool is_solid_color_; | 65 bool is_solid_color_; |
73 bool clear_canvas_with_debug_color_; | 66 bool clear_canvas_with_debug_color_; |
74 SkColor solid_color_; | 67 SkColor solid_color_; |
75 SkColor background_color_; | 68 SkColor background_color_; |
76 int pixel_record_distance_; | |
77 | 69 |
78 scoped_refptr<DisplayItemList> display_list_; | 70 scoped_refptr<DisplayItemList> display_list_; |
79 size_t painter_reported_memory_usage_; | 71 size_t painter_reported_memory_usage_; |
80 | 72 |
81 private: | 73 private: |
| 74 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, |
| 75 const gfx::Rect& new_recorded_viewport, |
| 76 Region* invalidation); |
| 77 |
82 friend class DisplayListRasterSource; | 78 friend class DisplayListRasterSource; |
83 | 79 |
84 void DetermineIfSolidColor(); | 80 void DetermineIfSolidColor(); |
85 | 81 |
86 DISALLOW_COPY_AND_ASSIGN(DisplayListRecordingSource); | 82 DISALLOW_COPY_AND_ASSIGN(DisplayListRecordingSource); |
87 }; | 83 }; |
88 | 84 |
89 } // namespace cc | 85 } // namespace cc |
90 | 86 |
91 #endif // CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ | 87 #endif // CC_PLAYBACK_DISPLAY_LIST_RECORDING_SOURCE_H_ |
OLD | NEW |