| 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_LAYER_TILING_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 16 #include "cc/base/region.h" | 16 #include "cc/base/region.h" |
| 17 #include "cc/base/tiling_data.h" | 17 #include "cc/base/tiling_data.h" |
| 18 #include "cc/resources/tile.h" | 18 #include "cc/resources/tile.h" |
| 19 #include "cc/resources/tile_priority.h" | 19 #include "cc/resources/tile_priority.h" |
| 20 #include "cc/trees/occlusion.h" | 20 #include "cc/trees/occlusion.h" |
| 21 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 namespace trace_event { | 24 namespace trace_event { |
| 25 class TracedValue; | 25 class TracedValue; |
| 26 } | 26 } |
| 27 | |
| 28 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
| 29 // new trace_event namespace. See crbug.com/451032. ETA: March 2015 | |
| 30 namespace debug { | |
| 31 using ::base::trace_event::TracedValue; | |
| 32 } | 27 } |
| 33 } // namespace base | |
| 34 | 28 |
| 35 namespace cc { | 29 namespace cc { |
| 36 | 30 |
| 37 class PictureLayerTiling; | 31 class PictureLayerTiling; |
| 38 class RasterSource; | 32 class RasterSource; |
| 39 | 33 |
| 40 class CC_EXPORT PictureLayerTilingClient { | 34 class CC_EXPORT PictureLayerTilingClient { |
| 41 public: | 35 public: |
| 42 // Create a tile at the given content_rect (in the contents scale of the | 36 // Create a tile at the given content_rect (in the contents scale of the |
| 43 // tiling) This might return null if the client cannot create such a tile. | 37 // tiling) This might return null if the client cannot create such a tile. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 protected: | 53 protected: |
| 60 virtual ~PictureLayerTilingClient() {} | 54 virtual ~PictureLayerTilingClient() {} |
| 61 }; | 55 }; |
| 62 | 56 |
| 63 class CC_EXPORT PictureLayerTiling { | 57 class CC_EXPORT PictureLayerTiling { |
| 64 public: | 58 public: |
| 65 static const int kBorderTexels = 1; | 59 static const int kBorderTexels = 1; |
| 66 | 60 |
| 67 ~PictureLayerTiling(); | 61 ~PictureLayerTiling(); |
| 68 | 62 |
| 63 static float CalculateSoonBorderDistance( |
| 64 const gfx::Rect& visible_rect_in_content_space, |
| 65 float content_to_screen_scale); |
| 66 |
| 69 // Create a tiling with no tiles. CreateTile() must be called to add some. | 67 // Create a tiling with no tiles. CreateTile() must be called to add some. |
| 70 static scoped_ptr<PictureLayerTiling> Create( | 68 static scoped_ptr<PictureLayerTiling> Create( |
| 71 float contents_scale, | 69 float contents_scale, |
| 72 scoped_refptr<RasterSource> raster_source, | 70 scoped_refptr<RasterSource> raster_source, |
| 73 PictureLayerTilingClient* client, | 71 PictureLayerTilingClient* client, |
| 74 size_t max_tiles_for_interest_area, | 72 size_t max_tiles_for_interest_area, |
| 75 float skewport_target_time_in_seconds, | 73 float skewport_target_time_in_seconds, |
| 76 int skewport_extrapolation_limit_in_content_pixels); | 74 int skewport_extrapolation_limit_in_content_pixels); |
| 77 | 75 |
| 78 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); | 76 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 }; | 205 }; |
| 208 | 206 |
| 209 void Reset(); | 207 void Reset(); |
| 210 | 208 |
| 211 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, | 209 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, |
| 212 float ideal_contents_scale, | 210 float ideal_contents_scale, |
| 213 double current_frame_time_in_seconds, | 211 double current_frame_time_in_seconds, |
| 214 const Occlusion& occlusion_in_layer_space); | 212 const Occlusion& occlusion_in_layer_space); |
| 215 | 213 |
| 216 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; | 214 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; |
| 217 void AsValueInto(base::debug::TracedValue* array) const; | 215 void AsValueInto(base::trace_event::TracedValue* array) const; |
| 218 size_t GPUMemoryUsageInBytes() const; | 216 size_t GPUMemoryUsageInBytes() const; |
| 219 | 217 |
| 220 struct RectExpansionCache { | 218 struct RectExpansionCache { |
| 221 RectExpansionCache(); | 219 RectExpansionCache(); |
| 222 | 220 |
| 223 gfx::Rect previous_start; | 221 gfx::Rect previous_start; |
| 224 gfx::Rect previous_bounds; | 222 gfx::Rect previous_bounds; |
| 225 gfx::Rect previous_result; | 223 gfx::Rect previous_result; |
| 226 int64 previous_target; | 224 int64 previous_target; |
| 227 }; | 225 }; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 321 |
| 324 private: | 322 private: |
| 325 DISALLOW_ASSIGN(PictureLayerTiling); | 323 DISALLOW_ASSIGN(PictureLayerTiling); |
| 326 | 324 |
| 327 RectExpansionCache expansion_cache_; | 325 RectExpansionCache expansion_cache_; |
| 328 }; | 326 }; |
| 329 | 327 |
| 330 } // namespace cc | 328 } // namespace cc |
| 331 | 329 |
| 332 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 330 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |