| 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 #include "CCLayerTreeHost.h" | 7 #include "CCLayerTreeHost.h" |
| 8 | 8 |
| 9 #include "CCFontAtlas.h" | 9 #include "CCFontAtlas.h" |
| 10 #include "CCGraphicsContext.h" | 10 #include "CCGraphicsContext.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return; | 527 return; |
| 528 | 528 |
| 529 if (layoutViewportSize().isEmpty()) | 529 if (layoutViewportSize().isEmpty()) |
| 530 return; | 530 return; |
| 531 | 531 |
| 532 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; | 532 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; |
| 533 | 533 |
| 534 updateLayers(rootLayer(), queue); | 534 updateLayers(rootLayer(), queue); |
| 535 } | 535 } |
| 536 | 536 |
| 537 static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageSc
aleFactor) | |
| 538 { | |
| 539 if (layer->boundsContainPageScale()) | |
| 540 layer->setContentsScale(deviceScaleFactor); | |
| 541 else | |
| 542 layer->setContentsScale(deviceScaleFactor * pageScaleFactor); | |
| 543 } | |
| 544 | |
| 545 static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa
t pageScaleFactor) | |
| 546 { | |
| 547 setScale(layer, deviceScaleFactor, pageScaleFactor); | |
| 548 | |
| 549 LayerChromium* maskLayer = layer->maskLayer(); | |
| 550 if (maskLayer) | |
| 551 setScale(maskLayer, deviceScaleFactor, pageScaleFactor); | |
| 552 | |
| 553 LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLaye
r()->maskLayer() : 0; | |
| 554 if (replicaMaskLayer) | |
| 555 setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor); | |
| 556 | |
| 557 const Vector<RefPtr<LayerChromium> >& children = layer->children(); | |
| 558 for (unsigned int i = 0; i < children.size(); ++i) | |
| 559 updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor); | |
| 560 } | |
| 561 | |
| 562 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu
e& queue) | 537 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu
e& queue) |
| 563 { | 538 { |
| 564 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); | 539 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); |
| 565 | 540 |
| 566 updateLayerScale(rootLayer, m_deviceScaleFactor, m_pageScaleFactor); | |
| 567 | |
| 568 LayerList updateList; | 541 LayerList updateList; |
| 569 | 542 |
| 570 { | 543 { |
| 571 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); | 544 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); |
| 572 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport
Size(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); | 545 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport
Size(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextur
eSize, updateList); |
| 573 CCLayerTreeHostCommon::calculateVisibleRects(updateList); | 546 CCLayerTreeHostCommon::calculateVisibleRects(updateList); |
| 574 } | 547 } |
| 575 | 548 |
| 576 // Reset partial texture update requests. | 549 // Reset partial texture update requests. |
| 577 m_partialTextureUpdateRequests = 0; | 550 m_partialTextureUpdateRequests = 0; |
| 578 | 551 |
| 579 bool needMoreUpdates = paintLayerContents(updateList, queue); | 552 bool needMoreUpdates = paintLayerContents(updateList, queue); |
| 580 if (m_triggerIdleUpdates && needMoreUpdates) | 553 if (m_triggerIdleUpdates && needMoreUpdates) |
| 581 setNeedsCommit(); | 554 setNeedsCommit(); |
| 582 | 555 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 else | 827 else |
| 855 layer->notifyAnimationFinished(wallClockTime); | 828 layer->notifyAnimationFinished(wallClockTime); |
| 856 } | 829 } |
| 857 } | 830 } |
| 858 | 831 |
| 859 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 832 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 860 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 833 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 861 } | 834 } |
| 862 | 835 |
| 863 } // namespace cc | 836 } // namespace cc |
| OLD | NEW |