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_IMPL_H_ | |
6 #define CC_PICTURE_LAYER_IMPL_H_ | |
7 | |
8 #include "cc/base/scoped_ptr_vector.h" | |
9 #include "cc/layer_impl.h" | |
10 #include "cc/resources/picture_layer_tiling.h" | |
11 #include "cc/resources/picture_layer_tiling_set.h" | |
12 #include "cc/resources/picture_pile_impl.h" | |
13 #include "skia/ext/refptr.h" | |
14 #include "third_party/skia/include/core/SkPicture.h" | |
15 | |
16 namespace cc { | |
17 | |
18 struct AppendQuadsData; | |
19 class QuadSink; | |
20 | |
21 class CC_EXPORT PictureLayerImpl : public LayerImpl, | |
22 public PictureLayerTilingClient { | |
23 public: | |
24 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | |
25 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); | |
26 } | |
27 virtual ~PictureLayerImpl(); | |
28 | |
29 // LayerImpl overrides. | |
30 virtual const char* LayerTypeAsString() const OVERRIDE; | |
31 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | |
32 OVERRIDE; | |
33 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | |
34 virtual void AppendQuads(QuadSink* quad_sink, | |
35 AppendQuadsData* append_quads_data) OVERRIDE; | |
36 virtual void DumpLayerProperties(std::string* str, int indent) const OVERRIDE; | |
37 virtual void UpdateTilePriorities() OVERRIDE; | |
38 virtual void DidBecomeActive() OVERRIDE; | |
39 virtual void DidLoseOutputSurface() OVERRIDE; | |
40 virtual void CalculateContentsScale(float ideal_contents_scale, | |
41 bool animating_transform_to_screen, | |
42 float* contents_scale_x, | |
43 float* contents_scale_y, | |
44 gfx::Size* content_bounds) OVERRIDE; | |
45 virtual skia::RefPtr<SkPicture> GetPicture() OVERRIDE; | |
46 | |
47 // PictureLayerTilingClient overrides. | |
48 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, | |
49 gfx::Rect content_rect) OVERRIDE; | |
50 virtual void UpdatePile(Tile* tile) OVERRIDE; | |
51 virtual gfx::Size CalculateTileSize( | |
52 gfx::Size current_tile_size, | |
53 gfx::Size content_bounds) OVERRIDE; | |
54 | |
55 // PushPropertiesTo active tree => pending tree | |
56 void SyncFromActiveLayer(); | |
57 void SyncTiling( | |
58 const PictureLayerTiling* tiling, | |
59 const Region& pending_layer_invalidation); | |
60 | |
61 void CreateTilingSet(); | |
62 void TransferTilingSet(scoped_ptr<PictureLayerTilingSet> tilings); | |
63 | |
64 // Mask-related functions | |
65 void SetIsMask(bool is_mask); | |
66 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; | |
67 | |
68 virtual bool AreVisibleResourcesReady() const OVERRIDE; | |
69 | |
70 virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; | |
71 | |
72 protected: | |
73 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | |
74 PictureLayerTiling* AddTiling(float contents_scale); | |
75 void RemoveTiling(float contents_scale); | |
76 void SyncFromActiveLayer(const PictureLayerImpl* other); | |
77 void ManageTilings(bool animating_transform_to_screen); | |
78 virtual void CalculateRasterContentsScale( | |
79 bool animating_transform_to_screen, | |
80 float* raster_contents_scale, | |
81 float* low_res_raster_contents_scale); | |
82 void CleanUpTilingsOnActiveLayer( | |
83 std::vector<PictureLayerTiling*> used_tilings); | |
84 PictureLayerImpl* PendingTwin() const; | |
85 PictureLayerImpl* ActiveTwin() const; | |
86 float MinimumContentsScale() const; | |
87 | |
88 virtual void GetDebugBorderProperties( | |
89 SkColor* color, float* width) const OVERRIDE; | |
90 | |
91 scoped_ptr<PictureLayerTilingSet> tilings_; | |
92 scoped_refptr<PicturePileImpl> pile_; | |
93 Region invalidation_; | |
94 | |
95 gfx::Transform last_screen_space_transform_; | |
96 gfx::Size last_bounds_; | |
97 float last_content_scale_; | |
98 float ideal_contents_scale_; | |
99 bool is_mask_; | |
100 | |
101 float ideal_page_scale_; | |
102 float ideal_device_scale_; | |
103 float ideal_source_scale_; | |
104 | |
105 float raster_page_scale_; | |
106 float raster_device_scale_; | |
107 float raster_source_scale_; | |
108 bool raster_source_scale_was_animating_; | |
109 | |
110 friend class PictureLayer; | |
111 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | |
112 }; | |
113 | |
114 } | |
115 | |
116 #endif // CC_PICTURE_LAYER_IMPL_H_ | |
OLD | NEW |