Chromium Code Reviews| 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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/math_util.h" | 8 #include "cc/math_util.h" |
| 9 #include "ui/gfx/point_conversions.h" | 9 #include "ui/gfx/point_conversions.h" |
| 10 #include "ui/gfx/rect_conversions.h" | 10 #include "ui/gfx/rect_conversions.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 tiles_.clear(); | 85 tiles_.clear(); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 gfx::Size tile_size = client_->CalculateTileSize( | 89 gfx::Size tile_size = client_->CalculateTileSize( |
| 90 tiling_data_.max_texture_size(), | 90 tiling_data_.max_texture_size(), |
| 91 content_bounds); | 91 content_bounds); |
| 92 if (tile_size != tiling_data_.max_texture_size()) { | 92 if (tile_size != tiling_data_.max_texture_size()) { |
| 93 tiling_data_.SetMaxTextureSize(tile_size); | 93 tiling_data_.SetMaxTextureSize(tile_size); |
| 94 tiles_.clear(); | 94 tiles_.clear(); |
| 95 CreateTilesFromLayerRect(gfx::Rect(layer_bounds_)); | |
|
danakj
2013/02/12 01:31:20
What if you set old_layer_bounds to empty here? Wo
enne (OOO)
2013/02/12 01:34:39
Hmm. I'm not sure the single line of reuse makes
danakj
2013/02/12 01:36:24
For instance, if you did it that way, you'd also g
danakj
2013/02/12 01:37:56
(Especially considering Justin's desire to record
| |
| 96 return; | |
| 95 } | 97 } |
| 96 | 98 |
| 97 // Any tiles outside our new bounds are invalid and should be dropped. | 99 // Any tiles outside our new bounds are invalid and should be dropped. |
| 98 if (old_content_bounds.width() > content_bounds.width() || | 100 if (old_content_bounds.width() > content_bounds.width() || |
| 99 old_content_bounds.height() > content_bounds.height()) { | 101 old_content_bounds.height() > content_bounds.height()) { |
| 100 int right = | 102 int right = |
| 101 tiling_data_.TileXIndexFromSrcCoord(content_bounds.width() - 1); | 103 tiling_data_.TileXIndexFromSrcCoord(content_bounds.width() - 1); |
| 102 int bottom = | 104 int bottom = |
| 103 tiling_data_.TileYIndexFromSrcCoord(content_bounds.height() - 1); | 105 tiling_data_.TileYIndexFromSrcCoord(content_bounds.height() - 1); |
| 104 | 106 |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 // and recreated, then that picture pile ref could exist indefinitely. To | 500 // and recreated, then that picture pile ref could exist indefinitely. To |
| 499 // prevent this, ask the client to update the pile to its own ref. This | 501 // prevent this, ask the client to update the pile to its own ref. This |
| 500 // will cause PicturePileImpls and their clones to get deleted once the | 502 // will cause PicturePileImpls and their clones to get deleted once the |
| 501 // corresponding PictureLayerImpl and any in flight raster jobs go out of | 503 // corresponding PictureLayerImpl and any in flight raster jobs go out of |
| 502 // scope. | 504 // scope. |
| 503 client_->UpdatePile(it->second); | 505 client_->UpdatePile(it->second); |
| 504 } | 506 } |
| 505 } | 507 } |
| 506 | 508 |
| 507 } // namespace cc | 509 } // namespace cc |
| OLD | NEW |