| 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 "TiledLayerChromium.h" | 9 #include "TiledLayerChromium.h" |
| 10 | 10 |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 return false; | 541 return false; |
| 542 IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->devi
ceViewportSize() : IntSize(); | 542 IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->devi
ceViewportSize() : IntSize(); |
| 543 IntRect contentRect(IntPoint::zero(), layer->contentBounds()); | 543 IntRect contentRect(IntPoint::zero(), layer->contentBounds()); |
| 544 return contentRect.width() <= viewportSize.width() + 64 | 544 return contentRect.width() <= viewportSize.width() + 64 |
| 545 && contentRect.height() <= viewportSize.height() + 64; | 545 && contentRect.height() <= viewportSize.height() + 64; |
| 546 } | 546 } |
| 547 | 547 |
| 548 // FIXME: Remove this and make this based on distance once distance can be calcu
lated | 548 // FIXME: Remove this and make this based on distance once distance can be calcu
lated |
| 549 // for offscreen layers. For now, prioritize all small animated layers after 512 | 549 // for offscreen layers. For now, prioritize all small animated layers after 512 |
| 550 // pixels of pre-painting. | 550 // pixels of pre-painting. |
| 551 void setPriorityForTexture(const CCPriorityCalculator& priorityCalc, | 551 void setPriorityForTexture(const IntRect& visibleRect, |
| 552 const IntRect& visibleRect, | |
| 553 const IntRect& tileRect, | 552 const IntRect& tileRect, |
| 554 bool drawsToRoot, | 553 bool drawsToRoot, |
| 555 bool isSmallAnimatedLayer, | 554 bool isSmallAnimatedLayer, |
| 556 CCPrioritizedTexture* texture) | 555 CCPrioritizedTexture* texture) |
| 557 { | 556 { |
| 558 int priority = CCPriorityCalculator::lowestPriority(); | 557 int priority = CCPriorityCalculator::lowestPriority(); |
| 559 if (!visibleRect.isEmpty()) | 558 if (!visibleRect.isEmpty()) |
| 560 priority = priorityCalc.priorityFromDistance(visibleRect, tileRect, draw
sToRoot); | 559 priority = CCPriorityCalculator::priorityFromDistance(visibleRect, tileR
ect, drawsToRoot); |
| 561 if (isSmallAnimatedLayer) | 560 if (isSmallAnimatedLayer) |
| 562 priority = CCPriorityCalculator::maxPriority(priority, priorityCalc.prio
rityFromDistance(512, drawsToRoot)); | 561 priority = CCPriorityCalculator::maxPriority(priority, CCPriorityCalcula
tor::smallAnimatedLayerMinPriority()); |
| 563 if (priority != CCPriorityCalculator::lowestPriority()) | 562 if (priority != CCPriorityCalculator::lowestPriority()) |
| 564 texture->setRequestPriority(priority); | 563 texture->setRequestPriority(priority); |
| 565 } | 564 } |
| 566 } | 565 } |
| 567 | 566 |
| 568 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori
tyCalc) | 567 void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priori
tyCalc) |
| 569 { | 568 { |
| 570 updateBounds(); | 569 updateBounds(); |
| 571 resetUpdateState(); | 570 resetUpdateState(); |
| 572 | 571 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 if (!layerTreeHost() || !layerTreeHost()->bufferedUpdates() || !
tileNeedsBufferedUpdate(tile)) | 612 if (!layerTreeHost() || !layerTreeHost()->bufferedUpdates() || !
tileNeedsBufferedUpdate(tile)) |
| 614 continue; | 613 continue; |
| 615 if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost()->request
PartialTextureUpdate()) { | 614 if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost()->request
PartialTextureUpdate()) { |
| 616 tile->partialUpdate = true; | 615 tile->partialUpdate = true; |
| 617 continue; | 616 continue; |
| 618 } | 617 } |
| 619 | 618 |
| 620 IntRect tileRect = m_tiler->tileRect(tile); | 619 IntRect tileRect = m_tiler->tileRect(tile); |
| 621 tile->dirtyRect = tileRect; | 620 tile->dirtyRect = tileRect; |
| 622 LayerTextureUpdater::Texture* backBuffer = tile->texture(); | 621 LayerTextureUpdater::Texture* backBuffer = tile->texture(); |
| 623 setPriorityForTexture(priorityCalc, visibleContentRect(), tile->
dirtyRect, drawsToRoot, smallAnimatedLayer, backBuffer->texture()); | 622 setPriorityForTexture(visibleContentRect(), tile->dirtyRect, dra
wsToRoot, smallAnimatedLayer, backBuffer->texture()); |
| 624 OwnPtr<CCPrioritizedTexture> frontBuffer = CCPrioritizedTexture:
:create(backBuffer->texture()->textureManager(), | 623 OwnPtr<CCPrioritizedTexture> frontBuffer = CCPrioritizedTexture:
:create(backBuffer->texture()->textureManager(), |
| 625
backBuffer->texture()->size(), | 624
backBuffer->texture()->size(), |
| 626
backBuffer->texture()->format()); | 625
backBuffer->texture()->format()); |
| 627 // Swap backBuffer into frontBuffer and add it to delete after c
ommit queue. | 626 // Swap backBuffer into frontBuffer and add it to delete after c
ommit queue. |
| 628 backBuffer->swapTextureWith(frontBuffer); | 627 backBuffer->swapTextureWith(frontBuffer); |
| 629 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.release())
; | 628 layerTreeHost()->deleteTextureAfterCommit(frontBuffer.release())
; |
| 630 } | 629 } |
| 631 } | 630 } |
| 632 } | 631 } |
| 633 | 632 |
| 634 // Now update priorities on all tiles we have in the layer, no matter where
they are. | 633 // Now update priorities on all tiles we have in the layer, no matter where
they are. |
| 635 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { | 634 for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begi
n(); iter != m_tiler->tiles().end(); ++iter) { |
| 636 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); | 635 UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); |
| 637 // FIXME: This should not ever be null. | 636 // FIXME: This should not ever be null. |
| 638 if (!tile) | 637 if (!tile) |
| 639 continue; | 638 continue; |
| 640 IntRect tileRect = m_tiler->tileRect(tile); | 639 IntRect tileRect = m_tiler->tileRect(tile); |
| 641 setPriorityForTexture(priorityCalc, visibleContentRect(), tileRect, draw
sToRoot, smallAnimatedLayer, tile->managedTexture()); | 640 setPriorityForTexture(visibleContentRect(), tileRect, drawsToRoot, small
AnimatedLayer, tile->managedTexture()); |
| 642 } | 641 } |
| 643 } | 642 } |
| 644 | 643 |
| 645 Region TiledLayerChromium::visibleContentOpaqueRegion() const | 644 Region TiledLayerChromium::visibleContentOpaqueRegion() const |
| 646 { | 645 { |
| 647 if (m_skipsDraw) | 646 if (m_skipsDraw) |
| 648 return Region(); | 647 return Region(); |
| 649 if (opaque()) | 648 if (opaque()) |
| 650 return visibleContentRect(); | 649 return visibleContentRect(); |
| 651 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); | 650 return m_tiler->opaqueRegionInContentRect(visibleContentRect()); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 prepaintRect.inflateX(m_tiler->tileSize().width()); | 780 prepaintRect.inflateX(m_tiler->tileSize().width()); |
| 782 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); | 781 prepaintRect.inflateY(m_tiler->tileSize().height() * 2); |
| 783 IntRect contentRect(IntPoint::zero(), contentBounds()); | 782 IntRect contentRect(IntPoint::zero(), contentBounds()); |
| 784 prepaintRect.intersect(contentRect); | 783 prepaintRect.intersect(contentRect); |
| 785 | 784 |
| 786 return prepaintRect; | 785 return prepaintRect; |
| 787 } | 786 } |
| 788 | 787 |
| 789 } | 788 } |
| 790 #endif // USE(ACCELERATED_COMPOSITING) | 789 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |