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

Unified Diff: cc/layer.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
« no previous file with comments | « cc/layer.h ('k') | cc/layer_impl.h » ('j') | cc/layer_quad.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer.cc
diff --git a/cc/layer.cc b/cc/layer.cc
index afa35e819ed7191251be9160681bdb3e488d4296..d4da8fad087e750dfc0999467f16988f7a1cc5a8 100644
--- a/cc/layer.cc
+++ b/cc/layer.cc
@@ -13,6 +13,7 @@
#include "cc/layer_tree_host.h"
#include "cc/settings.h"
#include "third_party/skia/include/core/SkImageFilter.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebAnimationDelegate.h>
#include <public/WebLayerScrollClient.h>
#include <public/WebSize.h>
@@ -120,13 +121,12 @@ void Layer::setNeedsCommit()
m_layerTreeHost->setNeedsCommit();
}
-IntRect Layer::layerRectToContentRect(const WebKit::WebRect& layerRect)
+gfx::Rect Layer::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);
}
void Layer::setParent(Layer* layer)
@@ -215,12 +215,12 @@ int Layer::indexOfChild(const Layer* reference)
return -1;
}
-void Layer::setBounds(const IntSize& size)
+void Layer::setBounds(const gfx::Size& size)
{
if (bounds() == size)
return;
- bool firstResize = bounds().isEmpty() && !size.isEmpty();
+ bool firstResize = bounds().IsEmpty() && !size.IsEmpty();
m_bounds = size;
@@ -258,7 +258,7 @@ void Layer::setChildren(const LayerList& children)
addChild(children[i]);
}
-void Layer::setAnchorPoint(const FloatPoint& anchorPoint)
+void Layer::setAnchorPoint(const gfx::PointF& anchorPoint)
{
if (m_anchorPoint == anchorPoint)
return;
@@ -282,7 +282,7 @@ void Layer::setBackgroundColor(SkColor backgroundColor)
setNeedsCommit();
}
-IntSize Layer::contentBounds() const
+gfx::Size Layer::contentBounds() const
{
return bounds();
}
@@ -379,7 +379,7 @@ void Layer::setContentsOpaque(bool opaque)
setNeedsDisplay();
}
-void Layer::setPosition(const FloatPoint& position)
+void Layer::setPosition(const gfx::PointF& position)
{
if (m_position == position)
return;
@@ -505,14 +505,14 @@ Layer* Layer::parent() const
return m_parent;
}
-void Layer::setNeedsDisplayRect(const FloatRect& dirtyRect)
+void Layer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
{
- m_updateRect.unite(dirtyRect);
+ m_updateRect.Union(dirtyRect);
// Simply mark the contents as dirty. For non-root layers, the call to
// setNeedsCommit will schedule a fresh compositing pass.
// For the root layer, setNeedsCommit has no effect.
- if (!dirtyRect.isEmpty())
+ if (!dirtyRect.IsEmpty())
m_needsDisplay = true;
setNeedsCommit();
@@ -594,7 +594,7 @@ void Layer::pushPropertiesTo(LayerImpl* layer)
// If the main thread commits multiple times before the impl thread actually draws, then damage tracking
// will become incorrect if we simply clobber the updateRect here. The LayerImpl's updateRect needs to
// accumulate (i.e. union) any update changes that have occurred on the main thread.
- m_updateRect.uniteIfNonZero(layer->updateRect());
+ m_updateRect.Union(layer->updateRect());
layer->setUpdateRect(m_updateRect);
layer->setScrollDelta(layer->scrollDelta() - layer->sentScrollDelta());
@@ -611,7 +611,7 @@ void Layer::pushPropertiesTo(LayerImpl* layer)
// Reset any state that should be cleared for the next update.
m_stackingOrderChanged = false;
- m_updateRect = FloatRect();
+ m_updateRect = gfx::RectF();
}
scoped_ptr<LayerImpl> Layer::createLayerImpl()
@@ -832,7 +832,7 @@ void Layer::notifyAnimationFinished(double wallClockTime)
Region Layer::visibleContentOpaqueRegion() const
{
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return Region();
}
« no previous file with comments | « cc/layer.h ('k') | cc/layer_impl.h » ('j') | cc/layer_quad.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698