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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (layer->fixedToContainerLayer()) { | 539 if (layer->fixedToContainerLayer()) { |
540 // Special case: this layer is a composited fixed-position layer; we nee
d to | 540 // Special case: this layer is a composited fixed-position layer; we nee
d to |
541 // explicitly compensate for all ancestors' nonzero scrollDeltas to keep
this layer | 541 // explicitly compensate for all ancestors' nonzero scrollDeltas to keep
this layer |
542 // fixed correctly. | 542 // fixed correctly. |
543 combinedTransform = currentScrollCompensationMatrix * combinedTransform; | 543 combinedTransform = currentScrollCompensationMatrix * combinedTransform; |
544 } | 544 } |
545 | 545 |
546 // The drawTransform that gets computed below is effectively the layer's dra
wTransform, unless | 546 // The drawTransform that gets computed below is effectively the layer's dra
wTransform, unless |
547 // the layer itself creates a renderSurface. In that case, the renderSurface
re-parents the transforms. | 547 // the layer itself creates a renderSurface. In that case, the renderSurface
re-parents the transforms. |
548 WebTransformationMatrix drawTransform = combinedTransform; | 548 WebTransformationMatrix drawTransform = combinedTransform; |
| 549 // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2origin] |
| 550 drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds().hei
ght() / 2.0); |
549 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { | 551 if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) { |
550 // M[draw] = M[parent] * LT * Tr[anchor2center] * Tr[center2anchor] | 552 // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[layer2content] |
551 drawTransform.translate(-layer->bounds().width() / 2.0, -layer->bounds()
.height() / 2.0); | |
552 // M[draw] = M[parent] * LT * Tr[anchor2origin] * S[content2layer] | |
553 drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<doub
le>(layer->contentBounds().width()), | 553 drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<doub
le>(layer->contentBounds().width()), |
554 layer->bounds().height() / static_cast<dou
ble>(layer->contentBounds().height())); | 554 layer->bounds().height() / static_cast<dou
ble>(layer->contentBounds().height())); |
555 } | 555 } |
556 | 556 |
557 // layerScreenSpaceTransform represents the transform between root layer's "
screen space" and local content space. | 557 // layerScreenSpaceTransform represents the transform between root layer's "
screen space" and local content space. |
558 WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; | 558 WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix; |
559 if (!layer->preserves3D()) | 559 if (!layer->preserves3D()) |
560 CCMathUtil::flattenTransformTo2d(layerScreenSpaceTransform); | 560 CCMathUtil::flattenTransformTo2d(layerScreenSpaceTransform); |
561 layerScreenSpaceTransform.multiply(drawTransform); | 561 layerScreenSpaceTransform.multiply(drawTransform); |
562 layer->setScreenSpaceTransform(layerScreenSpaceTransform); | 562 layer->setScreenSpaceTransform(layerScreenSpaceTransform); |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 | 949 |
950 foundLayer = currentLayer; | 950 foundLayer = currentLayer; |
951 break; | 951 break; |
952 } | 952 } |
953 | 953 |
954 // This can potentially return 0, which means the viewportPoint did not succ
essfully hit test any layers, not even the root layer. | 954 // This can potentially return 0, which means the viewportPoint did not succ
essfully hit test any layers, not even the root layer. |
955 return foundLayer; | 955 return foundLayer; |
956 } | 956 } |
957 | 957 |
958 } // namespace WebCore | 958 } // namespace WebCore |
OLD | NEW |