| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 return; | 460 return; |
| 461 | 461 |
| 462 if (layoutViewportSize().isEmpty()) | 462 if (layoutViewportSize().isEmpty()) |
| 463 return; | 463 return; |
| 464 | 464 |
| 465 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; | 465 m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes)
; |
| 466 | 466 |
| 467 updateLayers(rootLayer(), queue); | 467 updateLayers(rootLayer(), queue); |
| 468 } | 468 } |
| 469 | 469 |
| 470 static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageSc
aleFactor) | |
| 471 { | |
| 472 if (layer->boundsContainPageScale()) | |
| 473 layer->setContentsScale(deviceScaleFactor); | |
| 474 else | |
| 475 layer->setContentsScale(deviceScaleFactor * pageScaleFactor); | |
| 476 } | |
| 477 | |
| 478 static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa
t pageScaleFactor) | |
| 479 { | |
| 480 setScale(layer, deviceScaleFactor, pageScaleFactor); | |
| 481 | |
| 482 LayerChromium* maskLayer = layer->maskLayer(); | |
| 483 if (maskLayer) | |
| 484 setScale(maskLayer, deviceScaleFactor, pageScaleFactor); | |
| 485 | |
| 486 LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLaye
r()->maskLayer() : 0; | |
| 487 if (replicaMaskLayer) | |
| 488 setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor); | |
| 489 | |
| 490 const Vector<RefPtr<LayerChromium> >& children = layer->children(); | |
| 491 for (unsigned int i = 0; i < children.size(); ++i) | |
| 492 updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor); | |
| 493 } | |
| 494 | |
| 495 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu
e& queue) | 470 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu
e& queue) |
| 496 { | 471 { |
| 497 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); | 472 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); |
| 498 | 473 |
| 499 updateLayerScale(rootLayer, m_deviceScaleFactor, m_pageScaleFactor); | |
| 500 | |
| 501 LayerList updateList; | 474 LayerList updateList; |
| 502 | 475 |
| 503 { | 476 { |
| 504 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); | 477 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); |
| 505 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport
Size(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); | 478 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport
Size(), m_deviceScaleFactor, m_pageScaleFactor, rendererCapabilities().maxTextur
eSize, updateList); |
| 506 CCLayerTreeHostCommon::calculateVisibleRects(updateList); | 479 CCLayerTreeHostCommon::calculateVisibleRects(updateList); |
| 507 } | 480 } |
| 508 | 481 |
| 509 // Reset partial texture update requests. | 482 // Reset partial texture update requests. |
| 510 m_partialTextureUpdateRequests = 0; | 483 m_partialTextureUpdateRequests = 0; |
| 511 | 484 |
| 512 bool needMoreUpdates = paintLayerContents(updateList, queue); | 485 bool needMoreUpdates = paintLayerContents(updateList, queue); |
| 513 if (m_triggerIdleUpdates && needMoreUpdates) | 486 if (m_triggerIdleUpdates && needMoreUpdates) |
| 514 setNeedsCommit(); | 487 setNeedsCommit(); |
| 515 | 488 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 else | 752 else |
| 780 layer->notifyAnimationFinished(wallClockTime); | 753 layer->notifyAnimationFinished(wallClockTime); |
| 781 } | 754 } |
| 782 } | 755 } |
| 783 | 756 |
| 784 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) | 757 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn
dex) |
| 785 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); | 758 setAnimationEventsRecursive(events, layer->children()[childIndex].get(),
wallClockTime); |
| 786 } | 759 } |
| 787 | 760 |
| 788 } // namespace cc | 761 } // namespace cc |
| OLD | NEW |