OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/tiled_layer.h" | 5 #include "cc/tiled_layer.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "cc/layer_impl.h" | 10 #include "cc/layer_impl.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return true; | 225 return true; |
226 } | 226 } |
227 | 227 |
228 PrioritizedResourceManager* TiledLayer::resourceManager() const | 228 PrioritizedResourceManager* TiledLayer::resourceManager() const |
229 { | 229 { |
230 if (!layerTreeHost()) | 230 if (!layerTreeHost()) |
231 return 0; | 231 return 0; |
232 return layerTreeHost()->contentsTextureManager(); | 232 return layerTreeHost()->contentsTextureManager(); |
233 } | 233 } |
234 | 234 |
| 235 const PrioritizedResource* TiledLayer::resourceAtForTesting(int i, int j) const |
| 236 { |
| 237 UpdatableTile* tile = tileAt(i, j); |
| 238 if (!tile) |
| 239 return 0; |
| 240 return tile->managedResource(); |
| 241 } |
| 242 |
235 void TiledLayer::setLayerTreeHost(LayerTreeHost* host) | 243 void TiledLayer::setLayerTreeHost(LayerTreeHost* host) |
236 { | 244 { |
237 if (host && host != layerTreeHost()) { | 245 if (host && host != layerTreeHost()) { |
238 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().be
gin(); iter != m_tiler->tiles().end(); ++iter) { | 246 for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().be
gin(); iter != m_tiler->tiles().end(); ++iter) { |
239 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); | 247 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second); |
240 // FIXME: This should not ever be null. | 248 // FIXME: This should not ever be null. |
241 if (!tile) | 249 if (!tile) |
242 continue; | 250 continue; |
243 tile->managedResource()->setTextureManager(host->contentsTextureMana
ger()); | 251 tile->managedResource()->setTextureManager(host->contentsTextureMana
ger()); |
244 } | 252 } |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 gfx::Rect prepaintRect = visibleContentRect(); | 773 gfx::Rect prepaintRect = visibleContentRect(); |
766 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, | 774 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, |
767 -m_tiler->tileSize().height() * prepaintRows); | 775 -m_tiler->tileSize().height() * prepaintRows); |
768 gfx::Rect contentRect(gfx::Point(), contentBounds()); | 776 gfx::Rect contentRect(gfx::Point(), contentBounds()); |
769 prepaintRect.Intersect(contentRect); | 777 prepaintRect.Intersect(contentRect); |
770 | 778 |
771 return prepaintRect; | 779 return prepaintRect; |
772 } | 780 } |
773 | 781 |
774 } // namespace cc | 782 } // namespace cc |
OLD | NEW |