| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) | 258 void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) |
| 259 { | 259 { |
| 260 LayerChromium::pushPropertiesTo(layer); | 260 LayerChromium::pushPropertiesTo(layer); |
| 261 | 261 |
| 262 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); | 262 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); |
| 263 | 263 |
| 264 tiledLayer->setSkipsDraw(m_skipsDraw); | 264 tiledLayer->setSkipsDraw(m_skipsDraw); |
| 265 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); | 265 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); |
| 266 tiledLayer->setTilingData(*m_tiler); | 266 tiledLayer->setTilingData(*m_tiler); |
| 267 Vector<UpdatableTile*> invalidTiles; |
| 267 | 268 |
| 268 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 269 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { |
| 269 int i = iter->first.first; | 270 int i = iter->first.first; |
| 270 int j = iter->first.second; | 271 int j = iter->first.second; |
| 271 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); | 272 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); |
| 272 if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureForma
t)) | 273 if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureForma
t)) { |
| 274 invalidTiles.append(tile); |
| 273 continue; | 275 continue; |
| 276 } |
| 274 if (tile->isDirty()) | 277 if (tile->isDirty()) |
| 275 continue; | 278 continue; |
| 276 | 279 |
| 277 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId()
, tile->m_opaqueRect); | 280 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId()
, tile->m_opaqueRect); |
| 278 } | 281 } |
| 282 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite
r != invalidTiles.end(); ++iter) |
| 283 m_tiler->takeTile((*iter)->i(), (*iter)->j()); |
| 279 } | 284 } |
| 280 | 285 |
| 281 TextureManager* TiledLayerChromium::textureManager() const | 286 TextureManager* TiledLayerChromium::textureManager() const |
| 282 { | 287 { |
| 283 if (!layerTreeHost()) | 288 if (!layerTreeHost()) |
| 284 return 0; | 289 return 0; |
| 285 return layerTreeHost()->contentsTextureManager(); | 290 return layerTreeHost()->contentsTextureManager(); |
| 286 } | 291 } |
| 287 | 292 |
| 288 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const | 293 UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const |
| (...skipping 29 matching lines...) Expand all Loading... |
| 318 borderTexelOption = isNonCompositedContent ? CCLayerTilingData::NoBorderTexe
ls : CCLayerTilingData::HasBorderTexels; | 323 borderTexelOption = isNonCompositedContent ? CCLayerTilingData::NoBorderTexe
ls : CCLayerTilingData::HasBorderTexels; |
| 319 #endif | 324 #endif |
| 320 setBorderTexelOption(borderTexelOption); | 325 setBorderTexelOption(borderTexelOption); |
| 321 } | 326 } |
| 322 | 327 |
| 323 void TiledLayerChromium::invalidateRect(const IntRect& layerRect) | 328 void TiledLayerChromium::invalidateRect(const IntRect& layerRect) |
| 324 { | 329 { |
| 325 if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw) | 330 if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw) |
| 326 return; | 331 return; |
| 327 | 332 |
| 328 int left, top, right, bottom; | 333 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { |
| 329 m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); | 334 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); |
| 330 for (int j = top; j <= bottom; ++j) { | 335 ASSERT(tile); |
| 331 for (int i = left; i <= right; ++i) { | 336 IntRect bound = m_tiler->tileRect(tile); |
| 332 UpdatableTile* tile = tileAt(i, j); | 337 bound.intersect(layerRect); |
| 333 if (!tile) | 338 tile->m_dirtyRect.unite(bound); |
| 334 continue; | |
| 335 IntRect bound = m_tiler->tileRect(tile); | |
| 336 bound.intersect(layerRect); | |
| 337 tile->m_dirtyRect.unite(bound); | |
| 338 } | |
| 339 } | 339 } |
| 340 } | 340 } |
| 341 | 341 |
| 342 void TiledLayerChromium::protectVisibleTileTextures() | 342 void TiledLayerChromium::protectVisibleTileTextures() |
| 343 { | 343 { |
| 344 protectTileTextures(IntRect(IntPoint::zero(), contentBounds())); | 344 protectTileTextures(IntRect(IntPoint::zero(), contentBounds())); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void TiledLayerChromium::protectTileTextures(const IntRect& layerRect) | 347 void TiledLayerChromium::protectTileTextures(const IntRect& layerRect) |
| 348 { | 348 { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 // - only reserve idle paint tiles up to a memory reclaim threshold and | 586 // - only reserve idle paint tiles up to a memory reclaim threshold and |
| 587 // - insure we play nicely with other layers | 587 // - insure we play nicely with other layers |
| 588 prepaintRect.inflateX(m_tiler->tileSize().width()); | 588 prepaintRect.inflateX(m_tiler->tileSize().width()); |
| 589 prepaintRect.inflateY(m_tiler->tileSize().height()); | 589 prepaintRect.inflateY(m_tiler->tileSize().height()); |
| 590 prepaintRect.intersect(IntRect(IntPoint::zero(), contentBounds())); | 590 prepaintRect.intersect(IntRect(IntPoint::zero(), contentBounds())); |
| 591 return prepaintRect; | 591 return prepaintRect; |
| 592 } | 592 } |
| 593 | 593 |
| 594 } | 594 } |
| 595 #endif // USE(ACCELERATED_COMPOSITING) | 595 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |