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

Unified Diff: cc/layer_impl.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_impl.cc
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 3de9483fccaa6f420319d0fb77bf5b0fd8b1af06..4d36b7887a1a0e180ea77d60dbe168fb938498e3 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -16,6 +16,8 @@
#include "cc/scrollbar_animation_controller.h"
#include "cc/settings.h"
#include "third_party/skia/include/core/SkImageFilter.h"
+#include "ui/gfx/point_conversions.h"
+#include "ui/gfx/rect_conversions.h"
using WebKit::WebTransformationMatrix;
@@ -150,7 +152,7 @@ void LayerImpl::appendDebugBorderQuad(QuadSink& quadList, const SharedQuadState*
if (!hasDebugBorders())
return;
- IntRect contentRect(IntPoint(), contentBounds());
+ gfx::Rect contentRect(gfx::Point(), contentBounds());
quadList.append(DebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth()).PassAs<DrawQuad>(), appendQuadsData);
}
@@ -208,8 +210,8 @@ InputHandlerClient::ScrollStatus LayerImpl::tryScroll(const IntPoint& screenSpac
if (!nonFastScrollableRegion().isEmpty()) {
bool clipped = false;
- FloatPoint hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped);
- if (!clipped && nonFastScrollableRegion().contains(flooredIntPoint(hitTestPointInLocalSpace))) {
+ gfx::PointF hitTestPointInLocalSpace = MathUtil::projectPoint(screenSpaceTransform().inverse(), FloatPoint(screenSpacePoint), clipped);
+ if (!clipped && nonFastScrollableRegion().contains(cc::IntPoint(gfx::ToFlooredPoint(hitTestPointInLocalSpace)))) {
TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed nonFastScrollableRegion");
return InputHandlerClient::ScrollOnMainThread;
}
@@ -233,13 +235,12 @@ bool LayerImpl::drawCheckerboardForMissingTiles() const
return m_drawCheckerboardForMissingTiles && !Settings::backgroundColorInsteadOfCheckerboard();
}
-IntRect LayerImpl::layerRectToContentRect(const WebKit::WebRect& layerRect)
+gfx::Rect LayerImpl::layerRectToContentRect(const gfx::Rect& layerRect)
{
float widthScale = static_cast<float>(contentBounds().width()) / bounds().width();
float heightScale = static_cast<float>(contentBounds().height()) / bounds().height();
- FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.height);
- contentRect.scale(widthScale, heightScale);
- return enclosingIntRect(contentRect);
+ gfx::RectF contentRect = gfx::ScaleRect(layerRect, widthScale, heightScale);
+ return gfx::ToEnclosingRect(contentRect);
}
std::string LayerImpl::indentString(int indent)
@@ -356,7 +357,7 @@ void LayerImpl::resetAllChangeTrackingForSubtree()
m_layerPropertyChanged = false;
m_layerSurfacePropertyChanged = false;
- m_updateRect = FloatRect();
+ m_updateRect = gfx::RectF();
if (m_renderSurface)
m_renderSurface->resetPropertyChangedFlag();
@@ -401,7 +402,7 @@ void LayerImpl::setTransformFromAnimation(const WebTransformationMatrix& transfo
setTransform(transform);
}
-void LayerImpl::setBounds(const IntSize& bounds)
+void LayerImpl::setBounds(const gfx::Size& bounds)
{
if (m_bounds == bounds)
return;
@@ -447,7 +448,7 @@ void LayerImpl::setDrawsContent(bool drawsContent)
m_layerPropertyChanged = true;
}
-void LayerImpl::setAnchorPoint(const FloatPoint& anchorPoint)
+void LayerImpl::setAnchorPoint(const gfx::PointF& anchorPoint)
{
if (m_anchorPoint == anchorPoint)
return;
@@ -535,7 +536,7 @@ bool LayerImpl::opacityIsAnimating() const
return m_layerAnimationController->isAnimatingProperty(ActiveAnimation::Opacity);
}
-void LayerImpl::setPosition(const FloatPoint& position)
+void LayerImpl::setPosition(const gfx::PointF& position)
{
if (m_position == position)
return;
@@ -600,7 +601,7 @@ bool LayerImpl::hasDebugBorders() const
return SkColorGetA(m_debugBorderColor) && debugBorderWidth() > 0;
}
-void LayerImpl::setContentBounds(const IntSize& contentBounds)
+void LayerImpl::setContentBounds(const gfx::Size& contentBounds)
{
if (m_contentBounds == contentBounds)
return;
@@ -648,7 +649,7 @@ void LayerImpl::setDoubleSided(bool doubleSided)
Region LayerImpl::visibleContentOpaqueRegion() const
{
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return Region();
}
« no previous file with comments | « cc/layer_impl.h ('k') | cc/layer_iterator_unittest.cc » ('j') | cc/layer_quad.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698