summaryrefslogtreecommitdiffstats
path: root/cc/layer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'cc/layer.cc')
-rw-r--r--cc/layer.cc33
1 files changed, 16 insertions, 17 deletions
diff --git a/cc/layer.cc b/cc/layer.cc
index b36589d..d48ab89 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>
@@ -119,15 +120,13 @@ void Layer::setNeedsCommit()
m_layerTreeHost->setNeedsCommit();
}
-IntRect Layer::layerRectToContentRect(const FloatRect& layerRect) const
+gfx::Rect Layer::layerRectToContentRect(const gfx::RectF& layerRect) const
{
- FloatRect contentRect(layerRect);
- contentRect.scale(contentsScaleX(), contentsScaleY());
- IntRect intContentRect = enclosingIntRect(contentRect);
+ gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
// Intersect with content rect to avoid the extra pixel because for some
// values x and y, ceil((x / y) * y) may be x + 1.
- intContentRect.intersect(IntRect(IntPoint(), contentBounds()));
- return intContentRect;
+ contentRect.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
+ return gfx::ToEnclosingRect(contentRect);
}
void Layer::setParent(Layer* layer)
@@ -216,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;
@@ -259,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;
@@ -283,7 +282,7 @@ void Layer::setBackgroundColor(SkColor backgroundColor)
setNeedsCommit();
}
-IntSize Layer::contentBounds() const
+gfx::Size Layer::contentBounds() const
{
return bounds();
}
@@ -380,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;
@@ -506,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;
if (drawsContent())
@@ -597,7 +596,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());
@@ -614,7 +613,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()
@@ -831,7 +830,7 @@ void Layer::notifyAnimationFinished(double wallClockTime)
Region Layer::visibleContentOpaqueRegion() const
{
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return Region();
}