| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForSc
reen); | 363 layer->setScreenSpaceTransformIsAnimating(layerIsInAnimatingSubtreeForSc
reen); |
| 364 | 364 |
| 365 // Update the aggregate hierarchy matrix to include the transform of the
newly created RenderSurface. | 365 // Update the aggregate hierarchy matrix to include the transform of the
newly created RenderSurface. |
| 366 nextHierarchyMatrix.multiply(surfaceOriginTransform); | 366 nextHierarchyMatrix.multiply(surfaceOriginTransform); |
| 367 | 367 |
| 368 // The render surface clipRect contributes to the scissor rect that need
s to | 368 // The render surface clipRect contributes to the scissor rect that need
s to |
| 369 // be applied before drawing the render surface onto its containing | 369 // be applied before drawing the render surface onto its containing |
| 370 // surface and is therefore expressed in the parent's coordinate system. | 370 // surface and is therefore expressed in the parent's coordinate system. |
| 371 renderSurface->setClipRect(layer->parent() ? layer->parent()->clipRect()
: layer->clipRect()); | 371 renderSurface->setClipRect(layer->parent() ? layer->parent()->clipRect()
: layer->clipRect()); |
| 372 | 372 |
| 373 // The layer's clipRect can be reset here. The renderSurface will correc
tly clip the subtree. |
| 374 layer->setUsesLayerClipping(false); |
| 375 layer->setClipRect(IntRect()); |
| 376 |
| 373 if (layer->maskLayer()) { | 377 if (layer->maskLayer()) { |
| 374 renderSurface->setMaskLayer(layer->maskLayer()); | 378 renderSurface->setMaskLayer(layer->maskLayer()); |
| 375 layer->maskLayer()->setTargetRenderSurface(renderSurface); | 379 layer->maskLayer()->setTargetRenderSurface(renderSurface); |
| 376 } else | 380 } else |
| 377 renderSurface->setMaskLayer(0); | 381 renderSurface->setMaskLayer(0); |
| 378 | 382 |
| 379 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) | 383 if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) |
| 380 layer->replicaLayer()->maskLayer()->setTargetRenderSurface(renderSur
face); | 384 layer->replicaLayer()->maskLayer()->setTargetRenderSurface(renderSur
face); |
| 381 | 385 |
| 382 renderSurface->setFilters(layer->filters()); | 386 renderSurface->setFilters(layer->filters()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 399 layer->clearRenderSurface(); | 403 layer->clearRenderSurface(); |
| 400 | 404 |
| 401 // Layers inherit the clip rect from their parent. | 405 // Layers inherit the clip rect from their parent. |
| 402 layer->setClipRect(layer->parent()->clipRect()); | 406 layer->setClipRect(layer->parent()->clipRect()); |
| 403 if (layer->parent()->usesLayerClipping()) | 407 if (layer->parent()->usesLayerClipping()) |
| 404 layer->setUsesLayerClipping(true); | 408 layer->setUsesLayerClipping(true); |
| 405 | 409 |
| 406 // Layers without their own renderSurface will render into the neare
st ancestor surface. | 410 // Layers without their own renderSurface will render into the neare
st ancestor surface. |
| 407 layer->setTargetRenderSurface(layer->parent()->targetRenderSurface()
); | 411 layer->setTargetRenderSurface(layer->parent()->targetRenderSurface()
); |
| 408 } | 412 } |
| 413 } |
| 409 | 414 |
| 410 if (layer->masksToBounds()) { | 415 if (layer->masksToBounds()) { |
| 411 IntRect clipRect = transformedLayerRect; | 416 IntRect clipRect = transformedLayerRect; |
| 417 |
| 418 // If the layer already inherited a clipRect, we need to intersect with
it before |
| 419 // overriding the layer's clipRect and usesLayerClipping. |
| 420 if (layer->usesLayerClipping()) |
| 412 clipRect.intersect(layer->clipRect()); | 421 clipRect.intersect(layer->clipRect()); |
| 413 layer->setClipRect(clipRect); | 422 |
| 414 layer->setUsesLayerClipping(true); | 423 layer->setClipRect(clipRect); |
| 415 } | 424 layer->setUsesLayerClipping(true); |
| 416 } | 425 } |
| 417 | 426 |
| 418 // Note that at this point, layer->drawTransform() is not necessarily the sa
me as local variable drawTransform. | 427 // Note that at this point, layer->drawTransform() is not necessarily the sa
me as local variable drawTransform. |
| 419 // layerScreenSpaceTransform represents the transform between root layer's "
screen space" and local layer space. | 428 // layerScreenSpaceTransform represents the transform between root layer's "
screen space" and local layer space. |
| 420 TransformationMatrix layerScreenSpaceTransform = nextHierarchyMatrix; | 429 TransformationMatrix layerScreenSpaceTransform = nextHierarchyMatrix; |
| 421 layerScreenSpaceTransform.multiply(layer->drawTransform()); | 430 layerScreenSpaceTransform.multiply(layer->drawTransform()); |
| 422 layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.h
eight(), 0); | 431 layerScreenSpaceTransform.translate3d(-0.5 * bounds.width(), -0.5 * bounds.h
eight(), 0); |
| 423 layer->setScreenSpaceTransform(layerScreenSpaceTransform); | 432 layer->setScreenSpaceTransform(layerScreenSpaceTransform); |
| 424 | 433 |
| 425 // drawableContentRect() is always stored in the coordinate system of the | 434 // drawableContentRect() is always stored in the coordinate system of the |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 walkLayersAndCalculateVisibleLayerRects<LayerChromium, Vector<RefPtr<LayerCh
romium> >, RenderSurfaceChromium>(renderSurfaceLayerList); | 611 walkLayersAndCalculateVisibleLayerRects<LayerChromium, Vector<RefPtr<LayerCh
romium> >, RenderSurfaceChromium>(renderSurfaceLayerList); |
| 603 } | 612 } |
| 604 | 613 |
| 605 void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* la
yer, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const Tra
nsformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayer
List, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextur
eSize) | 614 void CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(CCLayerImpl* la
yer, CCLayerImpl* rootLayer, const TransformationMatrix& parentMatrix, const Tra
nsformationMatrix& fullHierarchyMatrix, Vector<CCLayerImpl*>& renderSurfaceLayer
List, Vector<CCLayerImpl*>& layerList, CCLayerSorter* layerSorter, int maxTextur
eSize) |
| 606 { | 615 { |
| 607 calculateDrawTransformsAndVisibilityInternal<CCLayerImpl, Vector<CCLayerImpl
*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarch
yMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize); | 616 calculateDrawTransformsAndVisibilityInternal<CCLayerImpl, Vector<CCLayerImpl
*>, CCRenderSurface, CCLayerSorter>(layer, rootLayer, parentMatrix, fullHierarch
yMatrix, 0, renderSurfaceLayerList, layerList, layerSorter, maxTextureSize); |
| 608 walkLayersAndCalculateVisibleLayerRects<CCLayerImpl, Vector<CCLayerImpl*>, C
CRenderSurface>(renderSurfaceLayerList); | 617 walkLayersAndCalculateVisibleLayerRects<CCLayerImpl, Vector<CCLayerImpl*>, C
CRenderSurface>(renderSurfaceLayerList); |
| 609 } | 618 } |
| 610 | 619 |
| 611 } // namespace WebCore | 620 } // namespace WebCore |
| OLD | NEW |