| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_RESOURCES_PICTURE_PILE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_H_ |
| 6 #define CC_RESOURCES_PICTURE_PILE_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_H_ |
| 7 | 7 |
| 8 #include <bitset> | 8 #include <bitset> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); | 22 PicturePile(float min_contents_scale, const gfx::Size& tile_grid_size); |
| 23 ~PicturePile() override; | 23 ~PicturePile() override; |
| 24 | 24 |
| 25 // RecordingSource overrides. | 25 // RecordingSource overrides. |
| 26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 26 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
| 27 Region* invalidation, | 27 Region* invalidation, |
| 28 const gfx::Size& layer_size, | 28 const gfx::Size& layer_size, |
| 29 const gfx::Rect& visible_layer_rect, | 29 const gfx::Rect& visible_layer_rect, |
| 30 int frame_number, | 30 int frame_number, |
| 31 RecordingMode recording_mode) override; | 31 RecordingMode recording_mode) override; |
| 32 void DidMoveToNewCompositor() override; |
| 32 scoped_refptr<RasterSource> CreateRasterSource( | 33 scoped_refptr<RasterSource> CreateRasterSource( |
| 33 bool can_use_lcd_text) const override; | 34 bool can_use_lcd_text) const override; |
| 34 gfx::Size GetSize() const final; | 35 gfx::Size GetSize() const final; |
| 35 void SetEmptyBounds() override; | 36 void SetEmptyBounds() override; |
| 36 void SetSlowdownRasterScaleFactor(int factor) override; | 37 void SetSlowdownRasterScaleFactor(int factor) override; |
| 37 void SetBackgroundColor(SkColor background_color) override; | 38 void SetBackgroundColor(SkColor background_color) override; |
| 38 void SetRequiresClear(bool requires_clear) override; | 39 void SetRequiresClear(bool requires_clear) override; |
| 39 bool IsSuitableForGpuRasterization() const override; | 40 bool IsSuitableForGpuRasterization() const override; |
| 40 void SetUnsuitableForGpuRasterizationForTesting() override; | 41 void SetUnsuitableForGpuRasterizationForTesting() override; |
| 41 gfx::Size GetTileGridSizeForTesting() const override; | 42 gfx::Size GetTileGridSizeForTesting() const override; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 class CC_EXPORT PictureInfo { | 45 class CC_EXPORT PictureInfo { |
| 45 public: | 46 public: |
| 46 enum { INVALIDATION_FRAMES_TRACKED = 32 }; | 47 enum { INVALIDATION_FRAMES_TRACKED = 32 }; |
| 47 | 48 |
| 48 PictureInfo(); | 49 PictureInfo(); |
| 49 ~PictureInfo(); | 50 ~PictureInfo(); |
| 50 | 51 |
| 51 bool Invalidate(int frame_number); | 52 bool Invalidate(int frame_number); |
| 52 bool NeedsRecording(int frame_number, int distance_to_visible); | 53 bool NeedsRecording(int frame_number, int distance_to_visible); |
| 53 void SetPicture(scoped_refptr<Picture> picture); | 54 void SetPicture(scoped_refptr<Picture> picture); |
| 54 const Picture* GetPicture() const; | 55 const Picture* GetPicture() const; |
| 55 | 56 |
| 56 float GetInvalidationFrequencyForTesting() const { | 57 float GetInvalidationFrequencyForTesting() const { |
| 57 return GetInvalidationFrequency(); | 58 return GetInvalidationFrequency(); |
| 58 } | 59 } |
| 59 | 60 |
| 61 void ResetInvalidationHistory(); |
| 62 |
| 60 private: | 63 private: |
| 61 void AdvanceInvalidationHistory(int frame_number); | 64 void AdvanceInvalidationHistory(int frame_number); |
| 62 float GetInvalidationFrequency() const; | 65 float GetInvalidationFrequency() const; |
| 63 | 66 |
| 64 int last_frame_number_; | 67 int last_frame_number_; |
| 65 scoped_refptr<const Picture> picture_; | 68 scoped_refptr<const Picture> picture_; |
| 66 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_; | 69 std::bitset<INVALIDATION_FRAMES_TRACKED> invalidation_history_; |
| 67 }; | 70 }; |
| 68 | 71 |
| 69 typedef std::pair<int, int> PictureMapKey; | 72 typedef std::pair<int, int> PictureMapKey; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void SetBufferPixels(int buffer_pixels); | 127 void SetBufferPixels(int buffer_pixels); |
| 125 | 128 |
| 126 bool is_suitable_for_gpu_rasterization_; | 129 bool is_suitable_for_gpu_rasterization_; |
| 127 | 130 |
| 128 DISALLOW_COPY_AND_ASSIGN(PicturePile); | 131 DISALLOW_COPY_AND_ASSIGN(PicturePile); |
| 129 }; | 132 }; |
| 130 | 133 |
| 131 } // namespace cc | 134 } // namespace cc |
| 132 | 135 |
| 133 #endif // CC_RESOURCES_PICTURE_PILE_H_ | 136 #endif // CC_RESOURCES_PICTURE_PILE_H_ |
| OLD | NEW |