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 | |
7 #include "cc/math_util.h" | |
6 #include "ui/gfx/rect_conversions.h" | 8 #include "ui/gfx/rect_conversions.h" |
7 #include "ui/gfx/size_conversions.h" | 9 #include "ui/gfx/size_conversions.h" |
8 | 10 |
9 namespace cc { | 11 namespace cc { |
10 | 12 |
11 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( | 13 scoped_ptr<PictureLayerTiling> PictureLayerTiling::Create( |
12 float contents_scale, | 14 float contents_scale, |
13 gfx::Size tile_size) { | 15 gfx::Size tile_size) { |
14 return make_scoped_ptr(new PictureLayerTiling(contents_scale, tile_size)); | 16 return make_scoped_ptr(new PictureLayerTiling(contents_scale, tile_size)); |
15 } | 17 } |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 DCHECK_LE(texture_rect.right(), texture_size().width()); | 261 DCHECK_LE(texture_rect.right(), texture_size().width()); |
260 DCHECK_LE(texture_rect.bottom(), texture_size().height()); | 262 DCHECK_LE(texture_rect.bottom(), texture_size().height()); |
261 | 263 |
262 return texture_rect; | 264 return texture_rect; |
263 } | 265 } |
264 | 266 |
265 gfx::Size PictureLayerTiling::Iterator::texture_size() const { | 267 gfx::Size PictureLayerTiling::Iterator::texture_size() const { |
266 return tiling_->tiling_data_.max_texture_size(); | 268 return tiling_->tiling_data_.max_texture_size(); |
267 } | 269 } |
268 | 270 |
271 void PictureLayerTiling::UpdateTilePriorities( | |
272 const gfx::Size& view_port, | |
273 float layer_content_scale, | |
274 const gfx::Transform& last_screen_transform, | |
275 const gfx::Transform& current_screen_transform, | |
276 double time_delta) { | |
277 gfx::Rect countent_rect = ContentRect(); | |
278 if (countent_rect.IsEmpty()) | |
279 return; | |
280 | |
281 gfx::Rect view_rect(gfx::Point(), view_port); | |
282 int right = tiling_data_.TileXIndexFromSrcCoord(countent_rect.width() - 1); | |
283 int bottom = tiling_data_.TileYIndexFromSrcCoord(countent_rect.height() - 1); | |
284 for (int j = 0; j <= bottom; ++j) { | |
285 for (int i = 0; i <= right; ++i) { | |
286 gfx::Rect content_rect = tiling_data_.TileBounds(i, j); | |
287 gfx::Rect layer_content_rect = gfx::ToEnclosingRect( | |
288 gfx::ScaleRect(content_rect, layer_content_scale / contents_scale_)); | |
danakj
2012/12/01 00:07:31
Maybe you should just pass in both content scale X
qinmin
2012/12/01 01:07:02
Done.
| |
289 gfx::Rect screen_rect = MathUtil::mapClippedRect( | |
290 current_screen_transform, layer_content_rect); | |
291 gfx::Rect previous_rect = MathUtil::mapClippedRect( | |
292 last_screen_transform, layer_content_rect); | |
danakj
2012/12/01 00:07:31
Don't you need the last_layer_content_rect here to
qinmin
2012/12/01 01:07:02
Yes, this is some of our concerns.
If tiling_conte
| |
293 | |
294 TilePriority priority; | |
295 priority.resolution = HIGH_RESOLUTION; | |
296 priority.time_to_visible_in_seconds = | |
297 TilePriority::TimeForBoundsToIntersect( | |
298 previous_rect, screen_rect, time_delta, view_rect); | |
299 | |
300 priority.distance_to_visible_in_pixels = | |
301 TilePriority::manhattanDistance(screen_rect, view_rect); | |
302 // TODO(qinmin): pass the correct tree to this function. | |
303 TileAt(i, j)->set_priority(ACTIVE_TREE, priority); | |
304 } | |
305 } | |
306 } | |
307 | |
269 } // namespace cc | 308 } // namespace cc |
OLD | NEW |