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

Unified Diff: cc/layer_tree_host_common.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some missed intstuff Created 8 years, 2 months 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 92b44d1ad2fa5623daf138e22b18010a3ccc7520..029e51d0828d110046948eb21ff33fe33a1de72c 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -7,7 +7,6 @@
#include "cc/layer_tree_host_common.h"
#include "FloatQuad.h"
-#include "IntRect.h"
#include "cc/layer.h"
#include "cc/layer_impl.h"
#include "cc/layer_iterator.h"
@@ -15,6 +14,7 @@
#include "cc/math_util.h"
#include "cc/render_surface.h"
#include "cc/render_surface_impl.h"
+#include "ui/gfx/rect_conversions.h"
#include <algorithm>
#include <public/WebTransformationMatrix.h>
@@ -30,26 +30,26 @@ ScrollAndScaleSet::~ScrollAndScaleSet()
{
}
-IntRect LayerTreeHostCommon::calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebTransformationMatrix& transform)
+gfx::Rect LayerTreeHostCommon::calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const WebTransformationMatrix& transform)
{
// Is this layer fully contained within the target surface?
- IntRect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect);
- if (targetSurfaceRect.contains(layerInSurfaceSpace))
+ gfx::Rect layerInSurfaceSpace = MathUtil::mapClippedRect(transform, layerBoundRect);
+ if (targetSurfaceRect.Contains(layerInSurfaceSpace))
return layerBoundRect;
// If the layer doesn't fill up the entire surface, then find the part of
// the surface rect where the layer could be visible. This avoids trying to
// project surface rect points that are behind the projection point.
- IntRect minimalSurfaceRect = targetSurfaceRect;
- minimalSurfaceRect.intersect(layerInSurfaceSpace);
+ gfx::Rect minimalSurfaceRect = targetSurfaceRect;
+ minimalSurfaceRect.Intersect(layerInSurfaceSpace);
// Project the corners of the target surface rect into the layer space.
// 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();
- IntRect layerRect = enclosingIntRect(MathUtil::projectClippedRect(surfaceToLayer, FloatRect(minimalSurfaceRect)));
- layerRect.intersect(layerBoundRect);
+ gfx::Rect layerRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(surfaceToLayer, gfx::RectF(minimalSurfaceRect)));
+ layerRect.Intersect(layerBoundRect);
return layerRect;
}
@@ -110,31 +110,31 @@ static inline bool layerClipsSubtree(LayerType* layer)
}
template<typename LayerType>
-static IntRect calculateVisibleContentRect(LayerType* layer)
+static gfx::Rect calculateVisibleContentRect(LayerType* layer)
{
DCHECK(layer->renderTarget());
// Nothing is visible if the layer bounds are empty.
- if (!layer->drawsContent() || layer->contentBounds().isEmpty() || layer->drawableContentRect().isEmpty())
- return IntRect();
+ if (!layer->drawsContent() || layer->contentBounds().IsEmpty() || layer->drawableContentRect().IsEmpty())
+ return gfx::Rect();
- IntRect targetSurfaceClipRect;
+ gfx::Rect targetSurfaceClipRect;
// First, compute visible bounds in target surface space.
- if (layer->renderTarget()->renderSurface()->clipRect().isEmpty())
+ if (layer->renderTarget()->renderSurface()->clipRect().IsEmpty())
targetSurfaceClipRect = layer->drawableContentRect();
else {
// 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 = enclosingIntRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect()));
- targetSurfaceClipRect.intersect(layer->drawableContentRect());
+ targetSurfaceClipRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(layer->renderTarget()->renderSurface()->drawTransform().inverse(), layer->renderTarget()->renderSurface()->clipRect()));
+ targetSurfaceClipRect.Intersect(layer->drawableContentRect());
}
- if (targetSurfaceClipRect.isEmpty())
- return IntRect();
+ if (targetSurfaceClipRect.IsEmpty())
+ return gfx::Rect();
- return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, IntRect(IntPoint(), layer->contentBounds()), layer->drawTransform());
+ return LayerTreeHostCommon::calculateVisibleRect(targetSurfaceClipRect, gfx::Rect(gfx::Point(), layer->contentBounds()), layer->drawTransform());
}
static bool isScaleOrTranslation(const WebTransformationMatrix& m)
@@ -182,7 +182,7 @@ static bool layerShouldBeSkipped(LayerType* layer)
// we would have skipped the entire subtree and never made it into this function,
// so it is safe to omit this check here.
- if (!layer->drawsContent() || layer->bounds().isEmpty())
+ if (!layer->drawsContent() || layer->bounds().IsEmpty())
return true;
LayerType* backfaceTestLayer = layer;
@@ -354,7 +354,7 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
rasterScale = 1;
if (layer->automaticallyComputeRasterScale()) {
- FloatPoint transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
+ gfx::PointF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
float combinedScale = std::max(transformScale.x(), transformScale.y());
rasterScale = combinedScale / deviceScaleFactor;
if (!layer->boundsContainPageScale())
@@ -379,12 +379,12 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
// Should be called just before the recursive calculateDrawTransformsInternal().
template<typename LayerType, typename LayerList>
-void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& renderSurfaceLayerList, const IntSize& deviceViewportSize)
+void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& renderSurfaceLayerList, const gfx::Size& deviceViewportSize)
{
if (!rootLayer->renderSurface())
rootLayer->createRenderSurface();
- rootLayer->renderSurface()->setContentRect(IntRect(IntPoint::zero(), deviceViewportSize));
+ rootLayer->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), deviceViewportSize));
rootLayer->renderSurface()->clearLayerLists();
DCHECK(renderSurfaceLayerList.empty());
@@ -396,9 +396,9 @@ void setupRootLayerAndSurfaceForRecursion(LayerType* rootLayer, LayerList& rende
template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLayer, const WebTransformationMatrix& parentMatrix,
const WebTransformationMatrix& fullHierarchyMatrix, const WebTransformationMatrix& currentScrollCompensationMatrix,
- const IntRect& clipRectFromAncestor, bool ancestorClipsSubtree,
+ const gfx::Rect& clipRectFromAncestor, bool ancestorClipsSubtree,
RenderSurfaceType* nearestAncestorThatMovesPixels, LayerList& renderSurfaceLayerList, LayerList& layerList,
- LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, IntRect& drawableContentRectOfSubtree)
+ LayerSorter* layerSorter, int maxTextureSize, float deviceScaleFactor, float pageScaleFactor, gfx::Rect& drawableContentRectOfSubtree)
{
// This function computes the new matrix transformations recursively for this
// layer and all its descendants. It also computes the appropriate render surfaces.
@@ -411,7 +411,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// positive Y-axis points downwards. This interpretation is valid because the orthographic
// projection applied at draw time flips the Y axis appropriately.
//
- // 2. The anchor point, when given as a FloatPoint object, is specified in "unit layer space",
+ // 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,
// the transform to the anchor point is specified in "layer space", where the bounds
// of the layer map to [bounds.width(), bounds.height()].
@@ -483,12 +483,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
//
// If we early-exit anywhere in this function, the drawableContentRect of this subtree should be considered empty.
- drawableContentRectOfSubtree = IntRect();
+ drawableContentRectOfSubtree = gfx::Rect();
if (subtreeShouldBeSkipped(layer))
return;
- IntRect clipRectForSubtree;
+ gfx::Rect clipRectForSubtree;
bool subtreeShouldBeClipped = false;
float drawOpacity = layer->opacity();
@@ -498,9 +498,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
drawOpacityIsAnimating |= layer->parent()->drawOpacityIsAnimating();
}
- IntSize bounds = layer->bounds();
- FloatPoint anchorPoint = layer->anchorPoint();
- FloatPoint position = layer->position() - layer->scrollDelta();
+ gfx::Size bounds = layer->bounds();
+ gfx::PointF anchorPoint = layer->anchorPoint();
+ gfx::PointF position = layer->position() - gfx::Vector2d(layer->scrollDelta().width(), layer->scrollDelta().height());
WebTransformationMatrix layerLocalTransform;
// LT = Tr[origin] * Tr[origin2anchor]
@@ -531,7 +531,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// 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;
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
// M[draw] = M[parent] * LT * S[layer2content]
drawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
@@ -551,14 +551,14 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
animatingTransformToScreen |= layer->parent()->screenSpaceTransformIsAnimating();
}
- FloatRect contentRect(FloatPoint(), layer->contentBounds());
+ 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;
- FloatPoint renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
+ gfx::PointF renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) {
// Check back-face visibility before continuing with this surface and its subtree
@@ -573,7 +573,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// 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.
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
drawTransform.scaleNonUniform(layer->contentBounds().width() / static_cast<double>(layer->bounds().width()),
layer->contentBounds().height() / static_cast<double>(layer->bounds().height()));
}
@@ -583,7 +583,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// The origin of the new surface is the upper left corner of the layer.
WebTransformationMatrix layerDrawTransform;
layerDrawTransform.scaleNonUniform(renderSurfaceSublayerScale.x(), renderSurfaceSublayerScale.y());
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
layerDrawTransform.scaleNonUniform(layer->bounds().width() / static_cast<double>(layer->contentBounds().width()),
layer->bounds().height() / static_cast<double>(layer->contentBounds().height()));
}
@@ -619,12 +619,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
if (layer->maskLayer()) {
layer->maskLayer()->setRenderTarget(layer);
- layer->maskLayer()->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
+ layer->maskLayer()->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
}
if (layer->replicaLayer() && layer->replicaLayer()->maskLayer()) {
layer->replicaLayer()->maskLayer()->setRenderTarget(layer);
- layer->replicaLayer()->maskLayer()->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
+ layer->replicaLayer()->maskLayer()->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
}
// FIXME: make this smarter for the SkImageFilter case (check for
@@ -636,7 +636,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
if (ancestorClipsSubtree)
renderSurface->setClipRect(clipRectFromAncestor);
else
- renderSurface->setClipRect(IntRect());
+ renderSurface->setClipRect(gfx::Rect());
renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels);
@@ -671,13 +671,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
}
}
- IntRect rectInTargetSpace = enclosingIntRect(MathUtil::mapClippedRect(layer->drawTransform(), contentRect));
+ gfx::Rect rectInTargetSpace = ToEnclosingRect(MathUtil::mapClippedRect(layer->drawTransform(), contentRect));
if (layerClipsSubtree(layer)) {
subtreeShouldBeClipped = true;
if (ancestorClipsSubtree && !layer->renderSurface()) {
clipRectForSubtree = clipRectFromAncestor;
- clipRectForSubtree.intersect(rectInTargetSpace);
+ clipRectForSubtree.Intersect(rectInTargetSpace);
} else
clipRectForSubtree = rectInTargetSpace;
}
@@ -701,41 +701,41 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
WebTransformationMatrix nextScrollCompensationMatrix = computeScrollCompensationMatrixForChildren(layer, parentMatrix, currentScrollCompensationMatrix);;
- IntRect accumulatedDrawableContentRectOfChildren;
+ gfx::Rect accumulatedDrawableContentRectOfChildren;
for (size_t i = 0; i < layer->children().size(); ++i) {
LayerType* child = LayerTreeHostCommon::getChildAsRawPtr(layer->children(), i);
- IntRect drawableContentRectOfChildSubtree;
+ gfx::Rect drawableContentRectOfChildSubtree;
calculateDrawTransformsInternal<LayerType, LayerList, RenderSurfaceType, LayerSorter>(child, rootLayer, sublayerMatrix, nextHierarchyMatrix, nextScrollCompensationMatrix,
clipRectForSubtree, subtreeShouldBeClipped, nearestAncestorThatMovesPixels,
renderSurfaceLayerList, descendants, layerSorter, maxTextureSize, deviceScaleFactor, pageScaleFactor, drawableContentRectOfChildSubtree);
- if (!drawableContentRectOfChildSubtree.isEmpty()) {
- accumulatedDrawableContentRectOfChildren.unite(drawableContentRectOfChildSubtree);
+ if (!drawableContentRectOfChildSubtree.IsEmpty()) {
+ accumulatedDrawableContentRectOfChildren.Union(drawableContentRectOfChildSubtree);
if (child->renderSurface())
descendants.push_back(child);
}
}
// Compute the total drawableContentRect for this subtree (the rect is in targetSurface space)
- IntRect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren;
+ gfx::Rect localDrawableContentRectOfSubtree = accumulatedDrawableContentRectOfChildren;
if (layer->drawsContent())
- localDrawableContentRectOfSubtree.unite(rectInTargetSpace);
+ localDrawableContentRectOfSubtree.Union(rectInTargetSpace);
if (subtreeShouldBeClipped)
- localDrawableContentRectOfSubtree.intersect(clipRectForSubtree);
+ localDrawableContentRectOfSubtree.Intersect(clipRectForSubtree);
// Compute the layer's drawable content rect (the rect is in targetSurface space)
- IntRect drawableContentRectOfLayer = rectInTargetSpace;
+ gfx::Rect drawableContentRectOfLayer = rectInTargetSpace;
if (subtreeShouldBeClipped)
- drawableContentRectOfLayer.intersect(clipRectForSubtree);
+ drawableContentRectOfLayer.Intersect(clipRectForSubtree);
layer->setDrawableContentRect(drawableContentRectOfLayer);
// Compute the layer's visible content rect (the rect is in content space)
- IntRect visibleContentRectOfLayer = calculateVisibleContentRect(layer);
+ gfx::Rect visibleContentRectOfLayer = calculateVisibleContentRect(layer);
layer->setVisibleContentRect(visibleContentRectOfLayer);
// Compute the remaining properties for the render surface, if the layer has one.
if (layer->renderSurface() && layer != rootLayer) {
RenderSurfaceType* renderSurface = layer->renderSurface();
- IntRect clippedContentRect = localDrawableContentRectOfSubtree;
+ gfx::Rect clippedContentRect = localDrawableContentRectOfSubtree;
// Don't clip if the layer is reflected as the reflection shouldn't be
// clipped. If the layer is animating, then the surface's transform to
@@ -743,18 +743,18 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// to clip.
if (!layer->replicaLayer() && transformToParentIsKnown(layer)) {
// Note, it is correct to use ancestorClipsSubtree here, because we are looking at this layer's renderSurface, not the layer itself.
- if (ancestorClipsSubtree && !clippedContentRect.isEmpty()) {
- IntRect surfaceClipRect = LayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform());
- clippedContentRect.intersect(surfaceClipRect);
+ if (ancestorClipsSubtree && !clippedContentRect.IsEmpty()) {
+ gfx::Rect surfaceClipRect = LayerTreeHostCommon::calculateVisibleRect(renderSurface->clipRect(), clippedContentRect, renderSurface->drawTransform());
+ clippedContentRect.Intersect(surfaceClipRect);
}
}
// The RenderSurfaceImpl backing texture cannot exceed the maximum supported
// texture size.
- clippedContentRect.setWidth(std::min(clippedContentRect.width(), maxTextureSize));
- clippedContentRect.setHeight(std::min(clippedContentRect.height(), maxTextureSize));
+ clippedContentRect.set_width(std::min(clippedContentRect.width(), maxTextureSize));
+ clippedContentRect.set_height(std::min(clippedContentRect.height(), maxTextureSize));
- if (clippedContentRect.isEmpty())
+ if (clippedContentRect.IsEmpty())
renderSurface->clearLayerLists();
renderSurface->setContentRect(clippedContentRect);
@@ -762,7 +762,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
// 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();
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
screenSpaceTransform.scaleNonUniform(layer->contentBounds().width() / static_cast<double>(layer->bounds().width()),
layer->contentBounds().height() / static_cast<double>(layer->bounds().height()));
}
@@ -816,7 +816,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
sortLayers(descendants.begin() + sortingStartIndex, descendants.end(), layerSorter);
if (layer->renderSurface())
- drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()->drawableContentRect());
+ drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface()->drawableContentRect());
else
drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
@@ -824,9 +824,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay
layer->renderTarget()->renderSurface()->addContributingDelegatedRenderPassLayer(layer);
}
-void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
+void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList)
{
- IntRect totalDrawableContentRect;
+ gfx::Rect totalDrawableContentRect;
WebTransformationMatrix identityMatrix;
WebTransformationMatrix deviceScaleTransform;
deviceScaleTransform.scale(deviceScaleFactor);
@@ -840,9 +840,9 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSiz
deviceScaleFactor, pageScaleFactor, totalDrawableContentRect);
}
-void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList)
+void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter* layerSorter, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList)
{
- IntRect totalDrawableContentRect;
+ gfx::Rect totalDrawableContentRect;
WebTransformationMatrix identityMatrix;
WebTransformationMatrix deviceScaleTransform;
deviceScaleTransform.scale(deviceScaleFactor);
@@ -856,7 +856,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const In
deviceScaleFactor, pageScaleFactor, totalDrawableContentRect);
}
-static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, FloatRect localSpaceRect)
+static bool pointHitsRect(const gfx::Point& screenSpacePoint, const WebTransformationMatrix& localSpaceToScreenSpaceTransform, gfx::RectF localSpaceRect)
{
// If the transform is not invertible, then assume that this point doesn't hit this rect.
if (!localSpaceToScreenSpaceTransform.isInvertible())
@@ -864,16 +864,16 @@ static bool pointHitsRect(const IntPoint& screenSpacePoint, const WebTransformat
// Transform the hit test point from screen space to the local space of the given rect.
bool clipped = false;
- FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), FloatPoint(screenSpacePoint), clipped);
+ gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(localSpaceToScreenSpaceTransform.inverse(), gfx::PointF(screenSpacePoint), clipped);
// If projectPoint could not project to a valid value, then we assume that this point doesn't hit this rect.
if (clipped)
return false;
- return localSpaceRect.contains(hitTestPointInLocalSpace);
+ return localSpaceRect.Contains(hitTestPointInLocalSpace);
}
-static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint, LayerImpl* layer)
+static bool pointIsClippedBySurfaceOrClipRect(const gfx::Point& screenSpacePoint, LayerImpl* layer)
{
LayerImpl* currentLayer = layer;
@@ -895,7 +895,7 @@ static bool pointIsClippedBySurfaceOrClipRect(const IntPoint& screenSpacePoint,
return false;
}
-LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList)
+LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList)
{
LayerImpl* foundLayer = 0;
@@ -909,7 +909,7 @@ LayerImpl* LayerTreeHostCommon::findLayerThatIsHitByPoint(const IntPoint& screen
LayerImpl* currentLayer = (*it);
- FloatRect contentRect(FloatPoint::zero(), currentLayer->contentBounds());
+ gfx::RectF contentRect(gfx::PointF(), currentLayer->contentBounds());
if (!pointHitsRect(screenSpacePoint, currentLayer->screenSpaceTransform(), contentRect))
continue;

Powered by Google App Engine
This is Rietveld 408576698