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_tiling.h" | 5 #include "cc/picture_layer_tiling.h" |
6 | 6 |
7 #include "cc/math_util.h" | 7 #include "cc/math_util.h" |
8 #include "ui/gfx/rect_conversions.h" | 8 #include "ui/gfx/rect_conversions.h" |
9 #include "ui/gfx/size_conversions.h" | 9 #include "ui/gfx/size_conversions.h" |
10 | 10 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 PictureLayerTiling::Iterator::Iterator() | 136 PictureLayerTiling::Iterator::Iterator() |
137 : tiling_(NULL), | 137 : tiling_(NULL), |
138 current_tile_(NULL), | 138 current_tile_(NULL), |
139 tile_i_(0), | 139 tile_i_(0), |
140 tile_j_(0), | 140 tile_j_(0), |
141 left_(0), | 141 left_(0), |
142 top_(0), | 142 top_(0), |
143 right_(0), | 143 right_(-1), |
144 bottom_(0) { | 144 bottom_(-1) { |
145 } | 145 } |
146 | 146 |
147 PictureLayerTiling::Iterator::Iterator(const PictureLayerTiling* tiling, | 147 PictureLayerTiling::Iterator::Iterator(const PictureLayerTiling* tiling, |
148 float dest_scale, | 148 float dest_scale, |
149 gfx::Rect dest_rect) | 149 gfx::Rect dest_rect) |
150 : tiling_(tiling), | 150 : tiling_(tiling), |
151 dest_rect_(dest_rect), | 151 dest_rect_(dest_rect), |
152 dest_to_content_scale_(tiling_->contents_scale_ / dest_scale), | 152 dest_to_content_scale_(tiling_->contents_scale_ / dest_scale), |
153 current_tile_(NULL), | 153 current_tile_(NULL), |
154 tile_i_(0), | 154 tile_i_(0), |
155 tile_j_(0), | 155 tile_j_(0), |
156 left_(0), | 156 left_(0), |
157 top_(0), | 157 top_(0), |
158 right_(0), | 158 right_(-1), |
159 bottom_(0) { | 159 bottom_(-1) { |
160 DCHECK(tiling_); | 160 DCHECK(tiling_); |
161 if (dest_rect_.IsEmpty()) | 161 if (dest_rect_.IsEmpty()) |
162 return; | 162 return; |
163 | 163 |
164 gfx::Rect content_rect = | 164 gfx::Rect content_rect = |
165 gfx::ToEnclosingRect(gfx::ScaleRect(dest_rect_, dest_to_content_scale_)); | 165 gfx::ToEnclosingRect(gfx::ScaleRect(dest_rect_, dest_to_content_scale_)); |
166 | 166 |
167 left_ = tiling_->tiling_data_.TileXIndexFromSrcCoord(content_rect.x()); | 167 left_ = tiling_->tiling_data_.TileXIndexFromSrcCoord(content_rect.x()); |
168 top_ = tiling_->tiling_data_.TileYIndexFromSrcCoord(content_rect.y()); | 168 top_ = tiling_->tiling_data_.TileYIndexFromSrcCoord(content_rect.y()); |
169 right_ = tiling_->tiling_data_.TileXIndexFromSrcCoord( | 169 right_ = tiling_->tiling_data_.TileXIndexFromSrcCoord( |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 void PictureLayerTiling::MoveTilePriorities(WhichTree src_tree, | 318 void PictureLayerTiling::MoveTilePriorities(WhichTree src_tree, |
319 WhichTree dst_tree) { | 319 WhichTree dst_tree) { |
320 DCHECK(src_tree != dst_tree); | 320 DCHECK(src_tree != dst_tree); |
321 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { | 321 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
322 it->second->set_priority(dst_tree, it->second->priority(src_tree)); | 322 it->second->set_priority(dst_tree, it->second->priority(src_tree)); |
323 it->second->set_priority(src_tree, TilePriority()); | 323 it->second->set_priority(src_tree, TilePriority()); |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 } // namespace cc | 327 } // namespace cc |
OLD | NEW |