Chromium Code Reviews| 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) | 470 static void setScale(LayerChromium* layer, float deviceScaleFactor, float pageSc aleFactor, bool inScrollLayer) |
| 471 { | 471 { |
| 472 if (layer->boundsContainPageScale()) | 472 if (!inScrollLayer || layer->boundsContainPageScale()) |
| 473 layer->setContentsScale(deviceScaleFactor); | 473 layer->setContentsScale(deviceScaleFactor); |
| 474 else | 474 else |
| 475 layer->setContentsScale(deviceScaleFactor * pageScaleFactor); | 475 layer->setContentsScale(deviceScaleFactor * pageScaleFactor); |
| 476 } | 476 } |
| 477 | 477 |
| 478 static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa t pageScaleFactor) | 478 static void updateLayerScale(LayerChromium* layer, float deviceScaleFactor, floa t pageScaleFactor, bool inScrollLayer) |
| 479 { | 479 { |
| 480 setScale(layer, deviceScaleFactor, pageScaleFactor); | 480 if (layer->scrollable()) |
| 481 inScrollLayer = true; | |
|
flackr
2012/09/17 19:37:51
Alexandre, is the logic for finding the root scrol
enne (OOO)
2012/09/17 20:37:00
I think I'd prefer to keep this complexity outside
| |
| 482 | |
| 483 setScale(layer, deviceScaleFactor, pageScaleFactor, inScrollLayer); | |
| 481 | 484 |
| 482 LayerChromium* maskLayer = layer->maskLayer(); | 485 LayerChromium* maskLayer = layer->maskLayer(); |
| 483 if (maskLayer) | 486 if (maskLayer) |
| 484 setScale(maskLayer, deviceScaleFactor, pageScaleFactor); | 487 setScale(maskLayer, deviceScaleFactor, pageScaleFactor, inScrollLayer); |
| 485 | 488 |
| 486 LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLaye r()->maskLayer() : 0; | 489 LayerChromium* replicaMaskLayer = layer->replicaLayer() ? layer->replicaLaye r()->maskLayer() : 0; |
| 487 if (replicaMaskLayer) | 490 if (replicaMaskLayer) |
| 488 setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor); | 491 setScale(replicaMaskLayer, deviceScaleFactor, pageScaleFactor, inScrollL ayer); |
| 489 | 492 |
| 490 const Vector<RefPtr<LayerChromium> >& children = layer->children(); | 493 const Vector<RefPtr<LayerChromium> >& children = layer->children(); |
| 491 for (unsigned int i = 0; i < children.size(); ++i) | 494 for (unsigned int i = 0; i < children.size(); ++i) |
| 492 updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor); | 495 updateLayerScale(children[i].get(), deviceScaleFactor, pageScaleFactor, inScrollLayer); |
| 493 } | 496 } |
| 494 | 497 |
| 495 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu e& queue) | 498 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdateQueu e& queue) |
| 496 { | 499 { |
| 497 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); | 500 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers"); |
| 498 | 501 |
| 499 updateLayerScale(rootLayer, m_deviceScaleFactor, m_pageScaleFactor); | 502 updateLayerScale(rootLayer, m_deviceScaleFactor, m_pageScaleFactor, false); |
| 500 | 503 |
| 501 LayerList updateList; | 504 LayerList updateList; |
| 502 | 505 |
| 503 { | 506 { |
| 504 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); | 507 TRACE_EVENT0("cc", "CCLayerTreeHost::updateLayers::calcDrawEtc"); |
| 505 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport Size(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); | 508 CCLayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewport Size(), m_deviceScaleFactor, rendererCapabilities().maxTextureSize, updateList); |
| 506 CCLayerTreeHostCommon::calculateVisibleRects(updateList); | 509 CCLayerTreeHostCommon::calculateVisibleRects(updateList); |
| 507 } | 510 } |
| 508 | 511 |
| 509 // Reset partial texture update requests. | 512 // Reset partial texture update requests. |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 779 else | 782 else |
| 780 layer->notifyAnimationFinished(wallClockTime); | 783 layer->notifyAnimationFinished(wallClockTime); |
| 781 } | 784 } |
| 782 } | 785 } |
| 783 | 786 |
| 784 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) | 787 for (size_t childIndex = 0; childIndex < layer->children().size(); ++childIn dex) |
| 785 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); | 788 setAnimationEventsRecursive(events, layer->children()[childIndex].get(), wallClockTime); |
| 786 } | 789 } |
| 787 | 790 |
| 788 } // namespace cc | 791 } // namespace cc |
| OLD | NEW |