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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #if USE(ACCELERATED_COMPOSITING) | 7 #if USE(ACCELERATED_COMPOSITING) |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "TiledLayerChromium.h" | 10 #include "TiledLayerChromium.h" |
11 | 11 |
12 #include "CCLayerImpl.h" | 12 #include "CCLayerImpl.h" |
13 #include "CCLayerTreeHost.h" | 13 #include "CCLayerTreeHost.h" |
| 14 #include "CCLayerTreeHostImpl.h" |
14 #include "CCOverdrawMetrics.h" | 15 #include "CCOverdrawMetrics.h" |
| 16 #include "CCResourceProvider.h" |
15 #include "CCTextureUpdateQueue.h" | 17 #include "CCTextureUpdateQueue.h" |
16 #include "CCTiledLayerImpl.h" | 18 #include "CCTiledLayerImpl.h" |
17 #include "GraphicsContext3D.h" | 19 #include "GraphicsContext3D.h" |
18 #include "Region.h" | 20 #include "Region.h" |
19 #include <wtf/CurrentTime.h> | 21 #include <wtf/CurrentTime.h> |
20 #include <wtf/MathExtras.h> | 22 #include <wtf/MathExtras.h> |
21 | 23 |
22 using namespace std; | 24 using namespace std; |
23 using WebKit::WebTransformationMatrix; | 25 using WebKit::WebTransformationMatrix; |
24 | 26 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) | 198 void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) |
197 { | 199 { |
198 LayerChromium::pushPropertiesTo(layer); | 200 LayerChromium::pushPropertiesTo(layer); |
199 | 201 |
200 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); | 202 CCTiledLayerImpl* tiledLayer = static_cast<CCTiledLayerImpl*>(layer); |
201 | 203 |
202 tiledLayer->setSkipsDraw(m_skipsDraw); | 204 tiledLayer->setSkipsDraw(m_skipsDraw); |
203 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); | 205 tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater:
:SampledTexelFormatRGBA); |
204 tiledLayer->setTilingData(*m_tiler); | 206 tiledLayer->setTilingData(*m_tiler); |
205 Vector<UpdatableTile*> invalidTiles; | 207 Vector<UpdatableTile*> invalidTiles; |
| 208 CCResourceProvider* resourceProvider = tiledLayer->layerTreeHostImpl()->reso
urceProvider(); |
206 | 209 |
207 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 210 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { |
208 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE | 211 #if WTF_NEW_HASHMAP_ITERATORS_INTERFACE |
209 int i = iter->key.first; | 212 int i = iter->key.first; |
210 int j = iter->key.second; | 213 int j = iter->key.second; |
211 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); | 214 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->value.get()); |
212 #else | 215 #else |
213 int i = iter->first.first; | 216 int i = iter->first.first; |
214 int j = iter->first.second; | 217 int j = iter->first.second; |
215 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); | 218 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); |
216 #endif | 219 #endif |
217 // FIXME: This should not ever be null. | 220 // FIXME: This should not ever be null. |
218 if (!tile) | 221 if (!tile) |
219 continue; | 222 continue; |
220 | |
221 tile->isInUseOnImpl = false; | |
222 | |
223 if (!tile->managedTexture()->haveBackingTexture()) { | 223 if (!tile->managedTexture()->haveBackingTexture()) { |
224 // Evicted tiles get deleted from both layers | 224 // Evicted tiles get deleted from both layers |
225 invalidTiles.append(tile); | 225 invalidTiles.append(tile); |
| 226 tile->isInUseOnImpl = false; |
| 227 continue; |
| 228 } |
| 229 if (!tile->validForFrame) { |
| 230 // Invalidated tiles are set so they can get different debug colors. |
| 231 tiledLayer->pushInvalidTile(i, j); |
| 232 CCResourceProvider::ResourceId id = tile->managedTexture()->resource
Id(); |
| 233 ASSERT(id); |
| 234 if (!resourceProvider->inUseByConsumer(id) /* && ubercomp */) |
| 235 tile->isInUseOnImpl = false; |
226 continue; | 236 continue; |
227 } | 237 } |
228 | 238 |
229 if (!tile->validForFrame) { | |
230 // Invalidated tiles are set so they can get different debug colors. | |
231 tiledLayer->pushInvalidTile(i, j); | |
232 continue; | |
233 } | |
234 | |
235 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(
), tile->opaqueRect()); | 239 tiledLayer->pushTileProperties(i, j, tile->managedTexture()->resourceId(
), tile->opaqueRect()); |
236 tile->isInUseOnImpl = true; | 240 tile->isInUseOnImpl = true; |
237 } | 241 } |
238 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite
r != invalidTiles.end(); ++iter) | 242 for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); ite
r != invalidTiles.end(); ++iter) |
239 m_tiler->takeTile((*iter)->i(), (*iter)->j()); | 243 m_tiler->takeTile((*iter)->i(), (*iter)->j()); |
240 } | 244 } |
241 | 245 |
242 CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const | 246 CCPrioritizedTextureManager* TiledLayerChromium::textureManager() const |
243 { | 247 { |
244 if (!layerTreeHost()) | 248 if (!layerTreeHost()) |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 for (int i = left; i <= right; ++i) { | 611 for (int i = left; i <= right; ++i) { |
608 if (!tileAt(i, j)) | 612 if (!tileAt(i, j)) |
609 createTile(i, j); | 613 createTile(i, j); |
610 } | 614 } |
611 } | 615 } |
612 } | 616 } |
613 | 617 |
614 // Also, minimally create all tiles for small animated layers and also | 618 // Also, minimally create all tiles for small animated layers and also |
615 // double-buffer them since we have limited their size to be reasonable. | 619 // double-buffer them since we have limited their size to be reasonable. |
616 IntRect doubleBufferedRect = visibleContentRect(); | 620 IntRect doubleBufferedRect = visibleContentRect(); |
617 if (smallAnimatedLayer) | 621 if (smallAnimatedLayer || true /* s/true/ubercomp */) |
618 doubleBufferedRect = IntRect(IntPoint::zero(), contentBounds()); | 622 doubleBufferedRect = IntRect(IntPoint::zero(), contentBounds()); |
619 | 623 |
620 // Create additional textures for double-buffered updates when needed. | 624 // Create additional textures for double-buffered updates when needed. |
621 // These textures must stay alive while the updated textures are incremental
ly | 625 // These textures must stay alive while the updated textures are incremental
ly |
622 // uploaded, swapped atomically via pushProperties, and finally deleted | 626 // uploaded, swapped atomically via pushProperties, and finally deleted |
623 // after the commit is complete, after which they can be recycled. | 627 // after the commit is complete, after which they can be recycled. |
624 if (!doubleBufferedRect.isEmpty()) { | 628 if (!doubleBufferedRect.isEmpty()) { |
625 int left, top, right, bottom; | 629 int left, top, right, bottom; |
626 m_tiler->contentRectToTileIndices(doubleBufferedRect, left, top, right,
bottom); | 630 m_tiler->contentRectToTileIndices(doubleBufferedRect, left, top, right,
bottom); |
627 for (int j = top; j <= bottom; ++j) { | 631 for (int j = top; j <= bottom; ++j) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 prepaintRect.inflateX(m_tiler->tileSize().width()); | 815 prepaintRect.inflateX(m_tiler->tileSize().width()); |
812 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); | 816 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); |
813 IntRect contentRect(IntPoint::zero(), contentBounds()); | 817 IntRect contentRect(IntPoint::zero(), contentBounds()); |
814 prepaintRect.intersect(contentRect); | 818 prepaintRect.intersect(contentRect); |
815 | 819 |
816 return prepaintRect; | 820 return prepaintRect; |
817 } | 821 } |
818 | 822 |
819 } | 823 } |
820 #endif // USE(ACCELERATED_COMPOSITING) | 824 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |