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 "cc/layer_tree_host_common.h" | 5 #include "cc/layer_tree_host_common.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 { | 383 { |
384 } | 384 } |
385 | 385 |
386 static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatin gTransformToScreen) | 386 static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatin gTransformToScreen) |
387 { | 387 { |
388 float rasterScale = layer->rasterScale(); | 388 float rasterScale = layer->rasterScale(); |
389 if (!rasterScale) { | 389 if (!rasterScale) { |
390 rasterScale = 1; | 390 rasterScale = 1; |
391 | 391 |
392 if (!animatingTransformToScreen && layer->automaticallyComputeRasterScal e()) { | 392 if (!animatingTransformToScreen && layer->automaticallyComputeRasterScal e()) { |
393 gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleCom ponents(combinedTransform); | 393 gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleCom ponents(combinedTransform, 0.f); |
danakj
2012/12/20 23:27:12
Now switch to 0.f so we don't save it when we don'
| |
394 float combinedScale = std::max(transformScale.x(), transformScale.y( )); | 394 float combinedScale = std::max(transformScale.x(), transformScale.y( )); |
395 rasterScale = combinedScale / deviceScaleFactor; | 395 rasterScale = combinedScale / deviceScaleFactor; |
396 if (!layer->boundsContainPageScale()) | 396 if (!layer->boundsContainPageScale()) |
397 rasterScale /= pageScaleFactor; | 397 rasterScale /= pageScaleFactor; |
398 // Prevent scale factors below 1 from being used or saved. | 398 // Prevent scale factors below 1 from being used or saved. |
399 if (rasterScale < 1) | 399 if (rasterScale < 1) |
400 rasterScale = 1; | 400 rasterScale = 1; |
401 else | 401 else |
402 layer->setRasterScale(rasterScale); | 402 layer->setRasterScale(rasterScale); |
403 } | 403 } |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 (accumulatedDrawOpacity == 1.0) && | 653 (accumulatedDrawOpacity == 1.0) && |
654 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation(); | 654 layerDrawProperties.target_space_transform.IsIdent ityOrIntegerTranslation(); |
655 | 655 |
656 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); | 656 gfx::RectF contentRect(gfx::PointF(), layer->contentBounds()); |
657 | 657 |
658 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. | 658 // fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space. |
659 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. | 659 // nextHierarchyMatrix will only change if this layer uses a new RenderSurfa ceImpl, otherwise remains the same. |
660 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix; | 660 gfx::Transform nextHierarchyMatrix = fullHierarchyMatrix; |
661 gfx::Transform sublayerMatrix; | 661 gfx::Transform sublayerMatrix; |
662 | 662 |
663 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform); | 663 gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScal eComponents(combinedTransform, deviceScaleFactor * pageScaleFactor); |
664 | 664 |
665 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) { | 665 if (subtreeShouldRenderToSeparateSurface(layer, combinedTransform.IsScaleOrT ranslation())) { |
666 // Check back-face visibility before continuing with this surface and it s subtree | 666 // Check back-face visibility before continuing with this surface and it s subtree |
667 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform)) | 667 if (!layer->doubleSided() && transformToParentIsKnown(layer) && isSurfac eBackFaceVisible(layer, combinedTransform)) |
668 return; | 668 return; |
669 | 669 |
670 if (!layer->renderSurface()) | 670 if (!layer->renderSurface()) |
671 layer->createRenderSurface(); | 671 layer->createRenderSurface(); |
672 | 672 |
673 RenderSurfaceType* renderSurface = layer->renderSurface(); | 673 RenderSurfaceType* renderSurface = layer->renderSurface(); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1118 | 1118 |
1119 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up | 1119 // At this point, we think the point does hit the touch event handler region o n the layer, but we need to walk up |
1120 // the parents to ensure that the layer was not clipped in such a way that the | 1120 // the parents to ensure that the layer was not clipped in such a way that the |
1121 // hit point actually should not hit the layer. | 1121 // hit point actually should not hit the layer. |
1122 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) | 1122 if (pointIsClippedBySurfaceOrClipRect(screenSpacePoint, layerImpl)) |
1123 return false; | 1123 return false; |
1124 | 1124 |
1125 return true; | 1125 return true; |
1126 } | 1126 } |
1127 } // namespace cc | 1127 } // namespace cc |
OLD | NEW |