| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PICTURE_LAYER_TILING_SET_H_ | |
| 6 #define CC_PICTURE_LAYER_TILING_SET_H_ | |
| 7 | |
| 8 #include "cc/base/region.h" | |
| 9 #include "cc/base/scoped_ptr_vector.h" | |
| 10 #include "cc/picture_layer_tiling.h" | |
| 11 #include "ui/gfx/size.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 class CC_EXPORT PictureLayerTilingSet { | |
| 16 public: | |
| 17 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); | |
| 18 ~PictureLayerTilingSet(); | |
| 19 | |
| 20 void SetClient(PictureLayerTilingClient* client); | |
| 21 | |
| 22 // Shallow copies all data (except client and bounds from other). | |
| 23 void CloneAll( | |
| 24 const PictureLayerTilingSet& other, | |
| 25 const Region& invalidation, | |
| 26 float minimum_contents_scale); | |
| 27 void Clone(const PictureLayerTiling* tiling, const Region& invalidation); | |
| 28 | |
| 29 void SetLayerBounds(gfx::Size layer_bounds); | |
| 30 gfx::Size LayerBounds() const; | |
| 31 | |
| 32 PictureLayerTiling* AddTiling(float contents_scale); | |
| 33 size_t num_tilings() const { return tilings_.size(); } | |
| 34 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | |
| 35 const PictureLayerTiling* tiling_at(size_t idx) const { | |
| 36 return tilings_[idx]; | |
| 37 } | |
| 38 | |
| 39 // Remove all tilings. | |
| 40 void RemoveAllTilings(); | |
| 41 | |
| 42 // Remove one tiling. | |
| 43 void Remove(PictureLayerTiling* tiling); | |
| 44 | |
| 45 // Remove all tiles; keep all tilings. | |
| 46 void RemoveAllTiles(); | |
| 47 | |
| 48 // For all tilings, create any tile that intersects |layer_rect|. | |
| 49 void CreateTilesFromLayerRect(gfx::Rect layer_rect); | |
| 50 | |
| 51 void UpdateTilePriorities( | |
| 52 WhichTree tree, | |
| 53 gfx::Size device_viewport, | |
| 54 gfx::Rect viewport_in_content_space, | |
| 55 gfx::Size last_layer_bounds, | |
| 56 gfx::Size current_layer_bounds, | |
| 57 float last_layer_contents_scale, | |
| 58 float current_layer_contents_scale, | |
| 59 const gfx::Transform& last_screen_transform, | |
| 60 const gfx::Transform& current_screen_transform, | |
| 61 int current_source_frame_number, | |
| 62 double current_frame_time, | |
| 63 bool store_screen_space_quads_on_tiles); | |
| 64 | |
| 65 void DidBecomeActive(); | |
| 66 | |
| 67 // For a given rect, iterates through tiles that can fill it. If no | |
| 68 // set of tiles with resources can fill the rect, then it will iterate | |
| 69 // through null tiles with valid geometry_rect() until the rect is full. | |
| 70 // If all tiles have resources, the union of all geometry_rects will | |
| 71 // exactly fill rect with no overlap. | |
| 72 class CC_EXPORT Iterator { | |
| 73 public: | |
| 74 Iterator(const PictureLayerTilingSet* set, | |
| 75 float contents_scale, | |
| 76 gfx::Rect content_rect, | |
| 77 float ideal_contents_scale, | |
| 78 PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment); | |
| 79 ~Iterator(); | |
| 80 | |
| 81 // Visible rect (no borders), always in the space of rect, | |
| 82 // regardless of the relative contents scale of the tiling. | |
| 83 gfx::Rect geometry_rect() const; | |
| 84 // Texture rect (in texels) for geometry_rect | |
| 85 gfx::RectF texture_rect() const; | |
| 86 // Texture size in texels | |
| 87 gfx::Size texture_size() const; | |
| 88 | |
| 89 Tile* operator->() const; | |
| 90 Tile* operator*() const; | |
| 91 | |
| 92 Iterator& operator++(); | |
| 93 operator bool() const; | |
| 94 | |
| 95 PictureLayerTiling* CurrentTiling(); | |
| 96 | |
| 97 private: | |
| 98 int NextTiling() const; | |
| 99 | |
| 100 const PictureLayerTilingSet* set_; | |
| 101 float contents_scale_; | |
| 102 float ideal_contents_scale_; | |
| 103 PictureLayerTiling::LayerDeviceAlignment layer_device_alignment_; | |
| 104 PictureLayerTiling::Iterator tiling_iter_; | |
| 105 int current_tiling_; | |
| 106 int ideal_tiling_; | |
| 107 | |
| 108 Region current_region_; | |
| 109 Region missing_region_; | |
| 110 Region::Iterator region_iter_; | |
| 111 }; | |
| 112 | |
| 113 scoped_ptr<base::Value> AsValue() const; | |
| 114 | |
| 115 private: | |
| 116 PictureLayerTilingClient* client_; | |
| 117 gfx::Size layer_bounds_; | |
| 118 ScopedPtrVector<PictureLayerTiling> tilings_; | |
| 119 | |
| 120 friend class Iterator; | |
| 121 }; | |
| 122 | |
| 123 } // namespace cc | |
| 124 | |
| 125 #endif // CC_PICTURE_LAYER_TILING_SET_H_ | |
| OLD | NEW |