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 #include "cc/picture_layer_impl.h" | 5 #include "cc/picture_layer_impl.h" |
6 | 6 |
7 #include "cc/layer_tree_host_impl.h" | 7 #include "cc/layer_tree_host_impl.h" |
8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
9 #include "cc/quad_sink.h" | 9 #include "cc/quad_sink.h" |
10 #include "cc/tile_draw_quad.h" | 10 #include "cc/tile_draw_quad.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 drawTransform(), | 37 drawTransform(), |
38 gfx::QuadF(visible_rect), | 38 gfx::QuadF(visible_rect), |
39 clipped); | 39 clipped); |
40 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); | 40 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); |
41 bool useAA = !isAxisAlignedInTarget; | 41 bool useAA = !isAxisAlignedInTarget; |
42 | 42 |
43 // TODO(enne): Generate quads from multiple tilings. | 43 // TODO(enne): Generate quads from multiple tilings. |
44 PictureLayerTiling* tiling = tilings_[0]; | 44 PictureLayerTiling* tiling = tilings_[0]; |
45 for (PictureLayerTiling::Iterator iter(tiling, visible_rect); iter; ++iter) { | 45 for (PictureLayerTiling::Iterator iter(tiling, visible_rect); iter; ++iter) { |
46 ResourceProvider::ResourceId resource; | 46 ResourceProvider::ResourceId resource; |
47 if (*iter) { | 47 if (*iter) |
48 resource = iter->GetDrawableResourceId( | 48 resource = iter->resource_id(); |
49 layerTreeHostImpl()->sourceFrameNumber()); | |
50 } | |
51 | 49 |
52 if (!resource) { | 50 if (!resource) { |
53 // TODO(enne): draw checkerboards, etc... | 51 // TODO(enne): draw checkerboards, etc... |
54 continue; | 52 continue; |
55 } | 53 } |
56 | 54 |
57 gfx::Rect geometry_rect = iter.geometry_rect(); | 55 gfx::Rect geometry_rect = iter.geometry_rect(); |
58 gfx::Rect texture_rect = iter.texture_rect(); | 56 gfx::Rect texture_rect = iter.texture_rect(); |
59 gfx::Rect opaque_rect = iter.opaque_rect(); | 57 gfx::Rect opaque_rect = iter.opaque_rect(); |
60 | 58 |
(...skipping 21 matching lines...) Expand all Loading... |
82 // TODO(enne): implement me | 80 // TODO(enne): implement me |
83 } | 81 } |
84 | 82 |
85 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, | 83 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling*, |
86 gfx::Rect rect) { | 84 gfx::Rect rect) { |
87 // TODO(nduca): where does this come from? | 85 // TODO(nduca): where does this come from? |
88 TileManager* tile_manager = NULL; | 86 TileManager* tile_manager = NULL; |
89 | 87 |
90 return make_scoped_refptr(new Tile( | 88 return make_scoped_refptr(new Tile( |
91 tile_manager, | 89 tile_manager, |
| 90 &pile_, |
92 rect.size(), | 91 rect.size(), |
93 GL_RGBA, | 92 GL_RGBA, |
94 rect, | 93 rect)); |
95 NORMAL_TILE_QUALITY)); | |
96 } | 94 } |
97 | 95 |
98 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { | 96 void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { |
99 tilings_.clear(); | 97 tilings_.clear(); |
100 for (size_t i = 0; i < other->tilings_.size(); ++i) { | 98 for (size_t i = 0; i < other->tilings_.size(); ++i) { |
101 scoped_ptr<PictureLayerTiling> clone = other->tilings_[i]->Clone(); | 99 scoped_ptr<PictureLayerTiling> clone = other->tilings_[i]->Clone(); |
102 clone->set_client(this); | 100 clone->set_client(this); |
103 tilings_.append(clone.Pass()); | 101 tilings_.append(clone.Pass()); |
104 } | 102 } |
105 } | 103 } |
106 | 104 |
107 void PictureLayerImpl::Update() { | 105 void PictureLayerImpl::Update() { |
108 // TODO(enne): Add more tilings during pinch zoom. | 106 // TODO(enne): Add more tilings during pinch zoom. |
109 if (!tilings_.size()) { | 107 if (!tilings_.size()) { |
110 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize; | 108 gfx::Size tile_size = layerTreeHostImpl()->settings().defaultTileSize; |
111 | 109 |
112 scoped_ptr<PictureLayerTiling> tiling = PictureLayerTiling::Create( | 110 scoped_ptr<PictureLayerTiling> tiling = PictureLayerTiling::Create( |
113 tile_size); | 111 tile_size); |
114 tiling->set_client(this); | 112 tiling->set_client(this); |
115 tiling->SetBounds(contentBounds()); | 113 tiling->SetBounds(contentBounds()); |
116 tiling->create_tiles(gfx::Rect(gfx::Point(), contentBounds())); | 114 tiling->create_tiles(gfx::Rect(gfx::Point(), contentBounds())); |
117 tilings_.append(tiling.Pass()); | 115 tilings_.append(tiling.Pass()); |
118 | 116 |
119 // TODO(enne): handle invalidations, create new tiles | 117 // TODO(enne): handle invalidations, create new tiles |
120 } | 118 } |
121 } | 119 } |
122 | 120 |
123 } // namespace cc | 121 } // namespace cc |
OLD | NEW |