Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7012)

Unified Diff: cc/layer_tree_host_common.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layer_tree_host_common.cc
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index ca7d45050f85c0857e5f88a4def5818ef1b5374e..09af18a8f5a25b97130a8a448ffb79bd94eae454 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -4,6 +4,8 @@
#include "cc/layer_tree_host_common.h"
+#include <algorithm>
+
#include "cc/layer.h"
#include "cc/layer_impl.h"
#include "cc/layer_iterator.h"
@@ -13,10 +15,9 @@
#include "cc/render_surface_impl.h"
#include "ui/gfx/point_conversions.h"
#include "ui/gfx/rect_conversions.h"
-#include <algorithm>
-#include <public/WebTransformationMatrix.h>
+#include "ui/gfx/transform.h"
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
@@ -28,7 +29,7 @@ ScrollAndScaleSet::~ScrollAndScaleSet()
{
}
-gfx::Rect LayerTreeHostCommon::calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const WebTransformationMatrix& transform)
+gfx::Rect LayerTreeHostCommon::calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const Transform& transform)
{
// Is this layer fully contained within the target surface?
gfx::Rect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect);
@@ -45,7 +46,7 @@ gfx::Rect LayerTreeHostCommon::calculateVisibleRect(const gfx::Rect& targetSurfa
// This bounding rectangle may be larger than it needs to be (being
// axis-aligned), but is a reasonable filter on the space to consider.
// Non-invertible transforms will create an empty rect here.
- const WebTransformationMatrix surfaceToLayer = transform.inverse();
+ const Transform surfaceToLayer = MathUtil::inverse(transform);
gfx::Rect layerRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(surfaceToLayer, gfx::RectF(minimalSurfaceRect)));
layerRect.Intersect(layerBoundRect);
return layerRect;
@@ -86,21 +87,21 @@ static bool isLayerBackFaceVisible(LayerType* layer)
// rendering context by checking if the parent preserves 3d.
if (layerIsInExisting3DRenderingContext(layer))
- return layer->drawTransform().isBackFaceVisible();
+ return MathUtil::isBackFaceVisible(layer->drawTransform());
// In this case, either the layer establishes a new 3d rendering context, or is not in
// a 3d rendering context at all.
- return layer->transform().isBackFaceVisible();
+ return MathUtil::isBackFaceVisible(layer->transform());
}
template<typename LayerType>
-static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMatrix& drawTransform)
+static bool isSurfaceBackFaceVisible(LayerType* layer, const Transform& drawTransform)
{
if (layerIsInExisting3DRenderingContext(layer))
- return drawTransform.isBackFaceVisible();
+ return MathUtil::isBackFaceVisible(drawTransform);
if (isRootLayerOfNewRenderingContext(layer))
- return layer->transform().isBackFaceVisible();
+ return MathUtil::isBackFaceVisible(layer->transform());
// If the renderSurface is not part of a new or existing rendering context, then the
// layers that contribute to this surface will decide back-face visibility for themselves.
@@ -131,7 +132,7 @@ static gfx::Rect calculateVisibleContentRect(LayerType* layer)
// In this case the target surface does clip layers that contribute to it. So, we
// have convert the current surface's clipRect from its ancestor surface space to
// the current surface space.
- targetSurfaceClipRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect()));
+ targetSurfaceClipRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(MathUtil::inverse(layer->renderTarget()->renderSurface()->drawTransform()), layer->renderTarget()->renderSurface()->clipRect()));
targetSurfaceClipRect.Intersect(layer->drawableContentRect());
}
@@ -141,12 +142,12 @@ static gfx::Rect calculateVisibleContentRect(LayerType* layer)
return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, gfx::Rect(gfx::Point(), layer->contentBounds()), layer->drawTransform());
}
-static bool isScaleOrTranslation(const WebTransformationMatrix& m)
+static bool isScaleOrTranslation(const Transform& m)
{
- return !m.m12() && !m.m13() && !m.m14()
- && !m.m21() && !m.m23() && !m.m24()
- && !m.m31() && !m.m32() && !m.m43()
- && m.m44();
+ return !m.matrix().getDouble(1, 0) && !m.matrix().getDouble(2, 0) && !m.matrix().getDouble(3, 0)
+ && !m.matrix().getDouble(0, 1) && !m.matrix().getDouble(2, 1) && !m.matrix().getDouble(3, 1)
+ && !m.matrix().getDouble(0, 2) && !m.matrix().getDouble(1, 2) && !m.matrix().getDouble(2, 3)
+ && m.matrix().getDouble(3, 3);
}
static inline bool transformToParentIsKnown(LayerImpl*)
@@ -265,7 +266,7 @@ static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlig
return false;
}
-WebTransformationMatrix computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer, const WebTransformationMatrix& parentMatrix)
+Transform computeScrollCompensationForThisLayer(LayerImpl* scrollingLayer, const Transform& parentMatrix)
{
// For every layer that has non-zero scrollDelta, we have to compute a transform that can undo the
// scrollDelta translation. In particular, we want this matrix to premultiply a fixed-position layer's
@@ -284,23 +285,23 @@ WebTransformationMatrix computeScrollCompensationForThisLayer(LayerImpl* scrolli
// that fixed position layer is fixed onto the same renderTarget as this scrollingLayer.
//
- WebTransformationMatrix partialLayerOriginTransform = parentMatrix;
- partialLayerOriginTransform.multiply(scrollingLayer->implTransform());
+ Transform partialLayerOriginTransform = parentMatrix;
+ partialLayerOriginTransform.PreconcatTransform(scrollingLayer->implTransform());
- WebTransformationMatrix scrollCompensationForThisLayer = partialLayerOriginTransform; // Step 3
- scrollCompensationForThisLayer.translate(scrollingLayer->scrollDelta().x(), scrollingLayer->scrollDelta().y()); // Step 2
- scrollCompensationForThisLayer.multiply(partialLayerOriginTransform.inverse()); // Step 1
+ Transform scrollCompensationForThisLayer = partialLayerOriginTransform; // Step 3
+ scrollCompensationForThisLayer.PreconcatTranslate(scrollingLayer->scrollDelta().x(), scrollingLayer->scrollDelta().y()); // Step 2
+ scrollCompensationForThisLayer.PreconcatTransform(MathUtil::inverse(partialLayerOriginTransform)); // Step 1
return scrollCompensationForThisLayer;
}
-WebTransformationMatrix computeScrollCompensationMatrixForChildren(Layer* currentLayer, const WebTransformationMatrix& currentParentMatrix, const WebTransformationMatrix& currentScrollCompensation)
+Transform computeScrollCompensationMatrixForChildren(Layer* currentLayer, const Transform& currentParentMatrix, const Transform& currentScrollCompensation)
{
// The main thread (i.e. Layer) does not need to worry about scroll compensation.
// So we can just return an identity matrix here.
- return WebTransformationMatrix();
+ return Transform();
}
-WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* layer, const WebTransformationMatrix& parentMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix)
+Transform computeScrollCompensationMatrixForChildren(LayerImpl* layer, const Transform& parentMatrix, const Transform& currentScrollCompensationMatrix)
{
// "Total scroll compensation" is the transform needed to cancel out all scrollDelta translations that
// occurred since the nearest container layer, even if there are renderSurfaces in-between.
@@ -323,7 +324,7 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* la
return currentScrollCompensationMatrix;
// Start as identity matrix.
- WebTransformationMatrix nextScrollCompensationMatrix;
+ Transform nextScrollCompensationMatrix;
// If this layer is not a container, then it inherits the existing scroll compensations.
if (!layer->isContainerForFixedPositionLayers())
@@ -332,8 +333,8 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* la
// If the current layer has a non-zero scrollDelta, then we should compute its local scrollCompensation
// and accumulate it to the nextScrollCompensationMatrix.
if (!layer->scrollDelta().IsZero()) {
- WebTransformationMatrix scrollCompensationForThisLayer = computeScrollCompensationForThisLayer(layer, parentMatrix);
- nextScrollCompensationMatrix.multiply(scrollCompensationForThisLayer);
+ Transform scrollCompensationForThisLayer = computeScrollCompensationForThisLayer(layer, parentMatrix);
+ nextScrollCompensationMatrix.PreconcatTransform(scrollCompensationForThisLayer);
}
// If the layer created its own renderSurface, we have to adjust nextScrollCompensationMatrix.
@@ -341,16 +342,16 @@ WebTransformationMatrix computeScrollCompensationMatrixForChildren(LayerImpl* la
// Step 1 (right-most in the math): transform from the new surface to the original ancestor surface
// Step 2: apply the scroll compensation
// Step 3: transform back to the new surface.
- if (layer->renderSurface() && !nextScrollCompensationMatrix.isIdentity())
- nextScrollCompensationMatrix = layer->renderSurface()->drawTransform().inverse() * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform();
+ if (layer->renderSurface() && !nextScrollCompensationMatrix.IsIdentity())
+ nextScrollCompensationMatrix = MathUtil::inverse(layer->renderSurface()->drawTransform()) * nextScrollCompensationMatrix * layer->renderSurface()->drawTransform();
return nextScrollCompensationMatrix;
}
// There is no contentsScale on impl thread.
-static inline void updateLayerContentsScale(LayerImpl*, const WebTransformationMatrix&, float, float, bool) { }
+static inline void updateLayerContentsScale(LayerImpl*, const Transform&, float, float, bool) { }
-static inline void updateLayerContentsScale(Layer* layer, const WebTransformationMatrix& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
+static inline void updateLayerContentsScale(Layer* layer, const Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
{
float rasterScale = layer->rasterScale();
if (!rasterScale) {
@@ -387,8 +388,8 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
// Recursively walks the layer tree starting at the given node and computes all the
// necessary transformations, clipRects, render surfaces, etc.
template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
-static void calculateDrawTransformsInternal(LayerType* layer, const WebTransformationMatrix& parentMatrix,
- const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix,
+static void calculateDrawTransformsInternal(LayerType* layer, const Transform& parentMatrix,
+ const Transform& fullHierarchyMatrix, const Transform& currentScrollCompensationMatrix,
const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree,
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree)
@@ -405,7 +406,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// projection applied at draw time flips the Y axis appropriately.
//
// 2. The anchor point, when given as a PointF object, is specified in "unit layer space",
- // where the bounds of the layer map to [0, 1]. However, as a WebTransformationMatrix object,
+ // where the bounds of the layer map to [0, 1]. However, as a Transform object,
// the transform to the anchor point is specified in "layer space", where the bounds
// of the layer map to [bounds.width(), bounds.height()].
//
@@ -503,16 +504,16 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
gfx::PointF anchorPoint = layer->anchorPoint();
gfx::PointF position = layer->position() - layer->scrollDelta();
- WebTransformationMatrix layerLocalTransform;
+ Transform layerLocalTransform;
// LT = Tr[origin] * Tr[origin2anchor]
- layerLocalTransform.translate3d(position.x() + anchorPoint.x() * bounds.width(), position.y() + anchorPoint.y() * bounds.height(), layer->anchorPointZ());
+ layerLocalTransform.PreconcatTranslate3d(position.x() + anchorPoint.x() * bounds.width(), position.y() + anchorPoint.y() * bounds.height(), layer->anchorPointZ());
// LT = Tr[origin] * Tr[origin2anchor] * M[layer]
- layerLocalTransform.multiply(layer->transform());
+ layerLocalTransform.PreconcatTransform(layer->transform());
// LT = Tr[origin] * Tr[origin2anchor] * M[layer] * Tr[anchor2origin]
- layerLocalTransform.translate3d(-anchorPoint.x() * bounds.width(), -anchorPoint.y() * bounds.height(), -layer->anchorPointZ());
+ layerLocalTransform.PreconcatTranslate3d(-anchorPoint.x() * bounds.width(), -anchorPoint.y() * bounds.height(), -layer->anchorPointZ());
- WebTransformationMatrix combinedTransform = parentMatrix;
- combinedTransform.multiply(layerLocalTransform);
+ Transform combinedTransform = parentMatrix;
+ combinedTransform.PreconcatTransform(layerLocalTransform);
// The layer's contentsSize is determined from the combinedTransform, which then informs the
// layer's drawTransform.
@@ -531,23 +532,23 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// The drawTransform that gets computed below is effectively the layer's drawTransform, unless
// the layer itself creates a renderSurface. In that case, the renderSurface re-parents the transforms.
- WebTransformationMatrix drawTransform = combinedTransform;
+ Transform drawTransform = combinedTransform;
// M[draw] = M[parent] * LT * S[layer2content]
- drawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(), 1.0 / layer->contentsScaleY());
+ drawTransform.PreconcatScale(1.0 / layer->contentsScaleX(), 1.0 / layer->contentsScaleY());
// layerScreenSpaceTransform represents the transform between root layer's "screen space" and local content space.
- WebTransformationMatrix layerScreenSpaceTransform = fullHierarchyMatrix;
+ Transform layerScreenSpaceTransform = fullHierarchyMatrix;
if (!layer->preserves3D())
MathUtil::flattenTransformTo2d(layerScreenSpaceTransform);
- layerScreenSpaceTransform.multiply(drawTransform);
+ layerScreenSpaceTransform.PreconcatTransform(drawTransform);
layer->setScreenSpaceTransform(layerScreenSpaceTransform);
gfx::RectF contentRect(gfx::PointF(), layer->contentBounds());
// fullHierarchyMatrix is the matrix that transforms objects between screen space (except projection matrix) and the most recent RenderSurfaceImpl's space.
// nextHierarchyMatrix will only change if this layer uses a new RenderSurfaceImpl, otherwise remains the same.
- WebTransformationMatrix nextHierarchyMatrix = fullHierarchyMatrix;
- WebTransformationMatrix sublayerMatrix;
+ Transform nextHierarchyMatrix = fullHierarchyMatrix;
+ Transform sublayerMatrix;
gfx::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
@@ -564,21 +565,21 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// The owning layer's draw transform has a scale from content to layer space which we need to undo and
// replace with a scale from the surface's subtree into layer space.
- drawTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
- drawTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
+ drawTransform.PreconcatScale(layer->contentsScaleX(), layer->contentsScaleY());
+ drawTransform.PreconcatScale(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
renderSurface->setDrawTransform(drawTransform);
// The origin of the new surface is the upper left corner of the layer.
- WebTransformationMatrix layerDrawTransform;
- layerDrawTransform.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
- layerDrawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(), 1.0 / layer->contentsScaleY());
+ Transform layerDrawTransform;
+ layerDrawTransform.PreconcatScale(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
+ layerDrawTransform.PreconcatScale(1.0 / layer->contentsScaleX(), 1.0 / layer->contentsScaleY());
layer->setDrawTransform(layerDrawTransform);
// Inside the surface's subtree, we scale everything to the owning layer's scale.
// The sublayer matrix transforms centered layer rects into target
// surface content space.
- sublayerMatrix.makeIdentity();
- sublayerMatrix.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
+ sublayerMatrix.matrix().setIdentity();
+ sublayerMatrix.PreconcatScale(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
// The opacity value is moved from the layer to its surface, so that the entire subtree properly inherits opacity.
renderSurface->setDrawOpacity(drawOpacity);
@@ -594,7 +595,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// Update the aggregate hierarchy matrix to include the transform of the
// newly created RenderSurfaceImpl.
- nextHierarchyMatrix.multiply(renderSurface->drawTransform());
+ nextHierarchyMatrix.PreconcatTransform(renderSurface->drawTransform());
// The new renderSurface here will correctly clip the entire subtree. So, we do
// not need to continue propagating the clipping state further down the tree. This
@@ -665,9 +666,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
MathUtil::flattenTransformTo2d(sublayerMatrix);
// Apply the sublayer transform at the center of the layer.
- sublayerMatrix.translate(0.5 * bounds.width(), 0.5 * bounds.height());
- sublayerMatrix.multiply(layer->sublayerTransform());
- sublayerMatrix.translate(-0.5 * bounds.width(), -0.5 * bounds.height());
+ sublayerMatrix.PreconcatTranslate(0.5 * bounds.width(), 0.5 * bounds.height());
+ sublayerMatrix.PreconcatTransform(layer->sublayerTransform());
+ sublayerMatrix.PreconcatTranslate(-0.5 * bounds.width(), -0.5 * bounds.height());
LayerList& descendants = (layer->renderSurface() ? layer->renderSurface()->layerList() : layerList);
@@ -677,7 +678,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
if (!layerShouldBeSkipped(layer))
descendants.push_back(layer);
- WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
+ Transform nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
gfx::Rect accumulatedDrawableContentRectOfChildren;
for (size_t i = 0; i < layer->children().size(); ++i) {
@@ -756,26 +757,26 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// The owning layer's screenSpaceTransform has a scale from content to layer space which we need to undo and
// replace with a scale from the surface's subtree into layer space.
- WebTransformationMatrix screenSpaceTransform = layer->screenSpaceTransform();
- screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
- screenSpaceTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
+ Transform screenSpaceTransform = layer->screenSpaceTransform();
+ screenSpaceTransform.PreconcatScale(layer->contentsScaleX(), layer->contentsScaleY());
+ screenSpaceTransform.PreconcatScale(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
renderSurface->setScreenSpaceTransform(screenSpaceTransform);
if (layer->replicaLayer()) {
- WebTransformationMatrix surfaceOriginToReplicaOriginTransform;
- surfaceOriginToReplicaOriginTransform.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
- surfaceOriginToReplicaOriginTransform.translate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(),
+ Transform surfaceOriginToReplicaOriginTransform;
+ surfaceOriginToReplicaOriginTransform.PreconcatScale(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
+ surfaceOriginToReplicaOriginTransform.PreconcatTranslate(layer->replicaLayer()->position().x() + layer->replicaLayer()->anchorPoint().x() * bounds.width(),
layer->replicaLayer()->position().y() + layer->replicaLayer()->anchorPoint().y() * bounds.height());
- surfaceOriginToReplicaOriginTransform.multiply(layer->replicaLayer()->transform());
- surfaceOriginToReplicaOriginTransform.translate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height());
- surfaceOriginToReplicaOriginTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
+ surfaceOriginToReplicaOriginTransform.PreconcatTransform(layer->replicaLayer()->transform());
+ surfaceOriginToReplicaOriginTransform.PreconcatTranslate(-layer->replicaLayer()->anchorPoint().x() * bounds.width(), -layer->replicaLayer()->anchorPoint().y() * bounds.height());
+ surfaceOriginToReplicaOriginTransform.PreconcatScale(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
// Compute the replica's "originTransform" that maps from the replica's origin space to the target surface origin space.
- WebTransformationMatrix replicaOriginTransform = layer->renderSurface()->drawTransform() * surfaceOriginToReplicaOriginTransform;
+ Transform replicaOriginTransform = layer->renderSurface()->drawTransform() * surfaceOriginToReplicaOriginTransform;
renderSurface->setReplicaDrawTransform(replicaOriginTransform);
// Compute the replica's "screenSpaceTransform" that maps from the replica's origin space to the screen's origin space.
- WebTransformationMatrix replicaScreenSpaceTransform = layer->renderSurface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform;
+ Transform replicaScreenSpaceTransform = layer->renderSurface()->screenSpaceTransform() * surfaceOriginToReplicaOriginTransform;
renderSurface->setReplicaScreenSpaceTransform(replicaScreenSpaceTransform);
}
@@ -819,9 +820,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
{
gfx::Rect totalDrawableContentRect;
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix deviceScaleTransform;
- deviceScaleTransform.scale(deviceScaleFactor);
+ Transform identityMatrix;
+ Transform deviceScaleTransform;
+ deviceScaleTransform.PreconcatScale(deviceScaleFactor, deviceScaleFactor);
std::vector<scoped_refptr<Layer> > dummyLayerList;
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
@@ -846,9 +847,9 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::S
void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList)
{
gfx::Rect totalDrawableContentRect;
- WebTransformationMatrix identityMatrix;
- WebTransformationMatrix deviceScaleTransform;
- deviceScaleTransform.scale(deviceScaleFactor);
+ Transform identityMatrix;
+ Transform deviceScaleTransform;
+ deviceScaleTransform.PreconcatScale(deviceScaleFactor, deviceScaleFactor);
std::vector<LayerImpl*> dummyLayerList;
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
@@ -870,15 +871,15 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gf
DCHECK(rootLayer->renderSurface());
}
-static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
+static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const Transform& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
{
// If the transform is not invertible, then assume that this point doesn't hit this rect.
- if (!localSpaceToScreenSpaceTransform.isInvertible())
+ if (!localSpaceToScreenSpaceTransform.IsInvertible())
return false;
// Transform the hit test point from screen space to the local space of the given rect.
bool clipped = false;
- gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), screenSpacePoint, clipped);
+ gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(MathUtil::inverse(localSpaceToScreenSpaceTransform), screenSpacePoint, clipped);
// If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect.
if (clipped)
@@ -887,15 +888,15 @@ static bool pointHitsRect(const gfx::PointF& screenSpacePoint, const WebTransfor
return localSpaceRect.Contains(hitTestPointInLocalSpace);
}
-static bool pointHitsRegion(gfx::PointF screenSpacePoint, const WebTransformationMatrix& screenSpaceTransform, const Region& layerSpaceRegion, float layerContentScaleX, float layerContentScaleY)
+static bool pointHitsRegion(gfx::PointF screenSpacePoint, const Transform& screenSpaceTransform, const Region& layerSpaceRegion, float layerContentScaleX, float layerContentScaleY)
{
// If the transform is not invertible, then assume that this point doesn't hit this region.
- if (!screenSpaceTransform.isInvertible())
+ if (!screenSpaceTransform.IsInvertible())
return false;
// Transform the hit test point from screen space to the local space of the given region.
bool clipped = false;
- gfx::PointF hitTestPointInContentSpace = MathUtil::projectPoint(screenSpaceTransform.inverse(), screenSpacePoint, clipped);
+ gfx::PointF hitTestPointInContentSpace = MathUtil::projectPoint(MathUtil::inverse(screenSpaceTransform), screenSpacePoint, clipped);
gfx::PointF hitTestPointInLayerSpace = gfx::ScalePoint(hitTestPointInContentSpace, 1 / layerContentScaleX, 1 / layerContentScaleY);
// If projectPoint could not project to a valid value, then we assume that this point doesn't hit this region.

Powered by Google App Engine
This is Rietveld 408576698