| 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 tiles_.erase(found); | 150 tiles_.erase(found); |
| 151 new_tiles.push_back(key); | 151 new_tiles.push_back(key); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 for (size_t i = 0; i < new_tiles.size(); ++i) | 155 for (size_t i = 0; i < new_tiles.size(); ++i) |
| 156 CreateTile(new_tiles[i].first, new_tiles[i].second); | 156 CreateTile(new_tiles[i].first, new_tiles[i].second); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void PictureLayerTiling::InvalidateTilesWithText() { |
| 160 std::vector<TileMapKey> new_tiles; |
| 161 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { |
| 162 if (it->second->has_text()) |
| 163 new_tiles.push_back(it->first); |
| 164 } |
| 165 |
| 166 for (size_t i = 0; i < new_tiles.size(); ++i) { |
| 167 tiles_.erase(new_tiles[i]); |
| 168 CreateTile(new_tiles[i].first, new_tiles[i].second); |
| 169 } |
| 170 } |
| 171 |
| 159 void PictureLayerTiling::CreateTilesFromLayerRect(gfx::Rect layer_rect) { | 172 void PictureLayerTiling::CreateTilesFromLayerRect(gfx::Rect layer_rect) { |
| 160 gfx::Rect content_rect = | 173 gfx::Rect content_rect = |
| 161 gfx::ToEnclosingRect(ScaleRect(layer_rect, contents_scale_)); | 174 gfx::ToEnclosingRect(ScaleRect(layer_rect, contents_scale_)); |
| 162 CreateTilesFromContentRect(content_rect); | 175 CreateTilesFromContentRect(content_rect); |
| 163 } | 176 } |
| 164 | 177 |
| 165 void PictureLayerTiling::CreateTilesFromContentRect(gfx::Rect content_rect) { | 178 void PictureLayerTiling::CreateTilesFromContentRect(gfx::Rect content_rect) { |
| 166 for (TilingData::Iterator iter(&tiling_data_, content_rect); iter; ++iter) { | 179 for (TilingData::Iterator iter(&tiling_data_, content_rect); iter; ++iter) { |
| 167 TileMap::iterator found = | 180 TileMap::iterator found = |
| 168 tiles_.find(TileMapKey(iter.index_x(), iter.index_y())); | 181 tiles_.find(TileMapKey(iter.index_x(), iter.index_y())); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 608 | 621 |
| 609 // If our delta is less then our event distance, we're done. | 622 // If our delta is less then our event distance, we're done. |
| 610 if (delta < event.distance) | 623 if (delta < event.distance) |
| 611 break; | 624 break; |
| 612 } | 625 } |
| 613 | 626 |
| 614 return gfx::Rect(origin_x, origin_y, width, height); | 627 return gfx::Rect(origin_x, origin_y, width, height); |
| 615 } | 628 } |
| 616 | 629 |
| 617 } // namespace cc | 630 } // namespace cc |
| OLD | NEW |