summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 18:15:58 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-01 18:15:58 +0000
commitaad0a007e1cd343892d7b13ce5ea8d90e8ef7f53 (patch)
tree24c9af166977bbf8f25aa5b129defb35f3f8ec05 /cc
parent33432d8c37e3b929c60097c1eb7a53b13f364fb5 (diff)
downloadchromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.zip
chromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.tar.gz
chromium_src-aad0a007e1cd343892d7b13ce5ea8d90e8ef7f53.tar.bz2
cc: Use gfx:: Geometry types for positions, bounds, and related things.
This covers layers, layer tree hosts, and related classes. *phew* I intentionally avoided anything to do with scrolling or page scale. Those should be changed to be Vectors and need a bit more thought. This change should be pretty mindless. It converts to gfx Rect, Size, Vector, and Point classes. No change is made for FloatPoint3D or FloatQuad yet. I've added cc/geometry.h as a place for free functions that don't exist on gfx types yet, and that we should port over in the future. No change in behaviour; covered by existing tests. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11264056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.gyp1
-rw-r--r--cc/contents_scaling_layer.cc6
-rw-r--r--cc/contents_scaling_layer.h2
-rw-r--r--cc/contents_scaling_layer_unittest.cc14
-rw-r--r--cc/damage_tracker.cc99
-rw-r--r--cc/damage_tracker.h34
-rw-r--r--cc/damage_tracker_unittest.cc435
-rw-r--r--cc/debug_rect_history.cc11
-rw-r--r--cc/debug_rect_history.h6
-rw-r--r--cc/delegated_renderer_layer_impl_unittest.cc88
-rw-r--r--cc/draw_quad_unittest.cc2
-rw-r--r--cc/font_atlas.cc6
-rw-r--r--cc/font_atlas.h10
-rw-r--r--cc/geometry.h21
-rw-r--r--cc/gl_renderer.cc26
-rw-r--r--cc/gl_renderer.h4
-rw-r--r--cc/gl_renderer_unittest.cc4
-rw-r--r--cc/heads_up_display_layer_impl.cc6
-rw-r--r--cc/image_layer.cc10
-rw-r--r--cc/image_layer.h2
-rw-r--r--cc/io_surface_layer_impl.cc4
-rw-r--r--cc/io_surface_layer_impl.h6
-rw-r--r--cc/layer.cc33
-rw-r--r--cc/layer.h43
-rw-r--r--cc/layer_impl.cc30
-rw-r--r--cc/layer_impl.h48
-rw-r--r--cc/layer_iterator_unittest.cc8
-rw-r--r--cc/layer_quad.cc6
-rw-r--r--cc/layer_quad.h6
-rw-r--r--cc/layer_sorter.cc34
-rw-r--r--cc/layer_sorter.h7
-rw-r--r--cc/layer_tiling_data.cc48
-rw-r--r--cc/layer_tiling_data.h32
-rw-r--r--cc/layer_tree_host.cc26
-rw-r--r--cc/layer_tree_host.h21
-rw-r--r--cc/layer_tree_host_common.cc151
-rw-r--r--cc/layer_tree_host_common.h10
-rw-r--r--cc/layer_tree_host_common_unittest.cc974
-rw-r--r--cc/layer_tree_host_impl.cc65
-rw-r--r--cc/layer_tree_host_impl.h20
-rw-r--r--cc/layer_tree_host_impl_unittest.cc665
-rw-r--r--cc/layer_tree_host_unittest.cc236
-rw-r--r--cc/layer_unittest.cc36
-rw-r--r--cc/math_util.cc60
-rw-r--r--cc/math_util.h34
-rw-r--r--cc/math_util_unittest.cc25
-rw-r--r--cc/occlusion_tracker.cc12
-rw-r--r--cc/occlusion_tracker_unittest.cc396
-rw-r--r--cc/overdraw_metrics.cc6
-rw-r--r--cc/priority_calculator.cc7
-rw-r--r--cc/priority_calculator.h7
-rw-r--r--cc/proxy.h7
-rw-r--r--cc/quad_culler_unittest.cc142
-rw-r--r--cc/render_pass.cc4
-rw-r--r--cc/render_surface.cc6
-rw-r--r--cc/render_surface.h18
-rw-r--r--cc/render_surface_impl.cc32
-rw-r--r--cc/render_surface_impl.h20
-rw-r--r--cc/renderer.h4
-rw-r--r--cc/scoped_texture.cc4
-rw-r--r--cc/scoped_texture.h2
-rw-r--r--cc/scrollbar_animation_controller.cc4
-rw-r--r--cc/scrollbar_animation_controller.h10
-rw-r--r--cc/scrollbar_layer.cc24
-rw-r--r--cc/scrollbar_layer.h4
-rw-r--r--cc/scrollbar_layer_impl.cc15
-rw-r--r--cc/single_thread_proxy.cc2
-rw-r--r--cc/single_thread_proxy.h2
-rw-r--r--cc/software_renderer.cc6
-rw-r--r--cc/software_renderer.h2
-rw-r--r--cc/software_renderer_unittest.cc30
-rw-r--r--cc/stubs/float_point_3d.h6
-rw-r--r--cc/stubs/float_size.h5
-rw-r--r--cc/stubs/int_point.h4
-rw-r--r--cc/stubs/skia_utils.h14
-rw-r--r--cc/test/layer_test_common.cc32
-rw-r--r--cc/test/layer_test_common.h12
-rw-r--r--cc/test/tiled_layer_test_common.cc10
-rw-r--r--cc/test/tiled_layer_test_common.h24
-rw-r--r--cc/texture_layer.cc4
-rw-r--r--cc/texture_layer.h6
-rw-r--r--cc/texture_layer_impl.cc2
-rw-r--r--cc/texture_layer_impl.h4
-rw-r--r--cc/thread_proxy.cc2
-rw-r--r--cc/thread_proxy.h4
-rw-r--r--cc/tile_draw_quad.cc4
-rw-r--r--cc/tile_draw_quad.h8
-rw-r--r--cc/tiled_layer.cc209
-rw-r--r--cc/tiled_layer.h20
-rw-r--r--cc/tiled_layer_impl.cc30
-rw-r--r--cc/tiled_layer_impl.h2
-rw-r--r--cc/tiled_layer_impl_unittest.cc58
-rw-r--r--cc/tiled_layer_unittest.cc404
-rw-r--r--cc/tree_synchronizer_unittest.cc8
-rw-r--r--cc/video_layer_impl.cc2
95 files changed, 2564 insertions, 2491 deletions
diff --git a/cc/cc.gyp b/cc/cc.gyp
index 19f72ba..2f8777e 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -46,6 +46,7 @@
'frame_rate_controller.h',
'frame_rate_counter.cc',
'frame_rate_counter.h',
+ 'geometry.h',
'graphics_context.h',
'heads_up_display_layer_impl.cc',
'heads_up_display_layer_impl.h',
diff --git a/cc/contents_scaling_layer.cc b/cc/contents_scaling_layer.cc
index 2e041a1..1b5443b 100644
--- a/cc/contents_scaling_layer.cc
+++ b/cc/contents_scaling_layer.cc
@@ -5,6 +5,7 @@
#include "config.h"
#include "cc/contents_scaling_layer.h"
+#include "ui/gfx/size_conversions.h"
namespace cc {
@@ -15,9 +16,8 @@ ContentsScalingLayer::ContentsScalingLayer()
ContentsScalingLayer::~ContentsScalingLayer() {
}
-IntSize ContentsScalingLayer::contentBounds() const {
- return IntSize(ceil(bounds().width() * contentsScaleX()),
- ceil(bounds().height() * contentsScaleY()));
+gfx::Size ContentsScalingLayer::contentBounds() const {
+ return gfx::ToCeiledSize(bounds().Scale(contentsScaleX(), contentsScaleY()));
}
float ContentsScalingLayer::contentsScaleX() const {
diff --git a/cc/contents_scaling_layer.h b/cc/contents_scaling_layer.h
index 94e83a9..45497ee 100644
--- a/cc/contents_scaling_layer.h
+++ b/cc/contents_scaling_layer.h
@@ -13,7 +13,7 @@ namespace cc {
// The content bounds are determined by bounds and scale of the contents.
class ContentsScalingLayer : public Layer {
public:
- virtual IntSize contentBounds() const OVERRIDE;
+ virtual gfx::Size contentBounds() const OVERRIDE;
virtual float contentsScaleX() const OVERRIDE;
virtual float contentsScaleY() const OVERRIDE;
virtual void setContentsScale(float contentsScale) OVERRIDE;
diff --git a/cc/contents_scaling_layer_unittest.cc b/cc/contents_scaling_layer_unittest.cc
index 4c79a90..e05d762 100644
--- a/cc/contents_scaling_layer_unittest.cc
+++ b/cc/contents_scaling_layer_unittest.cc
@@ -17,7 +17,7 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
: ContentsScalingLayer() {
}
- virtual void setNeedsDisplayRect(const FloatRect& dirtyRect) OVERRIDE {
+ virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect) OVERRIDE {
m_lastNeedsDisplayRect = dirtyRect;
ContentsScalingLayer::setNeedsDisplayRect(dirtyRect);
}
@@ -26,7 +26,7 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
m_needsDisplay = false;
}
- const FloatRect& lastNeedsDisplayRect() const {
+ const gfx::RectF& lastNeedsDisplayRect() const {
return m_lastNeedsDisplayRect;
}
@@ -34,14 +34,14 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
virtual ~MockContentsScalingLayer() {
}
- FloatRect m_lastNeedsDisplayRect;
+ gfx::RectF m_lastNeedsDisplayRect;
};
TEST(ContentsScalingLayerTest, checkContentsBounds) {
scoped_refptr<MockContentsScalingLayer> testLayer =
make_scoped_refptr(new MockContentsScalingLayer());
- testLayer->setBounds(IntSize(320, 240));
+ testLayer->setBounds(gfx::Size(320, 240));
EXPECT_FLOAT_EQ(1.0, testLayer->contentsScaleX());
EXPECT_FLOAT_EQ(1.0, testLayer->contentsScaleY());
EXPECT_EQ(320, testLayer->contentBounds().width());
@@ -51,7 +51,7 @@ TEST(ContentsScalingLayerTest, checkContentsBounds) {
EXPECT_EQ(640, testLayer->contentBounds().width());
EXPECT_EQ(480, testLayer->contentBounds().height());
- testLayer->setBounds(IntSize(10, 20));
+ testLayer->setBounds(gfx::Size(10, 20));
EXPECT_EQ(20, testLayer->contentBounds().width());
EXPECT_EQ(40, testLayer->contentBounds().height());
@@ -64,13 +64,13 @@ TEST(ContentsScalingLayerTest, checkContentsScaleChangeTriggersNeedsDisplay) {
scoped_refptr<MockContentsScalingLayer> testLayer =
make_scoped_refptr(new MockContentsScalingLayer());
- testLayer->setBounds(IntSize(320, 240));
+ testLayer->setBounds(gfx::Size(320, 240));
testLayer->resetNeedsDisplay();
EXPECT_FALSE(testLayer->needsDisplay());
testLayer->setContentsScale(testLayer->contentsScaleX() + 1.f);
EXPECT_TRUE(testLayer->needsDisplay());
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 320, 240),
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 320, 240),
testLayer->lastNeedsDisplayRect());
}
diff --git a/cc/damage_tracker.cc b/cc/damage_tracker.cc
index 400fe5f..103449f 100644
--- a/cc/damage_tracker.cc
+++ b/cc/damage_tracker.cc
@@ -32,26 +32,25 @@ DamageTracker::~DamageTracker()
{
}
-static inline void expandRectWithFilters(FloatRect& rect, const WebKit::WebFilterOperations& filters)
+static inline void expandRectWithFilters(gfx::RectF& rect, const WebKit::WebFilterOperations& filters)
{
int top, right, bottom, left;
filters.getOutsets(top, right, bottom, left);
- rect.move(-left, -top);
- rect.expand(left + right, top + bottom);
+ rect.Inset(-left, -top, -right, -bottom);
}
-static inline void expandDamageRectInsideRectWithFilters(FloatRect& damageRect, const FloatRect& preFilterRect, const WebKit::WebFilterOperations& filters)
+static inline void expandDamageRectInsideRectWithFilters(gfx::RectF& damageRect, const gfx::RectF& preFilterRect, const WebKit::WebFilterOperations& filters)
{
- FloatRect expandedDamageRect = damageRect;
+ gfx::RectF expandedDamageRect = damageRect;
expandRectWithFilters(expandedDamageRect, filters);
- FloatRect filterRect = preFilterRect;
+ gfx::RectF filterRect = preFilterRect;
expandRectWithFilters(filterRect, filters);
- expandedDamageRect.intersect(filterRect);
- damageRect.unite(expandedDamageRect);
+ expandedDamageRect.Intersect(filterRect);
+ damageRect.Union(expandedDamageRect);
}
-void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters, SkImageFilter* filter)
+void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations& filters, SkImageFilter* filter)
{
//
// This function computes the "damage rect" of a target surface, and updates the state
@@ -119,11 +118,11 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
// These functions cannot be bypassed with early-exits, even if we know what the
// damage will be for this frame, because we need to update the damage tracker state
// to correctly track the next frame.
- FloatRect damageFromActiveLayers = trackDamageFromActiveLayers(layerList, targetSurfaceLayerID);
- FloatRect damageFromSurfaceMask = trackDamageFromSurfaceMask(targetSurfaceMaskLayer);
- FloatRect damageFromLeftoverRects = trackDamageFromLeftoverRects();
+ gfx::RectF damageFromActiveLayers = trackDamageFromActiveLayers(layerList, targetSurfaceLayerID);
+ gfx::RectF damageFromSurfaceMask = trackDamageFromSurfaceMask(targetSurfaceMaskLayer);
+ gfx::RectF damageFromLeftoverRects = trackDamageFromLeftoverRects();
- FloatRect damageRectForThisUpdate;
+ gfx::RectF damageRectForThisUpdate;
if (m_forceFullDamageNextUpdate || targetSurfacePropertyChangedOnlyFromDescendant) {
damageRectForThisUpdate = targetSurfaceContentRect;
@@ -131,8 +130,8 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
} else {
// FIXME: can we clamp this damage to the surface's content rect? (affects performance, but not correctness)
damageRectForThisUpdate = damageFromActiveLayers;
- damageRectForThisUpdate.uniteIfNonZero(damageFromSurfaceMask);
- damageRectForThisUpdate.uniteIfNonZero(damageFromLeftoverRects);
+ damageRectForThisUpdate.Union(damageFromSurfaceMask);
+ damageRectForThisUpdate.Union(damageFromLeftoverRects);
if (filters.hasFilterThatMovesPixels()) {
expandRectWithFilters(damageRectForThisUpdate, filters);
@@ -144,7 +143,7 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
}
// Damage accumulates until we are notified that we actually did draw on that frame.
- m_currentDamageRect.uniteIfNonZero(damageRectForThisUpdate);
+ m_currentDamageRect.Union(damageRectForThisUpdate);
// The next history map becomes the current map for the next frame. Note this must
// happen every frame to correctly track changes, even if damage accumulates over
@@ -152,19 +151,19 @@ void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
swap(m_currentRectHistory, m_nextRectHistory);
}
-FloatRect DamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew)
+gfx::RectF DamageTracker::removeRectFromCurrentFrame(int layerID, bool& layerIsNew)
{
RectMap::iterator iter = m_currentRectHistory->find(layerID);
layerIsNew = iter == m_currentRectHistory->end();
if (layerIsNew)
- return FloatRect();
+ return gfx::RectF();
- FloatRect ret = iter->second;
+ gfx::RectF ret = iter->second;
m_currentRectHistory->erase(iter);
return ret;
}
-void DamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect)
+void DamageTracker::saveRectForNextFrame(int layerID, const gfx::RectF& targetSpaceRect)
{
// This layer should not yet exist in next frame's history.
DCHECK(layerID > 0);
@@ -172,9 +171,9 @@ void DamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetSpa
(*m_nextRectHistory)[layerID] = targetSpaceRect;
}
-FloatRect DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID)
+gfx::RectF DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID)
{
- FloatRect damageRect = FloatRect();
+ gfx::RectF damageRect = gfx::RectF();
for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
// Visit layers in back-to-front order.
@@ -189,9 +188,9 @@ FloatRect DamageTracker::trackDamageFromActiveLayers(const std::vector<LayerImpl
return damageRect;
}
-FloatRect DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer)
+gfx::RectF DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer)
{
- FloatRect damageRect = FloatRect();
+ gfx::RectF damageRect = gfx::RectF();
if (!targetSurfaceMaskLayer)
return damageRect;
@@ -199,22 +198,22 @@ FloatRect DamageTracker::trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMask
// Currently, if there is any change to the mask, we choose to damage the entire
// surface. This could potentially be optimized later, but it is not expected to be a
// common case.
- if (targetSurfaceMaskLayer->layerPropertyChanged() || !targetSurfaceMaskLayer->updateRect().isEmpty())
- damageRect = FloatRect(FloatPoint::zero(), FloatSize(targetSurfaceMaskLayer->bounds()));
+ if (targetSurfaceMaskLayer->layerPropertyChanged() || !targetSurfaceMaskLayer->updateRect().IsEmpty())
+ damageRect = gfx::RectF(gfx::PointF(), targetSurfaceMaskLayer->bounds());
return damageRect;
}
-FloatRect DamageTracker::trackDamageFromLeftoverRects()
+gfx::RectF DamageTracker::trackDamageFromLeftoverRects()
{
// After computing damage for all active layers, any leftover items in the current
// rect history correspond to layers/surfaces that no longer exist. So, these regions
// are now exposed on the target surface.
- FloatRect damageRect = FloatRect();
+ gfx::RectF damageRect = gfx::RectF();
for (RectMap::iterator it = m_currentRectHistory->begin(); it != m_currentRectHistory->end(); ++it)
- damageRect.unite(it->second);
+ damageRect.Union(it->second);
m_currentRectHistory->clear();
@@ -233,7 +232,7 @@ static bool layerNeedsToRedrawOntoItsTargetSurface(LayerImpl* layer)
return layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged();
}
-void DamageTracker::extendDamageForLayer(LayerImpl* layer, FloatRect& targetDamageRect)
+void DamageTracker::extendDamageForLayer(LayerImpl* layer, gfx::RectF& targetDamageRect)
{
// There are two ways that a layer can damage a region of the target surface:
// 1. Property change (e.g. opacity, position, transforms):
@@ -252,28 +251,28 @@ void DamageTracker::extendDamageForLayer(LayerImpl* layer, FloatRect& targetDama
// extendDamageForRenderSurface() must be called instead.
bool layerIsNew = false;
- FloatRect oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew);
+ gfx::RectF oldRectInTargetSpace = removeRectFromCurrentFrame(layer->id(), layerIsNew);
- FloatRect rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds()));
+ gfx::RectF rectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), gfx::RectF(FloatPoint(), layer->contentBounds()));
saveRectForNextFrame(layer->id(), rectInTargetSpace);
if (layerIsNew || layerNeedsToRedrawOntoItsTargetSurface(layer)) {
// If a layer is new or has changed, then its entire layer rect affects the target surface.
- targetDamageRect.uniteIfNonZero(rectInTargetSpace);
+ targetDamageRect.Union(rectInTargetSpace);
// The layer's old region is now exposed on the target surface, too.
// Note oldRectInTargetSpace is already in target space.
- targetDamageRect.uniteIfNonZero(oldRectInTargetSpace);
- } else if (!layer->updateRect().isEmpty()) {
+ targetDamageRect.Union(oldRectInTargetSpace);
+ } else if (!layer->updateRect().IsEmpty()) {
// If the layer properties haven't changed, then the the target surface is only
// affected by the layer's update area, which could be empty.
- FloatRect updateContentRect = layer->layerRectToContentRect(layer->updateRect());
- FloatRect updateRectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), updateContentRect);
- targetDamageRect.uniteIfNonZero(updateRectInTargetSpace);
+ gfx::RectF updateContentRect = layer->layerRectToContentRect(layer->updateRect());
+ gfx::RectF updateRectInTargetSpace = MathUtil::mapClippedRect(layer->drawTransform(), updateContentRect);
+ targetDamageRect.Union(updateRectInTargetSpace);
}
}
-void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& targetDamageRect)
+void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, gfx::RectF& targetDamageRect)
{
// There are two ways a "descendant surface" can damage regions of the "target surface":
// 1. Property change:
@@ -290,32 +289,32 @@ void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
RenderSurfaceImpl* renderSurface = layer->renderSurface();
bool surfaceIsNew = false;
- FloatRect oldSurfaceRect = removeRectFromCurrentFrame(layer->id(), surfaceIsNew);
+ gfx::RectF oldSurfaceRect = removeRectFromCurrentFrame(layer->id(), surfaceIsNew);
- FloatRect surfaceRectInTargetSpace = renderSurface->drawableContentRect(); // already includes replica if it exists.
+ gfx::RectF surfaceRectInTargetSpace = renderSurface->drawableContentRect(); // already includes replica if it exists.
saveRectForNextFrame(layer->id(), surfaceRectInTargetSpace);
- FloatRect damageRectInLocalSpace;
+ gfx::RectF damageRectInLocalSpace;
if (surfaceIsNew || renderSurface->surfacePropertyChanged() || layer->layerSurfacePropertyChanged()) {
// The entire surface contributes damage.
damageRectInLocalSpace = renderSurface->contentRect();
// The surface's old region is now exposed on the target surface, too.
- targetDamageRect.uniteIfNonZero(oldSurfaceRect);
+ targetDamageRect.Union(oldSurfaceRect);
} else {
// Only the surface's damageRect will damage the target surface.
damageRectInLocalSpace = renderSurface->damageTracker()->currentDamageRect();
}
// If there was damage, transform it to target space, and possibly contribute its reflection if needed.
- if (!damageRectInLocalSpace.isEmpty()) {
+ if (!damageRectInLocalSpace.IsEmpty()) {
const WebTransformationMatrix& drawTransform = renderSurface->drawTransform();
- FloatRect damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace);
- targetDamageRect.uniteIfNonZero(damageRectInTargetSpace);
+ gfx::RectF damageRectInTargetSpace = MathUtil::mapClippedRect(drawTransform, damageRectInLocalSpace);
+ targetDamageRect.Union(damageRectInTargetSpace);
if (layer->replicaLayer()) {
const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform();
- targetDamageRect.uniteIfNonZero(MathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace));
+ targetDamageRect.Union(MathUtil::mapClippedRect(replicaDrawTransform, damageRectInLocalSpace));
}
}
@@ -327,12 +326,12 @@ void DamageTracker::extendDamageForRenderSurface(LayerImpl* layer, FloatRect& ta
removeRectFromCurrentFrame(replicaMaskLayer->id(), replicaIsNew);
const WebTransformationMatrix& replicaDrawTransform = renderSurface->replicaDrawTransform();
- FloatRect replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTransform, FloatRect(FloatPoint::zero(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height())));
+ gfx::RectF replicaMaskLayerRect = MathUtil::mapClippedRect(replicaDrawTransform, gfx::RectF(FloatPoint(), FloatSize(replicaMaskLayer->bounds().width(), replicaMaskLayer->bounds().height())));
saveRectForNextFrame(replicaMaskLayer->id(), replicaMaskLayerRect);
// In the current implementation, a change in the replica mask damages the entire replica region.
- if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replicaMaskLayer->updateRect().isEmpty())
- targetDamageRect.uniteIfNonZero(replicaMaskLayerRect);
+ if (replicaIsNew || replicaMaskLayer->layerPropertyChanged() || !replicaMaskLayer->updateRect().IsEmpty())
+ targetDamageRect.Union(replicaMaskLayerRect);
}
// If the layer has a background filter, this may cause pixels in our surface to be expanded, so we will need to expand any damage
diff --git a/cc/damage_tracker.h b/cc/damage_tracker.h
index 59a13401..4680662b 100644
--- a/cc/damage_tracker.h
+++ b/cc/damage_tracker.h
@@ -7,15 +7,19 @@
#include "base/hash_tables.h"
#include "base/memory/scoped_ptr.h"
-#include "FloatRect.h"
+#include "ui/gfx/rect_f.h"
#include <vector>
+class SkImageFilter;
+
+namespace gfx {
+class Rect;
+}
+
namespace WebKit {
class WebFilterOperations;
}
-class SkImageFilter;
-
namespace cc {
class LayerImpl;
@@ -28,34 +32,34 @@ public:
static scoped_ptr<DamageTracker> create();
~DamageTracker();
- void didDrawDamagedArea() { m_currentDamageRect = FloatRect(); }
+ void didDrawDamagedArea() { m_currentDamageRect = gfx::RectF(); }
void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; }
- void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const IntRect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&, SkImageFilter* filter);
+ void updateDamageTrackingState(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDescendant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLayer, const WebKit::WebFilterOperations&, SkImageFilter* filter);
- const FloatRect& currentDamageRect() { return m_currentDamageRect; }
+ const gfx::RectF& currentDamageRect() { return m_currentDamageRect; }
private:
DamageTracker();
- FloatRect trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID);
- FloatRect trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer);
- FloatRect trackDamageFromLeftoverRects();
+ gfx::RectF trackDamageFromActiveLayers(const std::vector<LayerImpl*>& layerList, int targetSurfaceLayerID);
+ gfx::RectF trackDamageFromSurfaceMask(LayerImpl* targetSurfaceMaskLayer);
+ gfx::RectF trackDamageFromLeftoverRects();
- FloatRect removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
- void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect);
+ gfx::RectF removeRectFromCurrentFrame(int layerID, bool& layerIsNew);
+ void saveRectForNextFrame(int layerID, const gfx::RectF& targetSpaceRect);
// These helper functions are used only in trackDamageFromActiveLayers().
- void extendDamageForLayer(LayerImpl*, FloatRect& targetDamageRect);
- void extendDamageForRenderSurface(LayerImpl*, FloatRect& targetDamageRect);
+ void extendDamageForLayer(LayerImpl*, gfx::RectF& targetDamageRect);
+ void extendDamageForRenderSurface(LayerImpl*, gfx::RectF& targetDamageRect);
// To correctly track exposed regions, two hashtables of rects are maintained.
// The "current" map is used to compute exposed regions of the current frame, while
// the "next" map is used to collect layer rects that are used in the next frame.
- typedef base::hash_map<int, FloatRect> RectMap;
+ typedef base::hash_map<int, gfx::RectF> RectMap;
scoped_ptr<RectMap> m_currentRectHistory;
scoped_ptr<RectMap> m_nextRectHistory;
- FloatRect m_currentDamageRect;
+ gfx::RectF m_currentDamageRect;
bool m_forceFullDamageNextUpdate;
};
diff --git a/cc/damage_tracker_unittest.cc b/cc/damage_tracker_unittest.cc
index d7a8dabc..22280e4 100644
--- a/cc/damage_tracker_unittest.cc
+++ b/cc/damage_tracker_unittest.cc
@@ -71,18 +71,18 @@ scoped_ptr<LayerImpl> createTestTreeWithOneSurface()
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
scoped_ptr<LayerImpl> child = LayerImpl::create(2);
- root->setPosition(FloatPoint::zero());
- root->setAnchorPoint(FloatPoint::zero());
- root->setBounds(IntSize(500, 500));
- root->setContentBounds(IntSize(500, 500));
+ root->setPosition(gfx::PointF());
+ root->setAnchorPoint(gfx::PointF());
+ root->setBounds(gfx::Size(500, 500));
+ root->setContentBounds(gfx::Size(500, 500));
root->setDrawsContent(true);
root->createRenderSurface();
- root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
+ root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
- child->setPosition(FloatPoint(100, 100));
- child->setAnchorPoint(FloatPoint::zero());
- child->setBounds(IntSize(30, 30));
- child->setContentBounds(IntSize(30, 30));
+ child->setPosition(gfx::PointF(100, 100));
+ child->setAnchorPoint(gfx::PointF());
+ child->setBounds(gfx::Size(30, 30));
+ child->setContentBounds(gfx::Size(30, 30));
child->setDrawsContent(true);
root->addChild(child.Pass());
@@ -101,37 +101,37 @@ scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces()
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5);
- root->setPosition(FloatPoint::zero());
- root->setAnchorPoint(FloatPoint::zero());
- root->setBounds(IntSize(500, 500));
- root->setContentBounds(IntSize(500, 500));
+ root->setPosition(gfx::PointF());
+ root->setAnchorPoint(gfx::PointF());
+ root->setBounds(gfx::Size(500, 500));
+ root->setContentBounds(gfx::Size(500, 500));
root->setDrawsContent(true);
root->createRenderSurface();
- root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500)));
+ root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(500, 500)));
- child1->setPosition(FloatPoint(100, 100));
- child1->setAnchorPoint(FloatPoint::zero());
- child1->setBounds(IntSize(30, 30));
- child1->setContentBounds(IntSize(30, 30));
+ child1->setPosition(gfx::PointF(100, 100));
+ child1->setAnchorPoint(gfx::PointF());
+ child1->setBounds(gfx::Size(30, 30));
+ child1->setContentBounds(gfx::Size(30, 30));
child1->setOpacity(0.5); // with a child that drawsContent, this will cause the layer to create its own renderSurface.
child1->setDrawsContent(false); // this layer does not draw, but is intended to create its own renderSurface.
- child2->setPosition(FloatPoint(11, 11));
- child2->setAnchorPoint(FloatPoint::zero());
- child2->setBounds(IntSize(18, 18));
- child2->setContentBounds(IntSize(18, 18));
+ child2->setPosition(gfx::PointF(11, 11));
+ child2->setAnchorPoint(gfx::PointF());
+ child2->setBounds(gfx::Size(18, 18));
+ child2->setContentBounds(gfx::Size(18, 18));
child2->setDrawsContent(true);
- grandChild1->setPosition(FloatPoint(200, 200));
- grandChild1->setAnchorPoint(FloatPoint::zero());
- grandChild1->setBounds(IntSize(6, 8));
- grandChild1->setContentBounds(IntSize(6, 8));
+ grandChild1->setPosition(gfx::PointF(200, 200));
+ grandChild1->setAnchorPoint(gfx::PointF());
+ grandChild1->setBounds(gfx::Size(6, 8));
+ grandChild1->setContentBounds(gfx::Size(6, 8));
grandChild1->setDrawsContent(true);
- grandChild2->setPosition(FloatPoint(190, 190));
- grandChild2->setAnchorPoint(FloatPoint::zero());
- grandChild2->setBounds(IntSize(6, 8));
- grandChild2->setContentBounds(IntSize(6, 8));
+ grandChild2->setPosition(gfx::PointF(190, 190));
+ grandChild2->setAnchorPoint(gfx::PointF());
+ grandChild2->setBounds(gfx::Size(6, 8));
+ grandChild2->setContentBounds(gfx::Size(6, 8));
grandChild2->setDrawsContent(true);
child1->addChild(grandChild1.Pass());
@@ -181,8 +181,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithOneSurface)
EXPECT_EQ(1, root->renderSurface()->layerList()[0]->id());
EXPECT_EQ(2, root->renderSurface()->layerList()[1]->id());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
}
TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
@@ -194,8 +194,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
LayerImpl* child1 = root->children()[0];
LayerImpl* child2 = root->children()[1];
- FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
ASSERT_TRUE(child1->renderSurface());
EXPECT_FALSE(child2->renderSurface());
@@ -203,8 +203,8 @@ TEST_F(DamageTrackerTest, sanityCheckTestTreeWithTwoSurfaces)
EXPECT_EQ(2u, child1->renderSurface()->layerList().size());
// The render surface for child1 only has a contentRect that encloses grandChild1 and grandChild2, because child1 does not draw content.
- EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
@@ -215,30 +215,30 @@ TEST_F(DamageTrackerTest, verifyDamageForUpdateRects)
// CASE 1: Setting the update rect should cause the corresponding damage to the surface.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100).
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
// CASE 2: The same update rect twice in a row still produces the same damage.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 12, 13), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 12, 13), rootDamageRect);
// CASE 3: Setting a different update rect should cause damage on the new update region, but no additional exposed old region.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(20, 25, 1, 2));
+ child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (20, 25) relative to the child (100, 100).
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(120, 125, 1, 2), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(120, 125, 1, 2), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
@@ -249,7 +249,7 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
// CASE 1: The layer's property changed flag takes priority over update rect.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
child->setOpacity(0.5);
emulateDrawingOneFrame(root.get());
@@ -258,8 +258,8 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
ASSERT_EQ(2u, root->renderSurface()->layerList().size());
// Damage should be the entire child layer in targetSurface space.
- FloatRect expectedRect = FloatRect(100, 100, 30, 30);
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF expectedRect = gfx::RectF(100, 100, 30, 30);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
// CASE 2: If a layer moves due to property change, it damages both the new location
@@ -269,15 +269,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPropertyChanges)
// Cycle one frame of no change, just to sanity check that the next rect is not because of the old damage state.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
+ EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
// Then, test the actual layer movement.
clearDamageForAllSurfaces(root.get());
- child->setPosition(FloatPoint(200, 230));
+ child->setPosition(gfx::PointF(200, 230));
emulateDrawingOneFrame(root.get());
// Expect damage to be the combination of the previous one and the new one.
- expectedRect.uniteIfNonZero(FloatRect(200, 230, 30, 30));
+ expectedRect.Union(gfx::RectF(200, 230, 30, 30));
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
@@ -294,13 +294,13 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
rotation.rotate(45);
clearDamageForAllSurfaces(root.get());
- child->setAnchorPoint(FloatPoint(0.5, 0.5));
- child->setPosition(FloatPoint(85, 85));
+ child->setAnchorPoint(gfx::PointF(0.5, 0.5));
+ child->setPosition(gfx::PointF(85, 85));
emulateDrawingOneFrame(root.get());
// Sanity check that the layer actually moved to (85, 85), damaging its old location and new location.
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(85, 85, 45, 45), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(85, 85, 45, 45), rootDamageRect);
// With the anchor on the layer's center, now we can test the rotation more
// intuitively, since it applies about the layer's anchor.
@@ -313,7 +313,7 @@ TEST_F(DamageTrackerTest, verifyDamageForTransformedLayer)
// old exposed region should be fully contained in the new region.
double expectedWidth = 30 * sqrt(2.0);
double expectedPosition = 100 - 0.5 * expectedWidth;
- FloatRect expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
+ gfx::RectF expectedRect(expectedPosition, expectedPosition, expectedWidth, expectedWidth);
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
EXPECT_FLOAT_RECT_EQ(expectedRect, rootDamageRect);
}
@@ -340,15 +340,15 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
transform.translate3d(-50, -50, 0);
// Set up the child
- child->setPosition(FloatPoint(0, 0));
- child->setBounds(IntSize(100, 100));
- child->setContentBounds(IntSize(100, 100));
+ child->setPosition(gfx::PointF(0, 0));
+ child->setBounds(gfx::Size(100, 100));
+ child->setContentBounds(gfx::Size(100, 100));
child->setTransform(transform);
emulateDrawingOneFrame(root.get());
// Sanity check that the child layer's bounds would actually get clipped by w < 0,
// otherwise this test is not actually testing the intended scenario.
- FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100)));
+ FloatQuad testQuad(gfx::RectF(gfx::PointF(), gfx::SizeF(100, 100)));
bool clipped = false;
MathUtil::mapQuad(transform, testQuad, clipped);
EXPECT_TRUE(clipped);
@@ -360,9 +360,9 @@ TEST_F(DamageTrackerTest, verifyDamageForPerspectiveClippedLayer)
// The expected damage should cover the entire root surface (500x500), but we don't
// care whether the damage rect was clamped or is larger than the surface for this test.
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect damageWeCareAbout = FloatRect(FloatPoint::zero(), FloatSize(500, 500));
- EXPECT_TRUE(rootDamageRect.contains(damageWeCareAbout));
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF damageWeCareAbout = gfx::RectF(gfx::PointF(), gfx::SizeF(500, 500));
+ EXPECT_TRUE(rootDamageRect.Contains(damageWeCareAbout));
}
TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
@@ -382,14 +382,13 @@ TEST_F(DamageTrackerTest, verifyDamageForBlurredSurface)
// Setting the update rect should cause the corresponding damage to the surface, blurred based on the size of the blur filter.
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
emulateDrawingOneFrame(root.get());
// Damage position on the surface should be: position of updateRect (10, 11) relative to the child (100, 100), but expanded by the blur outsets.
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect expectedDamageRect = FloatRect(110, 111, 12, 13);
- expectedDamageRect.move(-outsetLeft, -outsetTop);
- expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF expectedDamageRect = gfx::RectF(110, 111, 12, 13);
+ expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
}
@@ -397,7 +396,7 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
{
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface();
LayerImpl* child = root->children()[0];
- FloatRect rootDamageRect, childDamageRect;
+ gfx::RectF rootDamageRect, childDamageRect;
// Allow us to set damage on child too.
child->setDrawsContent(true);
@@ -410,18 +409,18 @@ TEST_F(DamageTrackerTest, verifyDamageForImageFilter)
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 1: Setting the update rect should damage the whole surface (for now)
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(0, 0, 1, 1));
+ child->setUpdateRect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
@@ -447,15 +446,14 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// the surface, blurred based on the size of the child's background blur
// filter.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(FloatRect(297, 297, 2, 2));
+ root->setUpdateRect(gfx::RectF(297, 297, 2, 2));
emulateDrawingOneFrame(root.get());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage position on the surface should be a composition of the damage on the root and on child2.
// Damage on the root should be: position of updateRect (297, 297), but expanded by the blur outsets.
- FloatRect expectedDamageRect = FloatRect(297, 297, 2, 2);
- expectedDamageRect.move(-outsetLeft, -outsetTop);
- expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ gfx::RectF expectedDamageRect = gfx::RectF(297, 297, 2, 2);
+ expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
// CASE 2: Setting the update rect should cause the corresponding damage to
@@ -463,67 +461,64 @@ TEST_F(DamageTrackerTest, verifyDamageForBackgroundBlurredChild)
// filter. Since the damage extends to the right/bottom outside of the
// blurred layer, only the left/top should end up expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(FloatRect(297, 297, 30, 30));
+ root->setUpdateRect(gfx::RectF(297, 297, 30, 30));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage position on the surface should be a composition of the damage on the root and on child2.
// Damage on the root should be: position of updateRect (297, 297), but expanded on the left/top
// by the blur outsets.
- expectedDamageRect = FloatRect(297, 297, 30, 30);
- expectedDamageRect.move(-outsetLeft, -outsetTop);
- expectedDamageRect.expand(outsetLeft, outsetTop);
+ expectedDamageRect = gfx::RectF(297, 297, 30, 30);
+ expectedDamageRect.Inset(-outsetLeft, -outsetTop, 0, 0);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
// CASE 3: Setting this update rect outside the blurred contentBounds of the blurred
// child1 will not cause it to be expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(FloatRect(30, 30, 2, 2));
+ root->setUpdateRect(gfx::RectF(30, 30, 2, 2));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage on the root should be: position of updateRect (30, 30), not
// expanded.
- expectedDamageRect = FloatRect(30, 30, 2, 2);
+ expectedDamageRect = gfx::RectF(30, 30, 2, 2);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
// CASE 4: Setting this update rect inside the blurred contentBounds but outside the
// original contentBounds of the blurred child1 will cause it to be expanded.
clearDamageForAllSurfaces(root.get());
- root->setUpdateRect(FloatRect(99, 99, 1, 1));
+ root->setUpdateRect(gfx::RectF(99, 99, 1, 1));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage on the root should be: position of updateRect (99, 99), expanded
// by the blurring on child1, but since it is 1 pixel outside the layer, the
// expanding should be reduced by 1.
- expectedDamageRect = FloatRect(99, 99, 1, 1);
- expectedDamageRect.move(-outsetLeft + 1, -outsetTop + 1);
- expectedDamageRect.expand(outsetLeft + outsetRight - 1, outsetTop + outsetBottom - 1);
+ expectedDamageRect = gfx::RectF(99, 99, 1, 1);
+ expectedDamageRect.Inset(-outsetLeft + 1, -outsetTop + 1, -outsetRight, -outsetBottom);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
// CASE 5: Setting the update rect on child2, which is above child1, will
// not get blurred by child1, so it does not need to get expanded.
clearDamageForAllSurfaces(root.get());
- child2->setUpdateRect(FloatRect(0, 0, 1, 1));
+ child2->setUpdateRect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage on child2 should be: position of updateRect offset by the child's position (11, 11), and not expanded by anything.
- expectedDamageRect = FloatRect(11, 11, 1, 1);
+ expectedDamageRect = gfx::RectF(11, 11, 1, 1);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
// CASE 6: Setting the update rect on child1 will also blur the damage, so
// that any pixels needed for the blur are redrawn in the current frame.
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(FloatRect(0, 0, 1, 1));
+ child1->setUpdateRect(gfx::RectF(0, 0, 1, 1));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// Damage on child1 should be: position of updateRect offset by the child's position (100, 100), and expanded by the damage.
- expectedDamageRect = FloatRect(100, 100, 1, 1);
- expectedDamageRect.move(-outsetLeft, -outsetTop);
- expectedDamageRect.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ expectedDamageRect = gfx::RectF(100, 100, 1, 1);
+ expectedDamageRect.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
EXPECT_FLOAT_RECT_EQ(expectedDamageRect, rootDamageRect);
}
@@ -537,10 +532,10 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
clearDamageForAllSurfaces(root.get());
{
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
- child2->setPosition(FloatPoint(400, 380));
- child2->setAnchorPoint(FloatPoint::zero());
- child2->setBounds(IntSize(6, 8));
- child2->setContentBounds(IntSize(6, 8));
+ child2->setPosition(gfx::PointF(400, 380));
+ child2->setAnchorPoint(gfx::PointF());
+ child2->setBounds(gfx::Size(6, 8));
+ child2->setContentBounds(gfx::Size(6, 8));
child2->setDrawsContent(true);
root->addChild(child2.Pass());
}
@@ -549,8 +544,8 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
ASSERT_EQ(3u, root->renderSurface()->layerList().size());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
// CASE 2: If the layer is removed, its entire old layer becomes exposed, not just the
// last update rect.
@@ -558,13 +553,13 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingLayer)
// Advance one frame without damage so that we know the damage rect is not leftover from the previous case.
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
- EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().isEmpty());
+ EXPECT_TRUE(root->renderSurface()->damageTracker()->currentDamageRect().IsEmpty());
// Then, test removing child1.
child1->removeFromParent();
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 30, 30), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 30, 30), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
@@ -577,16 +572,16 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
clearDamageForAllSurfaces(root.get());
{
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
- child2->setPosition(FloatPoint(400, 380));
- child2->setAnchorPoint(FloatPoint::zero());
- child2->setBounds(IntSize(6, 8));
- child2->setContentBounds(IntSize(6, 8));
+ child2->setPosition(gfx::PointF(400, 380));
+ child2->setAnchorPoint(gfx::PointF());
+ child2->setBounds(gfx::Size(6, 8));
+ child2->setContentBounds(gfx::Size(6, 8));
child2->setDrawsContent(true);
child2->resetAllChangeTrackingForSubtree();
// Sanity check the initial conditions of the test, if these asserts trigger, it
// means the test no longer actually covers the intended scenario.
ASSERT_FALSE(child2->layerPropertyChanged());
- ASSERT_TRUE(child2->updateRect().isEmpty());
+ ASSERT_TRUE(child2->updateRect().IsEmpty());
root->addChild(child2.Pass());
}
emulateDrawingOneFrame(root.get());
@@ -594,8 +589,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNewUnchangedLayer)
// Sanity check - all 3 layers should be on the same render surface; render surfaces are tested elsewhere.
ASSERT_EQ(3u, root->renderSurface()->layerList().size());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(400, 380, 6, 8), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
@@ -607,10 +602,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
clearDamageForAllSurfaces(root.get());
{
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
- child2->setPosition(FloatPoint(400, 380));
- child2->setAnchorPoint(FloatPoint::zero());
- child2->setBounds(IntSize(6, 8));
- child2->setContentBounds(IntSize(6, 8));
+ child2->setPosition(gfx::PointF(400, 380));
+ child2->setAnchorPoint(gfx::PointF());
+ child2->setBounds(gfx::Size(6, 8));
+ child2->setContentBounds(gfx::Size(6, 8));
child2->setDrawsContent(true);
root->addChild(child2.Pass());
}
@@ -618,14 +613,14 @@ TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers)
emulateDrawingOneFrame(root.get());
// Damaging two layers simultaneously should cause combined damage.
- // - child1 update rect in surface space: FloatRect(100, 100, 1, 2);
- // - child2 update rect in surface space: FloatRect(400, 380, 3, 4);
+ // - child1 update rect in surface space: gfx::RectF(100, 100, 1, 2);
+ // - child2 update rect in surface space: gfx::RectF(400, 380, 3, 4);
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(FloatRect(0, 0, 1, 2));
- child2->setUpdateRect(FloatRect(0, 0, 3, 4));
+ child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
+ child2->setUpdateRect(gfx::RectF(0, 0, 3, 4));
emulateDrawingOneFrame(root.get());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(100, 100, 303, 284), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(100, 100, 303, 284), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
@@ -634,8 +629,8 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
LayerImpl* child1 = root->children()[0];
LayerImpl* child2 = root->children()[1];
LayerImpl* grandChild1 = root->children()[0]->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
// CASE 1: Damage to a descendant surface should propagate properly to ancestor surface.
//
@@ -644,20 +639,20 @@ TEST_F(DamageTrackerTest, verifyDamageForNestedSurfaces)
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(300, 300, 6, 8), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(300, 300, 6, 8), rootDamageRect);
// CASE 2: Same as previous case, but with additional damage elsewhere that should be properly unioned.
- // - child1 surface damage in root surface space: FloatRect(300, 300, 6, 8);
- // - child2 damage in root surface space: FloatRect(11, 11, 18, 18);
+ // - child1 surface damage in root surface space: gfx::RectF(300, 300, 6, 8);
+ // - child2 damage in root surface space: gfx::RectF(11, 11, 18, 18);
clearDamageForAllSurfaces(root.get());
grandChild1->setOpacity(0.7f);
child2->setOpacity(0.7f);
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(200, 200, 6, 8), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(11, 11, 295, 297), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(200, 200, 6, 8), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(11, 11, 295, 297), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
@@ -672,21 +667,21 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromDescendantLayer)
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
LayerImpl* child1 = root->children()[0];
LayerImpl* grandChild1 = root->children()[0]->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
clearDamageForAllSurfaces(root.get());
- grandChild1->setPosition(FloatPoint(195, 205));
+ grandChild1->setPosition(gfx::PointF(195, 205));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// The new surface bounds should be damaged entirely, even though only one of the layers changed.
- EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 11, 23), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 11, 23), childDamageRect);
// Damage to the root surface should be the union of child1's *entire* render surface
// (in target space), and its old exposed area (also in target space).
- EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 23), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 23), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
@@ -704,30 +699,30 @@ TEST_F(DamageTrackerTest, verifyDamageForSurfaceChangeFromAncestorLayer)
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
LayerImpl* child1 = root->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
clearDamageForAllSurfaces(root.get());
- child1->setPosition(FloatPoint(50, 50));
+ child1->setPosition(gfx::PointF(50, 50));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// The new surface bounds should be damaged entirely.
- EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
// The entire child1 surface and the old exposed child1 surface should damage the root surface.
- // - old child1 surface in target space: FloatRect(290, 290, 16, 18)
- // - new child1 surface in target space: FloatRect(240, 240, 16, 18)
- EXPECT_FLOAT_RECT_EQ(FloatRect(240, 240, 66, 68), rootDamageRect);
+ // - old child1 surface in target space: gfx::RectF(290, 290, 16, 18)
+ // - new child1 surface in target space: gfx::RectF(240, 240, 16, 18)
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(240, 240, 66, 68), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
{
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
LayerImpl* child1 = root->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
// CASE 1: If a descendant surface disappears, its entire old area becomes exposed.
//
@@ -740,7 +735,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
ASSERT_EQ(4u, root->renderSurface()->layerList().size());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
// CASE 2: If a descendant surface appears, its entire old area becomes exposed.
@@ -748,7 +743,7 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
// Then change the tree so that the render surface is added back.
clearDamageForAllSurfaces(root.get());
@@ -762,16 +757,16 @@ TEST_F(DamageTrackerTest, verifyDamageForAddingAndRemovingRenderSurfaces)
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(190, 190, 16, 18), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(290, 290, 16, 18), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(190, 190, 16, 18), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(290, 290, 16, 18), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
{
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
LayerImpl* child1 = root->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
// CASE 1: If nothing changes, the damage rect should be empty.
//
@@ -779,8 +774,8 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(childDamageRect.isEmpty());
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(childDamageRect.IsEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
// CASE 2: If nothing changes twice in a row, the damage rect should still be empty.
//
@@ -788,26 +783,26 @@ TEST_F(DamageTrackerTest, verifyNoDamageWhenNothingChanged)
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(childDamageRect.isEmpty());
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(childDamageRect.IsEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
}
TEST_F(DamageTrackerTest, verifyNoDamageForUpdateRectThatDoesNotDrawContent)
{
scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithTwoSurfaces();
LayerImpl* child1 = root->children()[0];
- FloatRect childDamageRect;
- FloatRect rootDamageRect;
+ gfx::RectF childDamageRect;
+ gfx::RectF rootDamageRect;
// In our specific tree, the update rect of child1 should not cause any damage to any
// surface because it does not actually draw content.
clearDamageForAllSurfaces(root.get());
- child1->setUpdateRect(FloatRect(0, 0, 1, 2));
+ child1->setUpdateRect(gfx::RectF(0, 0, 1, 2));
emulateDrawingOneFrame(root.get());
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(childDamageRect.isEmpty());
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(childDamageRect.IsEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
}
TEST_F(DamageTrackerTest, verifyDamageForReplica)
@@ -823,13 +818,13 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
// For this test case, we modify grandChild2, and add grandChild3 to extend the bounds
// of child1's surface. This way, we can test reflection changes without changing
// contentBounds of the surface.
- grandChild2->setPosition(FloatPoint(180, 180));
+ grandChild2->setPosition(gfx::PointF(180, 180));
{
scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6);
- grandChild3->setPosition(FloatPoint(240, 240));
- grandChild3->setAnchorPoint(FloatPoint::zero());
- grandChild3->setBounds(IntSize(10, 10));
- grandChild3->setContentBounds(IntSize(10, 10));
+ grandChild3->setPosition(gfx::PointF(240, 240));
+ grandChild3->setAnchorPoint(gfx::PointF());
+ grandChild3->setBounds(gfx::Size(10, 10));
+ grandChild3->setContentBounds(gfx::Size(10, 10));
grandChild3->setDrawsContent(true);
child1->addChild(grandChild3.Pass());
}
@@ -841,8 +836,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
clearDamageForAllSurfaces(root.get());
{
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(7);
- grandChild1Replica->setPosition(FloatPoint::zero());
- grandChild1Replica->setAnchorPoint(FloatPoint::zero());
+ grandChild1Replica->setPosition(gfx::PointF());
+ grandChild1Replica->setAnchorPoint(gfx::PointF());
WebTransformationMatrix reflection;
reflection.scale3d(-1, 1, 1);
grandChild1Replica->setTransform(reflection);
@@ -850,21 +845,21 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
}
emulateDrawingOneFrame(root.get());
- FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// The grandChild surface damage should not include its own replica. The child
// surface damage should include the normal and replica surfaces.
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 12, 8), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(294, 300, 12, 8), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 12, 8), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(294, 300, 12, 8), rootDamageRect);
// CASE 2: moving the descendant surface should cause both the original and reflected
// areas to be damaged on the target.
clearDamageForAllSurfaces(root.get());
- IntRect oldContentRect = child1->renderSurface()->contentRect();
- grandChild1->setPosition(FloatPoint(195, 205));
+ gfx::Rect oldContentRect = child1->renderSurface()->contentRect();
+ grandChild1->setPosition(gfx::PointF(195, 205));
emulateDrawingOneFrame(root.get());
ASSERT_EQ(oldContentRect.width(), child1->renderSurface()->contentRect().width());
ASSERT_EQ(oldContentRect.height(), child1->renderSurface()->contentRect().height());
@@ -874,11 +869,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
// The child surface damage should include normal and replica surfaces for both old and new locations.
- // - old location in target space: FloatRect(194, 200, 12, 8)
- // - new location in target space: FloatRect(189, 205, 12, 8)
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 6, 8), grandChildDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(189, 200, 17, 13), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(289, 300, 17, 13), rootDamageRect);
+ // - old location in target space: gfx::RectF(194, 200, 12, 8)
+ // - new location in target space: gfx::RectF(189, 205, 12, 8)
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 6, 8), grandChildDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 200, 17, 13), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 300, 17, 13), rootDamageRect);
// CASE 3: removing the reflection should cause the entire region including reflection
// to damage the target surface.
@@ -892,8 +887,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplica)
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(189, 205, 12, 8), childDamageRect);
- EXPECT_FLOAT_RECT_EQ(FloatRect(289, 305, 12, 8), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(189, 205, 12, 8), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(289, 305, 12, 8), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForMask)
@@ -910,7 +905,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
{
scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3);
maskLayer->setPosition(child->position());
- maskLayer->setAnchorPoint(FloatPoint::zero());
+ maskLayer->setAnchorPoint(gfx::PointF());
maskLayer->setBounds(child->bounds());
maskLayer->setContentBounds(child->bounds());
child->setMaskLayer(maskLayer.Pass());
@@ -921,10 +916,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
child->setOpacity(0.5);
{
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4);
- grandChild->setPosition(FloatPoint(2, 2));
- grandChild->setAnchorPoint(FloatPoint::zero());
- grandChild->setBounds(IntSize(2, 2));
- grandChild->setContentBounds(IntSize(2, 2));
+ grandChild->setPosition(gfx::PointF(2, 2));
+ grandChild->setAnchorPoint(gfx::PointF());
+ grandChild->setBounds(gfx::Size(2, 2));
+ grandChild->setContentBounds(gfx::Size(2, 2));
grandChild->setDrawsContent(true);
child->addChild(grandChild.Pass());
}
@@ -936,10 +931,10 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
// CASE 1: the updateRect on a mask layer should damage the entire target surface.
//
clearDamageForAllSurfaces(root.get());
- maskLayer->setUpdateRect(FloatRect(1, 2, 3, 4));
+ maskLayer->setUpdateRect(gfx::RectF(1, 2, 3, 4));
emulateDrawingOneFrame(root.get());
- FloatRect childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
+ gfx::RectF childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 2: a property change on the mask layer should damage the entire target surface.
//
@@ -948,7 +943,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(childDamageRect.isEmpty());
+ EXPECT_TRUE(childDamageRect.IsEmpty());
// Then test the property change.
clearDamageForAllSurfaces(root.get());
@@ -956,7 +951,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
// CASE 3: removing the mask also damages the entire target surface.
//
@@ -965,7 +960,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
clearDamageForAllSurfaces(root.get());
emulateDrawingOneFrame(root.get());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(childDamageRect.isEmpty());
+ EXPECT_TRUE(childDamageRect.IsEmpty());
// Then test mask removal.
clearDamageForAllSurfaces(root.get());
@@ -977,7 +972,7 @@ TEST_F(DamageTrackerTest, verifyDamageForMask)
ASSERT_TRUE(child->renderSurface());
childDamageRect = child->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 30, 30), childDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 30, 30), childDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
@@ -994,8 +989,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// Create a reflection about the left edge of grandChild1.
{
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
- grandChild1Replica->setPosition(FloatPoint::zero());
- grandChild1Replica->setAnchorPoint(FloatPoint::zero());
+ grandChild1Replica->setPosition(gfx::PointF());
+ grandChild1Replica->setAnchorPoint(gfx::PointF());
WebTransformationMatrix reflection;
reflection.scale3d(-1, 1, 1);
grandChild1Replica->setTransform(reflection);
@@ -1006,8 +1001,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
// Set up the mask layer on the replica layer
{
scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
- replicaMaskLayer->setPosition(FloatPoint::zero());
- replicaMaskLayer->setAnchorPoint(FloatPoint::zero());
+ replicaMaskLayer->setPosition(gfx::PointF());
+ replicaMaskLayer->setAnchorPoint(gfx::PointF());
replicaMaskLayer->setBounds(grandChild1->bounds());
replicaMaskLayer->setContentBounds(grandChild1->bounds());
grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
@@ -1024,11 +1019,11 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
replicaMaskLayer->setStackingOrderChanged(true);
emulateDrawingOneFrame(root.get());
- FloatRect grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
- FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
+ gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(grandChildDamageRect.isEmpty());
- EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
+ EXPECT_TRUE(grandChildDamageRect.IsEmpty());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
// CASE 2: removing the replica mask damages only the reflected region on the target surface.
//
@@ -1039,8 +1034,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMask)
grandChildDamageRect = grandChild1->renderSurface()->damageTracker()->currentDamageRect();
childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(grandChildDamageRect.isEmpty());
- EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect);
+ EXPECT_TRUE(grandChildDamageRect.IsEmpty());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(194, 200, 6, 8), childDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
@@ -1052,12 +1047,12 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
// Verify that the correct replicaOriginTransform is used for the replicaMask;
clearDamageForAllSurfaces(root.get());
- grandChild1->setAnchorPoint(FloatPoint(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
+ grandChild1->setAnchorPoint(gfx::PointF(1, 0)); // This is not exactly the anchor being tested, but by convention its expected to be the same as the replica's anchor point.
{
scoped_ptr<LayerImpl> grandChild1Replica = LayerImpl::create(6);
- grandChild1Replica->setPosition(FloatPoint::zero());
- grandChild1Replica->setAnchorPoint(FloatPoint(1, 0)); // This is the anchor being tested.
+ grandChild1Replica->setPosition(gfx::PointF());
+ grandChild1Replica->setAnchorPoint(gfx::PointF(1, 0)); // This is the anchor being tested.
WebTransformationMatrix reflection;
reflection.scale3d(-1, 1, 1);
grandChild1Replica->setTransform(reflection);
@@ -1068,8 +1063,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
// Set up the mask layer on the replica layer
{
scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7);
- replicaMaskLayer->setPosition(FloatPoint::zero());
- replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is not the anchor being tested.
+ replicaMaskLayer->setPosition(gfx::PointF());
+ replicaMaskLayer->setAnchorPoint(gfx::PointF()); // note, this is not the anchor being tested.
replicaMaskLayer->setBounds(grandChild1->bounds());
replicaMaskLayer->setContentBounds(grandChild1->bounds());
grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass());
@@ -1087,8 +1082,8 @@ TEST_F(DamageTrackerTest, verifyDamageForReplicaMaskWithAnchor)
emulateDrawingOneFrame(root.get());
- FloatRect childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(206, 200, 6, 8), childDamageRect);
+ gfx::RectF childDamageRect = child1->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(206, 200, 6, 8), childDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
@@ -1100,11 +1095,11 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
// it takes priority over any other partial damage.
//
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 12, 13));
+ child->setUpdateRect(gfx::RectF(10, 11, 12, 13));
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
// Case 2: An additional sanity check that forcing full damage works even when nothing
// on the layer tree changed.
@@ -1113,7 +1108,7 @@ TEST_F(DamageTrackerTest, verifyDamageWhenForcedFullDamage)
root->renderSurface()->damageTracker()->forceFullDamageNextUpdate();
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 500, 500), rootDamageRect);
}
TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
@@ -1127,10 +1122,10 @@ TEST_F(DamageTrackerTest, verifyDamageForEmptyLayerList)
ASSERT_TRUE(root == root->renderTarget());
RenderSurfaceImpl* targetSurface = root->renderSurface();
targetSurface->clearLayerLists();
- targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, IntRect(), 0, WebFilterOperations(), 0);
+ targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), false, gfx::Rect(), 0, WebFilterOperations(), 0);
- FloatRect damageRect = targetSurface->damageTracker()->currentDamageRect();
- EXPECT_TRUE(damageRect.isEmpty());
+ gfx::RectF damageRect = targetSurface->damageTracker()->currentDamageRect();
+ EXPECT_TRUE(damageRect.IsEmpty());
}
TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
@@ -1141,28 +1136,28 @@ TEST_F(DamageTrackerTest, verifyDamageAccumulatesUntilReset)
LayerImpl* child = root->children()[0];
clearDamageForAllSurfaces(root.get());
- child->setUpdateRect(FloatRect(10, 11, 1, 2));
+ child->setUpdateRect(gfx::RectF(10, 11, 1, 2));
emulateDrawingOneFrame(root.get());
// Sanity check damage after the first frame; this isnt the actual test yet.
- FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 1, 2), rootDamageRect);
+ gfx::RectF rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 1, 2), rootDamageRect);
// New damage, without having cleared the previous damage, should be unioned to the previous one.
- child->setUpdateRect(FloatRect(20, 25, 1, 2));
+ child->setUpdateRect(gfx::RectF(20, 25, 1, 2));
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_FLOAT_RECT_EQ(FloatRect(110, 111, 11, 16), rootDamageRect);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(110, 111, 11, 16), rootDamageRect);
// If we notify the damage tracker that we drew the damaged area, then damage should be emptied.
root->renderSurface()->damageTracker()->didDrawDamagedArea();
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
// Damage should remain empty even after one frame, since there's yet no new damage
emulateDrawingOneFrame(root.get());
rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect();
- EXPECT_TRUE(rootDamageRect.isEmpty());
+ EXPECT_TRUE(rootDamageRect.IsEmpty());
}
} // namespace
diff --git a/cc/debug_rect_history.cc b/cc/debug_rect_history.cc
index c085eef..455f354 100644
--- a/cc/debug_rect_history.cc
+++ b/cc/debug_rect_history.cc
@@ -55,9 +55,10 @@ void DebugRectHistory::savePaintRects(LayerImpl* layer)
// regardless of whether this layer is skipped for actual drawing or not. Therefore
// we traverse recursively over all layers, not just the render surface list.
- if (!layer->updateRect().isEmpty() && layer->drawsContent()) {
- FloatRect updateContentRect = layer->updateRect();
- updateContentRect.scale(layer->contentBounds().width() / static_cast<float>(layer->bounds().width()), layer->contentBounds().height() / static_cast<float>(layer->bounds().height()));
+ if (!layer->updateRect().IsEmpty() && layer->drawsContent()) {
+ float widthScale = layer->contentBounds().width() / static_cast<float>(layer->bounds().width());
+ float heightScale = layer->contentBounds().height() / static_cast<float>(layer->bounds().height());
+ gfx::RectF updateContentRect = gfx::ScaleRect(layer->updateRect(), widthScale, heightScale);
m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), updateContentRect)));
}
@@ -83,7 +84,7 @@ void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r
continue;
if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChanged())
- m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds()))));
+ m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUtil::mapClippedRect(layer->screenSpaceTransform(), gfx::RectF(gfx::PointF(), layer->contentBounds()))));
}
}
}
@@ -116,7 +117,7 @@ void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend
void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludingRects)
{
for (size_t i = 0; i < occludingRects.size(); ++i)
- m_debugRects.push_back(DebugRect(OccludingRectType, cc::IntRect(occludingRects[i])));
+ m_debugRects.push_back(DebugRect(OccludingRectType, cc::FloatRect(occludingRects[i])));
}
} // namespace cc
diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h
index e61c4dd..7f7de53 100644
--- a/cc/debug_rect_history.h
+++ b/cc/debug_rect_history.h
@@ -8,7 +8,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ui/gfx/rect.h"
-#include "FloatRect.h"
+#include "ui/gfx/rect_f.h"
#include <vector>
namespace cc {
@@ -38,12 +38,12 @@ struct LayerTreeSettings;
enum DebugRectType { PaintRectType, PropertyChangedRectType, SurfaceDamageRectType, ScreenSpaceRectType, ReplicaScreenSpaceRectType, OccludingRectType };
struct DebugRect {
- DebugRect(DebugRectType newType, FloatRect newRect)
+ DebugRect(DebugRectType newType, gfx::RectF newRect)
: type(newType)
, rect(newRect) { }
DebugRectType type;
- FloatRect rect;
+ gfx::RectF rect;
};
// This class maintains a history of rects of various types that can be used
diff --git a/cc/delegated_renderer_layer_impl_unittest.cc b/cc/delegated_renderer_layer_impl_unittest.cc
index 716bf1f..23df876 100644
--- a/cc/delegated_renderer_layer_impl_unittest.cc
+++ b/cc/delegated_renderer_layer_impl_unittest.cc
@@ -36,11 +36,11 @@ public:
DelegatedRendererLayerImplTest()
{
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
m_hostImpl = LayerTreeHostImpl::create(settings, this);
m_hostImpl->initializeRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
}
// LayerTreeHostImplClient implementation.
@@ -66,7 +66,7 @@ protected:
scoped_ptr<LayerTreeHostImpl> m_hostImpl;
};
-static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, RenderPass::Id id, IntRect outputRect, WebTransformationMatrix rootTransform)
+static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, RenderPass::Id id, gfx::Rect outputRect, WebTransformationMatrix rootTransform)
{
scoped_ptr<TestRenderPass> pass(TestRenderPass::create(id, outputRect, rootTransform));
TestRenderPass* saved = pass.get();
@@ -74,7 +74,7 @@ static TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, Rend
return saved;
}
-static SolidColorDrawQuad* addQuad(TestRenderPass* pass, IntRect rect, SkColor color)
+static SolidColorDrawQuad* addQuad(TestRenderPass* pass, gfx::Rect rect, SkColor color)
{
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
AppendQuadsData data(pass->id());
@@ -105,36 +105,36 @@ public:
scoped_ptr<LayerImpl> layerAfter = SolidColorLayerImpl::create(3).PassAs<LayerImpl>();
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(4);
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
- rootLayer->setBounds(IntSize(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ rootLayer->setBounds(gfx::Size(100, 100));
- layerBefore->setPosition(IntPoint(20, 20));
- layerBefore->setBounds(IntSize(14, 14));
- layerBefore->setContentBounds(IntSize(14, 14));
+ layerBefore->setPosition(gfx::Point(20, 20));
+ layerBefore->setBounds(gfx::Size(14, 14));
+ layerBefore->setContentBounds(gfx::Size(14, 14));
layerBefore->setDrawsContent(true);
layerBefore->setForceRenderSurface(true);
- layerAfter->setPosition(IntPoint(5, 5));
- layerAfter->setBounds(IntSize(15, 15));
- layerAfter->setContentBounds(IntSize(15, 15));
+ layerAfter->setPosition(gfx::Point(5, 5));
+ layerAfter->setBounds(gfx::Size(15, 15));
+ layerAfter->setContentBounds(gfx::Size(15, 15));
layerAfter->setDrawsContent(true);
layerAfter->setForceRenderSurface(true);
- delegatedRendererLayer->setPosition(IntPoint(3, 3));
- delegatedRendererLayer->setBounds(IntSize(10, 10));
- delegatedRendererLayer->setContentBounds(IntSize(10, 10));
+ delegatedRendererLayer->setPosition(gfx::Point(3, 3));
+ delegatedRendererLayer->setBounds(gfx::Size(10, 10));
+ delegatedRendererLayer->setContentBounds(gfx::Size(10, 10));
delegatedRendererLayer->setDrawsContent(true);
WebTransformationMatrix transform;
transform.translate(1, 1);
delegatedRendererLayer->setTransform(transform);
ScopedPtrVector<RenderPass> delegatedRenderPasses;
- TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), IntRect(6, 6, 6, 6), WebTransformationMatrix());
- addQuad(pass1, IntRect(0, 0, 6, 6), 33u);
- TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 7), IntRect(7, 7, 7, 7), WebTransformationMatrix());
- addQuad(pass2, IntRect(0, 0, 7, 7), 22u);
+ TestRenderPass* pass1 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), gfx::Rect(6, 6, 6, 6), WebTransformationMatrix());
+ addQuad(pass1, gfx::Rect(0, 0, 6, 6), 33u);
+ TestRenderPass* pass2 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 7), gfx::Rect(7, 7, 7, 7), WebTransformationMatrix());
+ addQuad(pass2, gfx::Rect(0, 0, 7, 7), 22u);
addRenderPassQuad(pass2, pass1);
- TestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 8), IntRect(8, 8, 8, 8), WebTransformationMatrix());
+ TestRenderPass* pass3 = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 8), gfx::Rect(8, 8, 8, 8), WebTransformationMatrix());
addRenderPassQuad(pass3, pass2);
delegatedRendererLayer->setRenderPasses(delegatedRenderPasses);
@@ -187,8 +187,8 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsContributingRenderPasses)
EXPECT_EQ(0, frame.renderPasses[4]->id().index);
// The DelegatedRendererLayer should have added its RenderPasses to the frame in order.
- EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[1]->outputRect());
- EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[2]->outputRect());
+ EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[1]->outputRect());
+ EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[2]->outputRect());
}
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses)
@@ -209,14 +209,14 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToContributingRenderPasses
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
// Verify it added the right quads.
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
- EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
}
TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
@@ -237,10 +237,10 @@ TEST_F(DelegatedRendererLayerImplTestSimple, AddsQuadsToTargetRenderPass)
ASSERT_EQ(2u, frame.renderPasses[3]->quadList().size());
// Verify it added the right quads.
- EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
// Its target layer should have a quad as well.
- EXPECT_RECT_EQ(IntRect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 15, 15), frame.renderPasses[3]->quadList()[1]->quadRect());
}
TEST_F(DelegatedRendererLayerImplTestSimple, QuadsFromRootRenderPassAreModifiedForTheTarget)
@@ -325,14 +325,14 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToContributingRenderPa
// The DelegatedRendererLayer should have added copies of its quads to contributing RenderPasses.
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
// Verify it added the right quads.
ASSERT_EQ(2u, frame.renderPasses[2]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
- EXPECT_RECT_EQ(IntRect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 7, 7), frame.renderPasses[2]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(6, 6, 6, 6), frame.renderPasses[2]->quadList()[1]->quadRect());
ASSERT_EQ(1u, frame.renderPasses[1]->quadList().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 6), frame.renderPasses[1]->quadList()[0]->quadRect());
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
@@ -353,7 +353,7 @@ TEST_F(DelegatedRendererLayerImplTestOwnSurface, AddsQuadsToTargetRenderPass)
ASSERT_EQ(1u, frame.renderPasses[3]->quadList().size());
// Verify it added the right quads.
- EXPECT_RECT_EQ(IntRect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
+ EXPECT_RECT_EQ(gfx::Rect(7, 7, 7, 7), frame.renderPasses[3]->quadList()[0]->quadRect());
}
TEST_F(DelegatedRendererLayerImplTestOwnSurface, QuadsFromRootRenderPassAreNotModifiedForTheTarget)
@@ -386,27 +386,27 @@ public:
scoped_ptr<LayerImpl> rootLayer = LayerImpl::create(1);
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer = DelegatedRendererLayerImpl::create(2);
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
- rootLayer->setBounds(IntSize(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
+ rootLayer->setBounds(gfx::Size(100, 100));
- delegatedRendererLayer->setPosition(IntPoint(20, 20));
- delegatedRendererLayer->setBounds(IntSize(20, 20));
- delegatedRendererLayer->setContentBounds(IntSize(20, 20));
+ delegatedRendererLayer->setPosition(gfx::Point(20, 20));
+ delegatedRendererLayer->setBounds(gfx::Size(20, 20));
+ delegatedRendererLayer->setContentBounds(gfx::Size(20, 20));
delegatedRendererLayer->setDrawsContent(true);
WebTransformationMatrix transform;
transform.translate(10, 10);
delegatedRendererLayer->setTransform(transform);
ScopedPtrVector<RenderPass> delegatedRenderPasses;
- IntRect passRect(0, 0, 50, 50);
+ gfx::Rect passRect(0, 0, 50, 50);
TestRenderPass* pass = addRenderPass(delegatedRenderPasses, RenderPass::Id(9, 6), passRect, WebTransformationMatrix());
MockQuadCuller quadSink(pass->quadList(), pass->sharedQuadStateList());
AppendQuadsData data(pass->id());
SharedQuadState* sharedState = quadSink.useSharedQuadState(SharedQuadState::create(WebTransformationMatrix(), passRect, passRect, 1, false));
- quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data);
- quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data);
- quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data);
- quadSink.append(SolidColorDrawQuad::create(sharedState, IntRect(10, 10, 10, 10), 4u).PassAs<DrawQuad>(), data);
+ quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 0, 10, 10), 1u).PassAs<DrawQuad>(), data);
+ quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(0, 10, 10, 10), 2u).PassAs<DrawQuad>(), data);
+ quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(10, 0, 10, 10), 3u).PassAs<DrawQuad>(), data);
+ quadSink.append(SolidColorDrawQuad::create(sharedState, gfx::Rect(10, 10, 10, 10), 4u).PassAs<DrawQuad>(), data);
delegatedRendererLayer->setRenderPasses(delegatedRenderPasses);
// The RenderPasses should be taken by the layer.
@@ -446,7 +446,7 @@ TEST_F(DelegatedRendererLayerImplTestSharedData, SharedData)
EXPECT_EQ(sharedState, quadList[3]->sharedQuadState());
// The state should be transformed only once.
- EXPECT_RECT_EQ(IntRect(30, 30, 50, 50), sharedState->clippedRectInTarget);
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 50, 50), sharedState->clippedRectInTarget);
WebTransformationMatrix expected;
expected.translate(30, 30);
EXPECT_TRANSFORMATION_MATRIX_EQ(expected, sharedState->quadTransform);
diff --git a/cc/draw_quad_unittest.cc b/cc/draw_quad_unittest.cc
index dc9fc7d..9cc99c1 100644
--- a/cc/draw_quad_unittest.cc
+++ b/cc/draw_quad_unittest.cc
@@ -253,7 +253,7 @@ TEST(DrawQuadTest, copyTileDrawQuad)
{
gfx::Rect opaqueRect(33, 44, 22, 33);
unsigned resourceId = 104;
- gfx::Point textureOffset(-31, 47);
+ gfx::Vector2d textureOffset(-31, 47);
gfx::Size textureSize(85, 32);
GLint textureFilter = 82;
bool swizzleContents = true;
diff --git a/cc/font_atlas.cc b/cc/font_atlas.cc
index 5d63d49..2d15766 100644
--- a/cc/font_atlas.cc
+++ b/cc/font_atlas.cc
@@ -11,12 +11,10 @@
#include "base/string_split.h"
#include "cc/proxy.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "ui/gfx/point.h"
-#include "ui/gfx/size.h"
namespace cc {
-FontAtlas::FontAtlas(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
+FontAtlas::FontAtlas(SkBitmap bitmap, gfx::Rect asciiToRectTable[128], int fontHeight)
: m_atlas(bitmap)
, m_fontHeight(fontHeight)
{
@@ -52,7 +50,7 @@ void FontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint
for (unsigned i = 0; i < textLine.length(); ++i) {
// If the ASCII code is out of bounds, then index 0 is used, which is just a plain rectangle glyph.
int asciiIndex = (textLine[i] < 128) ? textLine[i] : 0;
- IntRect glyphBounds = m_asciiToRectTable[asciiIndex];
+ gfx::Rect glyphBounds = m_asciiToRectTable[asciiIndex];
SkIRect source = SkIRect::MakeXYWH(glyphBounds.x(), glyphBounds.y(), glyphBounds.width(), glyphBounds.height());
canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(position.x(), position.y(), glyphBounds.width(), glyphBounds.height()), &paint);
position.set_x(position.x() + glyphBounds.width());
diff --git a/cc/font_atlas.h b/cc/font_atlas.h
index 1858c12..0a227a6 100644
--- a/cc/font_atlas.h
+++ b/cc/font_atlas.h
@@ -9,8 +9,8 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
-#include "IntRect.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/gfx/rect.h"
class SkCanvas;
@@ -24,7 +24,7 @@ namespace cc {
// This class provides basic ability to draw text onto the heads-up display.
class FontAtlas {
public:
- static scoped_ptr<FontAtlas> create(SkBitmap bitmap, IntRect asciiToRectTable[128], int fontHeight)
+ static scoped_ptr<FontAtlas> create(SkBitmap bitmap, gfx::Rect asciiToRectTable[128], int fontHeight)
{
return make_scoped_ptr(new FontAtlas(bitmap, asciiToRectTable, fontHeight));
}
@@ -42,15 +42,15 @@ public:
void drawDebugAtlas(SkCanvas*, const gfx::Point& destPosition) const;
private:
- FontAtlas(SkBitmap, IntRect asciiToRectTable[128], int fontHeight);
+ FontAtlas(SkBitmap, gfx::Rect asciiToRectTable[128], int fontHeight);
void drawOneLineOfTextInternal(SkCanvas*, const SkPaint&, const std::string&, const gfx::Point& destPosition) const;
// The actual texture atlas containing all the pre-rendered glyphs.
SkBitmap m_atlas;
- // The look-up tables mapping ascii characters to their IntRect locations on the atlas.
- IntRect m_asciiToRectTable[128];
+ // The look-up tables mapping ascii characters to their gfx::Rect locations on the atlas.
+ gfx::Rect m_asciiToRectTable[128];
int m_fontHeight;
diff --git a/cc/geometry.h b/cc/geometry.h
new file mode 100644
index 0000000..5501907
--- /dev/null
+++ b/cc/geometry.h
@@ -0,0 +1,21 @@
+// Copyright 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_GEOMETRY_H_
+#define CC_GEOMETRY_H_
+
+#include "ui/gfx/size.h"
+#include "ui/gfx/vector2d_f.h"
+#include <cmath>
+
+namespace cc {
+
+inline gfx::Size ClampSizeFromAbove(gfx::Size s, gfx::Size other) {
+ return gfx::Size(s.width() < other.width() ? s.width() : other.width(),
+ s.height() < other.height() ? s.height() : other.height());
+}
+
+} // namespace cc
+
+#endif // CC_GEOMETRY_H_
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index c69f933..6b78e04 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -466,7 +466,7 @@ scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame,
deviceRect.Intersect(frame.currentRenderPass->outputRect());
scoped_ptr<ScopedTexture> deviceBackgroundTexture = ScopedTexture::create(m_resourceProvider);
- if (!getFramebufferTexture(deviceBackgroundTexture.get(), cc::IntRect(deviceRect)))
+ if (!getFramebufferTexture(deviceBackgroundTexture.get(), deviceRect))
return scoped_ptr<ScopedTexture>();
SkBitmap filteredDeviceBackground = applyFilters(this, filters, deviceBackgroundTexture.get());
@@ -699,7 +699,7 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
float clampY = min(0.5, clampRect.height() / 2.0 - epsilon);
clampRect.Inset(clampX, clampY, clampX, clampY);
- gfx::PointF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrigin() - quad->quadRect().OffsetFromOrigin();
+ gfx::Vector2dF textureOffset = quad->textureOffset() + clampRect.OffsetFromOrigin() - quad->quadRect().OffsetFromOrigin();
// Map clamping rectangle to unit square.
float vertexTexTranslateX = -clampRect.x() / clampRect.width();
@@ -770,10 +770,10 @@ void GLRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQuad* qua
GLC(context(), context()->uniform4f(uniforms.vertexTexTransformLocation, vertexTexTranslateX, vertexTexTranslateY, vertexTexScaleX, vertexTexScaleY));
GLC(context(), context()->uniform4f(uniforms.fragmentTexTransformLocation, fragmentTexTranslateX, fragmentTexTranslateY, fragmentTexScaleX, fragmentTexScaleY));
- FloatPoint bottomRight(tileRect.right(), tileRect.bottom());
- FloatPoint bottomLeft(tileRect.x(), tileRect.bottom());
- FloatPoint topLeft(tileRect.x(), tileRect.y());
- FloatPoint topRight(tileRect.right(), tileRect.y());
+ gfx::PointF bottomRight(tileRect.right(), tileRect.bottom());
+ gfx::PointF bottomLeft(tileRect.x(), tileRect.bottom());
+ gfx::PointF topLeft(tileRect.x(), tileRect.y());
+ gfx::PointF topRight(tileRect.right(), tileRect.y());
// Map points to device space.
bottomRight = MathUtil::mapPoint(deviceTransform, bottomRight, clipped);
@@ -1237,10 +1237,10 @@ void GLRenderer::onContextLost()
}
-void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
+void GLRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect)
{
- DCHECK(rect.maxX() <= viewportWidth());
- DCHECK(rect.maxY() <= viewportHeight());
+ DCHECK(rect.right() <= viewportWidth());
+ DCHECK(rect.bottom() <= viewportHeight());
if (!pixels)
return;
@@ -1275,8 +1275,8 @@ void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
}
scoped_array<uint8_t> srcPixels(new uint8_t[rect.width() * rect.height() * 4]);
- GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height(),
- GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get()));
+ GLC(m_context, m_context->readPixels(rect.x(), viewportSize().height() - rect.bottom(), rect.width(), rect.height(),
+ GL_RGBA, GL_UNSIGNED_BYTE, srcPixels.get()));
uint8_t* destPixels = static_cast<uint8_t*>(pixels);
size_t rowBytes = rect.width() * 4;
@@ -1305,11 +1305,11 @@ void GLRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
enforceMemoryPolicy();
}
-bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const IntRect& deviceRect)
+bool GLRenderer::getFramebufferTexture(ScopedTexture* texture, const gfx::Rect& deviceRect)
{
DCHECK(!texture->id() || (texture->size() == deviceRect.size() && texture->format() == GL_RGB));
- if (!texture->id() && !texture->allocate(Renderer::ImplPool, cc::IntSize(deviceRect.size()), GL_RGB, ResourceProvider::TextureUsageAny))
+ if (!texture->id() && !texture->allocate(Renderer::ImplPool, deviceRect.size(), GL_RGB, ResourceProvider::TextureUsageAny))
return false;
ResourceProvider::ScopedWriteLockGL lock(m_resourceProvider, texture->id());
diff --git a/cc/gl_renderer.h b/cc/gl_renderer.h
index c4e32c0..cb03c06 100644
--- a/cc/gl_renderer.h
+++ b/cc/gl_renderer.h
@@ -50,7 +50,7 @@ public:
// puts backbuffer onscreen
virtual bool swapBuffers() OVERRIDE;
- virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
+ virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE;
virtual bool isContextLost() OVERRIDE;
@@ -69,7 +69,7 @@ protected:
const FloatQuad& sharedGeometryQuad() const { return m_sharedGeometryQuad; }
const GeometryBinding* sharedGeometry() const { return m_sharedGeometry.get(); }
- bool getFramebufferTexture(ScopedTexture*, const IntRect& deviceRect);
+ bool getFramebufferTexture(ScopedTexture*, const gfx::Rect& deviceRect);
void releaseRenderPassTextures();
virtual void bindFramebufferToOutputSurface(DrawingFrame&) OVERRIDE;
diff --git a/cc/gl_renderer_unittest.cc b/cc/gl_renderer_unittest.cc
index 01b1d51..5979a38 100644
--- a/cc/gl_renderer_unittest.cc
+++ b/cc/gl_renderer_unittest.cc
@@ -63,13 +63,13 @@ public:
{
m_rootLayer->createRenderSurface();
RenderPass::Id renderPassId = m_rootLayer->renderSurface()->renderPassId();
- scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, IntRect(), WebTransformationMatrix());
+ scoped_ptr<RenderPass> rootRenderPass = RenderPass::create(renderPassId, gfx::Rect(), WebTransformationMatrix());
m_renderPassesInDrawOrder.push_back(rootRenderPass.get());
m_renderPasses.set(renderPassId, rootRenderPass.Pass());
}
// RendererClient methods.
- virtual const IntSize& deviceViewportSize() const OVERRIDE { static IntSize fakeSize(1, 1); return fakeSize; }
+ virtual const gfx::Size& deviceViewportSize() const OVERRIDE { static gfx::Size fakeSize(1, 1); return fakeSize; }
virtual const LayerTreeSettings& settings() const OVERRIDE { static LayerTreeSettings fakeSettings; return fakeSettings; }
virtual void didLoseContext() OVERRIDE { }
virtual void onSwapBuffersComplete() OVERRIDE { }
diff --git a/cc/heads_up_display_layer_impl.cc b/cc/heads_up_display_layer_impl.cc
index 1730a51..5120b83 100644
--- a/cc/heads_up_display_layer_impl.cc
+++ b/cc/heads_up_display_layer_impl.cc
@@ -78,9 +78,9 @@ void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
- IntRect quadRect(IntPoint(), bounds());
+ gfx::Rect quadRect(gfx::Point(), bounds());
bool premultipliedAlpha = true;
- FloatRect uvRect(0, 0, 1, 1);
+ gfx::RectF uvRect(0, 0, 1, 1);
bool flipped = false;
quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_hudTexture->id(), premultipliedAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
}
@@ -276,7 +276,7 @@ void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory*
break;
}
- const FloatRect& rect = debugRects[i].rect;
+ const gfx::RectF& rect = debugRects[i].rect;
SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height());
SkPaint paint = createPaint();
paint.setColor(fillColor);
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
index 3c1712e..224f938 100644
--- a/cc/image_layer.cc
+++ b/cc/image_layer.cc
@@ -119,7 +119,7 @@ void ImageLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
if (m_needsDisplay) {
m_updater->setBitmap(m_bitmap);
updateTileSizeAndTilingOption();
- invalidateContentRect(IntRect(IntPoint(), contentBounds()));
+ invalidateContentRect(gfx::Rect(gfx::Point(), contentBounds()));
m_needsDisplay = false;
}
TiledLayer::update(queue, occlusion, stats);
@@ -140,9 +140,9 @@ LayerUpdater* ImageLayer::updater() const
return m_updater.get();
}
-IntSize ImageLayer::contentBounds() const
+gfx::Size ImageLayer::contentBounds() const
{
- return IntSize(m_bitmap.width(), m_bitmap.height());
+ return gfx::Size(m_bitmap.width(), m_bitmap.height());
}
bool ImageLayer::drawsContent() const
@@ -152,14 +152,14 @@ bool ImageLayer::drawsContent() const
float ImageLayer::contentsScaleX() const
{
- if (bounds().isEmpty() || contentBounds().isEmpty())
+ if (bounds().IsEmpty() || contentBounds().IsEmpty())
return 1;
return static_cast<float>(m_bitmap.width()) / bounds().width();
}
float ImageLayer::contentsScaleY() const
{
- if (bounds().isEmpty() || contentBounds().isEmpty())
+ if (bounds().IsEmpty() || contentBounds().IsEmpty())
return 1;
return static_cast<float>(m_bitmap.height()) / bounds().height();
}
diff --git a/cc/image_layer.h b/cc/image_layer.h
index 6f25a21..3d66f13 100644
--- a/cc/image_layer.h
+++ b/cc/image_layer.h
@@ -33,7 +33,7 @@ private:
virtual LayerUpdater* updater() const OVERRIDE;
virtual void createUpdaterIfNeeded() OVERRIDE;
- virtual IntSize contentBounds() const OVERRIDE;
+ virtual gfx::Size contentBounds() const OVERRIDE;
SkBitmap m_bitmap;
diff --git a/cc/io_surface_layer_impl.cc b/cc/io_surface_layer_impl.cc
index c80e092..8acf88b 100644
--- a/cc/io_surface_layer_impl.cc
+++ b/cc/io_surface_layer_impl.cc
@@ -79,7 +79,7 @@ void IOSurfaceLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
- IntRect quadRect(IntPoint(), contentBounds());
+ gfx::Rect quadRect(gfx::Point(), contentBounds());
quadSink.append(IOSurfaceDrawQuad::create(sharedQuadState, quadRect, m_ioSurfaceSize, m_ioSurfaceTextureId, IOSurfaceDrawQuad::Flipped).PassAs<DrawQuad>(), appendQuadsData);
}
@@ -98,7 +98,7 @@ void IOSurfaceLayerImpl::didLoseContext()
m_ioSurfaceChanged = true;
}
-void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize& size)
+void IOSurfaceLayerImpl::setIOSurfaceProperties(unsigned ioSurfaceId, const gfx::Size& size)
{
if (m_ioSurfaceId != ioSurfaceId)
m_ioSurfaceChanged = true;
diff --git a/cc/io_surface_layer_impl.h b/cc/io_surface_layer_impl.h
index aef12de..91e889e 100644
--- a/cc/io_surface_layer_impl.h
+++ b/cc/io_surface_layer_impl.h
@@ -5,8 +5,8 @@
#ifndef CCIOSurfaceLayerImpl_h
#define CCIOSurfaceLayerImpl_h
-#include "IntSize.h"
#include "cc/layer_impl.h"
+#include "ui/gfx/size.h"
namespace cc {
@@ -18,7 +18,7 @@ public:
}
virtual ~IOSurfaceLayerImpl();
- void setIOSurfaceProperties(unsigned ioSurfaceId, const IntSize&);
+ void setIOSurfaceProperties(unsigned ioSurfaceId, const gfx::Size&);
virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE;
@@ -33,7 +33,7 @@ private:
virtual const char* layerTypeAsString() const OVERRIDE;
unsigned m_ioSurfaceId;
- IntSize m_ioSurfaceSize;
+ gfx::Size m_ioSurfaceSize;
bool m_ioSurfaceChanged;
unsigned m_ioSurfaceTextureId;
};
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();
}
diff --git a/cc/layer.h b/cc/layer.h
index dda77d8..f875dd6 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -5,13 +5,14 @@
#ifndef LayerChromium_h
#define LayerChromium_h
-#include "FloatPoint.h"
#include "Region.h"
#include "base/memory/ref_counted.h"
#include "cc/layer_animation_controller.h"
#include "cc/occlusion_tracker.h"
#include "cc/render_surface.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
#include <public/WebFilterOperations.h>
#include <public/WebTransformationMatrix.h>
#include <string>
@@ -66,8 +67,8 @@ public:
const LayerList& children() const { return m_children; }
- void setAnchorPoint(const FloatPoint&);
- FloatPoint anchorPoint() const { return m_anchorPoint; }
+ void setAnchorPoint(const gfx::PointF&);
+ gfx::PointF anchorPoint() const { return m_anchorPoint; }
void setAnchorPointZ(float);
float anchorPointZ() const { return m_anchorPointZ; }
@@ -77,9 +78,9 @@ public:
// A layer's bounds are in logical, non-page-scaled pixels (however, the
// root layer's bounds are in physical pixels).
- void setBounds(const IntSize&);
- const IntSize& bounds() const { return m_bounds; }
- virtual IntSize contentBounds() const;
+ void setBounds(const gfx::Size&);
+ const gfx::Size& bounds() const { return m_bounds; }
+ virtual gfx::Size contentBounds() const;
void setMasksToBounds(bool);
bool masksToBounds() const { return m_masksToBounds; }
@@ -87,8 +88,8 @@ public:
void setMaskLayer(Layer*);
Layer* maskLayer() const { return m_maskLayer.get(); }
- virtual void setNeedsDisplayRect(const FloatRect& dirtyRect);
- void setNeedsDisplay() { setNeedsDisplayRect(FloatRect(FloatPoint(), bounds())); }
+ virtual void setNeedsDisplayRect(const gfx::RectF& dirtyRect);
+ void setNeedsDisplay() { setNeedsDisplayRect(gfx::RectF(gfx::PointF(), bounds())); }
virtual bool needsDisplay() const;
void setOpacity(float);
@@ -108,8 +109,8 @@ public:
virtual void setContentsOpaque(bool);
bool contentsOpaque() const { return m_contentsOpaque; }
- void setPosition(const FloatPoint&);
- FloatPoint position() const { return m_position; }
+ void setPosition(const gfx::PointF&);
+ gfx::PointF position() const { return m_position; }
void setIsContainerForFixedPositionLayers(bool);
bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
@@ -123,8 +124,8 @@ public:
void setTransform(const WebKit::WebTransformationMatrix&);
bool transformIsAnimating() const;
- const IntRect& visibleContentRect() const { return m_visibleContentRect; }
- void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
+ const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
void setScrollPosition(const IntPoint&);
const IntPoint& scrollPosition() const { return m_scrollPosition; }
@@ -223,8 +224,8 @@ public:
// It converts logical, non-page-scaled pixels to physical pixels.
const WebKit::WebTransformationMatrix& screenSpaceTransform() const { return m_screenSpaceTransform; }
void setScreenSpaceTransform(const WebKit::WebTransformationMatrix& matrix) { m_screenSpaceTransform = matrix; }
- const IntRect& drawableContentRect() const { return m_drawableContentRect; }
- void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
+ const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
+ void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
// The contentsScale converts from logical, non-page-scaled pixels to target pixels.
// The contentsScale is 1 for the root layer as it is already in physical pixels.
@@ -281,7 +282,7 @@ public:
virtual ScrollbarLayer* toScrollbarLayer();
- IntRect layerRectToContentRect(const FloatRect& layerRect) const;
+ gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const;
protected:
friend class LayerImpl;
@@ -302,7 +303,7 @@ protected:
// For layers that may do updating outside the compositor's control (i.e. plugin layers), this information
// is not available and the update rect will remain empty.
// Note this rect is in layer space (not content space).
- FloatRect m_updateRect;
+ gfx::RectF m_updateRect;
scoped_refptr<Layer> m_maskLayer;
@@ -336,10 +337,10 @@ private:
scoped_ptr<LayerAnimationController> m_layerAnimationController;
// Layer properties.
- IntSize m_bounds;
+ gfx::Size m_bounds;
// Uses layer's content space.
- IntRect m_visibleContentRect;
+ gfx::Rect m_visibleContentRect;
IntPoint m_scrollPosition;
IntSize m_maxScrollPosition;
@@ -348,8 +349,8 @@ private:
bool m_haveWheelEventHandlers;
Region m_nonFastScrollableRegion;
bool m_nonFastScrollableRegionChanged;
- FloatPoint m_position;
- FloatPoint m_anchorPoint;
+ gfx::PointF m_position;
+ gfx::PointF m_anchorPoint;
SkColor m_backgroundColor;
SkColor m_debugBorderColor;
float m_debugBorderWidth;
@@ -390,7 +391,7 @@ private:
bool m_screenSpaceTransformIsAnimating;
// Uses target surface space.
- IntRect m_drawableContentRect;
+ gfx::Rect m_drawableContentRect;
float m_rasterScale;
bool m_automaticallyComputeRasterScale;
bool m_boundsContainPageScale;
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 197e619..fadcf04 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;
@@ -152,7 +154,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);
}
@@ -210,8 +212,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;
}
@@ -235,15 +237,13 @@ bool LayerImpl::drawCheckerboardForMissingTiles() const
return m_drawCheckerboardForMissingTiles && !Settings::backgroundColorInsteadOfCheckerboard();
}
-IntRect LayerImpl::layerRectToContentRect(const FloatRect& layerRect) const
+gfx::Rect LayerImpl::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);
}
std::string LayerImpl::indentString(int indent)
@@ -360,7 +360,7 @@ void LayerImpl::resetAllChangeTrackingForSubtree()
m_layerPropertyChanged = false;
m_layerSurfacePropertyChanged = false;
- m_updateRect = FloatRect();
+ m_updateRect = gfx::RectF();
if (m_renderSurface)
m_renderSurface->resetPropertyChangedFlag();
@@ -405,7 +405,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;
@@ -451,7 +451,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;
@@ -539,7 +539,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;
@@ -604,7 +604,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;
@@ -662,7 +662,7 @@ void LayerImpl::setDoubleSided(bool doubleSided)
Region LayerImpl::visibleContentOpaqueRegion() const
{
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return Region();
}
diff --git a/cc/layer_impl.h b/cc/layer_impl.h
index f1fae67..3b59e12 100644
--- a/cc/layer_impl.h
+++ b/cc/layer_impl.h
@@ -5,8 +5,6 @@
#ifndef CCLayerImpl_h
#define CCLayerImpl_h
-#include "FloatRect.h"
-#include "IntRect.h"
#include "Region.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
@@ -18,6 +16,8 @@
#include "cc/scoped_ptr_vector.h"
#include "cc/shared_quad_state.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
#include <public/WebFilterOperations.h>
#include <public/WebTransformationMatrix.h>
#include <string>
@@ -95,8 +95,8 @@ public:
// Returns true if any of the layer's descendants has content to draw.
virtual bool descendantDrawsContent();
- void setAnchorPoint(const FloatPoint&);
- const FloatPoint& anchorPoint() const { return m_anchorPoint; }
+ void setAnchorPoint(const gfx::PointF&);
+ const gfx::PointF& anchorPoint() const { return m_anchorPoint; }
void setAnchorPointZ(float);
float anchorPointZ() const { return m_anchorPointZ; }
@@ -122,8 +122,8 @@ public:
void setOpacity(float);
bool opacityIsAnimating() const;
- void setPosition(const FloatPoint&);
- const FloatPoint& position() const { return m_position; }
+ void setPosition(const gfx::PointF&);
+ const gfx::PointF& position() const { return m_position; }
void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLayers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
bool isContainerForFixedPositionLayers() const { return m_isContainerForFixedPositionLayers; }
@@ -171,13 +171,13 @@ public:
// contentsScale to appropriate values. LayerImpl doesn't calculate any of
// them from the other values.
- void setBounds(const IntSize&);
- const IntSize& bounds() const { return m_bounds; }
+ void setBounds(const gfx::Size&);
+ const gfx::Size& bounds() const { return m_bounds; }
// ContentBounds may be [0, 1) pixels larger than bounds * contentsScale.
// Don't calculate scale from it. Use contentsScale instead for accuracy.
- void setContentBounds(const IntSize&);
- IntSize contentBounds() const { return m_contentBounds; }
+ void setContentBounds(const gfx::Size&);
+ gfx::Size contentBounds() const { return m_contentBounds; }
float contentsScaleX() const { return m_contentsScaleX; }
float contentsScaleY() const { return m_contentsScaleY; }
@@ -218,8 +218,8 @@ public:
InputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, InputHandlerClient::ScrollInputType) const;
- const IntRect& visibleContentRect() const { return m_visibleContentRect; }
- void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
+ const gfx::Rect& visibleContentRect() const { return m_visibleContentRect; }
+ void setVisibleContentRect(const gfx::Rect& visibleContentRect) { m_visibleContentRect = visibleContentRect; }
bool doubleSided() const { return m_doubleSided; }
void setDoubleSided(bool);
@@ -237,10 +237,10 @@ public:
bool screenSpaceTransformIsAnimating() const { return m_screenSpaceTransformIsAnimating; }
void setScreenSpaceTransformIsAnimating(bool animating) { m_screenSpaceTransformIsAnimating = animating; }
- const IntRect& drawableContentRect() const { return m_drawableContentRect; }
- void setDrawableContentRect(const IntRect& rect) { m_drawableContentRect = rect; }
- const FloatRect& updateRect() const { return m_updateRect; }
- void setUpdateRect(const FloatRect& updateRect) { m_updateRect = updateRect; }
+ const gfx::Rect& drawableContentRect() const { return m_drawableContentRect; }
+ void setDrawableContentRect(const gfx::Rect& rect) { m_drawableContentRect = rect; }
+ const gfx::RectF& updateRect() const { return m_updateRect; }
+ void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect; }
std::string layerTreeAsText() const;
@@ -270,7 +270,7 @@ public:
ScrollbarLayerImpl* verticalScrollbarLayer() const;
void setVerticalScrollbarLayer(ScrollbarLayerImpl*);
- IntRect layerRectToContentRect(const FloatRect& layerRect) const;
+ gfx::Rect layerRectToContentRect(const gfx::RectF& layerRect) const;
protected:
explicit LayerImpl(int);
@@ -306,10 +306,10 @@ private:
LayerTreeHostImpl* m_layerTreeHostImpl;
// Properties synchronized from the associated Layer.
- FloatPoint m_anchorPoint;
+ gfx::PointF m_anchorPoint;
float m_anchorPointZ;
- IntSize m_bounds;
- IntSize m_contentBounds;
+ gfx::Size m_bounds;
+ gfx::Size m_contentBounds;
float m_contentsScaleX;
float m_contentsScaleY;
IntPoint m_scrollPosition;
@@ -332,11 +332,11 @@ private:
bool m_layerSurfacePropertyChanged;
// Uses layer's content space.
- IntRect m_visibleContentRect;
+ gfx::Rect m_visibleContentRect;
bool m_masksToBounds;
bool m_contentsOpaque;
float m_opacity;
- FloatPoint m_position;
+ gfx::PointF m_position;
bool m_preserves3D;
bool m_useParentBackfaceVisibility;
bool m_drawCheckerboardForMissingTiles;
@@ -394,12 +394,12 @@ private:
// Hierarchical bounding rect containing the layer and its descendants.
// Uses target surface's space.
- IntRect m_drawableContentRect;
+ gfx::Rect m_drawableContentRect;
// Rect indicating what was repainted/updated during update.
// Note that plugin layers bypass this and leave it empty.
// Uses layer's content space.
- FloatRect m_updateRect;
+ gfx::RectF m_updateRect;
// Manages animations for this layer.
scoped_ptr<LayerAnimationController> m_layerAnimationController;
diff --git a/cc/layer_iterator_unittest.cc b/cc/layer_iterator_unittest.cc
index 471d322..9d7051e 100644
--- a/cc/layer_iterator_unittest.cc
+++ b/cc/layer_iterator_unittest.cc
@@ -37,9 +37,9 @@ private:
: Layer()
, m_drawsContent(true)
{
- setBounds(IntSize(100, 100));
- setPosition(IntPoint());
- setAnchorPoint(IntPoint());
+ setBounds(gfx::Size(100, 100));
+ setPosition(gfx::Point());
+ setAnchorPoint(gfx::Point());
}
virtual ~TestLayer()
{
@@ -211,7 +211,7 @@ TEST(LayerIteratorTest, complexTreeMultiSurface)
scoped_refptr<TestLayer> root231 = TestLayer::create();
rootLayer->createRenderSurface();
- rootLayer->renderSurface()->setContentRect(IntRect(IntPoint(), rootLayer->bounds()));
+ rootLayer->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), rootLayer->bounds()));
rootLayer->addChild(root1);
rootLayer->addChild(root2);
diff --git a/cc/layer_quad.cc b/cc/layer_quad.cc
index 2618a77..a510ea8 100644
--- a/cc/layer_quad.cc
+++ b/cc/layer_quad.cc
@@ -10,15 +10,15 @@
namespace cc {
-LayerQuad::Edge::Edge(const FloatPoint& p, const FloatPoint& q)
+LayerQuad::Edge::Edge(const gfx::PointF& p, const gfx::PointF& q)
{
DCHECK(p != q);
- FloatPoint tangent(p.y() - q.y(), q.x() - p.x());
+ gfx::Vector2dF tangent(p.y() - q.y(), q.x() - p.x());
float cross2 = p.x() * q.y() - q.x() * p.y();
set(tangent.x(), tangent.y(), cross2);
- scale(1.0f / tangent.length());
+ scale(1.0f / tangent.Length());
}
LayerQuad::LayerQuad(const FloatQuad& quad)
diff --git a/cc/layer_quad.h b/cc/layer_quad.h
index 9f4dfcf..3046c14 100644
--- a/cc/layer_quad.h
+++ b/cc/layer_quad.h
@@ -23,7 +23,7 @@ public:
, m_z(0)
{
}
- Edge(const FloatPoint&, const FloatPoint&);
+ Edge(const gfx::PointF&, const gfx::PointF&);
float x() const { return m_x; }
float y() const { return m_y; }
@@ -60,9 +60,9 @@ public:
}
void scale(float s) { scale(s, s, s); }
- FloatPoint intersect(const Edge& e) const
+ gfx::PointF intersect(const Edge& e) const
{
- return FloatPoint(
+ return gfx::PointF(
(y() * e.z() - e.y() * z()) / (x() * e.y() - e.x() * y()),
(x() * e.z() - e.x() * z()) / (e.x() * y() - x() * e.y()));
}
diff --git a/cc/layer_sorter.cc b/cc/layer_sorter.cc
index ef347dbe..c09211b 100644
--- a/cc/layer_sorter.cc
+++ b/cc/layer_sorter.cc
@@ -20,18 +20,18 @@ using WebKit::WebTransformationMatrix;
namespace cc {
-inline static float perpProduct(const FloatSize& u, const FloatSize& v)
+inline static float perpProduct(const gfx::Vector2dF& u, const gfx::Vector2dF& v)
{
- return u.width() * v.height() - u.height() * v.width();
+ return u.x() * v.y() - u.y() * v.x();
}
// Tests if two edges defined by their endpoints (a,b) and (c,d) intersect. Returns true and the
// point of intersection if they do and false otherwise.
-static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPoint& c, const FloatPoint& d, FloatPoint& r)
+static bool edgeEdgeTest(const gfx::PointF& a, const gfx::PointF& b, const gfx::PointF& c, const gfx::PointF& d, gfx::PointF& r)
{
- FloatSize u = b - a;
- FloatSize v = d - c;
- FloatSize w = a - c;
+ gfx::Vector2dF u = b - a;
+ gfx::Vector2dF v = d - c;
+ gfx::Vector2dF w = a - c;
float denom = perpProduct(u, v);
@@ -49,7 +49,7 @@ static bool edgeEdgeTest(const FloatPoint& a, const FloatPoint& b, const FloatPo
if (t < 0 || t > 1)
return false;
- u.scale(s);
+ u.Scale(s);
r = a + u;
return true;
}
@@ -81,14 +81,14 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape
weight = 0;
// Early out if the projected bounds don't overlap.
- if (!a->projectedBounds.intersects(b->projectedBounds))
+ if (!a->projectedBounds.Intersects(b->projectedBounds))
return None;
- FloatPoint aPoints[4] = {a->projectedQuad.p1(), a->projectedQuad.p2(), a->projectedQuad.p3(), a->projectedQuad.p4() };
- FloatPoint bPoints[4] = {b->projectedQuad.p1(), b->projectedQuad.p2(), b->projectedQuad.p3(), b->projectedQuad.p4() };
+ gfx::PointF aPoints[4] = {a->projectedQuad.p1(), a->projectedQuad.p2(), a->projectedQuad.p3(), a->projectedQuad.p4() };
+ gfx::PointF bPoints[4] = {b->projectedQuad.p1(), b->projectedQuad.p2(), b->projectedQuad.p3(), b->projectedQuad.p4() };
// Make a list of points that inside both layer quad projections.
- std::vector<FloatPoint> overlapPoints;
+ std::vector<gfx::PointF> overlapPoints;
// Check all four corners of one layer against the other layer's quad.
for (int i = 0; i < 4; ++i) {
@@ -99,7 +99,7 @@ LayerSorter::ABCompareResult LayerSorter::checkOverlap(LayerShape* a, LayerShape
}
// Check all the edges of one layer for intersection with the other layer's edges.
- FloatPoint r;
+ gfx::PointF r;
for (int ea = 0; ea < 4; ++ea)
for (int eb = 0; eb < 4; ++eb)
if (edgeEdgeTest(aPoints[ea], aPoints[(ea + 1) % 4],
@@ -153,7 +153,7 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix&
// Compute the projection of the layer quad onto the z = 0 plane.
- FloatPoint clippedQuad[8];
+ gfx::PointF clippedQuad[8];
int numVerticesInClippedQuad;
MathUtil::mapClippedQuad(drawTransform, layerQuad, clippedQuad, numVerticesInClippedQuad);
@@ -190,14 +190,18 @@ LayerShape::LayerShape(float width, float height, const WebTransformationMatrix&
transformOrigin = c1;
}
+LayerShape::~LayerShape()
+{
+}
+
// Returns the Z coordinate of a point on the layer that projects
// to point p which lies on the z = 0 plane. It does it by computing the
// intersection of a line starting from p along the Z axis and the plane
// of the layer.
-float LayerShape::layerZFromProjectedPoint(const FloatPoint& p) const
+float LayerShape::layerZFromProjectedPoint(const gfx::PointF& p) const
{
const FloatPoint3D zAxis(0, 0, 1);
- FloatPoint3D w = FloatPoint3D(p) - transformOrigin;
+ FloatPoint3D w = FloatPoint3D(cc::FloatPoint(p)) - transformOrigin;
float d = layerNormal.dot(zAxis);
float n = -layerNormal.dot(w);
diff --git a/cc/layer_sorter.h b/cc/layer_sorter.h
index 6d5f704..434fa23 100644
--- a/cc/layer_sorter.h
+++ b/cc/layer_sorter.h
@@ -7,10 +7,10 @@
#include "FloatPoint3D.h"
#include "FloatQuad.h"
-#include "FloatRect.h"
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "cc/layer_impl.h"
+#include "ui/gfx/rect_f.h"
#if defined(COMPILER_GCC)
namespace cc
@@ -40,13 +40,14 @@ struct GraphEdge;
struct LayerShape {
LayerShape();
LayerShape(float width, float height, const WebKit::WebTransformationMatrix& drawTransform);
+ ~LayerShape();
- float layerZFromProjectedPoint(const FloatPoint&) const;
+ float layerZFromProjectedPoint(const gfx::PointF&) const;
FloatPoint3D layerNormal;
FloatPoint3D transformOrigin;
FloatQuad projectedQuad;
- FloatRect projectedBounds;
+ gfx::RectF projectedBounds;
};
struct GraphNode {
diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc
index a38d8eb..b3ba58d 100644
--- a/cc/layer_tiling_data.cc
+++ b/cc/layer_tiling_data.cc
@@ -13,13 +13,13 @@ using namespace std;
namespace cc {
-scoped_ptr<LayerTilingData> LayerTilingData::create(const IntSize& tileSize, BorderTexelOption border)
+scoped_ptr<LayerTilingData> LayerTilingData::create(const gfx::Size& tileSize, BorderTexelOption border)
{
return make_scoped_ptr(new LayerTilingData(tileSize, border));
}
-LayerTilingData::LayerTilingData(const IntSize& tileSize, BorderTexelOption border)
- : m_tilingData(tileSize, IntSize(), border == HasBorderTexels)
+LayerTilingData::LayerTilingData(const gfx::Size& tileSize, BorderTexelOption border)
+ : m_tilingData(cc::IntSize(tileSize), cc::IntSize(), border == HasBorderTexels)
{
setTileSize(tileSize);
}
@@ -28,19 +28,19 @@ LayerTilingData::~LayerTilingData()
{
}
-void LayerTilingData::setTileSize(const IntSize& size)
+void LayerTilingData::setTileSize(const gfx::Size& size)
{
if (tileSize() == size)
return;
reset();
- m_tilingData.setMaxTextureSize(size);
+ m_tilingData.setMaxTextureSize(cc::IntSize(size));
}
-IntSize LayerTilingData::tileSize() const
+gfx::Size LayerTilingData::tileSize() const
{
- return m_tilingData.maxTextureSize();
+ return cc::IntSize(m_tilingData.maxTextureSize());
}
void LayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption)
@@ -82,29 +82,29 @@ void LayerTilingData::reset()
m_tiles.clear();
}
-void LayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const
+void LayerTilingData::contentRectToTileIndices(const gfx::Rect& contentRect, int& left, int& top, int& right, int& bottom) const
{
// An empty rect doesn't result in an empty set of tiles, so don't pass an empty rect.
// FIXME: Possibly we should fill a vector of tiles instead,
// since the normal use of this function is to enumerate some tiles.
- DCHECK(!contentRect.isEmpty());
+ DCHECK(!contentRect.IsEmpty());
left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x());
top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y());
- right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1);
- bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1);
+ right = m_tilingData.tileXIndexFromSrcCoord(contentRect.right() - 1);
+ bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.bottom() - 1);
}
-IntRect LayerTilingData::tileRect(const Tile* tile) const
+gfx::Rect LayerTilingData::tileRect(const Tile* tile) const
{
- IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j());
- tileRect.setSize(tileSize());
+ gfx::Rect tileRect = cc::IntRect(m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()));
+ tileRect.set_size(tileSize());
return tileRect;
}
-Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const
+Region LayerTilingData::opaqueRegionInContentRect(const gfx::Rect& contentRect) const
{
- if (contentRect.isEmpty())
+ if (contentRect.IsEmpty())
return Region();
Region opaqueRegion;
@@ -116,24 +116,24 @@ Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) co
if (!tile)
continue;
- IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect());
- opaqueRegion.unite(tileOpaqueRect);
+ gfx::Rect tileOpaqueRect = gfx::IntersectRects(contentRect, tile->opaqueRect());
+ opaqueRegion.unite(cc::IntRect(tileOpaqueRect));
}
}
return opaqueRegion;
}
-void LayerTilingData::setBounds(const IntSize& size)
+void LayerTilingData::setBounds(const gfx::Size& size)
{
- m_tilingData.setTotalSize(size);
- if (size.isEmpty()) {
+ m_tilingData.setTotalSize(cc::IntSize(size));
+ if (size.IsEmpty()) {
m_tiles.clear();
return;
}
// Any tiles completely outside our new bounds are invalid and should be dropped.
int left, top, right, bottom;
- contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
+ contentRectToTileIndices(gfx::Rect(gfx::Point(), size), left, top, right, bottom);
std::vector<TileMapKey> invalidTileKeys;
for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) {
if (it->first.first > right || it->first.second > bottom)
@@ -143,9 +143,9 @@ void LayerTilingData::setBounds(const IntSize& size)
m_tiles.erase(invalidTileKeys[i]);
}
-IntSize LayerTilingData::bounds() const
+gfx::Size LayerTilingData::bounds() const
{
- return m_tilingData.totalSize();
+ return cc::IntSize(m_tilingData.totalSize());
}
} // namespace cc
diff --git a/cc/layer_tiling_data.h b/cc/layer_tiling_data.h
index 97c59fd..33db3bf 100644
--- a/cc/layer_tiling_data.h
+++ b/cc/layer_tiling_data.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "cc/hash_pair.h"
#include "cc/scoped_ptr_hash_map.h"
+#include "ui/gfx/rect.h"
#include "IntRect.h"
#include "Region.h"
#include "TilingData.h"
@@ -22,17 +23,20 @@ public:
~LayerTilingData();
- static scoped_ptr<LayerTilingData> create(const IntSize& tileSize, BorderTexelOption);
+ static scoped_ptr<LayerTilingData> create(const gfx::Size& tileSize, BorderTexelOption);
bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); }
int numTilesX() const { return m_tilingData.numTilesX(); }
int numTilesY() const { return m_tilingData.numTilesY(); }
- IntRect tileBounds(int i, int j) const { return m_tilingData.tileBounds(i, j); }
- IntPoint textureOffset(int xIndex, int yIndex) const { return m_tilingData.textureOffset(xIndex, yIndex); }
+ gfx::Rect tileBounds(int i, int j) const { return cc::IntRect(m_tilingData.tileBounds(i, j)); }
+ gfx::Vector2d textureOffset(int xIndex, int yIndex) const {
+ cc::IntPoint p(m_tilingData.textureOffset(xIndex, yIndex));
+ return gfx::Vector2d(p.x(), p.y());
+ }
// Change the tile size. This may invalidate all the existing tiles.
- void setTileSize(const IntSize&);
- IntSize tileSize() const;
+ void setTileSize(const gfx::Size&);
+ gfx::Size tileSize() const;
// Change the border texel setting. This may invalidate all existing tiles.
void setBorderTexelOption(BorderTexelOption);
bool hasBorderTexels() const { return m_tilingData.borderTexels(); }
@@ -50,12 +54,12 @@ public:
int j() const { return m_j; }
void moveTo(int i, int j) { m_i = i; m_j = j; }
- const IntRect& opaqueRect() const { return m_opaqueRect; }
- void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRect; }
+ const gfx::Rect& opaqueRect() const { return m_opaqueRect; }
+ void setOpaqueRect(const gfx::Rect& opaqueRect) { m_opaqueRect = opaqueRect; }
private:
int m_i;
int m_j;
- IntRect m_opaqueRect;
+ gfx::Rect m_opaqueRect;
DISALLOW_COPY_AND_ASSIGN(Tile);
};
typedef std::pair<int, int> TileMapKey;
@@ -66,18 +70,18 @@ public:
Tile* tileAt(int, int) const;
const TileMap& tiles() const { return m_tiles; }
- void setBounds(const IntSize&);
- IntSize bounds() const;
+ void setBounds(const gfx::Size&);
+ gfx::Size bounds() const;
- void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const;
- IntRect tileRect(const Tile*) const;
+ void contentRectToTileIndices(const gfx::Rect&, int &left, int &top, int &right, int &bottom) const;
+ gfx::Rect tileRect(const Tile*) const;
- Region opaqueRegionInContentRect(const IntRect&) const;
+ Region opaqueRegionInContentRect(const gfx::Rect&) const;
void reset();
protected:
- LayerTilingData(const IntSize& tileSize, BorderTexelOption);
+ LayerTilingData(const gfx::Size& tileSize, BorderTexelOption);
TileMap m_tiles;
TilingData m_tilingData;
diff --git a/cc/layer_tree_host.cc b/cc/layer_tree_host.cc
index 06085b1..e4341a4 100644
--- a/cc/layer_tree_host.cc
+++ b/cc/layer_tree_host.cc
@@ -50,9 +50,9 @@ LayerTreeSettings::LayerTreeSettings()
, renderVSyncEnabled(true)
, refreshRate(0)
, maxPartialTextureUpdates(std::numeric_limits<size_t>::max())
- , defaultTileSize(IntSize(256, 256))
- , maxUntiledLayerSize(IntSize(512, 512))
- , minimumOcclusionTrackingSize(IntSize(160, 160))
+ , defaultTileSize(gfx::Size(256, 256))
+ , maxUntiledLayerSize(gfx::Size(512, 512))
+ , minimumOcclusionTrackingSize(gfx::Size(160, 160))
{
}
@@ -165,14 +165,14 @@ void LayerTreeHost::initializeRenderer()
m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates());
m_contentsTextureManager = PrioritizedTextureManager::create(0, m_proxy->rendererCapabilities().maxTextureSize, Renderer::ContentPool);
- m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GL_RGBA);
+ m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(gfx::Size(), GL_RGBA);
m_rendererInitialized = true;
- m_settings.defaultTileSize = IntSize(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
- min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
- m_settings.maxUntiledLayerSize = IntSize(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
- min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
+ m_settings.defaultTileSize = gfx::Size(min(m_settings.defaultTileSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
+ min(m_settings.defaultTileSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
+ m_settings.maxUntiledLayerSize = gfx::Size(min(m_settings.maxUntiledLayerSize.width(), m_proxy->rendererCapabilities().maxTextureSize),
+ min(m_settings.maxUntiledLayerSize.height(), m_proxy->rendererCapabilities().maxTextureSize));
}
LayerTreeHost::RecreateResult LayerTreeHost::recreateContext()
@@ -421,7 +421,7 @@ void LayerTreeHost::setRootLayer(scoped_refptr<Layer> rootLayer)
setNeedsCommit();
}
-void LayerTreeHost::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize)
+void LayerTreeHost::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
{
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
return;
@@ -502,7 +502,7 @@ void LayerTreeHost::updateLayers(ResourceUpdateQueue& queue, size_t memoryAlloca
if (!rootLayer())
return;
- if (layoutViewportSize().isEmpty())
+ if (layoutViewportSize().IsEmpty())
return;
m_contentsTextureManager->setMaxMemoryLimitBytes(memoryAllocationLimitBytes);
@@ -675,7 +675,7 @@ bool LayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList,
DCHECK(it->renderSurface()->drawOpacity() || it->renderSurface()->drawOpacityIsAnimating());
needMoreUpdates |= paintMasksForRenderSurface(*it, queue);
} else if (it.representsItself()) {
- DCHECK(!it->bounds().isEmpty());
+ DCHECK(!it->bounds().IsEmpty());
it->update(queue, &occlusionTracker, m_renderingStats);
needMoreUpdates |= it->needMoreUpdates();
}
@@ -709,7 +709,7 @@ void LayerTreeHost::applyScrollAndScale(const ScrollAndScaleSet& info)
m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta);
}
-FloatPoint LayerTreeHost::adjustEventPointForPinchZoom(const FloatPoint& point)
+gfx::PointF LayerTreeHost::adjustEventPointForPinchZoom(const gfx::PointF& point)
const
{
WebKit::WebTransformationMatrix inverseImplTransform = m_implTransform;
@@ -724,7 +724,7 @@ FloatPoint LayerTreeHost::adjustEventPointForPinchZoom(const FloatPoint& point)
/ inverseImplTransform.m22());
inverseImplTransform = inverseImplTransform.inverse();
bool wasClipped = false;
- FloatPoint adjustedPoint = MathUtil::projectPoint(inverseImplTransform, point, wasClipped);
+ gfx::PointF adjustedPoint = MathUtil::projectPoint(inverseImplTransform, point, wasClipped);
DCHECK(!wasClipped);
return adjustedPoint;
diff --git a/cc/layer_tree_host.h b/cc/layer_tree_host.h
index dc5aeaf..7879d1a 100644
--- a/cc/layer_tree_host.h
+++ b/cc/layer_tree_host.h
@@ -7,7 +7,6 @@
#include <limits>
-#include "IntRect.h"
#include "base/basictypes.h"
#include "base/cancelable_callback.h"
#include "base/hash_tables.h"
@@ -25,6 +24,7 @@
#include "cc/rendering_stats.h"
#include "cc/scoped_ptr_vector.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/rect.h"
#if defined(COMPILER_GCC)
namespace BASE_HASH_NAMESPACE {
@@ -40,6 +40,7 @@ struct hash<WebKit::WebGraphicsContext3D*> {
namespace cc {
class FontAtlas;
+class IntRect;
class Layer;
class LayerTreeHostImpl;
class LayerTreeHostImplClient;
@@ -65,9 +66,9 @@ struct LayerTreeSettings {
bool renderVSyncEnabled;
double refreshRate;
size_t maxPartialTextureUpdates;
- IntSize defaultTileSize;
- IntSize maxUntiledLayerSize;
- IntSize minimumOcclusionTrackingSize;
+ gfx::Size defaultTileSize;
+ gfx::Size maxUntiledLayerSize;
+ gfx::Size minimumOcclusionTrackingSize;
bool showDebugInfo() const { return showPlatformLayerTree || showFPSCounter || showDebugRects(); }
bool showDebugRects() const { return showPaintRects || showPropertyChangedRects || showSurfaceDamageRects || showScreenSpaceRects || showReplicaScreenSpaceRects || showOccludingRects; }
@@ -173,10 +174,10 @@ public:
const LayerTreeSettings& settings() const { return m_settings; }
- void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
+ void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
- const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
- const IntSize& deviceViewportSize() const { return m_deviceViewportSize; }
+ const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
+ const gfx::Size& deviceViewportSize() const { return m_deviceViewportSize; }
void setPageScaleFactorAndLimits(float pageScaleFactor, float minPageScaleFactor, float maxPageScaleFactor);
@@ -192,7 +193,7 @@ public:
void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration);
void applyScrollAndScale(const ScrollAndScaleSet&);
- FloatPoint adjustEventPointForPinchZoom(const FloatPoint&) const;
+ gfx::PointF adjustEventPointForPinchZoom(const gfx::PointF&) const;
void setImplTransform(const WebKit::WebTransformationMatrix&);
void startRateLimiter(WebKit::WebGraphicsContext3D*);
@@ -261,8 +262,8 @@ private:
LayerTreeSettings m_settings;
- IntSize m_layoutViewportSize;
- IntSize m_deviceViewportSize;
+ gfx::Size m_layoutViewportSize;
+ gfx::Size m_deviceViewportSize;
float m_deviceScaleFactor;
bool m_visible;
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index 65db168..e3d4f08 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -6,8 +6,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 +13,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 +29,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;
}
@@ -116,31 +115,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)
@@ -188,7 +187,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;
@@ -359,7 +358,7 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
rasterScale = 1;
if (layer->automaticallyComputeRasterScale()) {
- FloatPoint transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
+ gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
float combinedScale = std::max(transformScale.x(), transformScale.y());
rasterScale = combinedScale / deviceScaleFactor;
if (!layer->boundsContainPageScale())
@@ -387,9 +386,9 @@ static inline void updateLayerContentsScale(Layer* layer, const WebTransformatio
template<typename LayerType, typename LayerList, typename RenderSurfaceType, typename LayerSorter>
static void calculateDrawTransformsInternal(LayerType* layer, 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.
@@ -402,7 +401,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// 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()].
@@ -474,13 +473,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
//
// If we early-exit anywhere in this function, the drawableContentRect of this subtree should be considered empty.
- drawableContentRectOfSubtree = IntRect();
+ drawableContentRectOfSubtree = gfx::Rect();
// The root layer cannot skip calcDrawTransforms.
if (!isRootLayer(layer) && subtreeShouldBeSkipped(layer))
return;
- IntRect clipRectForSubtree;
+ gfx::Rect clipRectForSubtree;
bool subtreeShouldBeClipped = false;
float drawOpacity = layer->opacity();
@@ -490,9 +489,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
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]
@@ -523,7 +522,7 @@ 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;
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty()) {
// M[draw] = M[parent] * LT * S[layer2content]
drawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
1.0 / layer->contentsScaleY());
@@ -543,14 +542,14 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
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::Vector2dF renderSurfaceSublayerScale = MathUtil::computeTransform2dScaleComponents(combinedTransform);
if (subtreeShouldRenderToSeparateSurface(layer, isScaleOrTranslation(combinedTransform))) {
// Check back-face visibility before continuing with this surface and its subtree
@@ -565,20 +564,16 @@ 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.
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- drawTransform.scaleNonUniform(layer->contentsScaleX(),
- layer->contentsScaleY());
- }
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
+ drawTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
drawTransform.scaleNonUniform(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());
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- layerDrawTransform.scaleNonUniform(1.0 / layer->contentsScaleX(),
- 1.0 / layer->contentsScaleY());
- }
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
+ layerDrawTransform.scaleNonUniform(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.
@@ -611,12 +606,12 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
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
@@ -628,7 +623,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
if (ancestorClipsSubtree)
renderSurface->setClipRect(clipRectFromAncestor);
else
- renderSurface->setClipRect(IntRect());
+ renderSurface->setClipRect(gfx::Rect());
renderSurface->setNearestAncestorThatMovesPixels(nearestAncestorThatMovesPixels);
@@ -655,13 +650,13 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
layer->setRenderTarget(layer->parent()->renderTarget());
}
- 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;
}
@@ -685,35 +680,35 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
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, 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.
@@ -723,7 +718,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
layer->renderSurface()->setContentRect(clipRectFromAncestor);
} else if (layer->renderSurface() && !isRootLayer(layer)) {
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
@@ -731,18 +726,18 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
// 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);
@@ -750,10 +745,8 @@ 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();
- if (!layer->contentBounds().isEmpty() && !layer->bounds().isEmpty()) {
- screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(),
- layer->contentsScaleY());
- }
+ if (!layer->contentBounds().IsEmpty() && !layer->bounds().IsEmpty())
+ screenSpaceTransform.scaleNonUniform(layer->contentsScaleX(), layer->contentsScaleY());
screenSpaceTransform.scaleNonUniform(1 / renderSurfaceSublayerScale.x(), 1 / renderSurfaceSublayerScale.y());
renderSurface->setScreenSpaceTransform(screenSpaceTransform);
@@ -804,7 +797,7 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
sortLayers(descendants.begin() + sortingStartIndex, descendants.end(), layerSorter);
if (layer->renderSurface())
- drawableContentRectOfSubtree = enclosingIntRect(layer->renderSurface()->drawableContentRect());
+ drawableContentRectOfSubtree = gfx::ToEnclosingRect(layer->renderSurface()->drawableContentRect());
else
drawableContentRectOfSubtree = localDrawableContentRectOfSubtree;
@@ -812,9 +805,9 @@ static void calculateDrawTransformsInternal(LayerType* layer, const WebTransform
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);
@@ -822,7 +815,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSiz
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
bool subtreeShouldBeClipped = true;
- IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize);
+ gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
// This function should have received a root layer.
DCHECK(isRootLayer(rootLayer));
@@ -839,9 +832,9 @@ void LayerTreeHostCommon::calculateDrawTransforms(Layer* rootLayer, const IntSiz
DCHECK(rootLayer->renderSurface());
}
-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);
@@ -849,7 +842,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const In
// The root layer's renderSurface should receive the deviceViewport as the initial clipRect.
bool subtreeShouldBeClipped = true;
- IntRect deviceViewportRect(IntPoint::zero(), deviceViewportSize);
+ gfx::Rect deviceViewportRect(gfx::Point(), deviceViewportSize);
// This function should have received a root layer.
DCHECK(isRootLayer(rootLayer));
@@ -866,7 +859,7 @@ void LayerTreeHostCommon::calculateDrawTransforms(LayerImpl* rootLayer, const In
DCHECK(rootLayer->renderSurface());
}
-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())
@@ -874,16 +867,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;
@@ -905,7 +898,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;
@@ -919,7 +912,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;
diff --git a/cc/layer_tree_host_common.h b/cc/layer_tree_host_common.h
index 1349629..463ebc5 100644
--- a/cc/layer_tree_host_common.h
+++ b/cc/layer_tree_host_common.h
@@ -7,7 +7,7 @@
#include "base/memory/ref_counted.h"
#include "cc/scoped_ptr_vector.h"
-#include "IntRect.h"
+#include "ui/gfx/rect.h"
#include "IntSize.h"
#include <public/WebTransformationMatrix.h>
@@ -19,13 +19,13 @@ class Layer;
class LayerTreeHostCommon {
public:
- static IntRect calculateVisibleRect(const IntRect& targetSurfaceRect, const IntRect& layerBoundRect, const WebKit::WebTransformationMatrix&);
+ static gfx::Rect calculateVisibleRect(const gfx::Rect& targetSurfaceRect, const gfx::Rect& layerBoundRect, const WebKit::WebTransformationMatrix&);
- static void calculateDrawTransforms(Layer* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList);
- static void calculateDrawTransforms(LayerImpl* rootLayer, const IntSize& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList);
+ static void calculateDrawTransforms(Layer* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, int maxTextureSize, std::vector<scoped_refptr<Layer> >& renderSurfaceLayerList);
+ static void calculateDrawTransforms(LayerImpl* rootLayer, const gfx::Size& deviceViewportSize, float deviceScaleFactor, float pageScaleFactor, LayerSorter*, int maxTextureSize, std::vector<LayerImpl*>& renderSurfaceLayerList);
// Performs hit testing for a given renderSurfaceLayerList.
- static LayerImpl* findLayerThatIsHitByPoint(const IntPoint& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList);
+ static LayerImpl* findLayerThatIsHitByPoint(const gfx::Point& screenSpacePoint, std::vector<LayerImpl*>& renderSurfaceLayerList);
template<typename LayerType> static bool renderSurfaceContributesToTarget(LayerType*, int targetSurfaceLayerID);
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index ce08617..d25bb58 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -29,7 +29,7 @@ using WebKit::WebTransformationMatrix;
namespace {
template<typename LayerType>
-void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
layer->setTransform(transform);
layer->setSublayerTransform(sublayerTransform);
@@ -39,13 +39,13 @@ void setLayerPropertiesForTestingInternal(LayerType* layer, const WebTransformat
layer->setPreserves3D(preserves3D);
}
-void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(Layer* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<Layer>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setAutomaticallyComputeRasterScale(true);
}
-void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool preserves3D)
+void setLayerPropertiesForTesting(LayerImpl* layer, const WebTransformationMatrix& transform, const WebTransformationMatrix& sublayerTransform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool preserves3D)
{
setLayerPropertiesForTestingInternal<LayerImpl>(layer, transform, sublayerTransform, anchor, position, bounds, preserves3D);
layer->setContentBounds(bounds);
@@ -56,10 +56,10 @@ void executeCalculateDrawTransformsAndVisibility(Layer* rootLayer, float deviceS
WebTransformationMatrix identityMatrix;
std::vector<scoped_refptr<Layer> > dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
- IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
+ gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
// We are probably not testing what is intended if the rootLayer bounds are empty.
- DCHECK(!rootLayer->bounds().isEmpty());
+ DCHECK(!rootLayer->bounds().IsEmpty());
LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
}
@@ -70,10 +70,10 @@ void executeCalculateDrawTransformsAndVisibility(LayerImpl* rootLayer, float dev
WebTransformationMatrix identityMatrix;
std::vector<LayerImpl*> dummyRenderSurfaceLayerList;
int dummyMaxTextureSize = 512;
- IntSize deviceViewportSize = IntSize(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
+ gfx::Size deviceViewportSize = gfx::Size(rootLayer->bounds().width() * deviceScaleFactor, rootLayer->bounds().height() * deviceScaleFactor);
// We are probably not testing what is intended if the rootLayer bounds are empty.
- DCHECK(!rootLayer->bounds().isEmpty());
+ DCHECK(!rootLayer->bounds().IsEmpty());
LayerTreeHostCommon::calculateDrawTransforms(rootLayer, deviceViewportSize, deviceScaleFactor, pageScaleFactor, 0, dummyMaxTextureSize, dummyRenderSurfaceLayerList);
}
@@ -98,9 +98,9 @@ scoped_ptr<LayerImpl> createTreeForFixedPositionTests()
scoped_ptr<LayerImpl> greatGrandChild = LayerImpl::create(4);
WebTransformationMatrix IdentityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
setLayerPropertiesForTesting(child.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
setLayerPropertiesForTesting(grandChild.get(), IdentityMatrix, IdentityMatrix, anchor, position, bounds, false);
@@ -162,9 +162,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForNoOpLayer)
child->addChild(grandChild);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
executeCalculateDrawTransformsAndVisibility(parent.get());
@@ -180,13 +180,13 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
scoped_refptr<Layer> layer = Layer::create();
scoped_refptr<Layer> root = Layer::create();
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
root->addChild(layer);
// Case 1: setting the sublayer transform should not affect this layer's draw transform or screen-space transform.
WebTransformationMatrix arbitraryTranslation;
arbitraryTranslation.translate(10, 20);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, arbitraryTranslation, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
executeCalculateDrawTransformsAndVisibility(root.get());
WebTransformationMatrix expectedDrawTransform = identityMatrix;
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedDrawTransform, layer->drawTransform());
@@ -195,13 +195,13 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 2: Setting the bounds of the layer should not affect either the draw transform or the screenspace transform.
WebTransformationMatrix translationToCenter;
translationToCenter.translate(5, 6);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
// Case 3: The anchor point by itself (without a layer transform) should have no effect on the transforms.
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, layer->screenSpaceTransform());
@@ -209,7 +209,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// Case 4: A change in actual position affects both the draw transform and screen space transform.
WebTransformationMatrix positionTransform;
positionTransform.translate(0, 1.2);
- setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(positionTransform, layer->screenSpaceTransform());
@@ -218,7 +218,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// using a scale transform, because scale and translation are not commutative.
WebTransformationMatrix layerTransform;
layerTransform.scale3d(2, 2, 1);
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(layerTransform, layer->screenSpaceTransform());
@@ -227,7 +227,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
WebTransformationMatrix translationToAnchor;
translationToAnchor.translate(5, 0);
WebTransformationMatrix expectedResult = translationToAnchor * layerTransform * translationToAnchor.inverse();
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 0), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 0), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform());
@@ -236,7 +236,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleLayer)
// The current implementation of calculateDrawTransforms does this implicitly, but it is
// still worth testing to detect accidental regressions.
expectedResult = positionTransform * translationToAnchor * layerTransform * translationToAnchor.inverse();
- setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, FloatPoint(0.5, 0), FloatPoint(0, 1.2f), IntSize(10, 12), false);
+ setLayerPropertiesForTesting(layer.get(), layerTransform, identityMatrix, gfx::PointF(0.5, 0), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedResult, layer->screenSpaceTransform());
@@ -254,12 +254,12 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
child->addChild(grandChild);
// One-time setup of root layer
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Case 1: parent's anchorPoint should not affect child or grandChild.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(identityMatrix, child->screenSpaceTransform());
@@ -269,9 +269,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
// Case 2: parent's position affects child and grandChild.
WebTransformationMatrix parentPositionTransform;
parentPositionTransform.translate(0, 1.2);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 1.2f), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 1.2f), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentPositionTransform, child->screenSpaceTransform());
@@ -284,9 +284,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
WebTransformationMatrix parentTranslationToAnchor;
parentTranslationToAnchor.translate(2.5, 3);
WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse();
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, identityMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -305,9 +305,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
* parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
WebTransformationMatrix flattenedCompositeTransform = remove3DComponentOfMatrix(parentCompositeTransform);
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -316,9 +316,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSimpleHierarchy)
// Case 5: same as Case 4, except that child does preserve 3D, so the grandChild should receive the non-flattened composite transform.
//
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), true);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(76, 78), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), true);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(76, 78), false);
executeCalculateDrawTransformsAndVisibility(root.get());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->drawTransform());
EXPECT_TRANSFORMATION_MATRIX_EQ(parentCompositeTransform, child->screenSpaceTransform());
@@ -338,7 +338,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
@@ -353,7 +353,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
parentTranslationToCenter.translate(50, 60);
WebTransformationMatrix parentCompositeTransform = parentTranslationToAnchor * parentLayerTransform * parentTranslationToAnchor.inverse()
* parentTranslationToCenter * parentSublayerMatrix * parentTranslationToCenter.inverse();
- FloatPoint parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
+ gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
WebTransformationMatrix surfaceSublayerTransform;
surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
WebTransformationMatrix surfaceSublayerCompositeTransform = parentCompositeTransform * surfaceSublayerTransform.inverse();
@@ -361,9 +361,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForSingleRenderSurface)
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(100, 120), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(8, 10), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(100, 120), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(8, 10), false);
executeCalculateDrawTransformsAndVisibility(root.get());
// Render surface should have been created now.
@@ -397,7 +397,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// Child is set up so that a new render surface should be created.
child->setOpacity(0.5);
@@ -416,7 +416,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
childTranslationToCenter.translate(8, 9);
WebTransformationMatrix replicaLayerTransform;
replicaLayerTransform.scale3d(3, 3, 1);
- FloatPoint parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
+ gfx::Vector2dF parentCompositeScale = MathUtil::computeTransform2dScaleComponents(parentCompositeTransform);
WebTransformationMatrix surfaceSublayerTransform;
surfaceSublayerTransform.scaleNonUniform(parentCompositeScale.x(), parentCompositeScale.y());
WebTransformationMatrix replicaCompositeTransform = parentCompositeTransform * replicaLayerTransform * surfaceSublayerTransform.inverse();
@@ -424,10 +424,10 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForReplica)
// Child's render surface should not exist yet.
ASSERT_FALSE(child->renderSurface());
- setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, FloatPoint(0.25, 0.25), FloatPoint(0, 0), IntSize(10, 12), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(16, 18), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(-0.5, -0.5), IntSize(1, 1), false);
- setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(0, 0), false);
+ setLayerPropertiesForTesting(parent.get(), parentLayerTransform, parentSublayerMatrix, gfx::PointF(0.25, 0.25), gfx::PointF(0, 0), gfx::Size(10, 12), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(16, 18), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(-0.5, -0.5), gfx::Size(1, 1), false);
+ setLayerPropertiesForTesting(childReplica.get(), replicaLayerTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(0, 0), false);
executeCalculateDrawTransformsAndVisibility(root.get());
// Render surface should have been created now.
@@ -477,7 +477,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// One-time setup of root layer
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(1, 2), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(1, 2), false);
// All layers in the tree are initialized with an anchor at .25 and a size of (10,10).
// matrix "A" is the composite layer transform used in all layers, centered about the anchor point
@@ -501,7 +501,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
WebTransformationMatrix B = translationToCenter * sublayerTransform * translationToCenter.inverse();
WebTransformationMatrix R = A * translationToAnchor * replicaLayerTransform * translationToAnchor.inverse();
- FloatPoint surface1ParentTransformScale = MathUtil::computeTransform2dScaleComponents(A * B);
+ gfx::Vector2dF surface1ParentTransformScale = MathUtil::computeTransform2dScaleComponents(A * B);
WebTransformationMatrix surface1SublayerTransform;
surface1SublayerTransform.scaleNonUniform(surface1ParentTransformScale.x(), surface1ParentTransformScale.y());
@@ -510,7 +510,7 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// S1 = transform to move from renderSurface1 pixels to the layer space of the owning layer
WebTransformationMatrix S1 = surface1SublayerTransform.inverse();
- FloatPoint surface2ParentTransformScale = MathUtil::computeTransform2dScaleComponents(SS1 * A * B);
+ gfx::Vector2dF surface2ParentTransformScale = MathUtil::computeTransform2dScaleComponents(SS1 * A * B);
WebTransformationMatrix surface2SublayerTransform;
surface2SublayerTransform.scaleNonUniform(surface2ParentTransformScale.x(), surface2ParentTransformScale.y());
@@ -519,17 +519,17 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForRenderSurfaceHierarchy)
// S2 = transform to move from renderSurface2 pixels to the layer space of the owning layer
WebTransformationMatrix S2 = surface2SublayerTransform.inverse();
- setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false);
- setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(0, 0), IntSize(), false);
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(replicaOfRS1.get(), replicaLayerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false);
+ setLayerPropertiesForTesting(replicaOfRS2.get(), replicaLayerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(0, 0), gfx::Size(), false);
executeCalculateDrawTransformsAndVisibility(root.get());
@@ -635,9 +635,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForFlatteningLayer)
rotationAboutYAxis.rotate3d(0, 30, 0);
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), rotationAboutYAxis, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild.get(), rotationAboutYAxis, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild.get(), rotationAboutYAxis, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
root->addChild(child);
child->addChild(grandChild);
@@ -679,9 +679,9 @@ TEST(LayerTreeHostCommonTest, verifyTransformsForDegenerateIntermediateLayer)
// The child height is zero, but has non-zero width that should be accounted for while computing drawTransforms.
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 0), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 0), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
root->addChild(child);
child->addChild(grandChild);
@@ -702,9 +702,9 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForRenderSurfaceWithClipped
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint(30, 30), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(30, 30), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
parent->setMasksToBounds(true);
@@ -730,8 +730,8 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
scoped_refptr<LayerWithForcedDrawsContent> child = make_scoped_refptr(new LayerWithForcedDrawsContent());
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
renderSurface1->addChild(child);
@@ -748,7 +748,7 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceListForTransparentChild)
EXPECT_EQ(0U, parent->renderSurface()->layerList().size());
EXPECT_EQ(1U, renderSurfaceLayerList.size());
EXPECT_EQ(parent->id(), renderSurfaceLayerList[0]->id());
- EXPECT_EQ(IntRect(), parent->drawableContentRect());
+ EXPECT_EQ(gfx::Rect(), parent->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyForceRenderSurface)
@@ -759,9 +759,9 @@ TEST(LayerTreeHostCommonTest, verifyForceRenderSurface)
renderSurface1->setForceRenderSurface(true);
const WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint::zero(), FloatPoint::zero(), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(), gfx::PointF(), gfx::Size(10, 10), false);
parent->addChild(renderSurface1);
renderSurface1->addChild(child);
@@ -883,7 +883,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
LayerImpl* greatGrandChild = grandChild->children()[0];
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
greatGrandChild->setFixedToContainerLayer(true);
// Case 1: scrollDelta of 0, 0
@@ -931,7 +931,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithD
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setTransform(rotationAboutZ);
greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the renderTarget.
@@ -993,7 +993,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
child->setIsContainerForFixedPositionLayers(true);
child->setTransform(rotationAboutZ);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setTransform(rotationAboutZ);
greatGrandChild->setFixedToContainerLayer(true); // greatGrandChild is positioned upside-down with respect to the renderTarget.
@@ -1051,7 +1051,7 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithI
LayerImpl* greatGrandChild = grandChild->children()[0];
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setForceRenderSurface(true);
greatGrandChild->setFixedToContainerLayer(true);
greatGrandChild->setDrawsContent(true);
@@ -1127,16 +1127,16 @@ TEST(LayerTreeHostCommonTest, verifyScrollCompensationForFixedPositionLayerWithM
{
WebTransformationMatrix identity;
scoped_ptr<LayerImpl> fixedPositionChild = LayerImpl::create(5);
- setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(fixedPositionChild.get(), identity, identity, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
greatGrandChild->addChild(fixedPositionChild.Pass());
}
LayerImpl* fixedPositionChild = greatGrandChild->children()[0];
// Actually set up the scenario here.
child->setIsContainerForFixedPositionLayers(true);
- grandChild->setPosition(FloatPoint(8, 6));
+ grandChild->setPosition(gfx::PointF(8, 6));
grandChild->setForceRenderSurface(true);
- greatGrandChild->setPosition(FloatPoint(40, 60));
+ greatGrandChild->setPosition(gfx::PointF(40, 60));
greatGrandChild->setForceRenderSurface(true);
fixedPositionChild->setFixedToContainerLayer(true);
fixedPositionChild->setDrawsContent(true);
@@ -1381,12 +1381,12 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsRenderSurfaces)
child->addChild(leafNode1);
greatGrandChild->addChild(leafNode2);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
- setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(greatGrandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
child->setMasksToBounds(true);
child->setOpacity(0.4f);
@@ -1429,10 +1429,10 @@ TEST(LayerTreeHostCommonTest, verifyClipRectCullsSurfaceWithoutVisibleContent)
child->addChild(grandChild);
grandChild->addChild(leafNode);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(200, 200), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(200, 200), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
parent->setMasksToBounds(true);
child->setOpacity(0.4f);
@@ -1487,12 +1487,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
child->addChild(grandChild3);
child->addChild(grandChild4);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
child->setMasksToBounds(true);
grandChild3->setMasksToBounds(true);
@@ -1508,10 +1508,10 @@ TEST(LayerTreeHostCommonTest, verifyDrawableContentRectForLayers)
int dummyMaxTextureSize = 512;
LayerTreeHostCommon::calculateDrawTransforms(parent.get(), parent->bounds(), 1, 1, dummyMaxTextureSize, renderSurfaceLayerList);
- EXPECT_RECT_EQ(IntRect(IntPoint(5, 5), IntSize(10, 10)), grandChild1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(15, 15), IntSize(5, 5)), grandChild3->drawableContentRect());
- EXPECT_TRUE(grandChild4->drawableContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(5, 5), gfx::Size(10, 10)), grandChild1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(15, 15), gfx::Size(5, 5)), grandChild3->drawableContentRect());
+ EXPECT_TRUE(grandChild4->drawableContentRect().IsEmpty());
}
TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
@@ -1547,16 +1547,16 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
grandChild3->addChild(leafNode3);
grandChild4->addChild(leafNode4);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(20, 20), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(15, 15), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(45, 45), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(20, 20), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(15, 15), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChild4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(45, 45), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(leafNode4.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), false);
child->setMasksToBounds(true);
grandChild3->setMasksToBounds(true);
@@ -1579,9 +1579,9 @@ TEST(LayerTreeHostCommonTest, verifyClipRectIsPropagatedCorrectlyToSurfaces)
EXPECT_FALSE(grandChild4->renderSurface()); // Because grandChild4 is entirely clipped, it is expected to not have a renderSurface.
// Surfaces are clipped by their parent, but un-affected by the owning layer's masksToBounds.
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild1->renderSurface()->clipRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild2->renderSurface()->clipRect());
- EXPECT_RECT_EQ(IntRect(IntPoint(0, 0), IntSize(20, 20)), grandChild3->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild1->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild2->renderSurface()->clipRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20)), grandChild3->renderSurface()->clipRect());
}
TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
@@ -1626,15 +1626,15 @@ TEST(LayerTreeHostCommonTest, verifyAnimationsForRenderSurfaceHierarchy)
addAnimatedTransformToController(*grandChildOfRoot->layerAnimationController(), 10, 30, 0);
addAnimatedTransformToController(*grandChildOfRS2->layerAnimationController(), 10, 30, 0);
- setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
- setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, FloatPoint(0.25, 0), FloatPoint(2.5, 0), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(parent.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(childOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRoot.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS1.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
+ setLayerPropertiesForTesting(grandChildOfRS2.get(), layerTransform, sublayerTransform, gfx::PointF(0.25, 0), gfx::PointF(2.5, 0), gfx::Size(10, 10), false);
executeCalculateDrawTransformsAndVisibility(parent.get());
@@ -1729,23 +1729,23 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForIdentityTransform)
{
// Test the calculateVisibleRect() function works correctly for identity transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
- IntRect layerContentRect = IntRect(IntPoint(10, 10), IntSize(30, 30));
- IntRect expected = IntRect(IntPoint(10, 10), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(10, 10), gfx::Size(30, 30));
+ gfx::Rect expected = gfx::Rect(gfx::Point(10, 10), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
- layerContentRect = IntRect(IntPoint(120, 120), IntSize(30, 30));
+ layerContentRect = gfx::Rect(gfx::Point(120, 120), gfx::Size(30, 30));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: Layer is partially overlapping the surface rect.
- layerContentRect = IntRect(IntPoint(80, 80), IntSize(30, 30));
- expected = IntRect(IntPoint(80, 80), IntSize(20, 20));
+ layerContentRect = gfx::Rect(gfx::Point(80, 80), gfx::Size(30, 30));
+ expected = gfx::Rect(gfx::Point(80, 80), gfx::Size(20, 20));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1754,27 +1754,27 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForTranslations)
{
// Test the calculateVisibleRect() function works correctly for scaling transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(10, 10);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(120, 120);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: Layer is partially overlapping the surface rect.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(80, 80);
- expected = IntRect(IntPoint(0, 0), IntSize(20, 20));
+ expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(20, 20));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1784,16 +1784,16 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// Test the calculateVisibleRect() function works correctly for rotations about z-axis (i.e. 2D rotations).
// Remember that calculateVisibleRect() should return the visible rect in the layer's space.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Layer is contained within the surface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(50, 50);
layerToSurfaceTransform.rotate(45);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Layer is outside the surface rect.
@@ -1801,7 +1801,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
layerToSurfaceTransform.translate(-50, 0);
layerToSurfaceTransform.rotate(45);
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
- EXPECT_TRUE(actual.isEmpty());
+ EXPECT_TRUE(actual.IsEmpty());
// Case 3: The layer is rotated about its top-left corner. In surface space, the layer
// is oriented diagonally, with the left half outside of the renderSurface. In
@@ -1810,7 +1810,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
// bottom-right corners of the layer are still visible.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.rotate(45);
- expected = IntRect(IntPoint(0, 0), IntSize(30, 30));
+ expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(30, 30));
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
@@ -1822,7 +1822,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor2DRotations)
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(0, -sqrt(2.0) * 15);
layerToSurfaceTransform.rotate(45);
- expected = IntRect(IntPoint(15, 0), IntSize(15, 30)); // right half of layer bounds.
+ expected = gfx::Rect(gfx::Point(15, 0), gfx::Size(15, 30)); // right half of layer bounds.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1831,15 +1831,15 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
{
// Test that the calculateVisibleRect() function works correctly for 3d transforms.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Orthographic projection of a layer rotated about y-axis by 45 degrees, should be fully contained in the renderSurface.
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.rotate3d(0, 45, 0);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: Orthographic projection of a layer rotated about y-axis by 45 degrees, but
@@ -1849,7 +1849,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicTransform)
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.translate(-halfWidthOfRotatedLayer, 0);
layerToSurfaceTransform.rotate3d(0, 45, 0); // rotates about the left edge of the layer
- expected = IntRect(IntPoint(50, 0), IntSize(50, 100)); // right half of the layer.
+ expected = gfx::Rect(gfx::Point(50, 0), gfx::Size(50, 100)); // right half of the layer.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1859,8 +1859,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// Test the calculateVisibleRect() function works correctly when the layer has a
// perspective projection onto the target surface.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-50, -50), IntSize(200, 200));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
WebTransformationMatrix layerToSurfaceTransform;
// Case 1: Even though the layer is twice as large as the surface, due to perspective
@@ -1876,8 +1876,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// This translate places the layer in front of the surface's projection plane.
layerToSurfaceTransform.translate3d(0, 0, -27);
- IntRect expected = IntRect(IntPoint(-50, -50), IntSize(200, 200));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(-50, -50), gfx::Size(200, 200));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
// Case 2: same projection as before, except that the layer is also translated to the
@@ -1889,7 +1889,7 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveTransform)
// visible), then we would need to translate by (-36 / 9) * -50 == -200 in the layer's units.
//
layerToSurfaceTransform.translate3d(-200, 0, 0);
- expected = IntRect(IntPoint(50, -50), IntSize(100, 200)); // The right half of the layer's bounding rect.
+ expected = gfx::Rect(gfx::Point(50, -50), gfx::Size(100, 200)); // The right half of the layer's bounding rect.
actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1901,8 +1901,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
// behind the surface in an orthographic world should not be clipped when they are
// flattened to the surface.
- IntRect targetSurfaceRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(0, 0), IntSize(100, 100));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
WebTransformationMatrix layerToSurfaceTransform;
// This sequence of transforms effectively rotates the layer about the y-axis at the
@@ -1912,8 +1912,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dOrthographicIsNotClippedBehi
layerToSurfaceTransform.rotate3d(0, 45, 0);
layerToSurfaceTransform.translate(-50, 0);
- IntRect expected = IntRect(IntPoint(0, 0), IntSize(100, 100));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(0, 0), gfx::Size(100, 100));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1925,8 +1925,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
// but actually they are not. The visibleRect needs to be properly clipped by the
// w = 0 plane in homogeneous coordinates before converting to cartesian coordinates.
- IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-10, -1), IntSize(20, 2));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -1), gfx::Size(20, 2));
WebTransformationMatrix layerToSurfaceTransform;
// The layer is positioned so that the right half of the layer should be in front of
@@ -1941,12 +1941,12 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectFor3dPerspectiveWhenClippedByW)
// Sanity check that this transform does indeed cause w < 0 when applying the
// transform, otherwise this code is not testing the intended scenario.
bool clipped = false;
- MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(FloatRect(layerContentRect)), clipped);
+ MathUtil::mapQuad(layerToSurfaceTransform, FloatQuad(gfx::RectF(layerContentRect)), clipped);
ASSERT_TRUE(clipped);
int expectedXPosition = 0;
int expectedWidth = 10;
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_EQ(expectedXPosition, actual.x());
EXPECT_EQ(expectedWidth, actual.width());
}
@@ -1959,8 +1959,8 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// Un-projecting this new rect may require clipping again.
// This sequence of transforms causes one corner of the layer to protrude across the w = 0 plane, and should be clipped.
- IntRect targetSurfaceRect = IntRect(IntPoint(-50, -50), IntSize(100, 100));
- IntRect layerContentRect = IntRect(IntPoint(-10, -10), IntSize(20, 20));
+ gfx::Rect targetSurfaceRect = gfx::Rect(gfx::Point(-50, -50), gfx::Size(100, 100));
+ gfx::Rect layerContentRect = gfx::Rect(gfx::Point(-10, -10), gfx::Size(20, 20));
WebTransformationMatrix layerToSurfaceTransform;
layerToSurfaceTransform.makeIdentity();
layerToSurfaceTransform.applyPerspective(1);
@@ -1971,15 +1971,15 @@ TEST(LayerTreeHostCommonTest, verifyVisibleRectForPerspectiveUnprojection)
// Sanity check that un-projection does indeed cause w < 0, otherwise this code is not
// testing the intended scenario.
bool clipped = false;
- FloatRect clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
+ gfx::RectF clippedRect = MathUtil::mapClippedRect(layerToSurfaceTransform, layerContentRect);
MathUtil::projectQuad(layerToSurfaceTransform.inverse(), FloatQuad(clippedRect), clipped);
ASSERT_TRUE(clipped);
// Only the corner of the layer is not visible on the surface because of being
// clipped. But, the net result of rounding visible region to an axis-aligned rect is
// that the entire layer should still be considered visible.
- IntRect expected = IntRect(IntPoint(-10, -10), IntSize(20, 20));
- IntRect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
+ gfx::Rect expected = gfx::Rect(gfx::Point(-10, -10), gfx::Size(20, 20));
+ gfx::Rect actual = LayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerContentRect, layerToSurfaceTransform);
EXPECT_RECT_EQ(expected, actual);
}
@@ -1994,28 +1994,28 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSimpleLayer
root->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
executeCalculateDrawTransformsAndVisibility(root.get());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
// layer visibleContentRects are clipped by their targetSurface
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect());
- EXPECT_TRUE(child3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect());
+ EXPECT_TRUE(child3->visibleContentRect().IsEmpty());
// layer drawableContentRects are not clipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClippedByLayer)
@@ -2031,33 +2031,33 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersClipp
child->addChild(grandChild3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(grandChild2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(grandChild3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
child->setMasksToBounds(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_FALSE(child->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), child->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), child->visibleContentRect());
// All grandchild visibleContentRects should be clipped by child.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), grandChild1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), grandChild2->visibleContentRect());
- EXPECT_TRUE(grandChild3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), grandChild1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), grandChild2->visibleContentRect());
+ EXPECT_TRUE(grandChild3->visibleContentRect().IsEmpty());
// All grandchild drawableContentRects should also be clipped by child.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), grandChild1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 25, 25), grandChild2->drawableContentRect());
- EXPECT_TRUE(grandChild3->drawableContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), grandChild1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 25, 25), grandChild2->drawableContentRect());
+ EXPECT_TRUE(grandChild3->drawableContentRect().IsEmpty());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnclippedRenderSurface)
@@ -2073,35 +2073,35 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInUnc
renderSurface1->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
renderSurface1->setForceRenderSurface(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// An unclipped surface grows its drawableContentRect to include all drawable regions of the subtree.
- EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 170, 170), renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the unclipped surface are also unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInClippedRenderSurface)
@@ -2117,11 +2117,11 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInCli
renderSurface1->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2129,26 +2129,26 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForLayersInCli
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// A clipped surface grows its drawableContentRect to include all drawable regions of the subtree,
// but also gets clamped by the ancestor's clip.
- EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the surface have their visibleContentRect clipped by the surface clipRect.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), child2->visibleContentRect());
- EXPECT_TRUE(child3->visibleContentRect().isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), child2->visibleContentRect());
+ EXPECT_TRUE(child3->visibleContentRect().IsEmpty());
// But the drawableContentRects are unclipped.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHierarchy)
@@ -2167,12 +2167,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHier
renderSurface2->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(7, 13), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(7, 13), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2182,32 +2182,32 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsForSurfaceHier
ASSERT_TRUE(renderSurface1->renderSurface());
ASSERT_TRUE(renderSurface2->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface2->visibleContentRect());
// A clipped surface grows its drawableContentRect to include all drawable regions of the subtree,
// but also gets clamped by the ancestor's clip.
- EXPECT_RECT_EQ(IntRect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 95, 95), renderSurface1->renderSurface()->drawableContentRect());
// renderSurface1 lives in the "unclipped universe" of renderSurface1, and is only
// implicitly clipped by renderSurface1's contentRect. So, renderSurface2 grows to
// enclose all drawable content of its subtree.
- EXPECT_RECT_EQ(IntRect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 170, 170), renderSurface2->renderSurface()->drawableContentRect());
// All layers that draw content into renderSurface2 think they are unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child3->visibleContentRect());
// drawableContentRects are also unclipped.
- EXPECT_RECT_EQ(IntRect(5, 5, 50, 50), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(75, 75, 50, 50), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(125, 125, 50, 50), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(5, 5, 50, 50), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(75, 75, 50, 50), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(125, 125, 50, 50), child3->drawableContentRect());
}
TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformOnUnclippedSurface)
@@ -2224,29 +2224,29 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childRotation;
childRotation.rotate(45);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
renderSurface1->setForceRenderSurface(true);
executeCalculateDrawTransformsAndVisibility(root.get());
ASSERT_TRUE(renderSurface1->renderSurface());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), root->drawableContentRect());
// Layers that do not draw content should have empty visibleContentRects.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), renderSurface1->visibleContentRect());
// The unclipped surface grows its drawableContentRect to include all drawable regions of the subtree.
int diagonalRadius = ceil(sqrt(2.0) * 25);
- IntRect expectedSurfaceDrawableContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
+ gfx::Rect expectedSurfaceDrawableContent = gfx::Rect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect());
// All layers that draw content into the unclipped surface are also unclipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), child1->visibleContentRect());
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, child1->drawableContentRect());
}
@@ -2264,9 +2264,9 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
WebTransformationMatrix identityMatrix;
WebTransformationMatrix childRotation;
childRotation.rotate(45);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(50, 50), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(3, 4), false);
- setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, FloatPoint(0.5, 0.5), FloatPoint(25, 25), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(child1.get(), childRotation, identityMatrix, gfx::PointF(0.5, 0.5), gfx::PointF(25, 25), gfx::Size(50, 50), false);
root->setMasksToBounds(true);
renderSurface1->setForceRenderSurface(true);
@@ -2276,14 +2276,14 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsWithTransformO
// The clipped surface clamps the drawableContentRect that encloses the rotated layer.
int diagonalRadius = ceil(sqrt(2.0) * 25);
- IntRect unclippedSurfaceContent = IntRect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
- IntRect expectedSurfaceDrawableContent = intersection(unclippedSurfaceContent, IntRect(0, 0, 50, 50));
+ gfx::Rect unclippedSurfaceContent = gfx::Rect(50 - diagonalRadius, 50 - diagonalRadius, diagonalRadius * 2, diagonalRadius * 2);
+ gfx::Rect expectedSurfaceDrawableContent = gfx::IntersectRects(unclippedSurfaceContent, gfx::Rect(0, 0, 50, 50));
EXPECT_RECT_EQ(expectedSurfaceDrawableContent, renderSurface1->renderSurface()->drawableContentRect());
// On the clipped surface, only a quarter of the child1 is visible, but when rotating
// it back to child1's content space, the actual enclosing rect ends up covering the
// full left half of child1.
- EXPECT_RECT_EQ(IntRect(0, 0, 26, 50), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 26, 50), child1->visibleContentRect());
// The child's drawableContentRect is unclipped.
EXPECT_RECT_EQ(unclippedSurfaceContent, child1->drawableContentRect());
@@ -2306,12 +2306,12 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
renderSurface2->addChild(child3);
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(3, 4), false);
- setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(7, 13), false);
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(5, 5), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(75, 75), IntSize(50, 50), false);
- setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(125, 125), IntSize(50, 50), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(renderSurface1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(3, 4), false);
+ setLayerPropertiesForTesting(renderSurface2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(7, 13), false);
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(5, 5), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(75, 75), gfx::Size(50, 50), false);
+ setLayerPropertiesForTesting(child3.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(125, 125), gfx::Size(50, 50), false);
const double deviceScaleFactor = 2;
root->setContentsScale(deviceScaleFactor);
@@ -2330,28 +2330,28 @@ TEST(LayerTreeHostCommonTest, verifyDrawableAndVisibleContentRectsInHighDPI)
ASSERT_TRUE(renderSurface2->renderSurface());
// DrawableContentRects for all layers and surfaces are scaled by deviceScaleFactor.
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), root->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(10, 10, 190, 190), renderSurface1->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), root->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 190, 190), renderSurface1->renderSurface()->drawableContentRect());
// renderSurface2 lives in the "unclipped universe" of renderSurface1, and
// is only implicitly clipped by renderSurface1.
- EXPECT_RECT_EQ(IntRect(10, 10, 350, 350), renderSurface2->renderSurface()->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 350, 350), renderSurface2->renderSurface()->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(10, 10, 100, 100), child1->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(150, 150, 100, 100), child2->drawableContentRect());
- EXPECT_RECT_EQ(IntRect(250, 250, 100, 100), child3->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(10, 10, 100, 100), child1->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(150, 150, 100, 100), child2->drawableContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(250, 250, 100, 100), child3->drawableContentRect());
// The root layer does not actually draw content of its own.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), root->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), root->visibleContentRect());
// All layer visibleContentRects are expressed in content space of each
// layer, so they are also scaled by the deviceScaleFactor.
- EXPECT_RECT_EQ(IntRect(0, 0, 6, 8), renderSurface1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 14, 26), renderSurface2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child1->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child2->visibleContentRect());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), child3->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 6, 8), renderSurface1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 14, 26), renderSurface2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child1->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child2->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), child3->visibleContentRect());
}
TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
@@ -2401,15 +2401,15 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithoutPreserves3d)
// Nothing preserves 3d. According to current W3C CSS Transforms spec, these layers
// should blindly use their own local transforms to determine back-face culling.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2500,15 +2500,15 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3d)
// should use the transform with respect to that context. This 3d rendering context
// occurs when (a) parent's transform style is flat and (b) the layer's transform
// style is preserve-3d.
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // parent transform style is flat.
- setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d.
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // surface transform style is preserve-3d.
- setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // parent transform style is flat.
+ setLayerPropertiesForTesting(frontFacingChild.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // surface transform style is preserve-3d.
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // surface transform style is preserve-3d.
+ setLayerPropertiesForTesting(frontFacingChildOfFrontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfFrontFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(frontFacingChildOfBackFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(backFacingChildOfBackFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2583,12 +2583,12 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
// This is just an animating layer, not a surface.
addAnimatedTransformToController(*animatingChild->layerAnimationController(), 10, 30, 0);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(animatingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(childOfAnimatingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(animatingChild.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2615,13 +2615,13 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms)
EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id());
- EXPECT_FALSE(child2->visibleContentRect().isEmpty());
+ EXPECT_FALSE(child2->visibleContentRect().IsEmpty());
// The animating layers should have a visibleContentRect that represents the area of the front face that is within the viewport.
- EXPECT_EQ(animatingChild->visibleContentRect(), IntRect(IntPoint(), animatingChild->contentBounds()));
- EXPECT_EQ(animatingSurface->visibleContentRect(), IntRect(IntPoint(), animatingSurface->contentBounds()));
+ EXPECT_EQ(animatingChild->visibleContentRect(), gfx::Rect(gfx::Point(), animatingChild->contentBounds()));
+ EXPECT_EQ(animatingSurface->visibleContentRect(), gfx::Rect(gfx::Point(), animatingSurface->contentBounds()));
// And layers in the subtree of the animating layer should have valid visibleContentRects also.
- EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds()));
+ EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), gfx::Rect(gfx::Point(), childOfAnimatingSurface->contentBounds()));
}
TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface)
@@ -2650,11 +2650,11 @@ TEST(LayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningS
backfaceMatrix.rotate3d(0, 1, 0, 180);
backfaceMatrix.translate(-50, -50);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); // parent transform style is preserve3d.
- setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // surface transform style is flat.
- setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false); // surface transform style is flat.
- setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
- setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true); // parent transform style is preserve3d.
+ setLayerPropertiesForTesting(frontFacingSurface.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // surface transform style is flat.
+ setLayerPropertiesForTesting(backFacingSurface.get(), backfaceMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false); // surface transform style is flat.
+ setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
+ setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), false);
std::vector<scoped_refptr<Layer> > renderSurfaceLayerList;
int dummyMaxTextureSize = 512;
@@ -2688,11 +2688,11 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForEmptyLayerList)
std::vector<LayerImpl*> renderSurfaceLayerList;
- IntPoint testPoint(0, 0);
+ gfx::Point testPoint(0, 0);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 20);
+ testPoint = gfx::Point(10, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
}
@@ -2704,9 +2704,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2719,21 +2719,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayer)
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(101, 101);
+ gfx::Point testPoint(101, 101);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(-1, -1);
+ testPoint = gfx::Point(-1, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(1, 1);
+ testPoint = gfx::Point(1, 1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2753,9 +2753,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
ASSERT_FALSE(uninvertibleTransform.isInvertible());
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), uninvertibleTransform, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2771,31 +2771,31 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForUninvertibleTransform)
// Hit testing any point should not hit the layer. If the invertible matrix is
// accidentally ignored and treated like an identity, then the hit testing will
// incorrectly hit the layer when it shouldn't.
- IntPoint testPoint(1, 1);
+ gfx::Point testPoint(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 10);
+ testPoint = gfx::Point(10, 10);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(10, 30);
+ testPoint = gfx::Point(10, 30);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(50, 50);
+ testPoint = gfx::Point(50, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(67, 48);
+ testPoint = gfx::Point(67, 48);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(-1, -1);
+ testPoint = gfx::Point(-1, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
}
@@ -2807,9 +2807,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(12345);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(50, 50); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2822,22 +2822,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePositionedLayer)
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(49, 49);
+ gfx::Point testPoint(49, 49);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Even though the layer exists at (101, 101), it should not be visible there since the root renderSurface would clamp it.
- testPoint = IntPoint(101, 101);
+ testPoint = gfx::Point(101, 101);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(99, 99);
+ testPoint = gfx::Point(99, 99);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2854,9 +2854,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
rotation45DegreesAboutCenter.translate(50, 50);
rotation45DegreesAboutCenter.rotate3d(0, 0, 45);
rotation45DegreesAboutCenter.translate(-50, -50);
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), rotation45DegreesAboutCenter, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2870,26 +2870,26 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleRotatedLayer)
// Hit testing for points outside the layer.
// These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
- IntPoint testPoint(99, 99);
+ gfx::Point testPoint(99, 99);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(1, 1);
+ testPoint = gfx::Point(1, 1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(1, 50);
+ testPoint = gfx::Point(1, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
// Hit testing the corners that would overlap the unclipped layer, but are outside the clipped region.
- testPoint = IntPoint(50, -1);
+ testPoint = gfx::Point(50, -1);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_FALSE(resultLayer);
- testPoint = IntPoint(-1, 50);
+ testPoint = gfx::Point(-1, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_FALSE(resultLayer);
}
@@ -2910,9 +2910,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
WebTransformationMatrix translationByZ;
translationByZ.translate3d(0, 0, -1);
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), perspectiveProjectionAboutCenter * translationByZ, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -2926,21 +2926,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer)
// Hit testing for points outside the layer.
// These corners would have been inside the un-transformed layer, but they should not hit the correctly transformed layer.
- IntPoint testPoint(24, 24);
+ gfx::Point testPoint(24, 24);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the root layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -2963,18 +2963,18 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
- FloatPoint position(25, 25);
- IntSize bounds(50, 50);
+ gfx::PointF position(25, 25);
+ gfx::Size bounds(50, 50);
scoped_ptr<LayerImpl> testLayer = LayerImpl::create(12345);
setLayerPropertiesForTesting(testLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// override contentBounds and contentsScale
- testLayer->setContentBounds(IntSize(100, 100));
+ testLayer->setContentBounds(gfx::Size(100, 100));
testLayer->setContentsScale(2, 2);
testLayer->setDrawsContent(true);
@@ -2988,30 +2988,30 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents)
// Sanity check the scenario we just created.
// The visibleContentRect for testLayer is actually 100x100, even though its layout size is 50x50, positioned at 25x25.
LayerImpl* testLayer = root->children()[0];
- EXPECT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), testLayer->visibleContentRect());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), gfx::Size(100, 100)), testLayer->visibleContentRect());
ASSERT_EQ(1u, renderSurfaceLayerList.size());
ASSERT_EQ(1u, root->renderSurface()->layerList().size());
// Hit testing for a point outside the layer should return a null pointer (the root layer does not draw content, so it will not be hit tested either).
- IntPoint testPoint(101, 101);
+ gfx::Point testPoint(101, 101);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(24, 24);
+ testPoint = gfx::Point(24, 24);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the test layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(12345, resultLayer->id());
@@ -3024,21 +3024,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
DebugScopedSetImplThread thisScopeIsOnImplThread;
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
scoped_ptr<LayerImpl> clippingLayer = LayerImpl::create(123);
- FloatPoint position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(50, 50);
+ gfx::PointF position(25, 25); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(clippingLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
clippingLayer->setMasksToBounds(true);
scoped_ptr<LayerImpl> child = LayerImpl::create(456);
- position = FloatPoint(-50, -50);
- bounds = IntSize(300, 300);
+ position = gfx::PointF(-50, -50);
+ bounds = gfx::Size(300, 300);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
clippingLayer->addChild(child.Pass());
@@ -3056,22 +3056,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForSimpleClippedLayer)
// Hit testing for a point outside the layer should return a null pointer.
// Despite the child layer being very large, it should be clipped to the root layer's bounds.
- IntPoint testPoint(24, 24);
+ gfx::Point testPoint(24, 24);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Even though the layer exists at (101, 101), it should not be visible there since the clippingLayer would clamp it.
- testPoint = IntPoint(76, 76);
+ testPoint = gfx::Point(76, 76);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the child layer.
- testPoint = IntPoint(26, 26);
+ testPoint = gfx::Point(26, 26);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
- testPoint = IntPoint(74, 74);
+ testPoint = gfx::Point(74, 74);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
@@ -3094,9 +3094,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
scoped_ptr<LayerImpl> root = LayerImpl::create(123);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setMasksToBounds(true);
@@ -3105,16 +3105,16 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(789);
scoped_ptr<LayerImpl> rotatedLeaf = LayerImpl::create(2468);
- position = FloatPoint(10, 10);
- bounds = IntSize(80, 80);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(80, 80);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setMasksToBounds(true);
WebTransformationMatrix rotation45DegreesAboutCorner;
rotation45DegreesAboutCorner.rotate3d(0, 0, 45);
- position = FloatPoint(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
- bounds = IntSize(200, 200); // to ensure it covers at least sqrt(2) * 100.
+ position = gfx::PointF(0, 0); // remember, positioned with respect to its parent which is already at 10, 10
+ bounds = gfx::Size(200, 200); // to ensure it covers at least sqrt(2) * 100.
setLayerPropertiesForTesting(grandChild.get(), rotation45DegreesAboutCorner, identityMatrix, anchor, position, bounds, false);
grandChild->setMasksToBounds(true);
@@ -3125,8 +3125,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
rotatedLeafTransform.translate(50, 50);
rotatedLeafTransform.rotate3d(0, 0, 45);
rotatedLeafTransform.translate(-50, -50);
- position = FloatPoint(0, 0);
- bounds = IntSize(100, 100);
+ position = gfx::PointF(0, 0);
+ bounds = gfx::Size(100, 100);
setLayerPropertiesForTesting(rotatedLeaf.get(), rotatedLeafTransform, identityMatrix, anchor, position, bounds, false);
rotatedLeaf->setDrawsContent(true);
@@ -3148,12 +3148,12 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
ASSERT_EQ(2468, renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id());
// (11, 89) is close to the the bottom left corner within the clip, but it is not inside the layer.
- IntPoint testPoint(11, 89);
+ gfx::Point testPoint(11, 89);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Closer inwards from the bottom left will overlap the layer.
- testPoint = IntPoint(25, 75);
+ testPoint = gfx::Point(25, 75);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
@@ -3162,24 +3162,24 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer)
// clipped away by the grandParent and should not get hit. If hit testing blindly uses
// visibleContentRect without considering how parent may clip the layer, then hit
// testing would accidentally think that the point successfully hits the layer.
- testPoint = IntPoint(4, 50);
+ testPoint = gfx::Point(4, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// (11, 50) is inside the layer and within the clipped area.
- testPoint = IntPoint(11, 50);
+ testPoint = gfx::Point(11, 50);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
// Around the middle, just to the right and up, would have hit the layer except that
// that area should be clipped away by the parent.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Around the middle, just to the left and down, should successfully hit the layer.
- testPoint = IntPoint(49, 51);
+ testPoint = gfx::Point(49, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2468, resultLayer->id());
@@ -3192,15 +3192,15 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
DebugScopedSetImplThread thisScopeIsOnImplThread;
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
+ gfx::PointF anchor(0, 0);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, FloatPoint(0, 0), IntSize(100, 100), false);
+ setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, gfx::PointF(0, 0), gfx::Size(100, 100), false);
{
scoped_ptr<LayerImpl> intermediateLayer = LayerImpl::create(123);
- FloatPoint position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
- IntSize bounds(50, 50);
+ gfx::PointF position(10, 10); // this layer is positioned, and hit testing should correctly know where the layer is located.
+ gfx::Size bounds(50, 50);
setLayerPropertiesForTesting(intermediateLayer.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
// Sanity check the intermediate layer should not clip.
ASSERT_FALSE(intermediateLayer->masksToBounds());
@@ -3209,8 +3209,8 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
// The child of the intermediateLayer is translated so that it does not overlap intermediateLayer at all.
// If child is incorrectly clipped, we would not be able to hit it successfully.
scoped_ptr<LayerImpl> child = LayerImpl::create(456);
- position = FloatPoint(60, 60); // 70, 70 in screen space
- bounds = IntSize(20, 20);
+ position = gfx::PointF(60, 60); // 70, 70 in screen space
+ bounds = gfx::Size(20, 20);
setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child->setDrawsContent(true);
intermediateLayer->addChild(child.Pass());
@@ -3227,21 +3227,21 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForNonClippingIntermediateLayer)
ASSERT_EQ(456, root->renderSurface()->layerList()[0]->id());
// Hit testing for a point outside the layer should return a null pointer.
- IntPoint testPoint(69, 69);
+ gfx::Point testPoint(69, 69);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
- testPoint = IntPoint(91, 91);
+ testPoint = gfx::Point(91, 91);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
EXPECT_FALSE(resultLayer);
// Hit testing for a point inside should return the child layer.
- testPoint = IntPoint(71, 71);
+ testPoint = gfx::Point(71, 71);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
- testPoint = IntPoint(89, 89);
+ testPoint = gfx::Point(89, 89);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(456, resultLayer->id());
@@ -3255,9 +3255,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -3271,20 +3271,20 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
- position = FloatPoint(10, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child1->setDrawsContent(true);
- position = FloatPoint(50, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(50, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child2->setDrawsContent(true);
// Remember that grandChild is positioned with respect to its parent (i.e. child1).
// In screen space, the intended position is (10, 50), with size 100 x 50.
- position = FloatPoint(0, 40);
- bounds = IntSize(100, 50);
+ position = gfx::PointF(0, 40);
+ bounds = gfx::Size(100, 50);
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
grandChild1->setDrawsContent(true);
@@ -3313,37 +3313,37 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayers)
ASSERT_EQ(3, root->renderSurface()->layerList()[3]->id()); // child2
// Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
- IntPoint testPoint = IntPoint(1, 1);
+ gfx::Point testPoint = gfx::Point(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(1, resultLayer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
- testPoint = IntPoint(15, 15);
+ testPoint = gfx::Point(15, 15);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2, resultLayer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
- testPoint = IntPoint(51, 20);
+ testPoint = gfx::Point(51, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
- testPoint = IntPoint(80, 51);
+ testPoint = gfx::Point(80, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
- testPoint = IntPoint(20, 51);
+ testPoint = gfx::Point(20, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(4, resultLayer->id());
@@ -3360,9 +3360,9 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
WebTransformationMatrix identityMatrix;
- FloatPoint anchor(0, 0);
- FloatPoint position(0, 0);
- IntSize bounds(100, 100);
+ gfx::PointF anchor(0, 0);
+ gfx::PointF position(0, 0);
+ gfx::Size bounds(100, 100);
setLayerPropertiesForTesting(root.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
root->setDrawsContent(true);
@@ -3376,22 +3376,22 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
scoped_ptr<LayerImpl> child2 = LayerImpl::create(3);
scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4);
- position = FloatPoint(10, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(10, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child1->setDrawsContent(true);
child1->setForceRenderSurface(true);
- position = FloatPoint(50, 10);
- bounds = IntSize(50, 50);
+ position = gfx::PointF(50, 10);
+ bounds = gfx::Size(50, 50);
setLayerPropertiesForTesting(child2.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
child2->setDrawsContent(true);
child2->setForceRenderSurface(true);
// Remember that grandChild is positioned with respect to its parent (i.e. child1).
// In screen space, the intended position is (10, 50), with size 100 x 50.
- position = FloatPoint(0, 40);
- bounds = IntSize(100, 50);
+ position = gfx::PointF(0, 40);
+ bounds = gfx::Size(100, 50);
setLayerPropertiesForTesting(grandChild1.get(), identityMatrix, identityMatrix, anchor, position, bounds, false);
grandChild1->setDrawsContent(true);
grandChild1->setForceRenderSurface(true);
@@ -3427,37 +3427,37 @@ TEST(LayerTreeHostCommonTest, verifyHitTestingForMultipleLayerLists)
ASSERT_EQ(3, renderSurfaceLayerList[3]->id()); // child2
// Nothing overlaps the rootLayer at (1, 1), so hit testing there should find the root layer.
- IntPoint testPoint = IntPoint(1, 1);
+ gfx::Point testPoint = gfx::Point(1, 1);
LayerImpl* resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(1, resultLayer->id());
// At (15, 15), child1 and root are the only layers. child1 is expected to be on top.
- testPoint = IntPoint(15, 15);
+ testPoint = gfx::Point(15, 15);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(2, resultLayer->id());
// At (51, 20), child1 and child2 overlap. child2 is expected to be on top.
- testPoint = IntPoint(51, 20);
+ testPoint = gfx::Point(51, 20);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (80, 51), child2 and grandChild1 overlap. child2 is expected to be on top.
- testPoint = IntPoint(80, 51);
+ testPoint = gfx::Point(80, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (51, 51), all layers overlap each other. child2 is expected to be on top of all other layers.
- testPoint = IntPoint(51, 51);
+ testPoint = gfx::Point(51, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(3, resultLayer->id());
// At (20, 51), child1 and grandChild1 overlap. grandChild1 is expected to be on top.
- testPoint = IntPoint(20, 51);
+ testPoint = gfx::Point(20, 51);
resultLayer = LayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList);
ASSERT_TRUE(resultLayer);
EXPECT_EQ(4, resultLayer->id());
@@ -3468,7 +3468,7 @@ class NoScaleContentLayer : public ContentLayer
public:
static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); }
- virtual IntSize contentBounds() const OVERRIDE { return bounds(); }
+ virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); }
virtual float contentsScaleX() const OVERRIDE { return 1.0; }
virtual float contentsScaleY() const OVERRIDE { return 1.0; }
@@ -3491,13 +3491,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
parent->addChild(child);
parent->addChild(childNoScale);
@@ -3522,13 +3522,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
// Verify results of transformed parent rects
- FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds()));
+ gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBounds()));
- FloatRect parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
- FloatRect parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
+ gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
+ gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
- FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds());
- expectedParentDrawRect.scale(deviceScaleFactor);
+ gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds());
+ expectedParentDrawRect.Scale(deviceScaleFactor);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
@@ -3539,14 +3539,14 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPI)
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
// Verify results of transformed child rects
- FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds()));
+ gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds()));
- FloatRect childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
- FloatRect childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
+ gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
+ gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
- FloatRect expectedChildDrawRect(FloatPoint(), child->bounds());
- expectedChildDrawRect.move(child->position().x(), child->position().y());
- expectedChildDrawRect.scale(deviceScaleFactor);
+ gfx::RectF expectedChildDrawRect(gfx::PointF(), child->bounds());
+ expectedChildDrawRect.Offset(child->position().x(), child->position().y());
+ expectedChildDrawRect.Scale(deviceScaleFactor);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
@@ -3566,13 +3566,13 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(133, 133), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(133, 133), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 13), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 13), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 13), true);
+ setLayerPropertiesForTesting(childNoScale.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 13), true);
parent->addChild(child);
parent->addChild(childNoScale);
@@ -3597,15 +3597,15 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedParentTransform, parent->drawTransform());
// Verify results of transformed parent rects
- FloatRect parentContentBounds(FloatPoint(), FloatSize(parent->contentBounds()));
+ gfx::RectF parentContentBounds(gfx::PointF(), gfx::SizeF(parent->contentBounds()));
- FloatRect parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
- FloatRect parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
+ gfx::RectF parentDrawRect = MathUtil::mapClippedRect(parent->drawTransform(), parentContentBounds);
+ gfx::RectF parentScreenSpaceRect = MathUtil::mapClippedRect(parent->screenSpaceTransform(), parentContentBounds);
- FloatRect expectedParentDrawRect(FloatPoint(), parent->bounds());
- expectedParentDrawRect.scale(deviceScaleFactor);
- expectedParentDrawRect.setWidth(ceil(expectedParentDrawRect.width()));
- expectedParentDrawRect.setHeight(ceil(expectedParentDrawRect.height()));
+ gfx::RectF expectedParentDrawRect(gfx::PointF(), parent->bounds());
+ expectedParentDrawRect.Scale(deviceScaleFactor);
+ expectedParentDrawRect.set_width(ceil(expectedParentDrawRect.width()));
+ expectedParentDrawRect.set_height(ceil(expectedParentDrawRect.height()));
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedParentDrawRect, parentScreenSpaceRect);
@@ -3615,15 +3615,15 @@ TEST(LayerTreeHostCommonTest, verifyLayerTransformsInHighDPIAccurateScaleZeroChi
EXPECT_TRANSFORMATION_MATRIX_EQ(expectedChildTransform, child->screenSpaceTransform());
// Verify results of transformed child rects
- FloatRect childContentBounds(FloatPoint(), FloatSize(child->contentBounds()));
+ gfx::RectF childContentBounds(gfx::PointF(), gfx::SizeF(child->contentBounds()));
- FloatRect childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
- FloatRect childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
+ gfx::RectF childDrawRect = MathUtil::mapClippedRect(child->drawTransform(), childContentBounds);
+ gfx::RectF childScreenSpaceRect = MathUtil::mapClippedRect(child->screenSpaceTransform(), childContentBounds);
- FloatRect expectedChildDrawRect(FloatPoint(), child->bounds());
- expectedChildDrawRect.scale(deviceScaleFactor);
- expectedChildDrawRect.setWidth(ceil(expectedChildDrawRect.width()));
- expectedChildDrawRect.setHeight(ceil(expectedChildDrawRect.height()));
+ gfx::RectF expectedChildDrawRect(gfx::PointF(), child->bounds());
+ expectedChildDrawRect.Scale(deviceScaleFactor);
+ expectedChildDrawRect.set_width(ceil(expectedChildDrawRect.width()));
+ expectedChildDrawRect.set_height(ceil(expectedChildDrawRect.height()));
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childDrawRect);
EXPECT_FLOAT_RECT_EQ(expectedChildDrawRect, childScreenSpaceRect);
@@ -3652,16 +3652,16 @@ TEST(LayerTreeHostCommonTest, verifyContentsScale)
float fixedRasterScale = 2.5;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> childScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> childNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(12, 12), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> childNoAutoScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(22, 22), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(childNoAutoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true);
childNoAutoScale->setAutomaticallyComputeRasterScale(false);
childNoAutoScale->setRasterScale(fixedRasterScale);
@@ -3747,36 +3747,36 @@ TEST(LayerTreeHostCommonTest, verifyContentsScaleForSurfaces)
float fixedRasterScale = 4;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true);
+ setLayerPropertiesForTesting(parent.get(), parentScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(100, 100), true);
scoped_refptr<ContentLayer> surfaceScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(12, 12), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(12, 12), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceNoScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<ContentLayer> surfaceNoAutoScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(22, 22), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(22, 22), gfx::Size(10, 10), true);
surfaceNoAutoScale->setAutomaticallyComputeRasterScale(false);
surfaceNoAutoScale->setRasterScale(fixedRasterScale);
scoped_refptr<ContentLayer> surfaceNoAutoScaleChildScale = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScaleChildScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScaleChildScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
scoped_refptr<NoScaleContentLayer> surfaceNoAutoScaleChildNoScale = createNoScaleDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(surfaceNoAutoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(surfaceNoAutoScaleChildNoScale.get(), childScaleMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
// FIXME: Remove this when pageScaleFactor is applied in the compositor.
// Page scale should not apply to the parent.
@@ -3882,20 +3882,20 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPI)
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(30, 30), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(30, 30), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
WebTransformationMatrix replicaTransform;
replicaTransform.scaleNonUniform(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(2, 2), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(2, 2), gfx::Size(10, 10), true);
// This layer should end up in the same surface as child, with the same draw
// and screen space transforms.
scoped_refptr<ContentLayer> duplicateChildNonOwner = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 10), true);
+ setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 10), true);
parent->addChild(child);
child->addChild(duplicateChildNonOwner);
@@ -3965,20 +3965,20 @@ TEST(LayerTreeHostCommonTest, verifyRenderSurfaceTransformsInHighDPIAccurateScal
WebTransformationMatrix identityMatrix;
scoped_refptr<ContentLayer> parent = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(33, 31), true);
+ setLayerPropertiesForTesting(parent.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(33, 31), true);
scoped_refptr<ContentLayer> child = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(child.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
WebTransformationMatrix replicaTransform;
replicaTransform.scaleNonUniform(1, -1);
scoped_refptr<ContentLayer> replica = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(replica.get(), replicaTransform, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
// This layer should end up in the same surface as child, with the same draw
// and screen space transforms.
scoped_refptr<ContentLayer> duplicateChildNonOwner = createDrawableContentLayer(&delegate);
- setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(13, 11), true);
+ setLayerPropertiesForTesting(duplicateChildNonOwner.get(), identityMatrix, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(13, 11), true);
parent->addChild(child);
child->addChild(duplicateChildNonOwner);
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index 1add8df..4b1d2c6 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -94,13 +94,13 @@ bool PinchZoomViewport::setPageScaleFactorAndLimits(float pageScaleFactor, float
return true;
}
-FloatRect PinchZoomViewport::bounds() const
+gfx::RectF PinchZoomViewport::bounds() const
{
- FloatSize scaledViewportSize = m_layoutViewportSize;
- scaledViewportSize.scale(1 / totalPageScaleFactor());
+ gfx::SizeF scaledViewportSize = m_layoutViewportSize;
+ scaledViewportSize = scaledViewportSize.Scale(1 / totalPageScaleFactor());
- FloatRect bounds(FloatPoint(0, 0), scaledViewportSize);
- bounds.setLocation(m_pinchViewportScrollDelta);
+ gfx::RectF bounds(gfx::PointF(), scaledViewportSize);
+ bounds.set_origin(m_pinchViewportScrollDelta);
return bounds;
}
@@ -108,7 +108,7 @@ FloatRect PinchZoomViewport::bounds() const
FloatSize PinchZoomViewport::applyScroll(FloatSize& delta)
{
FloatSize overflow;
- FloatRect pinchedBounds = bounds();
+ FloatRect pinchedBounds = cc::FloatRect(bounds());
pinchedBounds.move(delta);
if (pinchedBounds.x() < 0) {
@@ -266,7 +266,7 @@ bool LayerTreeHostImpl::canDraw()
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw no root layer");
return false;
}
- if (deviceViewportSize().isEmpty()) {
+ if (deviceViewportSize().IsEmpty()) {
TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::canDraw empty viewport");
return false;
}
@@ -301,11 +301,11 @@ void LayerTreeHostImpl::startPageScaleAnimation(const IntSize& targetPosition, b
IntSize scrollTotal = flooredIntSize(m_rootScrollLayerImpl->scrollPosition() + m_rootScrollLayerImpl->scrollDelta());
scrollTotal.scale(m_pinchZoomViewport.pageScaleDelta());
float scaleTotal = m_pinchZoomViewport.totalPageScaleFactor();
- IntSize scaledContentSize = contentSize();
+ IntSize scaledContentSize = cc::IntSize(contentSize());
scaledContentSize.scale(m_pinchZoomViewport.pageScaleDelta());
double startTimeSeconds = (startTime - base::TimeTicks()).InSecondsF();
- m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, m_deviceViewportSize, scaledContentSize, startTimeSeconds);
+ m_pageScaleAnimation = PageScaleAnimation::create(scrollTotal, scaleTotal, cc::IntSize(m_deviceViewportSize), scaledContentSize, startTimeSeconds);
if (anchorPoint) {
IntSize windowAnchor(targetPosition);
@@ -411,7 +411,7 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
RenderPass::Id contributingRenderPassId = it->renderSurface()->renderPassId();
RenderPass* contributingRenderPass = frame.renderPassesById.get(contributingRenderPassId);
targetRenderPass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker, appendQuadsData);
- } else if (it.representsItself() && !it->visibleContentRect().isEmpty()) {
+ } else if (it.representsItself() && !it->visibleContentRect().IsEmpty()) {
bool hasOcclusionFromOutsideTargetSurface;
bool implDrawTransformIsUnknown = false;
if (occlusionTracker.occluded(it->renderTarget(), it->visibleContentRect(), it->drawTransform(), implDrawTransformIsUnknown, it->drawableContentRect(), &hasOcclusionFromOutsideTargetSurface))
@@ -509,12 +509,12 @@ void LayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled)
m_timeSourceClientAdapter->setActive(enabled);
}
-IntSize LayerTreeHostImpl::contentSize() const
+gfx::Size LayerTreeHostImpl::contentSize() const
{
// TODO(aelias): Hardcoding the first child here is weird. Think of
// a cleaner way to get the contentBounds on the Impl side.
if (!m_rootScrollLayerImpl || m_rootScrollLayerImpl->children().isEmpty())
- return IntSize();
+ return gfx::Size();
return m_rootScrollLayerImpl->children()[0]->contentBounds();
}
@@ -733,7 +733,7 @@ bool LayerTreeHostImpl::swapBuffers()
return m_renderer->swapBuffers();
}
-const IntSize& LayerTreeHostImpl::deviceViewportSize() const
+const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
{
return m_deviceViewportSize;
}
@@ -753,7 +753,7 @@ void LayerTreeHostImpl::onSwapBuffersComplete()
m_client->onSwapBuffersCompleteOnImplThread();
}
-void LayerTreeHostImpl::readback(void* pixels, const IntRect& rect)
+void LayerTreeHostImpl::readback(void* pixels, const gfx::Rect& rect)
{
DCHECK(m_renderer);
m_renderer->getFramebufferPixels(pixels, rect);
@@ -886,7 +886,7 @@ void LayerTreeHostImpl::resetContentsTexturesPurged()
m_client->onCanDrawStateChanged(canDraw());
}
-void LayerTreeHostImpl::setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize)
+void LayerTreeHostImpl::setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize)
{
if (layoutViewportSize == m_layoutViewportSize && deviceViewportSize == m_deviceViewportSize)
return;
@@ -964,28 +964,28 @@ void LayerTreeHostImpl::updateMaxScrollPosition()
if (!m_rootScrollLayerImpl || !m_rootScrollLayerImpl->children().size())
return;
- FloatSize viewBounds = m_deviceViewportSize;
+ gfx::SizeF viewBounds = m_deviceViewportSize;
if (LayerImpl* clipLayer = m_rootScrollLayerImpl->parent()) {
// Compensate for non-overlay scrollbars.
if (clipLayer->masksToBounds()) {
viewBounds = clipLayer->bounds();
- viewBounds.scale(m_deviceScaleFactor);
+ viewBounds = viewBounds.Scale(m_deviceScaleFactor);
}
}
- IntSize contentBounds = contentSize();
+ gfx::Size contentBounds = contentSize();
if (Settings::pageScalePinchZoomEnabled()) {
// Pinch with pageScale scrolls entirely in layout space. contentSize
// returns the bounds including the page scale factor, so calculate the
// pre page-scale layout size here.
float pageScaleFactor = m_pinchZoomViewport.pageScaleFactor();
- contentBounds.setWidth(contentBounds.width() / pageScaleFactor);
- contentBounds.setHeight(contentBounds.height() / pageScaleFactor);
+ contentBounds.set_width(contentBounds.width() / pageScaleFactor);
+ contentBounds.set_height(contentBounds.height() / pageScaleFactor);
} else {
- viewBounds.scale(1 / m_pinchZoomViewport.pageScaleDelta());
+ viewBounds = viewBounds.Scale(1 / m_pinchZoomViewport.pageScaleDelta());
}
- IntSize maxScroll = contentBounds - expandedIntSize(viewBounds);
+ IntSize maxScroll = cc::IntSize(contentBounds) - expandedIntSize(cc::FloatSize(viewBounds));
maxScroll.scale(1 / m_deviceScaleFactor);
// The viewport may be larger than the contents in some cases, such as
@@ -1092,8 +1092,8 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
// in layer coordinates.
bool startClipped, endClipped;
FloatPoint screenSpaceEndPoint = screenSpacePoint + screenSpaceDelta;
- FloatPoint localStartPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped);
- FloatPoint localEndPoint = MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped);
+ FloatPoint localStartPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpacePoint, startClipped));
+ FloatPoint localEndPoint = cc::FloatPoint(MathUtil::projectPoint(inverseScreenSpaceTransform, screenSpaceEndPoint, endClipped));
// In general scroll point coordinates should not get clipped.
DCHECK(!startClipped);
@@ -1102,8 +1102,8 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
return FloatSize();
// localStartPoint and localEndPoint are in content space but we want to move them to layer space for scrolling.
- float widthScale = 1.0 / layerImpl.contentsScaleX();
- float heightScale = 1.0 / layerImpl.contentsScaleY();
+ float widthScale = 1 / layerImpl.contentsScaleX();
+ float heightScale = 1 / layerImpl.contentsScaleY();
localStartPoint.scale(widthScale, heightScale);
localEndPoint.scale(widthScale, heightScale);
@@ -1116,11 +1116,11 @@ static FloatSize scrollLayerWithViewportSpaceDelta(PinchZoomViewport* viewport,
// Get the end point in the layer's content space so we can apply its screenSpaceTransform.
FloatPoint actualLocalEndPoint = localStartPoint + layerImpl.scrollDelta() - previousDelta;
- FloatPoint actualLocalContentEndPoint = actualLocalEndPoint;
- actualLocalContentEndPoint.scale(1 / widthScale, 1 / heightScale);
+ gfx::PointF actualLocalContentEndPoint = actualLocalEndPoint;
+ actualLocalContentEndPoint = actualLocalContentEndPoint.Scale(1 / widthScale, 1 / heightScale);
// Calculate the applied scroll delta in viewport space coordinates.
- FloatPoint actualScreenSpaceEndPoint = MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped);
+ FloatPoint actualScreenSpaceEndPoint = cc::FloatPoint(MathUtil::mapPoint(layerImpl.screenSpaceTransform(), actualLocalContentEndPoint, endClipped));
DCHECK(!endClipped);
if (endClipped)
return FloatSize();
@@ -1205,7 +1205,7 @@ void LayerTreeHostImpl::pinchGestureBegin()
}
void LayerTreeHostImpl::pinchGestureUpdate(float magnifyDelta,
- const IntPoint& anchor)
+ const IntPoint& anchor)
{
TRACE_EVENT0("cc", "LayerTreeHostImpl::pinchGestureUpdate");
@@ -1278,14 +1278,13 @@ void LayerTreeHostImpl::computePinchZoomDeltas(ScrollAndScaleSet* scrollInfo)
scrollBegin.scale(m_pinchZoomViewport.pageScaleDelta());
float scaleBegin = m_pinchZoomViewport.totalPageScaleFactor();
float pageScaleDeltaToSend = m_pinchZoomViewport.minPageScaleFactor() / m_pinchZoomViewport.pageScaleFactor();
- FloatSize scaledContentsSize = contentSize();
- scaledContentsSize.scale(pageScaleDeltaToSend);
+ gfx::SizeF scaledContentsSize = contentSize().Scale(pageScaleDeltaToSend);
FloatSize anchor = toSize(m_previousPinchAnchor);
FloatSize scrollEnd = scrollBegin + anchor;
scrollEnd.scale(m_pinchZoomViewport.minPageScaleFactor() / scaleBegin);
scrollEnd -= anchor;
- scrollEnd = scrollEnd.shrunkTo(roundedIntSize(scaledContentsSize - m_deviceViewportSize)).expandedTo(FloatSize(0, 0));
+ scrollEnd = scrollEnd.shrunkTo(roundedIntSize(cc::FloatSize(scaledContentsSize) - cc::IntSize(m_deviceViewportSize))).expandedTo(FloatSize(0, 0));
scrollEnd.scale(1 / pageScaleDeltaToSend);
scrollEnd.scale(m_deviceScaleFactor);
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index f26a7b7..783d042 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -75,10 +75,10 @@ public:
float maxPageScaleFactor);
// Returns the bounds and offset of the scaled and translated viewport to use for pinch-zoom.
- FloatRect bounds() const;
+ gfx::RectF bounds() const;
const FloatPoint& scrollDelta() const { return m_pinchViewportScrollDelta; }
- void setLayoutViewportSize(const FloatSize& size) { m_layoutViewportSize = size; }
+ void setLayoutViewportSize(const gfx::SizeF& size) { m_layoutViewportSize = size; }
// Apply the scroll offset in layout space to the offset of the pinch-zoom viewport. The viewport cannot be
// scrolled outside of the layout viewport bounds. Returns the component of the scroll that is un-applied due to
@@ -95,7 +95,7 @@ private:
float m_minPageScaleFactor;
FloatPoint m_pinchViewportScrollDelta;
- FloatSize m_layoutViewportSize;
+ gfx::SizeF m_layoutViewportSize;
};
// LayerTreeHostImpl owns the LayerImpl tree as well as associated rendering state
@@ -147,7 +147,7 @@ public:
void didDrawAllLayers(const FrameData&);
// RendererClient implementation
- virtual const IntSize& deviceViewportSize() const OVERRIDE;
+ virtual const gfx::Size& deviceViewportSize() const OVERRIDE;
virtual const LayerTreeSettings& settings() const OVERRIDE;
virtual void didLoseContext() OVERRIDE;
virtual void onSwapBuffersComplete() OVERRIDE;
@@ -174,7 +174,7 @@ public:
bool swapBuffers();
- void readback(void* pixels, const IntRect&);
+ void readback(void* pixels, const gfx::Rect&);
void setRootLayer(scoped_ptr<LayerImpl>);
LayerImpl* rootLayer() { return m_rootLayerImpl.get(); }
@@ -199,8 +199,8 @@ public:
void resetContentsTexturesPurged();
size_t memoryAllocationLimitBytes() const { return m_managedMemoryPolicy.bytesLimitWhenVisible; }
- void setViewportSize(const IntSize& layoutViewportSize, const IntSize& deviceViewportSize);
- const IntSize& layoutViewportSize() const { return m_layoutViewportSize; }
+ void setViewportSize(const gfx::Size& layoutViewportSize, const gfx::Size& deviceViewportSize);
+ const gfx::Size& layoutViewportSize() const { return m_layoutViewportSize; }
float deviceScaleFactor() const { return m_deviceScaleFactor; }
void setDeviceScaleFactor(float);
@@ -295,7 +295,7 @@ private:
bool calculateRenderPasses(FrameData&);
void animateLayersRecursive(LayerImpl*, base::TimeTicks monotonicTime, base::Time wallClockTime, AnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
void setBackgroundTickingEnabled(bool);
- IntSize contentSize() const;
+ gfx::Size contentSize() const;
void sendDidLoseContextRecursive(LayerImpl*);
void clearRenderSurfaces();
@@ -316,8 +316,8 @@ private:
int m_scrollingLayerIdFromPreviousTree;
bool m_scrollDeltaIsInViewportSpace;
LayerTreeSettings m_settings;
- IntSize m_layoutViewportSize;
- IntSize m_deviceViewportSize;
+ gfx::Size m_layoutViewportSize;
+ gfx::Size m_deviceViewportSize;
float m_deviceScaleFactor;
bool m_visible;
bool m_contentsTexturesPurged;
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index 79bc896..fc4d1dd 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -39,6 +39,7 @@
#include "media/base/video_frame.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/size_conversions.h"
#include <public/WebVideoFrame.h>
#include <public/WebVideoFrameProvider.h>
@@ -74,11 +75,11 @@ public:
{
Settings::setPageScalePinchZoomEnabled(GetParam());
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
m_hostImpl = LayerTreeHostImpl::create(settings, this);
m_hostImpl->initializeRenderer(createContext());
- m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
}
virtual void TearDown()
@@ -102,18 +103,18 @@ public:
Settings::setPartialSwapEnabled(partialSwap);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
myHostImpl->initializeRenderer(graphicsContext.Pass());
- myHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ myHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
- root->setBounds(IntSize(10, 10));
- root->setContentBounds(IntSize(10, 10));
- root->setVisibleContentRect(IntRect(0, 0, 10, 10));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
+ root->setBounds(gfx::Size(10, 10));
+ root->setContentBounds(gfx::Size(10, 10));
+ root->setVisibleContentRect(gfx::Rect(0, 0, 10, 10));
root->setDrawsContent(true);
myHostImpl->setRootLayer(root.Pass());
return myHostImpl.Pass();
@@ -141,28 +142,28 @@ public:
ASSERT_EQ(timesEncountered, 1);
}
- void setupScrollAndContentsLayers(const IntSize& contentSize)
+ void setupScrollAndContentsLayers(const gfx::Size& contentSize)
{
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setScrollable(true);
root->setScrollPosition(IntPoint(0, 0));
- root->setMaxScrollPosition(contentSize);
+ root->setMaxScrollPosition(cc::IntSize(contentSize));
root->setBounds(contentSize);
root->setContentBounds(contentSize);
- root->setPosition(FloatPoint(0, 0));
- root->setAnchorPoint(FloatPoint(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
scoped_ptr<LayerImpl> contents = LayerImpl::create(2);
contents->setDrawsContent(true);
contents->setBounds(contentSize);
contents->setContentBounds(contentSize);
- contents->setPosition(FloatPoint(0, 0));
- contents->setAnchorPoint(FloatPoint(0, 0));
+ contents->setPosition(gfx::PointF(0, 0));
+ contents->setAnchorPoint(gfx::PointF(0, 0));
root->addChild(contents.Pass());
m_hostImpl->setRootLayer(root.Pass());
}
- static scoped_ptr<LayerImpl> createScrollableLayer(int id, const IntSize& size)
+ static scoped_ptr<LayerImpl> createScrollableLayer(int id, const gfx::Size& size)
{
scoped_ptr<LayerImpl> layer = LayerImpl::create(id);
layer->setScrollable(true);
@@ -212,7 +213,7 @@ TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged)
EXPECT_FALSE(m_hostImpl->canDraw());
m_onCanDrawStateChangedCalled = false;
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
EXPECT_TRUE(m_hostImpl->canDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
@@ -223,18 +224,18 @@ TEST_P(LayerTreeHostImplTest, notifyIfCanDrawChanged)
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
EXPECT_TRUE(m_hostImpl->canDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
// Toggle the device viewport size to make sure it toggles canDraw.
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(0, 0));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(0, 0));
EXPECT_FALSE(m_hostImpl->canDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
EXPECT_TRUE(m_hostImpl->canDraw());
EXPECT_TRUE(m_onCanDrawStateChangedCalled);
m_onCanDrawStateChangedCalled = false;
@@ -331,8 +332,8 @@ TEST_P(LayerTreeHostImplTest, scrollDeltaRepeatedScrolls)
TEST_P(LayerTreeHostImplTest, scrollRootCallsCommitAndRedraw)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
@@ -355,9 +356,9 @@ TEST_P(LayerTreeHostImplTest, scrollWithoutRenderer)
// Initialization will fail here.
m_hostImpl->initializeRenderer(FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new FakeWebGraphicsContext3DMakeCurrentFails)).PassAs<GraphicsContext>());
- m_hostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_hostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
// We should not crash when trying to scroll after the renderer initialization fails.
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollIgnored);
@@ -367,15 +368,15 @@ TEST_P(LayerTreeHostImplTest, replaceTreeWhileScrolling)
{
const int scrollLayerId = 1;
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
// We should not crash if the tree is replaced while we are scrolling.
EXPECT_EQ(m_hostImpl->scrollBegin(IntPoint(0, 0), InputHandlerClient::Wheel), InputHandlerClient::ScrollStarted);
m_hostImpl->detachLayerTree();
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
// We should still be scrolling, because the scrolled layer also exists in the new tree.
IntSize scrollDelta(0, 10);
@@ -387,8 +388,8 @@ TEST_P(LayerTreeHostImplTest, replaceTreeWhileScrolling)
TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
// We should be able to scroll even if the root layer loses its render surface after the most
@@ -399,8 +400,8 @@ TEST_P(LayerTreeHostImplTest, clearRootRenderSurfaceAndScroll)
TEST_P(LayerTreeHostImplTest, wheelEventHandlers)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* root = m_hostImpl->rootLayer();
@@ -415,8 +416,8 @@ TEST_P(LayerTreeHostImplTest, wheelEventHandlers)
TEST_P(LayerTreeHostImplTest, shouldScrollOnMainThread)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* root = m_hostImpl->rootLayer();
@@ -428,8 +429,8 @@ TEST_P(LayerTreeHostImplTest, shouldScrollOnMainThread)
TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic)
{
- setupScrollAndContentsLayers(IntSize(200, 200));
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(200, 200));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
initializeRendererAndDrawFrame();
LayerImpl* root = m_hostImpl->rootLayer();
@@ -450,12 +451,12 @@ TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionBasic)
TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
{
- setupScrollAndContentsLayers(IntSize(200, 200));
- m_hostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(200, 200));
+ m_hostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
LayerImpl* root = m_hostImpl->rootLayer();
root->setNonFastScrollableRegion(IntRect(0, 0, 50, 50));
- root->setPosition(FloatPoint(-25, 0));
+ root->setPosition(gfx::PointF(-25, 0));
initializeRendererAndDrawFrame();
// This point would fall into the non-fast scrollable region except that we've moved the layer down by 25 pixels.
@@ -469,12 +470,11 @@ TEST_P(LayerTreeHostImplTest, nonFastScrollableRegionWithOffset)
TEST_P(LayerTreeHostImplTest, maxScrollPositionChangedByDeviceScaleFactor)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
float deviceScaleFactor = 2;
- IntSize layoutViewport(25, 25);
- IntSize deviceViewport(layoutViewport);
- deviceViewport.scale(deviceScaleFactor);
+ gfx::Size layoutViewport(25, 25);
+ gfx::Size deviceViewport(gfx::ToFlooredSize(layoutViewport.Scale(deviceScaleFactor)));
m_hostImpl->setViewportSize(layoutViewport, deviceViewport);
m_hostImpl->setDeviceScaleFactor(deviceScaleFactor);
EXPECT_EQ(m_hostImpl->rootLayer()->maxScrollPosition(), IntSize(25, 25));
@@ -491,8 +491,8 @@ TEST_P(LayerTreeHostImplTest, implPinchZoom)
if (!Settings::pageScalePinchZoomEnabled())
return;
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
@@ -544,8 +544,8 @@ TEST_P(LayerTreeHostImplTest, implPinchZoom)
TEST_P(LayerTreeHostImplTest, pinchGesture)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
@@ -631,8 +631,8 @@ TEST_P(LayerTreeHostImplTest, pinchGesture)
TEST_P(LayerTreeHostImplTest, pageScaleAnimation)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
@@ -683,8 +683,8 @@ TEST_P(LayerTreeHostImplTest, pageScaleAnimation)
TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
@@ -752,8 +752,8 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPageScale)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
- m_hostImpl->setViewportSize(IntSize(50, 50), IntSize(50, 50));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
+ m_hostImpl->setViewportSize(gfx::Size(50, 50), gfx::Size(50, 50));
initializeRendererAndDrawFrame();
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
@@ -826,14 +826,14 @@ protected:
, m_didDrawCalled(false)
, m_willDrawCalled(false)
{
- setAnchorPoint(FloatPoint(0, 0));
- setBounds(IntSize(10, 10));
- setContentBounds(IntSize(10, 10));
+ setAnchorPoint(gfx::PointF(0, 0));
+ setBounds(gfx::Size(10, 10));
+ setContentBounds(gfx::Size(10, 10));
setDrawsContent(true);
setSkipsDraw(false);
- setVisibleContentRect(IntRect(0, 0, 10, 10));
+ setVisibleContentRect(gfx::Rect(0, 0, 10, 10));
- scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::HasBorderTexels);
+ scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::HasBorderTexels);
tiler->setBounds(contentBounds());
setTilingData(*tiler.get());
}
@@ -854,9 +854,9 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
root->addChild(DidDrawCheckLayer::create(2));
DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0]);
// Ensure visibleContentRect for layer is empty
- layer->setPosition(FloatPoint(100, 100));
- layer->setBounds(IntSize(10, 10));
- layer->setContentBounds(IntSize(10, 10));
+ layer->setPosition(gfx::PointF(100, 100));
+ layer->setBounds(gfx::Size(10, 10));
+ layer->setContentBounds(gfx::Size(10, 10));
LayerTreeHostImpl::FrameData frame;
@@ -870,10 +870,10 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_FALSE(layer->willDrawCalled());
EXPECT_FALSE(layer->didDrawCalled());
- EXPECT_TRUE(layer->visibleContentRect().isEmpty());
+ EXPECT_TRUE(layer->visibleContentRect().IsEmpty());
// Ensure visibleContentRect for layer layer is not empty
- layer->setPosition(FloatPoint(0, 0));
+ layer->setPosition(gfx::PointF(0, 0));
EXPECT_FALSE(layer->willDrawCalled());
EXPECT_FALSE(layer->didDrawCalled());
@@ -885,12 +885,12 @@ TEST_P(LayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer)
EXPECT_TRUE(layer->willDrawCalled());
EXPECT_TRUE(layer->didDrawCalled());
- EXPECT_FALSE(layer->visibleContentRect().isEmpty());
+ EXPECT_FALSE(layer->visibleContentRect().IsEmpty());
}
TEST_P(LayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer)
{
- IntSize bigSize(1000, 1000);
+ gfx::Size bigSize(1000, 1000);
m_hostImpl->setViewportSize(bigSize, bigSize);
m_hostImpl->setRootLayer(DidDrawCheckLayer::create(1));
@@ -965,13 +965,13 @@ private:
explicit MissingTextureAnimatingLayer(int id, bool tileMissing, bool skipsDraw, bool animating, ResourceProvider* resourceProvider)
: DidDrawCheckLayer(id)
{
- scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels);
+ scoped_ptr<LayerTilingData> tilingData = LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::NoBorderTexels);
tilingData->setBounds(bounds());
setTilingData(*tilingData.get());
setSkipsDraw(skipsDraw);
if (!tileMissing) {
- ResourceProvider::ResourceId resource = resourceProvider->createResource(Renderer::ContentPool, IntSize(), GL_RGBA, ResourceProvider::TextureUsageAny);
- pushTileProperties(0, 0, resource, IntRect(), false);
+ ResourceProvider::ResourceId resource = resourceProvider->createResource(Renderer::ContentPool, gfx::Size(), GL_RGBA, ResourceProvider::TextureUsageAny);
+ pushTileProperties(0, 0, resource, gfx::Rect(), false);
}
if (animating)
addAnimatedTransformToLayer(*this, 10, 3, 0);
@@ -1036,24 +1036,24 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot)
{
// Test the configuration where a non-composited root layer is embedded in a
// scrollable outer layer.
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> contentLayer = LayerImpl::create(1);
contentLayer->setUseLCDText(true);
contentLayer->setDrawsContent(true);
- contentLayer->setPosition(FloatPoint(0, 0));
- contentLayer->setAnchorPoint(FloatPoint(0, 0));
+ contentLayer->setPosition(gfx::PointF(0, 0));
+ contentLayer->setAnchorPoint(gfx::PointF(0, 0));
contentLayer->setBounds(surfaceSize);
- contentLayer->setContentBounds(IntSize(surfaceSize.width() * 2, surfaceSize.height() * 2));
+ contentLayer->setContentBounds(gfx::Size(surfaceSize.width() * 2, surfaceSize.height() * 2));
contentLayer->setContentsScale(2, 2);
scoped_ptr<LayerImpl> scrollLayer = LayerImpl::create(2);
scrollLayer->setScrollable(true);
- scrollLayer->setMaxScrollPosition(surfaceSize);
+ scrollLayer->setMaxScrollPosition(cc::IntSize(surfaceSize));
scrollLayer->setBounds(surfaceSize);
scrollLayer->setContentBounds(surfaceSize);
- scrollLayer->setPosition(FloatPoint(0, 0));
- scrollLayer->setAnchorPoint(FloatPoint(0, 0));
+ scrollLayer->setPosition(gfx::PointF(0, 0));
+ scrollLayer->setAnchorPoint(gfx::PointF(0, 0));
scrollLayer->addChild(contentLayer.Pass());
m_hostImpl->setRootLayer(scrollLayer.Pass());
@@ -1069,7 +1069,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonCompositedRoot)
TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setBounds(surfaceSize);
root->setContentBounds(surfaceSize);
@@ -1087,7 +1087,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildCallsCommitAndRedraw)
TEST_P(LayerTreeHostImplTest, scrollMissesChild)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->addChild(createScrollableLayer(2, surfaceSize));
m_hostImpl->setRootLayer(root.Pass());
@@ -1102,7 +1102,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesChild)
TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize);
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
@@ -1125,7 +1125,7 @@ TEST_P(LayerTreeHostImplTest, scrollMissesBackfacingChild)
TEST_P(LayerTreeHostImplTest, scrollBlockedByContentLayer)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> contentLayer = createScrollableLayer(1, surfaceSize);
contentLayer->setShouldScrollOnMainThread(true);
contentLayer->setScrollable(false);
@@ -1143,7 +1143,7 @@ TEST_P(LayerTreeHostImplTest, scrollBlockedByContentLayer)
TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
m_hostImpl->setRootLayer(root.Pass());
@@ -1176,7 +1176,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
float pageScale = 2;
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
m_hostImpl->setRootLayer(root.Pass());
@@ -1212,7 +1212,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnImplThread)
TEST_P(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
float defaultPageScale = 1;
WebTransformationMatrix defaultPageScaleMatrix;
@@ -1257,7 +1257,7 @@ TEST_P(LayerTreeHostImplTest, pageScaleDeltaAppliedToRootScrollLayerOnly)
TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
root->setBounds(surfaceSize);
root->setContentBounds(surfaceSize);
@@ -1303,7 +1303,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildBeyondLimit)
// Scroll a child layer beyond its maximum scroll range and make sure the
// parent layer is scrolled on the axis on which the child was unable to
// scroll.
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
scoped_ptr<LayerImpl> grandChild = createScrollableLayer(3, surfaceSize);
@@ -1339,7 +1339,7 @@ TEST_P(LayerTreeHostImplTest, scrollEventBubbling)
{
// When we try to scroll a non-scrollable child layer, the scroll delta
// should be applied to one of its ancestors if possible.
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
scoped_ptr<LayerImpl> root = createScrollableLayer(1, surfaceSize);
scoped_ptr<LayerImpl> child = createScrollableLayer(2, surfaceSize);
@@ -1365,7 +1365,7 @@ TEST_P(LayerTreeHostImplTest, scrollEventBubbling)
TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw)
{
- IntSize surfaceSize(10, 10);
+ gfx::Size surfaceSize(10, 10);
m_hostImpl->setRootLayer(createScrollableLayer(1, surfaceSize));
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
@@ -1380,14 +1380,14 @@ TEST_P(LayerTreeHostImplTest, scrollBeforeRedraw)
TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
// Rotate the root layer 90 degrees counter-clockwise about its center.
WebTransformationMatrix rotateTransform;
rotateTransform.rotate(-90);
m_hostImpl->rootLayer()->setTransform(rotateTransform);
- IntSize surfaceSize(50, 50);
+ gfx::Size surfaceSize(50, 50);
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
@@ -1415,7 +1415,7 @@ TEST_P(LayerTreeHostImplTest, scrollAxisAlignedRotatedLayer)
TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
int childLayerId = 3;
float childLayerAngle = -20;
@@ -1431,7 +1431,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
child->setMaxScrollPosition(IntSize(0, child->contentBounds().height()));
m_hostImpl->rootLayer()->addChild(child.Pass());
- IntSize surfaceSize(50, 50);
+ gfx::Size surfaceSize(50, 50);
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
@@ -1476,7 +1476,7 @@ TEST_P(LayerTreeHostImplTest, scrollNonAxisAlignedRotatedLayer)
TEST_P(LayerTreeHostImplTest, scrollScaledLayer)
{
- setupScrollAndContentsLayers(IntSize(100, 100));
+ setupScrollAndContentsLayers(gfx::Size(100, 100));
// Scale the layer to twice its normal size.
int scale = 2;
@@ -1484,7 +1484,7 @@ TEST_P(LayerTreeHostImplTest, scrollScaledLayer)
scaleTransform.scale(scale);
m_hostImpl->rootLayer()->setTransform(scaleTransform);
- IntSize surfaceSize(50, 50);
+ gfx::Size surfaceSize(50, 50);
m_hostImpl->setViewportSize(surfaceSize, surfaceSize);
initializeRendererAndDrawFrame();
@@ -1540,14 +1540,14 @@ public:
{
m_quadsAppended = true;
- IntRect opaqueRect;
+ gfx::Rect opaqueRect;
if (contentsOpaque())
opaqueRect = m_quadRect;
else
opaqueRect = m_opaqueContentRect;
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
- scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, IntPoint(), IntSize(1, 1), 0, false, false, false, false, false);
+ scoped_ptr<TileDrawQuad> testBlendingDrawQuad = TileDrawQuad::create(sharedQuadState, m_quadRect, opaqueRect, m_resourceId, gfx::Vector2d(), gfx::Size(1, 1), 0, false, false, false, false, false);
testBlendingDrawQuad->setQuadVisibleRect(m_quadVisibleRect);
EXPECT_EQ(m_blend, testBlendingDrawQuad->needsBlending());
EXPECT_EQ(m_hasRenderSurface, !!renderSurface());
@@ -1563,9 +1563,9 @@ public:
bool quadsAppended() const { return m_quadsAppended; }
- void setQuadRect(const IntRect& rect) { m_quadRect = rect; }
- void setQuadVisibleRect(const IntRect& rect) { m_quadVisibleRect = rect; }
- void setOpaqueContentRect(const IntRect& rect) { m_opaqueContentRect = rect; }
+ void setQuadRect(const gfx::Rect& rect) { m_quadRect = rect; }
+ void setQuadVisibleRect(const gfx::Rect& rect) { m_quadVisibleRect = rect; }
+ void setOpaqueContentRect(const gfx::Rect& rect) { m_opaqueContentRect = rect; }
private:
explicit BlendStateCheckLayer(int id, ResourceProvider* resourceProvider)
@@ -1575,20 +1575,20 @@ private:
, m_quadsAppended(false)
, m_quadRect(5, 5, 5, 5)
, m_quadVisibleRect(5, 5, 5, 5)
- , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, IntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny))
+ , m_resourceId(resourceProvider->createResource(Renderer::ContentPool, gfx::Size(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny))
{
- setAnchorPoint(FloatPoint(0, 0));
- setBounds(IntSize(10, 10));
- setContentBounds(IntSize(10, 10));
+ setAnchorPoint(gfx::PointF(0, 0));
+ setBounds(gfx::Size(10, 10));
+ setContentBounds(gfx::Size(10, 10));
setDrawsContent(true);
}
bool m_blend;
bool m_hasRenderSurface;
bool m_quadsAppended;
- IntRect m_quadRect;
- IntRect m_opaqueContentRect;
- IntRect m_quadVisibleRect;
+ gfx::Rect m_quadRect;
+ gfx::Rect m_opaqueContentRect;
+ gfx::Rect m_quadVisibleRect;
ResourceProvider::ResourceId m_resourceId;
};
@@ -1596,8 +1596,8 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
{
{
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setBounds(IntSize(10, 10));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setBounds(gfx::Size(10, 10));
root->setContentBounds(root->bounds());
root->setDrawsContent(false);
m_hostImpl->setRootLayer(root.Pass());
@@ -1606,7 +1606,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
root->addChild(BlendStateCheckLayer::create(2, m_hostImpl->resourceProvider()));
BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0]);
- layer1->setPosition(FloatPoint(2, 2));
+ layer1->setPosition(gfx::PointF(2, 2));
LayerTreeHostImpl::FrameData frame;
@@ -1646,7 +1646,7 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
layer1->addChild(BlendStateCheckLayer::create(3, m_hostImpl->resourceProvider()));
BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0]);
- layer2->setPosition(FloatPoint(4, 4));
+ layer2->setPosition(gfx::PointF(4, 4));
// 2 opaque layers, drawn without blending.
layer1->setContentsOpaque(true);
@@ -1740,9 +1740,9 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Layer with partially opaque contents, drawn with blending.
layer1->setContentsOpaque(false);
- layer1->setQuadRect(IntRect(5, 5, 5, 5));
- layer1->setQuadVisibleRect(IntRect(5, 5, 5, 5));
- layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setQuadRect(gfx::Rect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(gfx::Rect(5, 5, 5, 5));
+ layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
@@ -1751,9 +1751,9 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Layer with partially opaque contents partially culled, drawn with blending.
layer1->setContentsOpaque(false);
- layer1->setQuadRect(IntRect(5, 5, 5, 5));
- layer1->setQuadVisibleRect(IntRect(5, 5, 5, 2));
- layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setQuadRect(gfx::Rect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(gfx::Rect(5, 5, 5, 2));
+ layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
@@ -1762,9 +1762,9 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Layer with partially opaque contents culled, drawn with blending.
layer1->setContentsOpaque(false);
- layer1->setQuadRect(IntRect(5, 5, 5, 5));
- layer1->setQuadVisibleRect(IntRect(7, 5, 3, 5));
- layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setQuadRect(gfx::Rect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(gfx::Rect(7, 5, 3, 5));
+ layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(true, false);
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
@@ -1773,9 +1773,9 @@ TEST_P(LayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers)
// Layer with partially opaque contents and translucent contents culled, drawn without blending.
layer1->setContentsOpaque(false);
- layer1->setQuadRect(IntRect(5, 5, 5, 5));
- layer1->setQuadVisibleRect(IntRect(5, 5, 2, 5));
- layer1->setOpaqueContentRect(IntRect(5, 5, 2, 5));
+ layer1->setQuadRect(gfx::Rect(5, 5, 5, 5));
+ layer1->setQuadVisibleRect(gfx::Rect(5, 5, 2, 5));
+ layer1->setOpaqueContentRect(gfx::Rect(5, 5, 2, 5));
layer1->setExpectation(false, false);
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
m_hostImpl->drawLayers(frame);
@@ -1789,7 +1789,7 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
m_hostImpl->initializeRenderer(createContext());
m_hostImpl->setBackgroundColor(SK_ColorGRAY);
- IntSize viewportSize(1000, 1000);
+ gfx::Size viewportSize(1000, 1000);
m_hostImpl->setViewportSize(viewportSize, viewportSize);
m_hostImpl->setRootLayer(LayerImpl::create(1));
@@ -1800,12 +1800,12 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
// No gutter rects
{
- IntRect layerRect(0, 0, 1000, 1000);
- child->setPosition(layerRect.location());
+ gfx::Rect layerRect(0, 0, 1000, 1000);
+ child->setPosition(layerRect.origin());
child->setBounds(layerRect.size());
child->setContentBounds(layerRect.size());
- child->setQuadRect(IntRect(IntPoint(), layerRect.size()));
- child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+ child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size()));
+ child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
@@ -1817,18 +1817,18 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
EXPECT_EQ(0u, numGutterQuads);
EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
- verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize));
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), gfx::Rect(gfx::Point(), viewportSize));
m_hostImpl->didDrawAllLayers(frame);
}
// Empty visible content area (fullscreen gutter rect)
{
- IntRect layerRect(0, 0, 0, 0);
- child->setPosition(layerRect.location());
+ gfx::Rect layerRect(0, 0, 0, 0);
+ child->setPosition(layerRect.origin());
child->setBounds(layerRect.size());
child->setContentBounds(layerRect.size());
- child->setQuadRect(IntRect(IntPoint(), layerRect.size()));
- child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+ child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size()));
+ child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
@@ -1841,18 +1841,18 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
EXPECT_EQ(1u, numGutterQuads);
EXPECT_EQ(1u, frame.renderPasses[0]->quadList().size());
- verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize));
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), gfx::Rect(gfx::Point(), viewportSize));
m_hostImpl->didDrawAllLayers(frame);
}
// Content area in middle of clip rect (four surrounding gutter rects)
{
- IntRect layerRect(500, 500, 200, 200);
- child->setPosition(layerRect.location());
+ gfx::Rect layerRect(500, 500, 200, 200);
+ child->setPosition(layerRect.origin());
child->setBounds(layerRect.size());
child->setContentBounds(layerRect.size());
- child->setQuadRect(IntRect(IntPoint(), layerRect.size()));
- child->setQuadVisibleRect(IntRect(IntPoint(), layerRect.size()));
+ child->setQuadRect(gfx::Rect(gfx::Point(), layerRect.size()));
+ child->setQuadVisibleRect(gfx::Rect(gfx::Point(), layerRect.size()));
LayerTreeHostImpl::FrameData frame;
EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));
@@ -1864,7 +1864,7 @@ TEST_P(LayerTreeHostImplTest, viewportCovered)
EXPECT_EQ(4u, numGutterQuads);
EXPECT_EQ(5u, frame.renderPasses[0]->quadList().size());
- verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), IntRect(IntPoint::zero(), viewportSize));
+ verifyQuadsExactlyCoverRect(frame.renderPasses[0]->quadList(), gfx::Rect(gfx::Point(), viewportSize));
m_hostImpl->didDrawAllLayers(frame);
}
@@ -1903,8 +1903,8 @@ TEST_P(LayerTreeHostImplTest, reshapeNotCalledUntilDraw)
m_hostImpl->initializeRenderer(outputSurface.Pass());
scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setBounds(IntSize(10, 10));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setBounds(gfx::Size(10, 10));
root->setDrawsContent(true);
m_hostImpl->setRootLayer(root.Pass());
EXPECT_FALSE(reshapeTracker->reshapeCalled());
@@ -1920,7 +1920,7 @@ class PartialSwapTrackerContext : public FakeWebGraphicsContext3D {
public:
virtual void postSubBufferCHROMIUM(int x, int y, int width, int height)
{
- m_partialSwapRect = IntRect(x, y, width, height);
+ m_partialSwapRect = gfx::Rect(x, y, width, height);
}
virtual WebString getString(WGC3Denum name)
@@ -1931,10 +1931,10 @@ public:
return WebString();
}
- IntRect partialSwapRect() const { return m_partialSwapRect; }
+ gfx::Rect partialSwapRect() const { return m_partialSwapRect; }
private:
- IntRect m_partialSwapRect;
+ gfx::Rect m_partialSwapRect;
};
// Make sure damage tracking propagates all the way to the graphics context,
@@ -1950,18 +1950,18 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
Settings::setPartialSwapEnabled(true);
scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this);
layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
- layerTreeHostImpl->setViewportSize(IntSize(500, 500), IntSize(500, 500));
+ layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500));
scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
- child->setPosition(FloatPoint(12, 13));
- child->setAnchorPoint(FloatPoint(0, 0));
- child->setBounds(IntSize(14, 15));
- child->setContentBounds(IntSize(14, 15));
+ child->setPosition(gfx::PointF(12, 13));
+ child->setAnchorPoint(gfx::PointF(0, 0));
+ child->setBounds(gfx::Size(14, 15));
+ child->setContentBounds(gfx::Size(14, 15));
child->setDrawsContent(true);
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setBounds(IntSize(500, 500));
- root->setContentBounds(IntSize(500, 500));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setBounds(gfx::Size(500, 500));
+ root->setContentBounds(gfx::Size(500, 500));
root->setDrawsContent(true);
root->addChild(child.Pass());
layerTreeHostImpl->setRootLayer(root.Pass());
@@ -1973,8 +1973,8 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
layerTreeHostImpl->drawLayers(frame);
layerTreeHostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
- IntRect actualSwapRect = partialSwapTracker->partialSwapRect();
- IntRect expectedSwapRect = IntRect(IntPoint::zero(), IntSize(500, 500));
+ gfx::Rect actualSwapRect = partialSwapTracker->partialSwapRect();
+ gfx::Rect expectedSwapRect = gfx::Rect(gfx::Point(), gfx::Size(500, 500));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
@@ -1982,31 +1982,31 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
// Second frame, only the damaged area should get swapped. Damage should be the union
// of old and new child rects.
- // expected damage rect: IntRect(IntPoint::zero(), IntSize(26, 28));
+ // expected damage rect: gfx::Rect(gfx::Point(), gfx::Size(26, 28));
// expected swap rect: vertically flipped, with origin at bottom left corner.
- layerTreeHostImpl->rootLayer()->children()[0]->setPosition(FloatPoint(0, 0));
+ layerTreeHostImpl->rootLayer()->children()[0]->setPosition(gfx::PointF(0, 0));
EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
layerTreeHostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
- expectedSwapRect = IntRect(IntPoint(0, 500-28), IntSize(26, 28));
+ expectedSwapRect = gfx::Rect(gfx::Point(0, 500-28), gfx::Size(26, 28));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height());
// Make sure that partial swap is constrained to the viewport dimensions
- // expected damage rect: IntRect(IntPoint::zero(), IntSize(500, 500));
+ // expected damage rect: gfx::Rect(gfx::Point(), gfx::Size(500, 500));
// expected swap rect: flipped damage rect, but also clamped to viewport
- layerTreeHostImpl->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ layerTreeHostImpl->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
layerTreeHostImpl->rootLayer()->setOpacity(0.7f); // this will damage everything
EXPECT_TRUE(layerTreeHostImpl->prepareToDraw(frame));
layerTreeHostImpl->drawLayers(frame);
m_hostImpl->didDrawAllLayers(frame);
layerTreeHostImpl->swapBuffers();
actualSwapRect = partialSwapTracker->partialSwapRect();
- expectedSwapRect = IntRect(IntPoint::zero(), IntSize(10, 10));
+ expectedSwapRect = gfx::Rect(gfx::Point(), gfx::Size(10, 10));
EXPECT_EQ(expectedSwapRect.x(), actualSwapRect.x());
EXPECT_EQ(expectedSwapRect.y(), actualSwapRect.y());
EXPECT_EQ(expectedSwapRect.width(), actualSwapRect.width());
@@ -2017,13 +2017,13 @@ TEST_P(LayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface)
{
scoped_ptr<LayerImpl> root = FakeDrawableLayerImpl::create(1);
scoped_ptr<LayerImpl> child = FakeDrawableLayerImpl::create(2);
- child->setAnchorPoint(FloatPoint(0, 0));
- child->setBounds(IntSize(10, 10));
- child->setContentBounds(IntSize(10, 10));
+ child->setAnchorPoint(gfx::PointF(0, 0));
+ child->setBounds(gfx::Size(10, 10));
+ child->setContentBounds(gfx::Size(10, 10));
child->setDrawsContent(true);
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setBounds(IntSize(10, 10));
- root->setContentBounds(IntSize(10, 10));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setBounds(gfx::Size(10, 10));
+ root->setContentBounds(gfx::Size(10, 10));
root->setDrawsContent(true);
root->setOpacity(0.7f);
root->addChild(child.Pass());
@@ -2049,7 +2049,7 @@ public:
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
SkColor gray = SkColorSetRGB(100, 100, 100);
- IntRect quadRect(IntPoint(0, 0), contentBounds());
+ gfx::Rect quadRect(gfx::Point(0, 0), contentBounds());
scoped_ptr<SolidColorDrawQuad> myQuad = SolidColorDrawQuad::create(sharedQuadState, quadRect, gray);
quadSink.append(myQuad.PassAs<DrawQuad>(), appendQuadsData);
}
@@ -2192,7 +2192,7 @@ TEST_P(LayerTreeHostImplTest, partialSwap)
Mock::VerifyAndClearExpectations(&mockContext);
// Damage a portion of the frame.
- myHostImpl->rootLayer()->setUpdateRect(IntRect(0, 0, 2, 3));
+ myHostImpl->rootLayer()->setUpdateRect(gfx::Rect(0, 0, 2, 3));
// The second frame will be partially-swapped (the y coordinates are flipped).
harness.mustSetScissor(0, 7, 2, 3);
@@ -2237,7 +2237,7 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
LayerTreeSettings settings;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(100, 100), IntSize(100, 100));
+ myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
/*
Layers are created as follows:
@@ -2261,30 +2261,30 @@ static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, Lay
scoped_ptr<LayerImpl> child = LayerImpl::create(2);
scoped_ptr<LayerImpl> grandChild = FakeLayerWithQuads::create(3);
- IntRect rootRect(0, 0, 100, 100);
- IntRect childRect(10, 10, 50, 50);
- IntRect grandChildRect(5, 5, 150, 150);
+ gfx::Rect rootRect(0, 0, 100, 100);
+ gfx::Rect childRect(10, 10, 50, 50);
+ gfx::Rect grandChildRect(5, 5, 150, 150);
root->createRenderSurface();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
- root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(rootRect.x(), rootRect.y()));
+ root->setBounds(gfx::Size(rootRect.width(), rootRect.height()));
root->setContentBounds(root->bounds());
root->setVisibleContentRect(rootRect);
root->setDrawsContent(false);
- root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height())));
+ root->renderSurface()->setContentRect(gfx::Rect(gfx::Point(), gfx::Size(rootRect.width(), rootRect.height())));
- child->setAnchorPoint(FloatPoint(0, 0));
- child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setAnchorPoint(gfx::PointF(0, 0));
+ child->setPosition(gfx::PointF(childRect.x(), childRect.y()));
child->setOpacity(0.5f);
- child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setBounds(gfx::Size(childRect.width(), childRect.height()));
child->setContentBounds(child->bounds());
child->setVisibleContentRect(childRect);
child->setDrawsContent(false);
- grandChild->setAnchorPoint(FloatPoint(0, 0));
- grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
- grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild->setAnchorPoint(gfx::PointF(0, 0));
+ grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y()));
+ grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.height()));
grandChild->setContentBounds(grandChild->bounds());
grandChild->setVisibleContentRect(grandChildRect);
grandChild->setDrawsContent(true);
@@ -2631,7 +2631,7 @@ public:
{
DCHECK(provider);
int pool = 0;
- IntSize size(10, 10);
+ gfx::Size size(10, 10);
GLenum format = GL_RGBA;
ResourceProvider::TextureUsageHint hint = ResourceProvider::TextureUsageAny;
setScrollbarGeometry(ScrollbarGeometryFixedThumb::create(FakeWebScrollbarThemeGeometryNonEmpty::create()));
@@ -2650,11 +2650,11 @@ protected:
static inline scoped_ptr<RenderPass> createRenderPassWithResource(ResourceProvider* provider)
{
- ResourceProvider::ResourceId resourceId = provider->createResource(0, IntSize(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny);
+ ResourceProvider::ResourceId resourceId = provider->createResource(0, gfx::Size(1, 1), GL_RGBA, ResourceProvider::TextureUsageAny);
- scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1), IntRect(0, 0, 1, 1), WebTransformationMatrix());
- scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransformationMatrix(), IntRect(0, 0, 1, 1), IntRect(0, 0, 1, 1), 1, false);
- scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedState.get(), IntRect(0, 0, 1, 1), resourceId, false, FloatRect(0, 0, 1, 1), false);
+ scoped_ptr<TestRenderPass> pass = TestRenderPass::create(RenderPass::Id(1, 1), gfx::Rect(0, 0, 1, 1), WebTransformationMatrix());
+ scoped_ptr<SharedQuadState> sharedState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(0, 0, 1, 1), gfx::Rect(0, 0, 1, 1), 1, false);
+ scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::create(sharedState.get(), gfx::Rect(0, 0, 1, 1), resourceId, false, gfx::RectF(0, 0, 1, 1), false);
pass->appendSharedQuadState(sharedState.Pass());
pass->appendQuad(quad.PassAs<DrawQuad>());
@@ -2667,42 +2667,42 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
int layerId = 1;
scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(layerId++));
- rootLayer->setBounds(IntSize(10, 10));
- rootLayer->setAnchorPoint(FloatPoint(0, 0));
+ rootLayer->setBounds(gfx::Size(10, 10));
+ rootLayer->setAnchorPoint(gfx::PointF(0, 0));
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(layerId++);
- tileLayer->setBounds(IntSize(10, 10));
- tileLayer->setAnchorPoint(FloatPoint(0, 0));
- tileLayer->setContentBounds(IntSize(10, 10));
+ tileLayer->setBounds(gfx::Size(10, 10));
+ tileLayer->setAnchorPoint(gfx::PointF(0, 0));
+ tileLayer->setContentBounds(gfx::Size(10, 10));
tileLayer->setDrawsContent(true);
tileLayer->setSkipsDraw(false);
- scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels));
- tilingData->setBounds(IntSize(10, 10));
+ scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::NoBorderTexels));
+ tilingData->setBounds(gfx::Size(10, 10));
tileLayer->setTilingData(*tilingData);
- tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
+ tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false);
rootLayer->addChild(tileLayer.PassAs<LayerImpl>());
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(layerId++);
- textureLayer->setBounds(IntSize(10, 10));
- textureLayer->setAnchorPoint(FloatPoint(0, 0));
- textureLayer->setContentBounds(IntSize(10, 10));
+ textureLayer->setBounds(gfx::Size(10, 10));
+ textureLayer->setAnchorPoint(gfx::PointF(0, 0));
+ textureLayer->setContentBounds(gfx::Size(10, 10));
textureLayer->setDrawsContent(true);
textureLayer->setTextureId(1);
rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
scoped_ptr<TiledLayerImpl> maskLayer = TiledLayerImpl::create(layerId++);
- maskLayer->setBounds(IntSize(10, 10));
- maskLayer->setAnchorPoint(FloatPoint(0, 0));
- maskLayer->setContentBounds(IntSize(10, 10));
+ maskLayer->setBounds(gfx::Size(10, 10));
+ maskLayer->setAnchorPoint(gfx::PointF(0, 0));
+ maskLayer->setContentBounds(gfx::Size(10, 10));
maskLayer->setDrawsContent(true);
maskLayer->setSkipsDraw(false);
maskLayer->setTilingData(*tilingData);
- maskLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
+ maskLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false);
scoped_ptr<TextureLayerImpl> textureLayerWithMask = TextureLayerImpl::create(layerId++);
- textureLayerWithMask->setBounds(IntSize(10, 10));
- textureLayerWithMask->setAnchorPoint(FloatPoint(0, 0));
- textureLayerWithMask->setContentBounds(IntSize(10, 10));
+ textureLayerWithMask->setBounds(gfx::Size(10, 10));
+ textureLayerWithMask->setAnchorPoint(gfx::PointF(0, 0));
+ textureLayerWithMask->setContentBounds(gfx::Size(10, 10));
textureLayerWithMask->setDrawsContent(true);
textureLayerWithMask->setTextureId(1);
textureLayerWithMask->setMaskLayer(maskLayer.PassAs<LayerImpl>());
@@ -2715,53 +2715,51 @@ TEST_P(LayerTreeHostImplTest, dontUseOldResourcesAfterLostContext)
base::Bind(FakeVideoFrame::toVideoFrame);
FakeVideoFrameProvider provider;
provider.setFrame(&videoFrame);
- scoped_ptr<VideoLayerImpl> videoLayer =
- VideoLayerImpl::create(layerId++, &provider, unwrapper);
- videoLayer->setBounds(IntSize(10, 10));
- videoLayer->setAnchorPoint(FloatPoint(0, 0));
- videoLayer->setContentBounds(IntSize(10, 10));
+ scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(layerId++, &provider, unwrapper);
+ videoLayer->setBounds(gfx::Size(10, 10));
+ videoLayer->setAnchorPoint(gfx::PointF(0, 0));
+ videoLayer->setContentBounds(gfx::Size(10, 10));
videoLayer->setDrawsContent(true);
videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
FakeVideoFrameProvider hwProvider;
- scoped_ptr<VideoLayerImpl> hwVideoLayer =
- VideoLayerImpl::create(layerId++, &hwProvider, unwrapper);
- hwVideoLayer->setBounds(IntSize(10, 10));
- hwVideoLayer->setAnchorPoint(FloatPoint(0, 0));
- hwVideoLayer->setContentBounds(IntSize(10, 10));
+ scoped_ptr<VideoLayerImpl> hwVideoLayer = VideoLayerImpl::create(layerId++, &hwProvider, unwrapper);
+ hwVideoLayer->setBounds(gfx::Size(10, 10));
+ hwVideoLayer->setAnchorPoint(gfx::PointF(0, 0));
+ hwVideoLayer->setContentBounds(gfx::Size(10, 10));
hwVideoLayer->setDrawsContent(true);
hwVideoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(hwVideoLayer.PassAs<LayerImpl>());
scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(layerId++);
- ioSurfaceLayer->setBounds(IntSize(10, 10));
- ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
- ioSurfaceLayer->setContentBounds(IntSize(10, 10));
+ ioSurfaceLayer->setBounds(gfx::Size(10, 10));
+ ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0));
+ ioSurfaceLayer->setContentBounds(gfx::Size(10, 10));
ioSurfaceLayer->setDrawsContent(true);
- ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
+ ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10));
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
scoped_ptr<HeadsUpDisplayLayerImpl> hudLayer = HeadsUpDisplayLayerImpl::create(layerId++);
- hudLayer->setBounds(IntSize(10, 10));
- hudLayer->setAnchorPoint(FloatPoint(0, 0));
- hudLayer->setContentBounds(IntSize(10, 10));
+ hudLayer->setBounds(gfx::Size(10, 10));
+ hudLayer->setAnchorPoint(gfx::PointF(0, 0));
+ hudLayer->setContentBounds(gfx::Size(10, 10));
hudLayer->setDrawsContent(true);
hudLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(hudLayer.PassAs<LayerImpl>());
scoped_ptr<FakeScrollbarLayerImpl> scrollbarLayer(FakeScrollbarLayerImpl::create(layerId++));
- scrollbarLayer->setBounds(IntSize(10, 10));
- scrollbarLayer->setContentBounds(IntSize(10, 10));
+ scrollbarLayer->setBounds(gfx::Size(10, 10));
+ scrollbarLayer->setContentBounds(gfx::Size(10, 10));
scrollbarLayer->setDrawsContent(true);
scrollbarLayer->setLayerTreeHostImpl(m_hostImpl.get());
scrollbarLayer->createResources(m_hostImpl->resourceProvider());
rootLayer->addChild(scrollbarLayer.PassAs<LayerImpl>());
scoped_ptr<DelegatedRendererLayerImpl> delegatedRendererLayer(DelegatedRendererLayerImpl::create(layerId++));
- delegatedRendererLayer->setBounds(IntSize(10, 10));
- delegatedRendererLayer->setContentBounds(IntSize(10, 10));
+ delegatedRendererLayer->setBounds(gfx::Size(10, 10));
+ delegatedRendererLayer->setContentBounds(gfx::Size(10, 10));
delegatedRendererLayer->setDrawsContent(true);
delegatedRendererLayer->setLayerTreeHostImpl(m_hostImpl.get());
ScopedPtrVector<RenderPass> passList;
@@ -2867,25 +2865,25 @@ private:
TEST_P(LayerTreeHostImplTest, layersFreeTextures)
{
scoped_ptr<LayerImpl> rootLayer(LayerImpl::create(1));
- rootLayer->setBounds(IntSize(10, 10));
- rootLayer->setAnchorPoint(FloatPoint(0, 0));
+ rootLayer->setBounds(gfx::Size(10, 10));
+ rootLayer->setAnchorPoint(gfx::PointF(0, 0));
scoped_ptr<TiledLayerImpl> tileLayer = TiledLayerImpl::create(2);
- tileLayer->setBounds(IntSize(10, 10));
- tileLayer->setAnchorPoint(FloatPoint(0, 0));
- tileLayer->setContentBounds(IntSize(10, 10));
+ tileLayer->setBounds(gfx::Size(10, 10));
+ tileLayer->setAnchorPoint(gfx::PointF(0, 0));
+ tileLayer->setContentBounds(gfx::Size(10, 10));
tileLayer->setDrawsContent(true);
tileLayer->setSkipsDraw(false);
- scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(IntSize(10, 10), LayerTilingData::NoBorderTexels));
- tilingData->setBounds(IntSize(10, 10));
+ scoped_ptr<LayerTilingData> tilingData(LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::NoBorderTexels));
+ tilingData->setBounds(gfx::Size(10, 10));
tileLayer->setTilingData(*tilingData);
- tileLayer->pushTileProperties(0, 0, 1, IntRect(0, 0, 10, 10), false);
+ tileLayer->pushTileProperties(0, 0, 1, gfx::Rect(0, 0, 10, 10), false);
rootLayer->addChild(tileLayer.PassAs<LayerImpl>());
scoped_ptr<TextureLayerImpl> textureLayer = TextureLayerImpl::create(3);
- textureLayer->setBounds(IntSize(10, 10));
- textureLayer->setAnchorPoint(FloatPoint(0, 0));
- textureLayer->setContentBounds(IntSize(10, 10));
+ textureLayer->setBounds(gfx::Size(10, 10));
+ textureLayer->setAnchorPoint(gfx::PointF(0, 0));
+ textureLayer->setContentBounds(gfx::Size(10, 10));
textureLayer->setDrawsContent(true);
textureLayer->setTextureId(1);
rootLayer->addChild(textureLayer.PassAs<LayerImpl>());
@@ -2893,21 +2891,20 @@ TEST_P(LayerTreeHostImplTest, layersFreeTextures)
VideoLayerImpl::FrameUnwrapper unwrapper =
base::Bind(FakeVideoFrame::toVideoFrame);
FakeVideoFrameProvider provider;
- scoped_ptr<VideoLayerImpl> videoLayer =
- VideoLayerImpl::create(4, &provider, unwrapper);
- videoLayer->setBounds(IntSize(10, 10));
- videoLayer->setAnchorPoint(FloatPoint(0, 0));
- videoLayer->setContentBounds(IntSize(10, 10));
+ scoped_ptr<VideoLayerImpl> videoLayer = VideoLayerImpl::create(4, &provider, unwrapper);
+ videoLayer->setBounds(gfx::Size(10, 10));
+ videoLayer->setAnchorPoint(gfx::PointF(0, 0));
+ videoLayer->setContentBounds(gfx::Size(10, 10));
videoLayer->setDrawsContent(true);
videoLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(videoLayer.PassAs<LayerImpl>());
scoped_ptr<IOSurfaceLayerImpl> ioSurfaceLayer = IOSurfaceLayerImpl::create(5);
- ioSurfaceLayer->setBounds(IntSize(10, 10));
- ioSurfaceLayer->setAnchorPoint(FloatPoint(0, 0));
- ioSurfaceLayer->setContentBounds(IntSize(10, 10));
+ ioSurfaceLayer->setBounds(gfx::Size(10, 10));
+ ioSurfaceLayer->setAnchorPoint(gfx::PointF(0, 0));
+ ioSurfaceLayer->setContentBounds(gfx::Size(10, 10));
ioSurfaceLayer->setDrawsContent(true);
- ioSurfaceLayer->setIOSurfaceProperties(1, IntSize(10, 10));
+ ioSurfaceLayer->setIOSurfaceProperties(1, gfx::Size(10, 10));
ioSurfaceLayer->setLayerTreeHostImpl(m_hostImpl.get());
rootLayer->addChild(ioSurfaceLayer.PassAs<LayerImpl>());
@@ -2967,12 +2964,12 @@ TEST_P(LayerTreeHostImplTest, hasTransparentBackground)
Mock::VerifyAndClearExpectations(&mockContext);
}
-static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRect, LayerImpl** result)
+static void addDrawingLayerTo(LayerImpl* parent, int id, const gfx::Rect& layerRect, LayerImpl** result)
{
scoped_ptr<LayerImpl> layer = FakeLayerWithQuads::create(id);
LayerImpl* layerPtr = layer.get();
- layerPtr->setAnchorPoint(FloatPoint(0, 0));
- layerPtr->setPosition(FloatPoint(layerRect.location()));
+ layerPtr->setAnchorPoint(gfx::PointF(0, 0));
+ layerPtr->setPosition(gfx::PointF(layerRect.origin()));
layerPtr->setBounds(layerRect.size());
layerPtr->setContentBounds(layerRect.size());
layerPtr->setDrawsContent(true); // only children draw content
@@ -2982,7 +2979,7 @@ static void addDrawingLayerTo(LayerImpl* parent, int id, const IntRect& layerRec
*result = layerPtr;
}
-static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, LayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPtr, LayerImpl*& childPtr, const IntSize& rootSize)
+static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, LayerImpl*& rootPtr, LayerImpl*& intermediateLayerPtr, LayerImpl*& surfaceLayerPtr, LayerImpl*& childPtr, const gfx::Size& rootSize)
{
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
@@ -2992,24 +2989,24 @@ static void setupLayersForTextureCaching(LayerTreeHostImpl* layerTreeHostImpl, L
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
layerTreeHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(10, 10, rootSize.width(), rootSize.height()), &intermediateLayerPtr);
intermediateLayerPtr->setDrawsContent(false); // only children draw content
// Surface layer is the layer that changes its opacity
// It will contain other layers that draw content.
- addDrawingLayerTo(intermediateLayerPtr, 3, IntRect(10, 10, rootSize.width(), rootSize.height()), &surfaceLayerPtr);
+ addDrawingLayerTo(intermediateLayerPtr, 3, gfx::Rect(10, 10, rootSize.width(), rootSize.height()), &surfaceLayerPtr);
surfaceLayerPtr->setDrawsContent(false); // only children draw content
surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface
// Child of the surface layer will produce some quads
- addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(5, 5, rootSize.width() - 25, rootSize.height() - 25), &childPtr);
+ addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(5, 5, rootSize.width() - 25, rootSize.height() - 25), &childPtr);
}
class GLRendererWithReleaseTextures : public GLRenderer {
@@ -3022,7 +3019,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
Settings::setPartialSwapEnabled(true);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
LayerImpl* rootPtr;
@@ -3030,31 +3027,31 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(100, 100);
+ gfx::Size rootSize(100, 100);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 3, IntRect(0, 0, rootSize.width(), rootSize.height()), &surfaceLayerPtr);
+ addDrawingLayerTo(rootPtr, 3, gfx::Rect(0, 0, rootSize.width(), rootSize.height()), &surfaceLayerPtr);
surfaceLayerPtr->setDrawsContent(false);
// Surface layer is the layer that changes its opacity
// It will contain other layers that draw content.
surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface
- addDrawingLayerTo(surfaceLayerPtr, 4, IntRect(0, 0, 100, 3), 0);
- addDrawingLayerTo(surfaceLayerPtr, 5, IntRect(0, 97, 100, 3), 0);
+ addDrawingLayerTo(surfaceLayerPtr, 4, gfx::Rect(0, 0, 100, 3), 0);
+ addDrawingLayerTo(surfaceLayerPtr, 5, gfx::Rect(0, 97, 100, 3), 0);
// Rotation will put part of the child ouside the bounds of the root layer.
// Nevertheless, the child layers should be drawn.
@@ -3081,7 +3078,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
EXPECT_LT(quadVisibleRect.width(), 100);
// Verify that the render surface texture is *not* clipped.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), frame.renderPasses[0]->outputRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), frame.renderPasses[0]->outputRect());
EXPECT_EQ(DrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material());
RenderPassDrawQuad* quad = static_cast<RenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0]);
@@ -3119,7 +3116,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
Settings::setPartialSwapEnabled(false);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
// Layers are structure as follows:
@@ -3142,32 +3139,32 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(1000, 1000);
+ gfx::Size rootSize(1000, 1000);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr);
layerS1Ptr->setForceRenderSurface(true);
- addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11
- addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12
+ addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(10, 10, 10, 10), 0); // L11
+ addDrawingLayerTo(layerS1Ptr, 4, gfx::Rect(0, 0, 30, 30), 0); // L12
- addDrawingLayerTo(rootPtr, 5, IntRect(550, 250, 300, 400), &layerS2Ptr);
+ addDrawingLayerTo(rootPtr, 5, gfx::Rect(550, 250, 300, 400), &layerS2Ptr);
layerS2Ptr->setForceRenderSurface(true);
- addDrawingLayerTo(layerS2Ptr, 6, IntRect(20, 20, 5, 5), 0); // L21
+ addDrawingLayerTo(layerS2Ptr, 6, gfx::Rect(20, 20, 5, 5), 0); // L21
// Initial draw - must receive all quads
{
@@ -3235,7 +3232,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
Settings::setPartialSwapEnabled(false);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
// Layers are structure as follows:
@@ -3255,33 +3252,33 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(1000, 1000);
+ gfx::Size rootSize(1000, 1000);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 800, 800), &layerS1Ptr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 800, 800), &layerS1Ptr);
layerS1Ptr->setForceRenderSurface(true);
layerS1Ptr->setDrawsContent(false);
- addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11
- addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 500, 300, 300), 0); // L12
- addDrawingLayerTo(layerS1Ptr, 5, IntRect(500, 0, 300, 300), 0); // L13
- addDrawingLayerTo(layerS1Ptr, 6, IntRect(500, 500, 300, 300), 0); // L14
- addDrawingLayerTo(layerS1Ptr, 9, IntRect(500, 500, 300, 300), 0); // L14
+ addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(0, 0, 300, 300), 0); // L11
+ addDrawingLayerTo(layerS1Ptr, 4, gfx::Rect(0, 500, 300, 300), 0); // L12
+ addDrawingLayerTo(layerS1Ptr, 5, gfx::Rect(500, 0, 300, 300), 0); // L13
+ addDrawingLayerTo(layerS1Ptr, 6, gfx::Rect(500, 500, 300, 300), 0); // L14
+ addDrawingLayerTo(layerS1Ptr, 9, gfx::Rect(500, 500, 300, 300), 0); // L14
- addDrawingLayerTo(rootPtr, 7, IntRect(450, 450, 450, 450), &layerS2Ptr);
+ addDrawingLayerTo(rootPtr, 7, gfx::Rect(450, 450, 450, 450), &layerS2Ptr);
layerS2Ptr->setForceRenderSurface(true);
// Initial draw - must receive all quads
@@ -3351,7 +3348,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
Settings::setPartialSwapEnabled(false);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
// Layers are structured as follows:
@@ -3369,29 +3366,29 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(1000, 1000);
+ gfx::Size rootSize(1000, 1000);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr);
layerS1Ptr->setForceRenderSurface(true);
- addDrawingLayerTo(layerS1Ptr, 3, IntRect(0, 0, 300, 300), 0); // L11
- addDrawingLayerTo(layerS1Ptr, 4, IntRect(100, 0, 300, 300), 0); // L12
+ addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(0, 0, 300, 300), 0); // L11
+ addDrawingLayerTo(layerS1Ptr, 4, gfx::Rect(100, 0, 300, 300), 0); // L12
- addDrawingLayerTo(rootPtr, 7, IntRect(200, 0, 300, 300), &layerS2Ptr);
+ addDrawingLayerTo(rootPtr, 7, gfx::Rect(200, 0, 300, 300), &layerS2Ptr);
layerS2Ptr->setForceRenderSurface(true);
// Initial draw - must receive all quads
@@ -3452,23 +3449,23 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(1000, 1000);
+ gfx::Size rootSize(1000, 1000);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(0, 0, 400, 400), &layerS1Ptr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(0, 0, 400, 400), &layerS1Ptr);
layerS1Ptr->setForceRenderSurface(true);
WebTransformationMatrix transform = layerS1Ptr->transform();
transform.translate(200, 200);
@@ -3476,7 +3473,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
transform.translate(-200, -200);
layerS1Ptr->setTransform(transform);
- addDrawingLayerTo(layerS1Ptr, 3, IntRect(200, 0, 200, 400), 0); // L11
+ addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(200, 0, 200, 400), 0); // L11
// Initial draw - must receive all quads
{
@@ -3514,7 +3511,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
Settings::setPartialSwapEnabled(true);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
// Layers are structure as follows:
@@ -3537,32 +3534,32 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
- IntSize rootSize(1000, 1000);
+ gfx::Size rootSize(1000, 1000);
myHostImpl->initializeRenderer(context.Pass());
- myHostImpl->setViewportSize(IntSize(rootSize.width(), rootSize.height()), IntSize(rootSize.width(), rootSize.height()));
+ myHostImpl->setViewportSize(gfx::Size(rootSize.width(), rootSize.height()), gfx::Size(rootSize.width(), rootSize.height()));
scoped_ptr<LayerImpl> root = LayerImpl::create(1);
rootPtr = root.get();
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(0, 0));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(0, 0));
root->setBounds(rootSize);
root->setContentBounds(rootSize);
root->setDrawsContent(true);
root->setMasksToBounds(true);
myHostImpl->setRootLayer(root.Pass());
- addDrawingLayerTo(rootPtr, 2, IntRect(300, 300, 300, 300), &layerS1Ptr);
+ addDrawingLayerTo(rootPtr, 2, gfx::Rect(300, 300, 300, 300), &layerS1Ptr);
layerS1Ptr->setForceRenderSurface(true);
- addDrawingLayerTo(layerS1Ptr, 3, IntRect(10, 10, 10, 10), 0); // L11
- addDrawingLayerTo(layerS1Ptr, 4, IntRect(0, 0, 30, 30), 0); // L12
+ addDrawingLayerTo(layerS1Ptr, 3, gfx::Rect(10, 10, 10, 10), 0); // L11
+ addDrawingLayerTo(layerS1Ptr, 4, gfx::Rect(0, 0, 30, 30), 0); // L12
- addDrawingLayerTo(rootPtr, 5, IntRect(550, 250, 300, 400), &layerS2Ptr);
+ addDrawingLayerTo(rootPtr, 5, gfx::Rect(550, 250, 300, 400), &layerS2Ptr);
layerS2Ptr->setForceRenderSurface(true);
- addDrawingLayerTo(layerS2Ptr, 6, IntRect(20, 20, 5, 5), 0); // L21
+ addDrawingLayerTo(layerS2Ptr, 6, gfx::Rect(20, 20, 5, 5), 0); // L21
// Initial draw - must receive all quads
{
@@ -3627,7 +3624,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
Settings::setPartialSwapEnabled(false);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
/*
@@ -3652,36 +3649,36 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
scoped_ptr<TiledLayerImpl> child = TiledLayerImpl::create(2);
scoped_ptr<LayerImpl> grandChild = LayerImpl::create(3);
- IntRect rootRect(0, 0, 100, 100);
- IntRect childRect(10, 10, 50, 50);
- IntRect grandChildRect(5, 5, 150, 150);
+ gfx::Rect rootRect(0, 0, 100, 100);
+ gfx::Rect childRect(10, 10, 50, 50);
+ gfx::Rect grandChildRect(5, 5, 150, 150);
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
myHostImpl->initializeRenderer(context.Pass());
- root->setAnchorPoint(FloatPoint(0, 0));
- root->setPosition(FloatPoint(rootRect.x(), rootRect.y()));
- root->setBounds(IntSize(rootRect.width(), rootRect.height()));
+ root->setAnchorPoint(gfx::PointF(0, 0));
+ root->setPosition(gfx::PointF(rootRect.x(), rootRect.y()));
+ root->setBounds(gfx::Size(rootRect.width(), rootRect.height()));
root->setContentBounds(root->bounds());
root->setDrawsContent(true);
root->setMasksToBounds(true);
- child->setAnchorPoint(FloatPoint(0, 0));
- child->setPosition(FloatPoint(childRect.x(), childRect.y()));
+ child->setAnchorPoint(gfx::PointF(0, 0));
+ child->setPosition(gfx::PointF(childRect.x(), childRect.y()));
child->setOpacity(0.5);
- child->setBounds(IntSize(childRect.width(), childRect.height()));
+ child->setBounds(gfx::Size(childRect.width(), childRect.height()));
child->setContentBounds(child->bounds());
child->setDrawsContent(true);
child->setSkipsDraw(false);
// child layer has 10x10 tiles.
- scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(10, 10), LayerTilingData::HasBorderTexels);
+ scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10, 10), LayerTilingData::HasBorderTexels);
tiler->setBounds(child->contentBounds());
child->setTilingData(*tiler.get());
- grandChild->setAnchorPoint(FloatPoint(0, 0));
- grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y()));
- grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height()));
+ grandChild->setAnchorPoint(gfx::PointF(0, 0));
+ grandChild->setPosition(gfx::Point(grandChildRect.x(), grandChildRect.y()));
+ grandChild->setBounds(gfx::Size(grandChildRect.width(), grandChildRect.height()));
grandChild->setContentBounds(grandChild->bounds());
grandChild->setDrawsContent(true);
@@ -3716,7 +3713,7 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
EXPECT_TRUE(myHostImpl->renderer()->haveCachedResourcesForRenderPassId(childPassId));
// Damage a single tile of surface 2.
- childPtr->setUpdateRect(IntRect(10, 10, 10, 10));
+ childPtr->setUpdateRect(gfx::Rect(10, 10, 10, 10));
{
LayerTreeHostImpl::FrameData frame;
@@ -3734,7 +3731,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
Settings::setPartialSwapEnabled(true);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
LayerImpl* rootPtr;
@@ -3742,7 +3739,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
LayerImpl* surfaceLayerPtr;
LayerImpl* childPtr;
- setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100));
+ setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, gfx::Size(100, 100));
{
LayerTreeHostImpl::FrameData frame;
@@ -3895,7 +3892,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
Settings::setPartialSwapEnabled(false);
LayerTreeSettings settings;
- settings.minimumOcclusionTrackingSize = IntSize();
+ settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this);
LayerImpl* rootPtr;
@@ -3903,7 +3900,7 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
LayerImpl* surfaceLayerPtr;
LayerImpl* childPtr;
- setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, IntSize(100, 100));
+ setupLayersForTextureCaching(myHostImpl.get(), rootPtr, intermediateLayerPtr, surfaceLayerPtr, childPtr, gfx::Size(100, 100));
{
LayerTreeHostImpl::FrameData frame;
@@ -4103,7 +4100,7 @@ public:
virtual bool haveCachedResourcesForRenderPassId(RenderPass::Id id) const OVERRIDE { return m_textures.count(id); }
// RendererClient implementation.
- virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
+ virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; }
virtual void didLoseContext() OVERRIDE { }
virtual void onSwapBuffersComplete() OVERRIDE { }
@@ -4116,7 +4113,7 @@ protected:
private:
LayerTreeSettings m_settings;
- IntSize m_viewportSize;
+ gfx::Size m_viewportSize;
base::hash_set<RenderPass::Id> m_textures;
};
@@ -4125,13 +4122,13 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
renderer->clearCachedTextures();
// One shared state for all quads - we don't need the correct details
- testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true);
+ testData.sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), gfx::Rect(), gfx::Rect(), 1.0, true);
const char* currentChar = testScript;
// Pre-create root pass
RenderPass::Id rootRenderPassId = RenderPass::Id(testScript[0], testScript[1]);
- testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRenderPassId, IntRect(), WebTransformationMatrix()));
+ testData.renderPassCache.add(rootRenderPassId, TestRenderPass::create(rootRenderPassId, gfx::Rect(), WebTransformationMatrix()));
while (*currentChar) {
int layerId = *currentChar;
currentChar++;
@@ -4151,7 +4148,7 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
while (*currentChar && *currentChar != '\n') {
if (*currentChar == 's') {
// Solid color draw quad
- scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::create(testData.sharedQuadState.get(), IntRect(0, 0, 10, 10), SK_ColorWHITE);
+ scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::create(testData.sharedQuadState.get(), gfx::Rect(0, 0, 10, 10), SK_ColorWHITE);
renderPass->appendQuad(quad.PassAs<DrawQuad>());
currentChar++;
@@ -4188,11 +4185,11 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova
if (hasTexture)
renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId);
- testData.renderPassCache.add(newRenderPassId, TestRenderPass::create(newRenderPassId, IntRect(), WebTransformationMatrix()));
+ testData.renderPassCache.add(newRenderPassId, TestRenderPass::create(newRenderPassId, gfx::Rect(), WebTransformationMatrix()));
}
- IntRect quadRect = IntRect(0, 0, 1, 1);
- IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect();
+ gfx::Rect quadRect = gfx::Rect(0, 0, 1, 1);
+ gfx::Rect contentsChangedRect = contentsChanged ? quadRect : gfx::Rect();
scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, 1, contentsChangedRect, 1, 1, 0, 0);
renderPass->appendQuad(quad.PassAs<DrawQuad>());
}
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 1117356..166c4070 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -22,6 +22,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/khronos/GLES2/gl2.h"
#include "third_party/khronos/GLES2/gl2ext.h"
+#include "ui/gfx/point_conversions.h"
+#include "ui/gfx/size_conversions.h"
#include <public/WebLayerScrollClient.h>
#include <public/WebSize.h>
@@ -309,7 +311,7 @@ public:
m_numCommits++;
if (m_numCommits == 1) {
// Make the viewport empty so the host says it can't draw.
- m_layerTreeHost->setViewportSize(IntSize(0, 0), IntSize(0, 0));
+ m_layerTreeHost->setViewportSize(gfx::Size(0, 0), gfx::Size(0, 0));
scoped_array<char> pixels(new char[4]);
m_layerTreeHost->compositeAndReadback(static_cast<void*>(pixels.get()), IntRect(0, 0, 1, 1));
@@ -990,7 +992,7 @@ public:
virtual void beginTest() OVERRIDE
{
- m_layerTreeHost->setViewportSize(IntSize(20, 20), IntSize(20, 20));
+ m_layerTreeHost->setViewportSize(gfx::Size(20, 20), gfx::Size(20, 20));
m_layerTreeHost->setBackgroundColor(SK_ColorGRAY);
m_layerTreeHost->setPageScaleFactorAndLimits(5, 5, 5);
@@ -999,7 +1001,7 @@ public:
virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE
{
- EXPECT_EQ(IntSize(20, 20), impl->layoutViewportSize());
+ EXPECT_EQ(gfx::Size(20, 20), impl->layoutViewportSize());
EXPECT_EQ(SK_ColorGRAY, impl->backgroundColor());
EXPECT_EQ(5, impl->pageScaleFactor());
@@ -1159,8 +1161,8 @@ private:
: ContentLayer(client)
, m_paintContentsCount(0)
{
- setAnchorPoint(FloatPoint(0, 0));
- setBounds(IntSize(10, 10));
+ setAnchorPoint(gfx::PointF(0, 0));
+ setBounds(gfx::Size(10, 10));
setIsDrawable(true);
}
virtual ~ContentLayerWithUpdateTracking()
@@ -1224,7 +1226,7 @@ class NoScaleContentLayer : public ContentLayer {
public:
static scoped_refptr<NoScaleContentLayer> create(ContentLayerClient* client) { return make_scoped_refptr(new NoScaleContentLayer(client)); }
- virtual IntSize contentBounds() const OVERRIDE { return bounds(); }
+ virtual gfx::Size contentBounds() const OVERRIDE { return bounds(); }
virtual float contentsScaleX() const OVERRIDE { return 1.0; }
virtual float contentsScaleY() const OVERRIDE { return 1.0; }
@@ -1244,7 +1246,7 @@ public:
virtual void beginTest() OVERRIDE
{
- m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
m_layerTreeHost->rootLayer()->addChild(m_updateCheckLayer);
m_updateCheckLayer->setOpacity(0);
m_updateCheckLayer->setDrawOpacity(0);
@@ -1287,20 +1289,20 @@ public:
virtual void beginTest() OVERRIDE
{
- m_layerTreeHost->setViewportSize(IntSize(40, 40), IntSize(60, 60));
+ m_layerTreeHost->setViewportSize(gfx::Size(40, 40), gfx::Size(60, 60));
m_layerTreeHost->setDeviceScaleFactor(1.5);
- EXPECT_EQ(IntSize(40, 40), m_layerTreeHost->layoutViewportSize());
- EXPECT_EQ(IntSize(60, 60), m_layerTreeHost->deviceViewportSize());
+ EXPECT_EQ(gfx::Size(40, 40), m_layerTreeHost->layoutViewportSize());
+ EXPECT_EQ(gfx::Size(60, 60), m_layerTreeHost->deviceViewportSize());
m_rootLayer->addChild(m_childLayer);
m_rootLayer->setIsDrawable(true);
- m_rootLayer->setBounds(IntSize(30, 30));
+ m_rootLayer->setBounds(gfx::Size(30, 30));
m_rootLayer->setAnchorPoint(FloatPoint(0, 0));
m_childLayer->setIsDrawable(true);
- m_childLayer->setPosition(IntPoint(2, 2));
- m_childLayer->setBounds(IntSize(10, 10));
+ m_childLayer->setPosition(gfx::Point(2, 2));
+ m_childLayer->setBounds(gfx::Size(10, 10));
m_childLayer->setAnchorPoint(FloatPoint(0, 0));
m_layerTreeHost->setRootLayer(m_rootLayer);
@@ -1320,15 +1322,15 @@ public:
ASSERT_EQ(1u, impl->rootLayer()->children().size());
// Device viewport is scaled.
- EXPECT_EQ(IntSize(40, 40), impl->layoutViewportSize());
- EXPECT_EQ(IntSize(60, 60), impl->deviceViewportSize());
+ EXPECT_EQ(gfx::Size(40, 40), impl->layoutViewportSize());
+ EXPECT_EQ(gfx::Size(60, 60), impl->deviceViewportSize());
LayerImpl* root = impl->rootLayer();
LayerImpl* child = impl->rootLayer()->children()[0];
// Positions remain in layout pixels.
- EXPECT_EQ(IntPoint(0, 0), root->position());
- EXPECT_EQ(IntPoint(2, 2), child->position());
+ EXPECT_EQ(gfx::Point(0, 0), root->position());
+ EXPECT_EQ(gfx::Point(2, 2), child->position());
// Compute all the layer transforms for the frame.
MockLayerTreeHostImpl::LayerList renderSurfaceLayerList;
@@ -1340,11 +1342,11 @@ public:
ASSERT_EQ(2u, root->renderSurface()->layerList().size());
// The root render surface is the size of the viewport.
- EXPECT_RECT_EQ(IntRect(0, 0, 60, 60), root->renderSurface()->contentRect());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 60, 60), root->renderSurface()->contentRect());
// The content bounds of the child should be scaled.
- IntSize childBoundsScaled = child->bounds();
- childBoundsScaled.scale(1.5);
+ gfx::Size childBoundsScaled = child->bounds();
+ childBoundsScaled = gfx::ToRoundedSize(childBoundsScaled.Scale(1.5));
EXPECT_EQ(childBoundsScaled, child->contentBounds());
WebTransformationMatrix scaleTransform;
@@ -1399,7 +1401,7 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->setRootLayer(m_layer);
- m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
postSetNeedsCommitToMainThread();
postSetNeedsRedrawToMainThread();
@@ -1473,7 +1475,7 @@ TEST_F(LayerTreeHostTestAtomicCommit, runMultiThread)
runTest(true);
}
-static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+static void setLayerPropertiesForTesting(Layer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
{
layer->removeAllChildren();
if (parent)
@@ -1499,11 +1501,11 @@ public:
virtual void beginTest() OVERRIDE
{
m_layerTreeHost->setRootLayer(m_parent);
- m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
WebTransformationMatrix identityMatrix;
- setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(10, 20), true);
- setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 10), IntSize(10, 10), false);
+ setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(10, 20), true);
+ setLayerPropertiesForTesting(m_child.get(), m_parent.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 10), gfx::Size(10, 10), false);
postSetNeedsCommitToMainThread();
postSetNeedsRedrawToMainThread();
@@ -1590,15 +1592,15 @@ public:
break;
case 2:
// Damage part of layers.
- m_parent->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
- m_child->setNeedsDisplayRect(FloatRect(0, 0, 5, 5));
+ m_parent->setNeedsDisplayRect(gfx::RectF(0, 0, 5, 5));
+ m_child->setNeedsDisplayRect(gfx::RectF(0, 0, 5, 5));
break;
case 3:
m_child->setNeedsDisplay();
- m_layerTreeHost->setViewportSize(IntSize(10, 10), IntSize(10, 10));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 10), gfx::Size(10, 10));
break;
case 4:
- m_layerTreeHost->setViewportSize(IntSize(10, 20), IntSize(10, 20));
+ m_layerTreeHost->setViewportSize(gfx::Size(10, 20), gfx::Size(10, 20));
break;
default:
NOTREACHED();
@@ -1645,7 +1647,7 @@ private:
Region m_occludedScreenSpace;
};
-static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const FloatPoint& anchor, const FloatPoint& position, const IntSize& bounds, bool opaque)
+static void setTestLayerPropertiesForTesting(TestLayer* layer, Layer* parent, const WebTransformationMatrix& transform, const gfx::PointF& anchor, const gfx::PointF& position, const gfx::Size& bounds, bool opaque)
{
setLayerPropertiesForTesting(layer, parent, transform, anchor, position, bounds, opaque);
layer->clearOccludedScreenSpace();
@@ -1675,9 +1677,9 @@ public:
// positioned on the screen.
// The child layer is rotated and the grandChild is opaque, but clipped to the child and rootLayer
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), false);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), false);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
@@ -1686,75 +1688,75 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer is opaque, then it adds to the occlusion seen by the rootLayer.
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Add a second child to the root layer and the regions should merge
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(70, 20), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(70, 20), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 20, 170, 180), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
// Move the second child to be sure.
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
m_layerTreeHost->setRootLayer(rootLayer);
m_layerTreeHost->setViewportSize(rootLayer->bounds(), rootLayer->bounds());
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 170, 170), child2->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 30, 190, 170), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(2u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a mask on it, then it shouldn't contribute to occlusion on stuff below it
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
+ setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
child->setMaskLayer(mask.get());
@@ -1763,20 +1765,20 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer with a mask is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
- setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
+ setLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
child->setMaskLayer(mask.get());
@@ -1785,20 +1787,20 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a non-opaque drawOpacity, then it shouldn't contribute to occlusion on stuff below it
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
child->setMaskLayer(0);
child->setOpacity(0.5);
@@ -1808,20 +1810,20 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer with non-opaque drawOpacity is below child2, then child2 should contribute to occlusion on everything, and child shouldn't contribute to the rootLayer
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
child->setMaskLayer(0);
child->setOpacity(0.5);
@@ -1831,13 +1833,13 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Kill the layerTreeHost immediately.
@@ -1876,10 +1878,10 @@ public:
// If the child layer has a filter that changes alpha values, and is below child2, then child2 should contribute to occlusion on everything,
// and child shouldn't contribute to the rootLayer
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
{
WebFilterOperations filters;
@@ -1894,21 +1896,21 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(1u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 40, 190, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(2u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// If the child layer has a filter that moves pixels/changes alpha, and is below child2, then child should not inherit occlusion from outside its subtree,
// and should not contribute to the rootLayer
- setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
- setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, FloatPoint(0, 0), FloatPoint(30, 30), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 10), IntSize(500, 500), true);
- setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(10, 70), IntSize(500, 500), true);
+ setTestLayerPropertiesForTesting(rootLayer.get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
+ setTestLayerPropertiesForTesting(child.get(), rootLayer.get(), childTransform, gfx::PointF(0, 0), gfx::PointF(30, 30), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(grandChild.get(), child.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 10), gfx::Size(500, 500), true);
+ setTestLayerPropertiesForTesting(child2.get(), rootLayer.get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(10, 70), gfx::Size(500, 500), true);
{
WebFilterOperations filters;
@@ -1921,13 +1923,13 @@ public:
m_layerTreeHost->updateLayers(queue, std::numeric_limits<size_t>::max());
m_layerTreeHost->commitComplete();
- EXPECT_RECT_EQ(IntRect(), child2->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(cc::IntRect(), child2->occludedScreenSpace().bounds());
EXPECT_EQ(0u, child2->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(), grandChild->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(cc::IntRect(), grandChild->occludedScreenSpace().bounds());
EXPECT_EQ(0u, grandChild->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(cc::IntRect(30, 40, 170, 160), child->occludedScreenSpace().bounds());
EXPECT_EQ(1u, child->occludedScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
+ EXPECT_RECT_EQ(cc::IntRect(10, 70, 190, 130), rootLayer->occludedScreenSpace().bounds());
EXPECT_EQ(1u, rootLayer->occludedScreenSpace().rects().size());
// Kill the layerTreeHost immediately.
@@ -1962,10 +1964,10 @@ public:
for (int i = 0; i < numSurfaces; ++i) {
layers.push_back(TestLayer::create());
if (!i) {
- setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(200, 200), true);
+ setTestLayerPropertiesForTesting(layers.back().get(), 0, identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(200, 200), true);
layers.back()->createRenderSurface();
} else {
- setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(200-i, 200-i), true);
+ setTestLayerPropertiesForTesting(layers.back().get(), layers[layers.size()-2].get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(1, 1), gfx::Size(200-i, 200-i), true);
layers.back()->setMasksToBounds(true);
layers.back()->setReplicaLayer(replica.get()); // Make it have a RenderSurfaceImpl
}
@@ -1973,7 +1975,7 @@ public:
for (int i = 1; i < numSurfaces; ++i) {
children.push_back(TestLayer::create());
- setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false);
+ setTestLayerPropertiesForTesting(children.back().get(), layers[i].get(), identityMatrix, gfx::PointF(0, 0), gfx::PointF(0, 0), gfx::Size(500, 500), false);
}
m_layerTreeHost->setRootLayer(layers[0].get());
@@ -1984,7 +1986,7 @@ public:
m_layerTreeHost->commitComplete();
for (int i = 0; i < numSurfaces-1; ++i) {
- IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
+ cc::IntRect expectedOcclusion(i+1, i+1, 200-i-1, 200-i-1);
EXPECT_RECT_EQ(expectedOcclusion, layers[i]->occludedScreenSpace().bounds());
EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size());
@@ -3074,9 +3076,9 @@ public:
m_layerTreeHost->rootLayer()->setBounds(IntSize(10, 10));
m_contentLayer = ContentLayer::create(&m_mockDelegate);
- m_contentLayer->setBounds(IntSize(10, 10));
- m_contentLayer->setPosition(FloatPoint(0, 0));
- m_contentLayer->setAnchorPoint(FloatPoint(0, 0));
+ m_contentLayer->setBounds(gfx::Size(10, 10));
+ m_contentLayer->setPosition(gfx::PointF(0, 0));
+ m_contentLayer->setAnchorPoint(gfx::PointF(0, 0));
m_contentLayer->setIsDrawable(true);
m_layerTreeHost->rootLayer()->addChild(m_contentLayer);
@@ -3134,19 +3136,19 @@ public:
m.translate(250, 360);
m.scale(2);
- IntPoint point(400, 550);
- IntPoint transformedPoint;
+ gfx::Point point(400, 550);
+ gfx::Point transformedPoint;
// Unit transform, no change expected.
m_layerTreeHost->setImplTransform(WebTransformationMatrix());
- transformedPoint = roundedIntPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
+ transformedPoint = gfx::ToRoundedPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
EXPECT_EQ(point.x(), transformedPoint.x());
EXPECT_EQ(point.y(), transformedPoint.y());
m_layerTreeHost->setImplTransform(m);
// Apply m^(-1): 138 = 400/2 - 250/4; 185 = 550/2 - 360/4.
- transformedPoint = roundedIntPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
+ transformedPoint = gfx::ToRoundedPoint(m_layerTreeHost->adjustEventPointForPinchZoom(point));
EXPECT_EQ(138, transformedPoint.x());
EXPECT_EQ(185, transformedPoint.y());
endTest();
diff --git a/cc/layer_unittest.cc b/cc/layer_unittest.cc
index a4a0725..f1a64e8 100644
--- a/cc/layer_unittest.cc
+++ b/cc/layer_unittest.cc
@@ -419,12 +419,12 @@ TEST_F(LayerTest, checkSetNeedsDisplayCausesCorrectBehavior)
testLayer->setLayerTreeHost(m_layerTreeHost.get());
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setIsDrawable(true));
- IntSize testBounds = IntSize(501, 508);
+ gfx::Size testBounds = gfx::Size(501, 508);
- FloatRect dirty1 = FloatRect(10, 15, 1, 2);
- FloatRect dirty2 = FloatRect(20, 25, 3, 4);
- FloatRect emptyDirtyRect = FloatRect(40, 45, 0, 0);
- FloatRect outOfBoundsDirtyRect = FloatRect(400, 405, 500, 502);
+ gfx::RectF dirty1 = gfx::RectF(10, 15, 1, 2);
+ gfx::RectF dirty2 = gfx::RectF(20, 25, 3, 4);
+ gfx::RectF emptyDirtyRect = gfx::RectF(40, 45, 0, 0);
+ gfx::RectF outOfBoundsDirtyRect = gfx::RectF(400, 405, 500, 502);
// Before anything, testLayer should not be dirty.
EXPECT_FALSE(testLayer->needsDisplay());
@@ -486,25 +486,25 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior)
EXPECT_FALSE(testLayer->needsDisplay());
// Test properties that should not call needsDisplay and needsCommit when changed.
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50)));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(gfx::Rect(0, 0, 40, 50)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUseLCDText(true));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setRenderTarget(0));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawTransform(WebTransformationMatrix()));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setScreenSpaceTransform(WebTransformationMatrix()));
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(IntRect(4, 5, 6, 7)));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawableContentRect(gfx::Rect(4, 5, 6, 7)));
EXPECT_FALSE(testLayer->needsDisplay());
// Next, test properties that should call setNeedsCommit (but not setNeedsDisplay)
// All properties need to be set to new values in order for setNeedsCommit to be called.
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(FloatPoint(1.23f, 4.56f)));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPoint(gfx::PointF(1.23f, 4.56f)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setAnchorPointZ(0.7f));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBackgroundColor(SK_ColorLTGRAY));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMasksToBounds(true));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setMaskLayer(dummyLayer.get()));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setOpacity(0.5));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setContentsOpaque(true));
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(FloatPoint(4, 9)));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setPosition(gfx::PointF(4, 9)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setReplicaLayer(dummyLayer.get()));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setSublayerTransform(WebTransformationMatrix(0, 0, 0, 0, 0, 0)));
EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setScrollable(true));
@@ -522,7 +522,7 @@ TEST_F(LayerTest, checkPropertyChangeCausesCorrectBehavior)
EXPECT_FALSE(testLayer->needsDisplay());
// Test properties that should call setNeedsDisplay and setNeedsCommit
- EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(IntSize(5, 10)));
+ EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(1, testLayer->setBounds(gfx::Size(5, 10)));
EXPECT_TRUE(testLayer->needsDisplay());
}
@@ -533,20 +533,20 @@ TEST_F(LayerTest, verifyPushPropertiesAccumulatesUpdateRect)
scoped_refptr<Layer> testLayer = Layer::create();
scoped_ptr<LayerImpl> implLayer = LayerImpl::create(1);
- testLayer->setNeedsDisplayRect(FloatRect(FloatPoint::zero(), FloatSize(5, 5)));
+ testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)));
testLayer->pushPropertiesTo(implLayer.get());
- EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(5, 5)), implLayer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(5, 5)), implLayer->updateRect());
// The LayerImpl's updateRect should be accumulated here, since we did not do anything to clear it.
- testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
+ testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
testLayer->pushPropertiesTo(implLayer.get());
- EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint::zero(), FloatSize(15, 15)), implLayer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(), gfx::SizeF(15, 15)), implLayer->updateRect());
// If we do clear the LayerImpl side, then the next updateRect should be fresh without accumulation.
implLayer->resetAllChangeTrackingForSubtree();
- testLayer->setNeedsDisplayRect(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)));
+ testLayer->setNeedsDisplayRect(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)));
testLayer->pushPropertiesTo(implLayer.get());
- EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(10, 10), FloatSize(5, 5)), implLayer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(10, 10), gfx::SizeF(5, 5)), implLayer->updateRect());
}
class FakeLayerImplTreeHost : public LayerTreeHost {
@@ -792,9 +792,9 @@ TEST(LayerTestWithoutFixture, setBoundsTriggersSetNeedsRedrawAfterGettingNonEmpt
{
scoped_refptr<MockLayer> layer(new MockLayer);
EXPECT_FALSE(layer->needsDisplay());
- layer->setBounds(IntSize(0, 10));
+ layer->setBounds(gfx::Size(0, 10));
EXPECT_FALSE(layer->needsDisplay());
- layer->setBounds(IntSize(10, 10));
+ layer->setBounds(gfx::Size(10, 10));
EXPECT_TRUE(layer->needsDisplay());
}
diff --git a/cc/math_util.cc b/cc/math_util.cc
index 66fcc7c..bf77b497 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -6,9 +6,11 @@
#include "cc/math_util.h"
-#include "FloatPoint.h"
#include "FloatQuad.h"
-#include "IntRect.h"
+#include "FloatSize.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_conversions.h"
+#include "ui/gfx/rect_f.h"
#include <cmath>
#include <public/WebTransformationMatrix.h>
@@ -16,7 +18,7 @@ using WebKit::WebTransformationMatrix;
namespace cc {
-static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const FloatPoint& p)
+static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const gfx::PointF& p)
{
// In this case, the layer we are trying to project onto is perpendicular to ray
// (point p and z-axis direction) that we are trying to project. This happens when the
@@ -82,7 +84,7 @@ static HomogeneousCoordinate computeClippedPointForEdge(const HomogeneousCoordin
return HomogeneousCoordinate(x, y, z, w);
}
-static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& ymin, float& ymax, const FloatPoint& p)
+static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& ymin, float& ymax, const gfx::PointF& p)
{
xmin = std::min(p.x(), xmin);
xmax = std::max(p.x(), xmax);
@@ -90,27 +92,27 @@ static inline void expandBoundsToIncludePoint(float& xmin, float& xmax, float& y
ymax = std::max(p.y(), ymax);
}
-static inline void addVertexToClippedQuad(const FloatPoint& newVertex, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad)
+static inline void addVertexToClippedQuad(const gfx::PointF& newVertex, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
{
clippedQuad[numVerticesInClippedQuad] = newVertex;
numVerticesInClippedQuad++;
}
-IntRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const IntRect& srcRect)
+gfx::Rect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const gfx::Rect& srcRect)
{
- return enclosingIntRect(mapClippedRect(transform, FloatRect(srcRect)));
+ return gfx::ToEnclosingRect(mapClippedRect(transform, gfx::RectF(srcRect)));
}
-FloatRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect)
+gfx::RectF MathUtil::mapClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
{
if (transform.isIdentityOrTranslation()) {
- FloatRect mappedRect(srcRect);
- mappedRect.move(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
+ gfx::RectF mappedRect(srcRect);
+ mappedRect.Offset(static_cast<float>(transform.m41()), static_cast<float>(transform.m42()));
return mappedRect;
}
// Apply the transform, but retain the result in homogeneous coordinates.
- FloatQuad q = FloatQuad(FloatRect(srcRect));
+ FloatQuad q = FloatQuad(gfx::RectF(srcRect));
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, q.p1());
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, q.p2());
HomogeneousCoordinate h3 = mapHomogeneousPoint(transform, q.p3());
@@ -119,10 +121,10 @@ FloatRect MathUtil::mapClippedRect(const WebTransformationMatrix& transform, con
return computeEnclosingClippedRect(h1, h2, h3, h4);
}
-FloatRect MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const FloatRect& srcRect)
+gfx::RectF MathUtil::projectClippedRect(const WebTransformationMatrix& transform, const gfx::RectF& srcRect)
{
// Perform the projection, but retain the result in homogeneous coordinates.
- FloatQuad q = FloatQuad(FloatRect(srcRect));
+ FloatQuad q = FloatQuad(gfx::RectF(srcRect));
HomogeneousCoordinate h1 = projectHomogeneousPoint(transform, q.p1());
HomogeneousCoordinate h2 = projectHomogeneousPoint(transform, q.p2());
HomogeneousCoordinate h3 = projectHomogeneousPoint(transform, q.p3());
@@ -131,7 +133,7 @@ FloatRect MathUtil::projectClippedRect(const WebTransformationMatrix& transform,
return computeEnclosingClippedRect(h1, h2, h3, h4);
}
-void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad)
+void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad)
{
HomogeneousCoordinate h1 = mapHomogeneousPoint(transform, srcQuad.p1());
HomogeneousCoordinate h2 = mapHomogeneousPoint(transform, srcQuad.p2());
@@ -169,10 +171,10 @@ void MathUtil::mapClippedQuad(const WebTransformationMatrix& transform, const Fl
DCHECK(numVerticesInClippedQuad <= 8);
}
-FloatRect MathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices)
+gfx::RectF MathUtil::computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices)
{
if (numVertices < 2)
- return FloatRect();
+ return gfx::RectF();
float xmin = std::numeric_limits<float>::max();
float xmax = -std::numeric_limits<float>::max();
@@ -182,13 +184,13 @@ FloatRect MathUtil::computeEnclosingRectOfVertices(FloatPoint vertices[], int nu
for (int i = 0; i < numVertices; ++i)
expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, vertices[i]);
- return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin));
+ return gfx::RectF(gfx::PointF(xmin, ymin), gfx::SizeF(xmax - xmin, ymax - ymin));
}
-FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4)
+gfx::RectF MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4)
{
// This function performs clipping as necessary and computes the enclosing 2d
- // FloatRect of the vertices. Doing these two steps simultaneously allows us to avoid
+ // gfx::RectF of the vertices. Doing these two steps simultaneously allows us to avoid
// the overhead of storing an unknown number of clipped vertices.
// If no vertices on the quad are clipped, then we can simply return the enclosing rect directly.
@@ -200,7 +202,7 @@ FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1,
bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped();
if (everythingClipped)
- return FloatRect();
+ return gfx::RectF();
float xmin = std::numeric_limits<float>::max();
@@ -232,7 +234,7 @@ FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1,
if (h4.shouldBeClipped() ^ h1.shouldBeClipped())
expandBoundsToIncludePoint(xmin, xmax, ymin, ymax, computeClippedPointForEdge(h4, h1).cartesianPoint2d());
- return FloatRect(FloatPoint(xmin, ymin), FloatSize(xmax - xmin, ymax - ymin));
+ return gfx::RectF(gfx::PointF(xmin, ymin), gfx::SizeF(xmax - xmin, ymax - ymin));
}
FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const FloatQuad& q, bool& clipped)
@@ -255,9 +257,9 @@ FloatQuad MathUtil::mapQuad(const WebTransformationMatrix& transform, const Floa
return FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
}
-FloatPoint MathUtil::mapPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped)
+gfx::PointF MathUtil::mapPoint(const WebTransformationMatrix& transform, const gfx::PointF& p, bool& clipped)
{
- HomogeneousCoordinate h = mapHomogeneousPoint(transform, p);
+ HomogeneousCoordinate h = mapHomogeneousPoint(transform, cc::FloatPoint(p));
if (h.w > 0) {
clipped = false;
@@ -269,7 +271,7 @@ FloatPoint MathUtil::mapPoint(const WebTransformationMatrix& transform, const Fl
// Avoid dividing by w if w == 0.
if (!h.w)
- return FloatPoint();
+ return gfx::PointF();
// This return value will be invalid because clipped == true, but (1) users of this
// code should be ignoring the return value when clipped == true anyway, and (2) this
@@ -317,7 +319,7 @@ FloatQuad MathUtil::projectQuad(const WebTransformationMatrix& transform, const
return projectedQuad;
}
-FloatPoint MathUtil::projectPoint(const WebTransformationMatrix& transform, const FloatPoint& p, bool& clipped)
+gfx::PointF MathUtil::projectPoint(const WebTransformationMatrix& transform, const gfx::PointF& p, bool& clipped)
{
HomogeneousCoordinate h = projectHomogeneousPoint(transform, p);
@@ -332,7 +334,7 @@ FloatPoint MathUtil::projectPoint(const WebTransformationMatrix& transform, cons
// Avoid dividing by w if w == 0.
if (!h.w)
- return FloatPoint();
+ return gfx::PointF();
// This return value will be invalid because clipped == true, but (1) users of this
// code should be ignoring the return value when clipped == true anyway, and (2) this
@@ -367,13 +369,13 @@ static inline float scaleOnAxis(double a, double b, double c)
return std::sqrt(a * a + b * b + c * c);
}
-FloatPoint MathUtil::computeTransform2dScaleComponents(const WebTransformationMatrix& transform)
+gfx::Vector2dF MathUtil::computeTransform2dScaleComponents(const WebTransformationMatrix& transform)
{
if (transform.hasPerspective())
- return FloatPoint(1, 1);
+ return gfx::Vector2dF(1, 1);
float xScale = scaleOnAxis(transform.m11(), transform.m12(), transform.m13());
float yScale = scaleOnAxis(transform.m21(), transform.m22(), transform.m23());
- return FloatPoint(xScale, yScale);
+ return gfx::Vector2dF(xScale, yScale);
}
float MathUtil::smallestAngleBetweenVectors(const FloatSize& v1, const FloatSize& v2)
diff --git a/cc/math_util.h b/cc/math_util.h
index 199c851..942652f 100644
--- a/cc/math_util.h
+++ b/cc/math_util.h
@@ -6,18 +6,22 @@
#define CCMathUtil_h
#include "base/logging.h"
-#include "FloatPoint.h"
+#include "ui/gfx/point_f.h"
#include "FloatPoint3D.h"
namespace WebKit {
class WebTransformationMatrix;
}
+namespace gfx {
+class Rect;
+class RectF;
+}
+
namespace cc {
-class IntRect;
-class FloatRect;
class FloatQuad;
+class FloatSize;
struct HomogeneousCoordinate {
HomogeneousCoordinate(double newX, double newY, double newZ, double newW)
@@ -33,15 +37,15 @@ struct HomogeneousCoordinate {
return w <= 0;
}
- FloatPoint cartesianPoint2d() const
+ gfx::PointF cartesianPoint2d() const
{
if (w == 1)
- return FloatPoint(x, y);
+ return gfx::PointF(x, y);
// For now, because this code is used privately only by MathUtil, it should never be called when w == 0, and we do not yet need to handle that case.
DCHECK(w);
double invW = 1.0 / w;
- return FloatPoint(x * invW, y * invW);
+ return gfx::PointF(x * invW, y * invW);
}
FloatPoint3D cartesianPoint3d() const
@@ -72,30 +76,30 @@ public:
//
// These functions return the axis-aligned rect that encloses the correctly clipped,
// transformed polygon.
- static IntRect mapClippedRect(const WebKit::WebTransformationMatrix&, const IntRect&);
- static FloatRect mapClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
- static FloatRect projectClippedRect(const WebKit::WebTransformationMatrix&, const FloatRect&);
+ static gfx::Rect mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::Rect&);
+ static gfx::RectF mapClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
+ static gfx::RectF projectClippedRect(const WebKit::WebTransformationMatrix&, const gfx::RectF&);
// Returns an array of vertices that represent the clipped polygon. After returning, indexes from
// 0 to numVerticesInClippedQuad are valid in the clippedQuad array. Note that
// numVerticesInClippedQuad may be zero, which means the entire quad was clipped, and
// none of the vertices in the array are valid.
- static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, FloatPoint clippedQuad[8], int& numVerticesInClippedQuad);
+ static void mapClippedQuad(const WebKit::WebTransformationMatrix&, const FloatQuad& srcQuad, gfx::PointF clippedQuad[8], int& numVerticesInClippedQuad);
- static FloatRect computeEnclosingRectOfVertices(FloatPoint vertices[], int numVertices);
- static FloatRect computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
+ static gfx::RectF computeEnclosingRectOfVertices(gfx::PointF vertices[], int numVertices);
+ static gfx::RectF computeEnclosingClippedRect(const HomogeneousCoordinate& h1, const HomogeneousCoordinate& h2, const HomogeneousCoordinate& h3, const HomogeneousCoordinate& h4);
// NOTE: These functions do not do correct clipping against w = 0 plane, but they
// correctly detect the clipped condition via the boolean clipped.
static FloatQuad mapQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
- static FloatPoint mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
+ static gfx::PointF mapPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
static FloatPoint3D mapPoint(const WebKit::WebTransformationMatrix&, const FloatPoint3D&, bool& clipped);
static FloatQuad projectQuad(const WebKit::WebTransformationMatrix&, const FloatQuad&, bool& clipped);
- static FloatPoint projectPoint(const WebKit::WebTransformationMatrix&, const FloatPoint&, bool& clipped);
+ static gfx::PointF projectPoint(const WebKit::WebTransformationMatrix&, const gfx::PointF&, bool& clipped);
static void flattenTransformTo2d(WebKit::WebTransformationMatrix&);
- static FloatPoint computeTransform2dScaleComponents(const WebKit::WebTransformationMatrix&);
+ static gfx::Vector2dF computeTransform2dScaleComponents(const WebKit::WebTransformationMatrix&);
// Returns the smallest angle between the given two vectors in degrees. Neither vector is
// assumed to be normalized.
diff --git a/cc/math_util_unittest.cc b/cc/math_util_unittest.cc
index c342834..0d2a677 100644
--- a/cc/math_util_unittest.cc
+++ b/cc/math_util_unittest.cc
@@ -6,10 +6,11 @@
#include "cc/math_util.h"
-#include "FloatRect.h"
#include "cc/test/geometry_test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
#include <public/WebTransformationMatrix.h>
using namespace cc;
@@ -90,12 +91,12 @@ TEST(MathUtilTest, verifyProjectionOfPerpendicularPlane)
transform.makeIdentity();
transform.setM33(0);
- FloatRect rect = FloatRect(0, 0, 1, 1);
- FloatRect projectedRect = MathUtil::projectClippedRect(transform, rect);
+ gfx::RectF rect = gfx::RectF(0, 0, 1, 1);
+ gfx::RectF projectedRect = MathUtil::projectClippedRect(transform, rect);
EXPECT_EQ(0, projectedRect.x());
EXPECT_EQ(0, projectedRect.y());
- EXPECT_TRUE(projectedRect.isEmpty());
+ EXPECT_TRUE(projectedRect.IsEmpty());
}
TEST(MathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds)
@@ -109,27 +110,27 @@ TEST(MathUtilTest, verifyEnclosingClippedRectUsesCorrectInitialBounds)
// However, if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to
// numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing
// clipped rect will be computed incorrectly.
- FloatRect result = MathUtil::computeEnclosingClippedRect(h1, h2, h3, h4);
+ gfx::RectF result = MathUtil::computeEnclosingClippedRect(h1, h2, h3, h4);
- EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(-100, -100), gfx::SizeF(90, 90)), result);
}
TEST(MathUtilTest, verifyEnclosingRectOfVerticesUsesCorrectInitialBounds)
{
- FloatPoint vertices[3];
+ gfx::PointF vertices[3];
int numVertices = 3;
- vertices[0] = FloatPoint(-10, -100);
- vertices[1] = FloatPoint(-100, -10);
- vertices[2] = FloatPoint(-30, -30);
+ vertices[0] = gfx::PointF(-10, -100);
+ vertices[1] = gfx::PointF(-100, -10);
+ vertices[2] = gfx::PointF(-30, -30);
// The bounds of the enclosing rect should be -100 to -10 for both x and y. However,
// if there is a bug where the initial xmin/xmax/ymin/ymax are initialized to
// numeric_limits<float>::min() (which is zero, not -flt_max) then the enclosing
// clipped rect will be computed incorrectly.
- FloatRect result = MathUtil::computeEnclosingRectOfVertices(vertices, numVertices);
+ gfx::RectF result = MathUtil::computeEnclosingRectOfVertices(vertices, numVertices);
- EXPECT_FLOAT_RECT_EQ(FloatRect(FloatPoint(-100, -100), FloatSize(90, 90)), result);
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(gfx::PointF(-100, -100), gfx::SizeF(90, 90)), result);
}
TEST(MathUtilTest, smallestAngleBetweenVectors)
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index abe2661..b2326d4 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -133,7 +133,7 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
for (size_t i = 0; i < rects.size(); ++i) {
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(rects[i])));
- if (!surface->clipRect().isEmpty())
+ if (!surface->clipRect().IsEmpty())
transformedRect.Intersect(surface->clipRect());
transformedRegion.unite(cc::IntRect(transformedRect));
}
@@ -185,7 +185,7 @@ static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const gfx:
return;
gfx::Rect boundsInTarget = gfx::ToEnclosingRect(MathUtil::mapClippedRect(surfaceTransform, cc::FloatRect(surfaceRect)));
- if (!contributingLayer->renderSurface()->clipRect().isEmpty())
+ if (!contributingLayer->renderSurface()->clipRect().IsEmpty())
boundsInTarget.Intersect(contributingLayer->renderSurface()->clipRect());
int outsetTop, outsetRight, outsetBottom, outsetLeft;
@@ -248,7 +248,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(con
template<typename LayerType>
static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const gfx::Rect& clipRectInTarget, const gfx::Size& minimumTrackingSize, std::vector<gfx::Rect>* occludingScreenSpaceRects)
{
- DCHECK(layer->visibleContentRect().contains(opaqueContents.bounds()));
+ DCHECK(layer->visibleContentRect().Contains(cc::IntRect(opaqueContents.bounds())));
bool clipped;
FloatQuad visibleTransformedQuad = MathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped);
@@ -308,7 +308,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
{
- gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, cc::FloatRect(contentRect));
+ gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
// Take the gfx::ToEnclosingRect, as we want to include partial pixels in the test.
gfx::Rect targetRect = gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget);
return targetRect.IsEmpty() || occlusion.contains(cc::IntRect(targetRect));
@@ -358,9 +358,9 @@ static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRec
return contentRect;
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
- FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, cc::FloatRect(contentRect));
+ gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
gfx::Rect shrunkRect = rectSubtractRegion(gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget), occlusion);
- gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), cc::FloatRect(shrunkRect)));
+ gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), gfx::RectF(shrunkRect)));
// The rect back in content space is a bounding box and may extend outside of the original contentRect, so clamp it to the contentRectBounds.
return gfx::IntersectRects(unoccludedRect, contentRect);
}
diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc
index cab12b1..e59c0ab 100644
--- a/cc/occlusion_tracker_unittest.cc
+++ b/cc/occlusion_tracker_unittest.cc
@@ -41,10 +41,10 @@ public:
virtual Region visibleContentOpaqueRegion() const OVERRIDE
{
if (m_overrideOpaqueContentsRect)
- return intersection(m_opaqueContentsRect, visibleContentRect());
+ return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect()));
return Layer::visibleContentOpaqueRegion();
}
- void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
+ void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
{
m_overrideOpaqueContentsRect = true;
m_opaqueContentsRect = opaqueContentsRect;
@@ -56,7 +56,7 @@ private:
}
bool m_overrideOpaqueContentsRect;
- IntRect m_opaqueContentsRect;
+ gfx::Rect m_opaqueContentsRect;
};
class TestContentLayerImpl : public LayerImpl {
@@ -71,10 +71,10 @@ public:
virtual Region visibleContentOpaqueRegion() const OVERRIDE
{
if (m_overrideOpaqueContentsRect)
- return intersection(m_opaqueContentsRect, visibleContentRect());
+ return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect()));
return LayerImpl::visibleContentOpaqueRegion();
}
- void setOpaqueContentsRect(const IntRect& opaqueContentsRect)
+ void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect)
{
m_overrideOpaqueContentsRect = true;
m_opaqueContentsRect = opaqueContentsRect;
@@ -82,7 +82,7 @@ public:
private:
bool m_overrideOpaqueContentsRect;
- IntRect m_opaqueContentsRect;
+ gfx::Rect m_opaqueContentsRect;
};
static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return layer->drawTransformIsAnimating(); }
@@ -200,7 +200,7 @@ protected:
LayerTreeHost::setNeedsFilterContext(false);
}
- typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ typename Types::ContentLayerType* createRoot(const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
typename Types::ContentLayerType* layerPtr = layer.get();
@@ -211,7 +211,7 @@ protected:
return layerPtr;
}
- typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ typename Types::LayerType* createLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
typename Types::LayerPtrType layer(Types::createLayer());
typename Types::LayerType* layerPtr = layer.get();
@@ -220,7 +220,7 @@ protected:
return layerPtr;
}
- typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ typename Types::LayerType* createSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
typename Types::LayerType* layer = createLayer(parent, transform, position, bounds);
WebFilterOperations filters;
@@ -229,7 +229,7 @@ protected:
return layer;
}
- typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
+ typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds, bool opaque)
{
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
typename Types::ContentLayerType* layerPtr = layer.get();
@@ -240,16 +240,16 @@ protected:
else {
layerPtr->setContentsOpaque(false);
if (opaque)
- layerPtr->setOpaqueContentsRect(IntRect(IntPoint(), bounds));
+ layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds));
else
- layerPtr->setOpaqueContentsRect(IntRect());
+ layerPtr->setOpaqueContentsRect(gfx::Rect());
}
parent->addChild(Types::passLayerPtr(layer));
return layerPtr;
}
- typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ typename Types::LayerType* createReplicaLayer(typename Types::LayerType* owningLayer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
typename Types::ContentLayerType* layerPtr = layer.get();
@@ -258,7 +258,7 @@ protected:
return layerPtr;
}
- typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const IntSize& bounds)
+ typename Types::LayerType* createMaskLayer(typename Types::LayerType* owningLayer, const gfx::Size& bounds)
{
typename Types::ContentLayerPtrType layer(Types::createContentLayer());
typename Types::ContentLayerType* layerPtr = layer.get();
@@ -267,7 +267,7 @@ protected:
return layerPtr;
}
- typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds, bool opaque)
+ typename Types::ContentLayerType* createDrawingSurface(typename Types::LayerType* parent, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds, bool opaque)
{
typename Types::ContentLayerType* layer = createDrawingLayer(parent, transform, position, bounds, opaque);
WebFilterOperations filters;
@@ -355,7 +355,7 @@ protected:
const WebTransformationMatrix identityMatrix;
private:
- void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ void setBaseProperties(typename Types::LayerType* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
layer->setTransform(transform);
layer->setSublayerTransform(WebTransformationMatrix());
@@ -364,12 +364,12 @@ private:
layer->setBounds(bounds);
}
- void setProperties(Layer* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ void setProperties(Layer* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
setBaseProperties(layer, transform, position, bounds);
}
- void setProperties(LayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const IntSize& bounds)
+ void setProperties(LayerImpl* layer, const WebTransformationMatrix& transform, const FloatPoint& position, const gfx::Size& bounds)
{
setBaseProperties(layer, transform, position, bounds);
@@ -461,8 +461,8 @@ protected:
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), gfx::Size(500, 500), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -557,8 +557,8 @@ protected:
layerTransform.rotate(90);
layerTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -609,8 +609,8 @@ protected:
WebTransformationMatrix layerTransform;
layerTransform.translate(20, 20);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -675,11 +675,11 @@ protected:
childTransform.rotate(90);
childTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
child->setMasksToBounds(true);
- typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -795,14 +795,14 @@ protected:
childTransform.rotate(90);
childTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
child->setMasksToBounds(true);
- typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
// |child2| makes |parent|'s surface get considered by OcclusionTracker first, instead of |child|'s. This exercises different code in
// leaveToTargetRenderSurface, as the target surface has already been seen.
- typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true);
+ typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), gfx::Size(60, 20), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -911,10 +911,10 @@ protected:
WebTransformationMatrix layerTransform;
layerTransform.translate(10, 10);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
child->setMasksToBounds(true);
- typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), gfx::Size(500, 500), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -975,12 +975,12 @@ protected:
childTransform.rotate(90);
childTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), IntSize(500, 500));
+ typename Types::LayerType* child = this->createLayer(parent, childTransform, FloatPoint(30, 30), gfx::Size(500, 500));
child->setMasksToBounds(true);
- typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
- typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true);
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), gfx::Size(500, 60), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1065,12 +1065,12 @@ protected:
childTransform.rotate(90);
childTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), IntSize(10, 10));
- typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), IntSize(10, 10));
- typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
- typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
+ typename Types::LayerType* child1 = this->createSurface(parent, childTransform, FloatPoint(30, 30), gfx::Size(10, 10));
+ typename Types::LayerType* child2 = this->createSurface(parent, childTransform, FloatPoint(20, 40), gfx::Size(10, 10));
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1181,12 +1181,12 @@ protected:
child2Transform.rotate(90);
child2Transform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), IntSize(10, 10));
- typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), IntSize(10, 10), false);
- typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true);
- typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
+ typename Types::LayerType* child1 = this->createSurface(parent, child1Transform, FloatPoint(30, 20), gfx::Size(10, 10));
+ typename Types::LayerType* child2 = this->createDrawingSurface(parent, child2Transform, FloatPoint(20, 40), gfx::Size(10, 10), false);
+ typename Types::ContentLayerType* layer1 = this->createDrawingLayer(child1, this->identityMatrix, FloatPoint(-10, -20), gfx::Size(510, 510), true);
+ typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1285,11 +1285,11 @@ protected:
layerTransform.rotate(90);
layerTransform.translate(-250, -250);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
- typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
- typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
+ typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
+ typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
+ typename Types::ContentLayerType* opacityLayer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true);
WebFilterOperations filters;
filters.append(WebFilterOperation::createBlurFilter(10));
@@ -1365,9 +1365,9 @@ protected:
OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
- this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1397,10 +1397,10 @@ protected:
OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 170));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 170));
parent->setMasksToBounds(true);
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
- this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1430,10 +1430,10 @@ protected:
OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true);
- typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
- this->createMaskLayer(replica, IntSize(10, 10));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true);
+ typename Types::LayerType* replica = this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), gfx::Size());
+ this->createMaskLayer(replica, gfx::Size(10, 10));
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1463,8 +1463,8 @@ protected:
OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1508,8 +1508,8 @@ protected:
OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100));
@@ -1553,8 +1553,8 @@ protected:
OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1593,8 +1593,8 @@ protected:
OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
@@ -1633,8 +1633,8 @@ protected:
OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1677,8 +1677,8 @@ protected:
OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
@@ -1721,8 +1721,8 @@ protected:
OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1765,8 +1765,8 @@ protected:
OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
@@ -1809,8 +1809,8 @@ protected:
OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1834,8 +1834,8 @@ protected:
OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), false);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1871,13 +1871,13 @@ protected:
OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(200, 200), false);
this->calcDrawEtc(parent);
{
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100));
+ layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
@@ -1893,7 +1893,7 @@ protected:
{
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180));
+ layer->setOpaqueContentsRect(gfx::Rect(20, 20, 180, 180));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
@@ -1909,7 +1909,7 @@ protected:
{
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
- layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100));
+ layer->setOpaqueContentsRect(gfx::Rect(150, 150, 100, 100));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
@@ -1936,9 +1936,9 @@ protected:
WebTransformationMatrix transform;
transform.rotate3d(0, 30, 0);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -1969,9 +1969,9 @@ protected:
WebTransformationMatrix translationToBack;
translationToFront.translate3d(0, 0, -100);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* child1 = this->createDrawingLayer(parent, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true);
- typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* child1 = this->createDrawingLayer(parent, translationToBack, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, translationToFront, FloatPoint(50, 50), gfx::Size(100, 100), true);
parent->setPreserves3D(true);
this->calcDrawEtc(parent);
@@ -2002,9 +2002,9 @@ protected:
transform.rotate3d(1, 0, 0, -30);
transform.translate(-150, -150);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), gfx::Size(200, 200), true);
container->setPreserves3D(true);
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
@@ -2034,9 +2034,9 @@ protected:
transform.rotate3d(1, 0, 0, -167);
transform.translate(-250, -50);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 100));
- typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(0, 0), IntSize(500, 500), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 100));
+ typename Types::LayerType* container = this->createLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(0, 0), gfx::Size(500, 500), true);
container->setPreserves3D(true);
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
@@ -2065,8 +2065,8 @@ protected:
transform.translate3d(0, 0, 110);
transform.translate(-50, -50);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
parent->setPreserves3D(true);
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
@@ -2096,9 +2096,9 @@ protected:
transform.translate3d(0, 0, 99);
transform.translate(-50, -50);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100));
parent->setMasksToBounds(true);
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), IntSize(100, 100), true);
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, transform, FloatPoint(0, 0), gfx::Size(100, 100), true);
parent->setPreserves3D(true);
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
@@ -2125,13 +2125,13 @@ protected:
OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
- typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
- typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
- typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
+ typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
+ typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
addOpacityTransitionToController(*layer->layerAnimationController(), 10, 0, 1, false);
addOpacityTransitionToController(*surface->layerAnimationController(), 10, 0, 1, false);
@@ -2178,13 +2178,13 @@ protected:
OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
- typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
- typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false);
- typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
+ typename Types::ContentLayerType* parent2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false);
+ typename Types::ContentLayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true);
addOpacityTransitionToController(*layer->layerAnimationController(), 10, 1, 0, false);
addOpacityTransitionToController(*surface->layerAnimationController(), 10, 1, 0, false);
@@ -2231,12 +2231,12 @@ protected:
OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
- typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true);
- typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true);
- typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
- typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
+ typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true);
+ typename Types::ContentLayerType* surfaceChild = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true);
+ typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLayer(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
+ typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(50, 300), true);
addAnimatedTransformToController(*layer->layerAnimationController(), 10, 30, 0);
addAnimatedTransformToController(*surface->layerAnimationController(), 10, 30, 0);
@@ -2329,11 +2329,11 @@ protected:
surfaceTransform.scale(2);
surfaceTransform.translate(-150, -150);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(500, 500));
- typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false);
- typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false);
- surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
- surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 500));
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, surfaceTransform, FloatPoint(0, 0), gfx::Size(300, 300), false);
+ typename Types::ContentLayerType* surface2 = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(300, 300), false);
+ surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
+ surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200));
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2368,10 +2368,10 @@ protected:
OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300));
parent->setMasksToBounds(true);
- typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false);
- surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200));
+ typename Types::ContentLayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 300), false);
+ surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200));
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2394,10 +2394,10 @@ protected:
OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
- this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
- typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2433,10 +2433,10 @@ protected:
OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
- this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
- typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 110), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2473,11 +2473,11 @@ protected:
OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
- this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100));
- typename Types::LayerType* overSurface = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true);
- typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100));
+ typename Types::LayerType* overSurface = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(40, 100), true);
+ typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 100), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2517,10 +2517,10 @@ protected:
{
// This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
- typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true);
- typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 10), gfx::Size(100, 50), true);
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
@@ -2576,8 +2576,8 @@ protected:
{
// This test verifies that the top-most surface is considered occluded outside of its target's clipRect and outside the viewport rect.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(100, 200));
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 200));
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true);
this->calcDrawEtc(parent);
{
@@ -2616,11 +2616,11 @@ protected:
{
// This test verifies that the surface cliprect does not end up empty and clip away the entire unoccluded rect.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(80, 200));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(80, 200));
parent->setMasksToBounds(true);
- typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true);
- typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false);
- typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
+ typename Types::LayerType* surface = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true);
+ typename Types::LayerType* surfaceChild = this->createDrawingSurface(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), false);
+ typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true);
this->calcDrawEtc(parent);
TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
@@ -2672,14 +2672,14 @@ protected:
// Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
// appears at 50, 50 and the replica at 200, 50.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
- typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
- this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
- typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
- typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
- typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
- typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
- typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
+ typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
+ typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
+ typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
+ typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
+ typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
// Filters make the layer own a surface.
WebFilterOperations filters;
@@ -2792,12 +2792,12 @@ protected:
scaleByHalf.scale(0.5);
// Makes two surfaces that completely cover |parent|. The occlusion both above and below the filters will be reduced by each of them.
- typename Types::ContentLayerType* root = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(75, 75));
- typename Types::LayerType* parent = this->createSurface(root, scaleByHalf, FloatPoint(0, 0), IntSize(150, 150));
+ typename Types::ContentLayerType* root = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(75, 75));
+ typename Types::LayerType* parent = this->createSurface(root, scaleByHalf, FloatPoint(0, 0), gfx::Size(150, 150));
parent->setMasksToBounds(true);
- typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
- typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false);
- typename Types::LayerType* occludingLayerAbove = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true);
+ typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
+ typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false);
+ typename Types::LayerType* occludingLayerAbove = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(50, 50), true);
// Filters make the layers own surfaces.
WebFilterOperations filters;
@@ -2846,18 +2846,18 @@ protected:
void runMyTest()
{
// Make a surface and its replica, each 50x50, that are completely surrounded by opaque layers which are above them in the z-order.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
// We stick the filtered surface inside a clipping surface so that we can make sure the clip is honored when exposing pixels for
// the background filter.
- typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70));
+ typename Types::LayerType* clippingSurface = this->createSurface(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 70));
clippingSurface->setMasksToBounds(true);
- typename Types::LayerType* filteredSurface = this->createDrawingLayer(clippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false);
- this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(150, 0), IntSize());
- typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true);
- typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true);
- typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true);
- typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true);
- typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true);
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(clippingSurface, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(150, 0), gfx::Size());
+ typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true);
+ typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true);
+ typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true);
+ typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true);
+ typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true);
// Filters make the layer own a surface. This filter is large enough that it goes outside the bottom of the clippingSurface.
WebFilterOperations filters;
@@ -2973,11 +2973,11 @@ protected:
// Make a surface and its replica, each 50x50, with a smaller 30x30 layer centered below each.
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
// appears at 50, 50 and the replica at 200, 50.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
- typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true);
- typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true);
- typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
- this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
+ typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(60, 60), gfx::Size(30, 30), true);
+ typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(210, 60), gfx::Size(30, 30), true);
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
// Filters make the layer own a surface.
WebFilterOperations filters;
@@ -3023,11 +3023,11 @@ protected:
// Make a surface and its replica, each 50x50, that are completely occluded by opaque layers which are above them in the z-order.
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
// appears at 50, 50 and the replica at 200, 50.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
- typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
- this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
- typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true);
- typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
+ typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), true);
+ typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(50, 50), true);
// Filters make the layer own a surface.
WebFilterOperations filters;
@@ -3072,13 +3072,13 @@ protected:
// Make a surface and its replica, each 50x50, that are partially occluded by opaque layers which are above them in the z-order.
// The surface is scaled to test that the pixel moving is done in the target space, where the background filter is applied, but the surface
// appears at 50, 50 and the replica at 200, 50.
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(300, 150));
- typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false);
- this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), IntSize());
- typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true);
- typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true);
- typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true);
- typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true);
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 150));
+ typename Types::LayerType* filteredSurface = this->createDrawingLayer(parent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false);
+ this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoint(300, 0), gfx::Size());
+ typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(70, 50), gfx::Size(30, 50), true);
+ typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(30, 50), true);
+ typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(90, 40), gfx::Size(10, 10), true);
+ typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(200, 40), gfx::Size(10, 10), true);
// Filters make the layer own a surface.
WebFilterOperations filters;
@@ -3139,10 +3139,10 @@ protected:
OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {}
void runMyTest()
{
- IntSize trackingSize(100, 100);
- IntSize belowTrackingSize(99, 99);
+ gfx::Size trackingSize(100, 100);
+ gfx::Size belowTrackingSize(99, 99);
- typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), IntSize(400, 400));
+ typename Types::ContentLayerType* parent = this->createRoot(this->identityMatrix, FloatPoint(0, 0), gfx::Size(400, 400));
typename Types::LayerType* large = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), trackingSize, true);
typename Types::LayerType* small = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
this->calcDrawEtc(parent);
@@ -3162,9 +3162,9 @@ protected:
// The large layer is tracked as it is large enough.
this->visitLayer(large, occlusion);
- EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
diff --git a/cc/overdraw_metrics.cc b/cc/overdraw_metrics.cc
index 14d36ce..4c4f2be 100644
--- a/cc/overdraw_metrics.cc
+++ b/cc/overdraw_metrics.cc
@@ -33,13 +33,13 @@ OverdrawMetrics::OverdrawMetrics(bool recordMetricsForFrame)
{
}
-static inline float wedgeProduct(const FloatPoint& p1, const FloatPoint& p2)
+static inline float wedgeProduct(const gfx::PointF& p1, const gfx::PointF& p2)
{
return p1.x() * p2.y() - p1.y() * p2.x();
}
// Calculates area of an arbitrary convex polygon with up to 8 points.
-static inline float polygonArea(const FloatPoint points[8], int numPoints)
+static inline float polygonArea(const gfx::PointF points[8], int numPoints)
{
if (numPoints < 3)
return 0;
@@ -53,7 +53,7 @@ static inline float polygonArea(const FloatPoint points[8], int numPoints)
// Takes a given quad, maps it by the given transformation, and gives the area of the resulting polygon.
static inline float areaOfMappedQuad(const WebTransformationMatrix& transform, const FloatQuad& quad)
{
- FloatPoint clippedQuad[8];
+ gfx::PointF clippedQuad[8];
int numVerticesInClippedQuad = 0;
MathUtil::mapClippedQuad(transform, quad, clippedQuad, numVerticesInClippedQuad);
return polygonArea(clippedQuad, numVerticesInClippedQuad);
diff --git a/cc/priority_calculator.cc b/cc/priority_calculator.cc
index fc250d9..8993f88 100644
--- a/cc/priority_calculator.cc
+++ b/cc/priority_calculator.cc
@@ -5,6 +5,7 @@
#include "config.h"
#include "cc/priority_calculator.h"
+#include "ui/gfx/rect.h"
using namespace std;
@@ -71,9 +72,9 @@ int PriorityCalculator::lingeringPriority(int previousPriority)
}
namespace {
-int manhattanDistance(const IntRect& a, const IntRect& b)
+int manhattanDistance(const gfx::Rect& a, const gfx::Rect& b)
{
- IntRect c = unionRect(a, b);
+ gfx::Rect c = gfx::UnionRects(a, b);
int x = max(0, c.width() - a.width() - b.width() + 1);
int y = max(0, c.height() - a.height() - b.height() + 1);
return (x + y);
@@ -81,7 +82,7 @@ int manhattanDistance(const IntRect& a, const IntRect& b)
}
// static
-int PriorityCalculator::priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface)
+int PriorityCalculator::priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface)
{
int distance = manhattanDistance(visibleRect, textureRect);
if (!distance)
diff --git a/cc/priority_calculator.h b/cc/priority_calculator.h
index 761b6d5..2b39fdc 100644
--- a/cc/priority_calculator.h
+++ b/cc/priority_calculator.h
@@ -5,8 +5,9 @@
#ifndef CCPriorityCalculator_h
#define CCPriorityCalculator_h
-#include "IntRect.h"
-#include "IntSize.h"
+namespace gfx {
+class Rect;
+}
namespace cc {
@@ -16,7 +17,7 @@ public:
static int visiblePriority(bool drawsToRootSurface);
static int renderSurfacePriority();
static int lingeringPriority(int previousPriority);
- static int priorityFromDistance(const IntRect& visibleRect, const IntRect& textureRect, bool drawsToRootSurface);
+ static int priorityFromDistance(const gfx::Rect& visibleRect, const gfx::Rect& textureRect, bool drawsToRootSurface);
static int smallAnimatedLayerMinPriority();
static int highestPriority();
diff --git a/cc/proxy.h b/cc/proxy.h
index a0a53a3..7b1c7e8 100644
--- a/cc/proxy.h
+++ b/cc/proxy.h
@@ -10,10 +10,13 @@
#include "base/time.h"
#include <public/WebCompositorOutputSurface.h>
+namespace gfx {
+class Rect;
+}
+
namespace cc {
class Thread;
-class IntRect;
class IntSize;
struct RenderingStats;
struct RendererCapabilities;
@@ -34,7 +37,7 @@ public:
virtual ~Proxy();
- virtual bool compositeAndReadback(void *pixels, const IntRect&) = 0;
+ virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) = 0;
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) = 0;
diff --git a/cc/quad_culler_unittest.cc b/cc/quad_culler_unittest.cc
index 6aaddd5..a9f15bb 100644
--- a/cc/quad_culler_unittest.cc
+++ b/cc/quad_culler_unittest.cc
@@ -25,25 +25,25 @@ namespace {
class TestOcclusionTrackerImpl : public OcclusionTrackerImpl {
public:
- TestOcclusionTrackerImpl(const IntRect& scissorRectInScreen, bool recordMetricsForFrame = true)
+ TestOcclusionTrackerImpl(const gfx::Rect& scissorRectInScreen, bool recordMetricsForFrame = true)
: OcclusionTrackerImpl(scissorRectInScreen, recordMetricsForFrame)
, m_scissorRectInScreen(scissorRectInScreen)
{
}
protected:
- virtual IntRect layerScissorRectInTargetSurface(const LayerImpl* layer) const { return m_scissorRectInScreen; }
+ virtual gfx::Rect layerScissorRectInTargetSurface(const LayerImpl* layer) const { return m_scissorRectInScreen; }
private:
- IntRect m_scissorRectInScreen;
+ gfx::Rect m_scissorRectInScreen;
};
typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, LayerIteratorActions::FrontToBack> LayerIteratorType;
-static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const IntRect& layerRect, float opacity, bool opaque, const IntRect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
+static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTransformationMatrix& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, const gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList)
{
scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1);
- scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(IntSize(100, 100), LayerTilingData::NoBorderTexels);
+ scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(100, 100), LayerTilingData::NoBorderTexels);
tiler->setBounds(layerRect.size());
layer->setTilingData(*tiler);
layer->setSkipsDraw(false);
@@ -58,11 +58,11 @@ static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTra
ResourceProvider::ResourceId resourceId = 1;
for (int i = 0; i < tiler->numTilesX(); ++i)
for (int j = 0; j < tiler->numTilesY(); ++j) {
- IntRect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : intersection(tiler->tileBounds(i, j), layerOpaqueRect);
+ gfx::Rect tileOpaqueRect = opaque ? tiler->tileBounds(i, j) : gfx::IntersectRects(tiler->tileBounds(i, j), layerOpaqueRect);
layer->pushTileProperties(i, j, resourceId++, tileOpaqueRect, false);
}
- IntRect rectInTarget = MathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect());
+ gfx::Rect rectInTarget = MathUtil::mapClippedRect(layer->drawTransform(), layer->visibleContentRect());
if (!parent) {
layer->createRenderSurface();
surfaceLayerList.push_back(layer.get());
@@ -70,7 +70,7 @@ static scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const WebTra
} else {
layer->setRenderTarget(parent->renderTarget());
parent->renderSurface()->layerList().push_back(layer.get());
- rectInTarget.unite(MathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect()));
+ rectInTarget.Union(MathUtil::mapClippedRect(parent->drawTransform(), parent->visibleContentRect()));
}
layer->setDrawableContentRect(rectInTarget);
@@ -89,22 +89,22 @@ static void appendQuads(QuadList& quadList, SharedQuadStateList& sharedStateList
#define DECLARE_AND_INITIALIZE_TEST_QUADS \
DebugScopedSetImplThread impl; \
- QuadList quadList; \
- SharedQuadStateList sharedStateList; \
- std::vector<LayerImpl*> renderSurfaceLayerList; \
+ QuadList quadList; \
+ SharedQuadStateList sharedStateList; \
+ std::vector<LayerImpl*> renderSurfaceLayerList; \
WebTransformationMatrix childTransform; \
- IntSize rootSize = IntSize(300, 300); \
- IntRect rootRect = IntRect(IntPoint(), rootSize); \
- IntSize childSize = IntSize(200, 200); \
- IntRect childRect = IntRect(IntPoint(), childSize);
+ gfx::Size rootSize = gfx::Size(300, 300); \
+ gfx::Rect rootRect = gfx::Rect(rootSize); \
+ gfx::Size childSize = gfx::Size(200, 200); \
+ gfx::Rect childRect = gfx::Rect(childSize);
TEST(QuadCullerTest, verifyNoCulling)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -119,9 +119,9 @@ TEST(QuadCullerTest, verifyCullChildLinesUpTopLeft)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -136,9 +136,9 @@ TEST(QuadCullerTest, verifyCullWhenChildOpacityNotOne)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 0.9f, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -153,9 +153,9 @@ TEST(QuadCullerTest, verifyCullWhenChildOpaqueFlagFalse)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -172,9 +172,9 @@ TEST(QuadCullerTest, verifyCullCenterTileOnly)
childTransform.translate(50, 50);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -213,11 +213,11 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize1)
rootTransform.translate(99.1, 99.1);
rootTransform.scale(1.018);
- rootRect = childRect = IntRect(0, 0, 100, 100);
+ rootRect = childRect = gfx::Rect(0, 0, 100, 100);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -241,11 +241,11 @@ TEST(QuadCullerTest, verifyCullCenterTileNonIntegralSize2)
WebTransformationMatrix rootTransform;
rootTransform.translate(100, 100);
- rootRect = childRect = IntRect(0, 0, 100, 100);
+ rootRect = childRect = gfx::Rect(0, 0, 100, 100);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, rootTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -263,9 +263,9 @@ TEST(QuadCullerTest, verifyCullChildLinesUpBottomRight)
childTransform.translate(100, 100);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -282,10 +282,10 @@ TEST(QuadCullerTest, verifyCullSubRegion)
childTransform.translate(50, 50);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -302,10 +302,10 @@ TEST(QuadCullerTest, verifyCullSubRegion2)
childTransform.translate(50, 10);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -322,10 +322,10 @@ TEST(QuadCullerTest, verifyCullSubRegionCheckOvercull)
childTransform.translate(50, 49);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ gfx::Rect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);
scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, false, childOpaqueRect, renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -343,9 +343,9 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude)
// Use a small rotation so as to not disturb the geometry significantly.
childTransform.rotate(1);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), childTransform, childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -369,9 +369,9 @@ TEST(QuadCullerTest, verifyNonAxisAlignedQuadsSafelyCulled)
WebTransformationMatrix parentTransform;
parentTransform.rotate(1);
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(-100, -100, 1000, 1000));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, parentTransform, rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(-100, -100, 1000, 1000));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -386,9 +386,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(200, 100, 100, 100));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(200, 100, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -403,9 +403,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverCulledTile)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(100, 100, 100, 100));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(100, 100, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -420,9 +420,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverPartialTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -437,9 +437,9 @@ TEST(QuadCullerTest, verifyCullOutsideScissorOverNoTiles)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(500, 500, 100, 100));
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(500, 500, 100, 100));
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
@@ -454,9 +454,9 @@ TEST(QuadCullerTest, verifyWithoutMetrics)
{
DECLARE_AND_INITIALIZE_TEST_QUADS
- scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, IntRect(), renderSurfaceLayerList);
- scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, IntRect(), renderSurfaceLayerList);
- TestOcclusionTrackerImpl occlusionTracker(IntRect(50, 50, 200, 200), false);
+ scoped_ptr<TiledLayerImpl> rootLayer = makeLayer(0, WebTransformationMatrix(), rootRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ scoped_ptr<TiledLayerImpl> childLayer = makeLayer(rootLayer.get(), WebTransformationMatrix(), childRect, 1, true, gfx::Rect(), renderSurfaceLayerList);
+ TestOcclusionTrackerImpl occlusionTracker(gfx::Rect(50, 50, 200, 200), false);
LayerIteratorType it = LayerIteratorType::begin(&renderSurfaceLayerList);
appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracker);
diff --git a/cc/render_pass.cc b/cc/render_pass.cc
index 57f9829..935458a 100644
--- a/cc/render_pass.cc
+++ b/cc/render_pass.cc
@@ -92,7 +92,7 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
// Manually create the quad state for the gutter quads, as the root layer
// doesn't have any bounds and so can't generate this itself.
// FIXME: Make the gutter quads generated by the solid color layer (make it smarter about generating quads to fill unoccluded areas).
- IntRect rootTargetRect = rootLayer->renderSurface()->contentRect();
+ gfx::Rect rootTargetRect = rootLayer->renderSurface()->contentRect();
float opacity = 1;
bool opaque = true;
SharedQuadState* sharedQuadState = quadCuller.useSharedQuadState(SharedQuadState::create(rootLayer->drawTransform(), rootTargetRect, rootTargetRect, opacity, opaque));
@@ -101,7 +101,7 @@ void RenderPass::appendQuadsToFillScreen(LayerImpl* rootLayer, SkColor screenBac
Vector<WebCore::IntRect> fillRects = fillRegion.rects();
for (size_t i = 0; i < fillRects.size(); ++i) {
// The root layer transform is composed of translations and scales only, no perspective, so mapping is sufficient.
- IntRect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i]));
+ gfx::Rect layerRect = MathUtil::mapClippedRect(transformToLayerSpace, cc::IntRect(fillRects[i]));
// Skip the quad culler and just append the quads directly to avoid occlusion checks.
m_quadList.append(SolidColorDrawQuad::create(sharedQuadState, layerRect, screenBackgroundColor).PassAs<DrawQuad>());
}
diff --git a/cc/render_surface.cc b/cc/render_surface.cc
index cac1d65..3662800 100644
--- a/cc/render_surface.cc
+++ b/cc/render_surface.cc
@@ -28,11 +28,11 @@ RenderSurface::~RenderSurface()
{
}
-FloatRect RenderSurface::drawableContentRect() const
+gfx::RectF RenderSurface::drawableContentRect() const
{
- FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
+ gfx::RectF drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
if (m_owningLayer->hasReplica())
- drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
+ drawableContentRect.Union(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
return drawableContentRect;
}
diff --git a/cc/render_surface.h b/cc/render_surface.h
index a78b53f..02aa70a 100644
--- a/cc/render_surface.h
+++ b/cc/render_surface.h
@@ -8,8 +8,8 @@
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
-#include "FloatRect.h"
-#include "IntRect.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
#include <public/WebTransformationMatrix.h>
#include <vector>
@@ -23,10 +23,10 @@ public:
~RenderSurface();
// Returns the rect that encloses the RenderSurfaceImpl including any reflection.
- FloatRect drawableContentRect() const;
+ gfx::RectF drawableContentRect() const;
- const IntRect& contentRect() const { return m_contentRect; }
- void setContentRect(const IntRect& contentRect) { m_contentRect = contentRect; }
+ const gfx::Rect& contentRect() const { return m_contentRect; }
+ void setContentRect(const gfx::Rect& contentRect) { m_contentRect = contentRect; }
float drawOpacity() const { return m_drawOpacity; }
void setDrawOpacity(float drawOpacity) { m_drawOpacity = drawOpacity; }
@@ -53,8 +53,8 @@ public:
bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
- const IntRect& clipRect() const { return m_clipRect; }
- void setClipRect(const IntRect& clipRect) { m_clipRect = clipRect; }
+ const gfx::Rect& clipRect() const { return m_clipRect; }
+ void setClipRect(const gfx::Rect& clipRect) { m_clipRect = clipRect; }
typedef std::vector<scoped_refptr<Layer> > LayerList;
LayerList& layerList() { return m_layerList; }
@@ -72,7 +72,7 @@ private:
Layer* m_owningLayer;
// Uses this surface's space.
- IntRect m_contentRect;
+ gfx::Rect m_contentRect;
float m_drawOpacity;
bool m_drawOpacityIsAnimating;
@@ -84,7 +84,7 @@ private:
bool m_screenSpaceTransformsAreAnimating;
// Uses the space of the surface's target surface.
- IntRect m_clipRect;
+ gfx::Rect m_clipRect;
LayerList m_layerList;
diff --git a/cc/render_surface_impl.cc b/cc/render_surface_impl.cc
index 40c0dea..b1fe31e 100644
--- a/cc/render_surface_impl.cc
+++ b/cc/render_surface_impl.cc
@@ -18,6 +18,7 @@
#include "cc/render_pass_draw_quad.h"
#include "cc/render_pass_sink.h"
#include "cc/shared_quad_state.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebTransformationMatrix.h>
using WebKit::WebTransformationMatrix;
@@ -51,11 +52,11 @@ RenderSurfaceImpl::~RenderSurfaceImpl()
{
}
-FloatRect RenderSurfaceImpl::drawableContentRect() const
+gfx::RectF RenderSurfaceImpl::drawableContentRect() const
{
- FloatRect drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
+ gfx::RectF drawableContentRect = MathUtil::mapClippedRect(m_drawTransform, m_contentRect);
if (m_owningLayer->hasReplica())
- drawableContentRect.unite(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
+ drawableContentRect.Union(MathUtil::mapClippedRect(m_replicaDrawTransform, m_contentRect));
return drawableContentRect;
}
@@ -102,7 +103,7 @@ int RenderSurfaceImpl::owningLayerId() const
}
-void RenderSurfaceImpl::setClipRect(const IntRect& clipRect)
+void RenderSurfaceImpl::setClipRect(const gfx::Rect& clipRect)
{
if (m_clipRect == clipRect)
return;
@@ -113,10 +114,10 @@ void RenderSurfaceImpl::setClipRect(const IntRect& clipRect)
bool RenderSurfaceImpl::contentsChanged() const
{
- return !m_damageTracker->currentDamageRect().isEmpty();
+ return !m_damageTracker->currentDamageRect().IsEmpty();
}
-void RenderSurfaceImpl::setContentRect(const IntRect& contentRect)
+void RenderSurfaceImpl::setContentRect(const gfx::Rect& contentRect)
{
if (m_contentRect == contentRect)
return;
@@ -157,23 +158,24 @@ void RenderSurfaceImpl::clearLayerLists()
m_contributingDelegatedRenderPassLayerList.clear();
}
-static inline IntRect computeClippedRectInTarget(const LayerImpl* owningLayer)
+static inline gfx::Rect computeClippedRectInTarget(const LayerImpl* owningLayer)
{
DCHECK(owningLayer->parent());
const LayerImpl* renderTarget = owningLayer->parent()->renderTarget();
const RenderSurfaceImpl* self = owningLayer->renderSurface();
- IntRect clippedRectInTarget = self->clipRect();
+ gfx::Rect clippedRectInTarget = self->clipRect();
if (owningLayer->backgroundFilters().hasFilterThatMovesPixels()) {
// If the layer has background filters that move pixels, we cannot scissor as tightly.
// FIXME: this should be able to be a tighter scissor, perhaps expanded by the filter outsets?
clippedRectInTarget = renderTarget->renderSurface()->contentRect();
- } else if (clippedRectInTarget.isEmpty()) {
+ } else if (clippedRectInTarget.IsEmpty()) {
// For surfaces, empty clipRect means that the surface does not clip anything.
- clippedRectInTarget = enclosingIntRect(intersection(renderTarget->renderSurface()->contentRect(), self->drawableContentRect()));
+ clippedRectInTarget = renderTarget->renderSurface()->contentRect();
+ clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
} else
- clippedRectInTarget.intersect(enclosingIntRect(self->drawableContentRect()));
+ clippedRectInTarget.Intersect(gfx::ToEnclosingRect(self->drawableContentRect()));
return clippedRectInTarget;
}
@@ -202,7 +204,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
{
DCHECK(!forReplica || m_owningLayer->hasReplica());
- IntRect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
+ gfx::Rect clippedRectInTarget = computeClippedRectInTarget(m_owningLayer);
bool isOpaque = false;
const WebTransformationMatrix& drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform;
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(SharedQuadState::create(drawTransform, m_contentRect, clippedRectInTarget, m_drawOpacity, isOpaque).Pass());
@@ -222,12 +224,12 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
// to draw the layer and its reflection in. For now we only apply a separate reflection
// mask if the contents don't have a mask of their own.
LayerImpl* maskLayer = m_owningLayer->maskLayer();
- if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
+ if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty()))
maskLayer = 0;
if (!maskLayer && forReplica) {
maskLayer = m_owningLayer->replicaLayer()->maskLayer();
- if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().isEmpty()))
+ if (maskLayer && (!maskLayer->drawsContent() || maskLayer->bounds().IsEmpty()))
maskLayer = 0;
}
@@ -243,7 +245,7 @@ void RenderSurfaceImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQ
}
ResourceProvider::ResourceId maskResourceId = maskLayer ? maskLayer->contentsResourceId() : 0;
- IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect();
+ gfx::Rect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : gfx::Rect();
quadSink.append(RenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, maskResourceId, contentsChangedSinceLastFrame,
maskTexCoordScaleX, maskTexCoordScaleY, maskTexCoordOffsetX, maskTexCoordOffsetY).PassAs<DrawQuad>(), appendQuadsData);
diff --git a/cc/render_surface_impl.h b/cc/render_surface_impl.h
index f74e420..ec0fde9 100644
--- a/cc/render_surface_impl.h
+++ b/cc/render_surface_impl.h
@@ -5,12 +5,12 @@
#ifndef CCRenderSurface_h
#define CCRenderSurface_h
-#include "FloatRect.h"
-#include "IntRect.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "cc/render_pass.h"
#include "cc/shared_quad_state.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/rect_f.h"
#include <public/WebTransformationMatrix.h>
namespace cc {
@@ -31,10 +31,10 @@ public:
std::string name() const;
void dumpSurface(std::string*, int indent) const;
- FloatPoint contentRectCenter() const { return FloatRect(m_contentRect).center(); }
+ gfx::PointF contentRectCenter() const { return gfx::RectF(m_contentRect).CenterPoint(); }
// Returns the rect that encloses the RenderSurfaceImpl including any reflection.
- FloatRect drawableContentRect() const;
+ gfx::RectF drawableContentRect() const;
float drawOpacity() const { return m_drawOpacity; }
void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
@@ -62,13 +62,13 @@ public:
bool screenSpaceTransformsAreAnimating() const { return m_screenSpaceTransformsAreAnimating; }
void setScreenSpaceTransformsAreAnimating(bool animating) { m_screenSpaceTransformsAreAnimating = animating; }
- void setClipRect(const IntRect&);
- const IntRect& clipRect() const { return m_clipRect; }
+ void setClipRect(const gfx::Rect&);
+ const gfx::Rect& clipRect() const { return m_clipRect; }
bool contentsChanged() const;
- void setContentRect(const IntRect&);
- const IntRect& contentRect() const { return m_contentRect; }
+ void setContentRect(const gfx::Rect&);
+ const gfx::Rect& contentRect() const { return m_contentRect; }
std::vector<LayerImpl*>& layerList() { return m_layerList; }
void addContributingDelegatedRenderPassLayer(LayerImpl*);
@@ -91,7 +91,7 @@ private:
LayerImpl* m_owningLayer;
// Uses this surface's space.
- IntRect m_contentRect;
+ gfx::Rect m_contentRect;
bool m_surfacePropertyChanged;
float m_drawOpacity;
@@ -104,7 +104,7 @@ private:
bool m_screenSpaceTransformsAreAnimating;
// Uses the space of the surface's target surface.
- IntRect m_clipRect;
+ gfx::Rect m_clipRect;
std::vector<LayerImpl*> m_layerList;
std::vector<DelegatedRendererLayerImpl*> m_contributingDelegatedRenderPassLayerList;
diff --git a/cc/renderer.h b/cc/renderer.h
index dfb6a87..11e00fc 100644
--- a/cc/renderer.h
+++ b/cc/renderer.h
@@ -17,7 +17,7 @@ class ScopedTexture;
class RendererClient {
public:
- virtual const IntSize& deviceViewportSize() const = 0;
+ virtual const gfx::Size& deviceViewportSize() const = 0;
virtual const LayerTreeSettings& settings() const = 0;
virtual void didLoseContext() = 0;
virtual void onSwapBuffersComplete() = 0;
@@ -61,7 +61,7 @@ public:
// puts backbuffer onscreen
virtual bool swapBuffers() = 0;
- virtual void getFramebufferPixels(void *pixels, const IntRect&) = 0;
+ virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) = 0;
virtual bool isContextLost();
diff --git a/cc/scoped_texture.cc b/cc/scoped_texture.cc
index 406dad2..5f40475 100644
--- a/cc/scoped_texture.cc
+++ b/cc/scoped_texture.cc
@@ -19,10 +19,10 @@ ScopedTexture::~ScopedTexture()
free();
}
-bool ScopedTexture::allocate(int pool, const IntSize& size, GLenum format, ResourceProvider::TextureUsageHint hint)
+bool ScopedTexture::allocate(int pool, const gfx::Size& size, GLenum format, ResourceProvider::TextureUsageHint hint)
{
DCHECK(!id());
- DCHECK(!size.isEmpty());
+ DCHECK(!size.IsEmpty());
setDimensions(size, format);
setId(m_resourceProvider->createResource(pool, size, format, hint));
diff --git a/cc/scoped_texture.h b/cc/scoped_texture.h
index 90ed719..ef32261 100644
--- a/cc/scoped_texture.h
+++ b/cc/scoped_texture.h
@@ -26,7 +26,7 @@ public:
using Texture::format;
using Texture::bytes;
- bool allocate(int pool, const IntSize&, GLenum format, ResourceProvider::TextureUsageHint);
+ bool allocate(int pool, const gfx::Size&, GLenum format, ResourceProvider::TextureUsageHint);
void free();
void leak();
diff --git a/cc/scrollbar_animation_controller.cc b/cc/scrollbar_animation_controller.cc
index 764f069..7335e2c 100644
--- a/cc/scrollbar_animation_controller.cc
+++ b/cc/scrollbar_animation_controller.cc
@@ -65,10 +65,10 @@ void ScrollbarAnimationController::updateScrollOffset(LayerImpl* scrollLayer)
updateScrollOffsetAtTime(scrollLayer, (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF());
}
-IntSize ScrollbarAnimationController::getScrollLayerBounds(const LayerImpl* scrollLayer)
+gfx::Size ScrollbarAnimationController::getScrollLayerBounds(const LayerImpl* scrollLayer)
{
if (!scrollLayer->children().size())
- return IntSize();
+ return gfx::Size();
// Copy & paste from LayerTreeHostImpl...
// FIXME: Hardcoding the first child here is weird. Think of
// a cleaner way to get the contentBounds on the Impl side.
diff --git a/cc/scrollbar_animation_controller.h b/cc/scrollbar_animation_controller.h
index 9b9c2ca..bccd992 100644
--- a/cc/scrollbar_animation_controller.h
+++ b/cc/scrollbar_animation_controller.h
@@ -9,6 +9,10 @@
#include "FloatPoint.h"
#include "IntSize.h"
+namespace gfx {
+class Size;
+}
+
namespace cc {
class LayerImpl;
@@ -35,7 +39,7 @@ public:
ScrollbarLayerImpl* verticalScrollbarLayer() const { return m_verticalScrollbarLayer; }
FloatPoint currentPos() const { return m_currentPos; }
- IntSize totalSize() const { return m_totalSize; }
+ gfx::Size totalSize() const { return m_totalSize; }
IntSize maximum() const { return m_maximum; }
virtual void didPinchGestureBeginAtTime(double monotonicTime) { }
@@ -47,14 +51,14 @@ protected:
explicit ScrollbarAnimationController(LayerImpl* scrollLayer);
private:
- static IntSize getScrollLayerBounds(const LayerImpl*);
+ static gfx::Size getScrollLayerBounds(const LayerImpl*);
// Beware of dangling pointer. Always update these during tree synchronization.
ScrollbarLayerImpl* m_horizontalScrollbarLayer;
ScrollbarLayerImpl* m_verticalScrollbarLayer;
FloatPoint m_currentPos;
- IntSize m_totalSize;
+ gfx::Size m_totalSize;
IntSize m_maximum;
};
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index 87b9e6b..cb648c8 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -12,6 +12,7 @@
#include "cc/layer_tree_host.h"
#include "cc/resource_update_queue.h"
#include "cc/scrollbar_layer_impl.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebRect.h>
using WebKit::WebRect;
@@ -198,13 +199,13 @@ void ScrollbarLayer::createUpdaterIfNeeded()
m_thumb = m_thumbUpdater->createResource(layerTreeHost()->contentsTextureManager());
}
-void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const IntRect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
+void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, LayerUpdater::Resource* texture, const gfx::Rect& rect, ResourceUpdateQueue& queue, RenderingStats& stats)
{
// Skip painting and uploading if there are no invalidations and
// we already have valid texture data.
if (texture->texture()->haveBackingTexture()
&& texture->texture()->size() == rect.size()
- && m_updateRect.isEmpty())
+ && m_updateRect.IsEmpty())
return;
// We should always have enough memory for UI.
@@ -224,18 +225,17 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
texture->update(queue, rect, destOffset, false, stats);
}
-IntRect ScrollbarLayer::scrollbarLayerRectToContentRect(const WebRect& layerRect) const
+gfx::Rect ScrollbarLayer::scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const
{
// Don't intersect with the bounds as in layerRectToContentRect() because
// layerRect here might be in coordinates of the containing layer.
- FloatRect contentRect(layerRect.x, layerRect.y, layerRect.width, layerRect.height);
- contentRect.scale(contentsScaleX(), contentsScaleY());
- return enclosingIntRect(contentRect);
+ gfx::RectF contentRect = gfx::ScaleRect(layerRect, contentsScaleX(), contentsScaleY());
+ return gfx::ToEnclosingRect(contentRect);
}
void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
@@ -250,7 +250,7 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
m_foreTrack->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
if (m_thumb) {
- IntSize thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
+ gfx::Size thumbSize = scrollbarLayerRectToContentRect(m_geometry->thumbRect(m_scrollbar.get())).size();
m_thumb->texture()->setDimensions(thumbSize, m_textureFormat);
m_thumb->texture()->setRequestPriority(PriorityCalculator::uiPriority(drawsToRoot));
}
@@ -258,20 +258,20 @@ void ScrollbarLayer::setTexturePriorities(const PriorityCalculator&)
void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*, RenderingStats& stats)
{
- if (contentBounds().isEmpty())
+ if (contentBounds().IsEmpty())
return;
createUpdaterIfNeeded();
- IntRect contentRect = scrollbarLayerRectToContentRect(WebRect(m_scrollbar->location().x, m_scrollbar->location().y, bounds().width(), bounds().height()));
+ gfx::Rect contentRect = scrollbarLayerRectToContentRect(gfx::Rect(m_scrollbar->location(), bounds()));
updatePart(m_backTrackUpdater.get(), m_backTrack.get(), contentRect, queue, stats);
if (m_foreTrack && m_foreTrackUpdater)
updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, queue, stats);
// Consider the thumb to be at the origin when painting.
WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
- IntRect originThumbRect = scrollbarLayerRectToContentRect(WebRect(0, 0, thumbRect.width, thumbRect.height));
- if (!originThumbRect.isEmpty())
+ gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
+ if (!originThumbRect.IsEmpty())
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
}
diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h
index 035d3ee..6da0993 100644
--- a/cc/scrollbar_layer.h
+++ b/cc/scrollbar_layer.h
@@ -40,9 +40,9 @@ protected:
virtual ~ScrollbarLayer();
private:
- void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const IntRect&, ResourceUpdateQueue&, RenderingStats&);
+ void updatePart(CachingBitmapContentLayerUpdater*, LayerUpdater::Resource*, const gfx::Rect&, ResourceUpdateQueue&, RenderingStats&);
void createUpdaterIfNeeded();
- IntRect scrollbarLayerRectToContentRect(const WebKit::WebRect& layerRect) const;
+ gfx::Rect scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const;
scoped_ptr<WebKit::WebScrollbar> m_scrollbar;
WebKit::WebScrollbarThemePainter m_painter;
diff --git a/cc/scrollbar_layer_impl.cc b/cc/scrollbar_layer_impl.cc
index 180fd82..271ee26 100644
--- a/cc/scrollbar_layer_impl.cc
+++ b/cc/scrollbar_layer_impl.cc
@@ -66,10 +66,9 @@ void ScrollbarLayerImpl::setScrollbarData(WebScrollbar* scrollbar)
m_geometry->update(scrollbar);
}
-static FloatRect toUVRect(const WebRect& r, const IntRect& bounds)
+static gfx::RectF toUVRect(const gfx::Rect& r, const gfx::Rect& bounds)
{
- return FloatRect(static_cast<float>(r.x) / bounds.width(), static_cast<float>(r.y) / bounds.height(),
- static_cast<float>(r.width) / bounds.width(), static_cast<float>(r.height) / bounds.height());
+ return gfx::ScaleRect(r, 1.0 / bounds.width(), 1.0 / bounds.height());
}
IntRect ScrollbarLayerImpl::scrollbarLayerRectToContentRect(const WebRect& layerRect) const
@@ -85,9 +84,9 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
{
bool premultipledAlpha = false;
bool flipped = false;
- FloatRect uvRect(0, 0, 1, 1);
- IntRect boundsRect(IntPoint(), bounds());
- IntRect contentBoundsRect(IntPoint(), contentBounds());
+ gfx::RectF uvRect(0, 0, 1, 1);
+ gfx::Rect boundsRect(gfx::Point(), bounds());
+ gfx::Rect contentBoundsRect(gfx::Point(), contentBounds());
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
@@ -112,8 +111,8 @@ void ScrollbarLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& append
// Order matters here: since the back track texture is being drawn to the entire contents rect, we must append it after the thumb and
// fore track quads. The back track texture contains (and displays) the buttons.
- if (!contentBoundsRect.isEmpty())
- quadSink.append(TextureDrawQuad::create(sharedQuadState, IntRect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
+ if (!contentBoundsRect.IsEmpty())
+ quadSink.append(TextureDrawQuad::create(sharedQuadState, gfx::Rect(contentBoundsRect), m_backTrackResourceId, premultipledAlpha, uvRect, flipped).PassAs<DrawQuad>(), appendQuadsData);
}
void ScrollbarLayerImpl::didLoseContext()
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 6c63c3d..7fe679f 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -43,7 +43,7 @@ SingleThreadProxy::~SingleThreadProxy()
DCHECK(!m_layerTreeHostImpl.get() && !m_layerTreeHost); // make sure stop() got called.
}
-bool SingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
+bool SingleThreadProxy::compositeAndReadback(void *pixels, const gfx::Rect& rect)
{
TRACE_EVENT0("cc", "SingleThreadProxy::compositeAndReadback");
DCHECK(Proxy::isMainThread());
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 93f8c09..91e0810 100644
--- a/cc/single_thread_proxy.h
+++ b/cc/single_thread_proxy.h
@@ -22,7 +22,7 @@ public:
virtual ~SingleThreadProxy();
// Proxy implementation
- virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
+ virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE;
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
virtual void finishAllRendering() OVERRIDE;
virtual bool isStarted() const OVERRIDE;
diff --git a/cc/software_renderer.cc b/cc/software_renderer.cc
index 3d0b60e..9592039 100644
--- a/cc/software_renderer.cc
+++ b/cc/software_renderer.cc
@@ -268,7 +268,7 @@ void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua
DCHECK(isSoftwareResource(quad->resourceId()));
ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->resourceId());
- SkIRect uvRect = toSkIRect(gfx::Rect(quad->textureOffset(), quad->quadRect().size()));
+ SkIRect uvRect = toSkIRect(gfx::Rect(gfx::PointAtOffsetFromOrigin(quad->textureOffset()), quad->quadRect().size()));
m_skCurrentCanvas->drawBitmapRect(*lock.skBitmap(), &uvRect, toSkRect(quadVertexRect()), &m_skCurrentPaint);
}
@@ -344,11 +344,11 @@ bool SoftwareRenderer::swapBuffers()
return true;
}
-void SoftwareRenderer::getFramebufferPixels(void *pixels, const IntRect& rect)
+void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect)
{
SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap();
SkBitmap subsetBitmap;
- SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - rect.maxY(), rect.width(), rect.height());
+ SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - rect.bottom(), rect.width(), rect.height());
fullBitmap.extractSubset(&subsetBitmap, invertRect);
subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.width() * 4);
m_outputDevice->unlock();
diff --git a/cc/software_renderer.h b/cc/software_renderer.h
index 0e4251a..40aa32d 100644
--- a/cc/software_renderer.h
+++ b/cc/software_renderer.h
@@ -35,7 +35,7 @@ public:
virtual bool swapBuffers() OVERRIDE;
- virtual void getFramebufferPixels(void *pixels, const IntRect&) OVERRIDE;
+ virtual void getFramebufferPixels(void *pixels, const gfx::Rect&) OVERRIDE;
virtual void setVisible(bool) OVERRIDE;
diff --git a/cc/software_renderer_unittest.cc b/cc/software_renderer_unittest.cc
index f40720f..a04864a 100644
--- a/cc/software_renderer_unittest.cc
+++ b/cc/software_renderer_unittest.cc
@@ -40,10 +40,10 @@ public:
FakeWebCompositorOutputSurface* outputSurface() const { return m_outputSurface.get(); }
ResourceProvider* resourceProvider() const { return m_resourceProvider.get(); }
SoftwareRenderer* renderer() const { return m_renderer.get(); }
- void setViewportSize(IntSize viewportSize) { m_viewportSize = viewportSize; }
+ void setViewportSize(gfx::Size viewportSize) { m_viewportSize = viewportSize; }
// RendererClient implementation.
- virtual const IntSize& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
+ virtual const gfx::Size& deviceViewportSize() const OVERRIDE { return m_viewportSize; }
virtual const LayerTreeSettings& settings() const OVERRIDE { return m_settings; }
virtual void didLoseContext() OVERRIDE { }
virtual void onSwapBuffersComplete() OVERRIDE { }
@@ -57,17 +57,17 @@ protected:
scoped_ptr<FakeWebCompositorOutputSurface> m_outputSurface;
scoped_ptr<ResourceProvider> m_resourceProvider;
scoped_ptr<SoftwareRenderer> m_renderer;
- IntSize m_viewportSize;
+ gfx::Size m_viewportSize;
LayerTreeSettings m_settings;
};
TEST_F(SoftwareRendererTest, solidColorQuad)
{
- IntSize outerSize(100, 100);
+ gfx::Size outerSize(100, 100);
int outerPixels = outerSize.width() * outerSize.height();
- IntSize innerSize(98, 98);
- IntRect outerRect(IntPoint(), outerSize);
- IntRect innerRect(IntPoint(1, 1), innerSize);
+ gfx::Size innerSize(98, 98);
+ gfx::Rect outerRect(gfx::Point(), outerSize);
+ gfx::Rect innerRect(gfx::Point(1, 1), innerSize);
setViewportSize(outerSize);
initializeRenderer();
@@ -103,12 +103,12 @@ TEST_F(SoftwareRendererTest, solidColorQuad)
TEST_F(SoftwareRendererTest, tileQuad)
{
- IntSize outerSize(100, 100);
+ gfx::Size outerSize(100, 100);
int outerPixels = outerSize.width() * outerSize.height();
- IntSize innerSize(98, 98);
+ gfx::Size innerSize(98, 98);
int innerPixels = innerSize.width() * innerSize.height();
- IntRect outerRect(IntPoint(), outerSize);
- IntRect innerRect(IntPoint(1, 1), innerSize);
+ gfx::Rect outerRect(gfx::Point(), outerSize);
+ gfx::Rect innerRect(gfx::Point(1, 1), innerSize);
setViewportSize(outerSize);
initializeRenderer();
@@ -127,13 +127,13 @@ TEST_F(SoftwareRendererTest, tileQuad)
resourceProvider()->upload(resourceYellow, reinterpret_cast<uint8_t*>(yellowPixels.get()), gfx::Rect(gfx::Point(), outerSize), gfx::Rect(gfx::Point(), outerSize), gfx::Vector2d());
resourceProvider()->upload(resourceCyan, reinterpret_cast<uint8_t*>(cyanPixels.get()), gfx::Rect(gfx::Point(), innerSize), gfx::Rect(gfx::Point(), innerSize), gfx::Vector2d());
- IntRect rect = IntRect(IntPoint(), deviceViewportSize());
+ gfx::Rect rect = gfx::Rect(gfx::Point(), deviceViewportSize());
scoped_ptr<SharedQuadState> sharedQuadState = SharedQuadState::create(WebTransformationMatrix(), outerRect, outerRect, 1.0, true);
RenderPass::Id rootRenderPassId = RenderPass::Id(1, 1);
- scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, IntRect(IntPoint(), deviceViewportSize()), WebTransformationMatrix());
- scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, IntPoint(), outerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
- scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, IntPoint(), innerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
+ scoped_ptr<TestRenderPass> rootRenderPass = TestRenderPass::create(rootRenderPassId, gfx::Rect(gfx::Point(), deviceViewportSize()), WebTransformationMatrix());
+ scoped_ptr<DrawQuad> outerQuad = TileDrawQuad::create(sharedQuadState.get(), outerRect, outerRect, resourceYellow, gfx::Vector2d(), outerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
+ scoped_ptr<DrawQuad> innerQuad = TileDrawQuad::create(sharedQuadState.get(), innerRect, innerRect, resourceCyan, gfx::Vector2d(), innerSize, 0, false, false, false, false, false).PassAs<DrawQuad>();
rootRenderPass->appendQuad(innerQuad.Pass());
rootRenderPass->appendQuad(outerQuad.Pass());
diff --git a/cc/stubs/float_point_3d.h b/cc/stubs/float_point_3d.h
index 02ff076..92e036f 100644
--- a/cc/stubs/float_point_3d.h
+++ b/cc/stubs/float_point_3d.h
@@ -39,10 +39,16 @@ public:
{
}
+
FloatPoint3D(WebCore::FloatPoint point)
: WebCore::FloatPoint3D(point)
{
}
+
+ explicit FloatPoint3D(gfx::PointF point)
+ : WebCore::FloatPoint3D(point.x(), point.y(), 0)
+ {
+ }
};
}
diff --git a/cc/stubs/float_size.h b/cc/stubs/float_size.h
index acbd5da..d58fb42 100644
--- a/cc/stubs/float_size.h
+++ b/cc/stubs/float_size.h
@@ -38,6 +38,11 @@ public:
{
}
+ explicit FloatSize(gfx::SizeF size)
+ : WebCore::FloatSize(size.width(), size.height())
+ {
+ }
+
operator gfx::SizeF() const { return gfx::SizeF(width(), height()); }
};
diff --git a/cc/stubs/int_point.h b/cc/stubs/int_point.h
index 2e39da6..068c662 100644
--- a/cc/stubs/int_point.h
+++ b/cc/stubs/int_point.h
@@ -32,7 +32,11 @@ public:
IntPoint(WebCore::IntPoint point)
: WebCore::IntPoint(point.x(), point.y())
{
+ }
+ explicit IntPoint(gfx::Point point)
+ : WebCore::IntPoint(point.x(), point.y())
+ {
}
operator gfx::Point() const { return gfx::Point(x(), y()); }
diff --git a/cc/stubs/skia_utils.h b/cc/stubs/skia_utils.h
index d7b1fbf..8404fa3 100644
--- a/cc/stubs/skia_utils.h
+++ b/cc/stubs/skia_utils.h
@@ -5,11 +5,23 @@
#ifndef CC_STUBS_SKIAUTILS_H_
#define CC_STUBS_SKIAUTILS_H_
+#include <limits>
+
+#include "third_party/skia/include/core/SkScalar.h"
+
namespace cc {
+// Skia has problems when passed infinite, etc floats, filter them to 0.
inline SkScalar FloatToSkScalar(float f)
{
- return SkFloatToScalar(isfinite(f) ? f : 0);
+ // This checks if |f| is NaN.
+ if (f != f)
+ return 0;
+ if (f == std::numeric_limits<double>::infinity())
+ return 0;
+ if (f == -std::numeric_limits<double>::infinity())
+ return 0;
+ return SkFloatToScalar(f);
}
}
diff --git a/cc/test/layer_test_common.cc b/cc/test/layer_test_common.cc
index 72546dd..9e7dd33 100644
--- a/cc/test/layer_test_common.cc
+++ b/cc/test/layer_test_common.cc
@@ -6,48 +6,52 @@
#include "cc/test/layer_test_common.h"
+#include "Region.h"
#include "cc/draw_quad.h"
#include "cc/math_util.h"
+#include "cc/render_pass.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/point_conversions.h"
+#include "ui/gfx/rect_conversions.h"
+#include "ui/gfx/size_conversions.h"
namespace LayerTestCommon {
// Align with expected and actual output
const char* quadString = " Quad: ";
-bool floatRectCanBeSafelyRoundedToIntRect(const cc::FloatRect& r)
+bool canRectFBeSafelyRoundedToRect(const gfx::RectF& r)
{
// Ensure that range of float values is not beyond integer range.
- if (!r.isExpressibleAsIntRect())
+ if (!cc::FloatRect(r).isExpressibleAsIntRect())
return false;
// Ensure that the values are actually integers.
- if (floorf(r.x()) == r.x()
- && floorf(r.y()) == r.y()
- && floorf(r.width()) == r.width()
- && floorf(r.height()) == r.height())
+ if (gfx::ToFlooredPoint(r.origin()) == r.origin()
+ && gfx::ToFlooredSize(r.size()) == r.size())
return true;
return false;
}
void verifyQuadsExactlyCoverRect(const cc::QuadList& quads,
- const cc::IntRect& rect) {
- cc::Region remaining(rect);
+ const gfx::Rect& rect) {
+ cc::Region remaining = cc::IntRect(rect);
for (size_t i = 0; i < quads.size(); ++i) {
cc::DrawQuad* quad = quads[i];
- cc::FloatRect floatQuadRect = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, cc::FloatRect(quad->quadRect()));
+ gfx::RectF quadRectF = cc::MathUtil::mapClippedRect(quad->sharedQuadState()->quadTransform, gfx::RectF(quad->quadRect()));
// Before testing for exact coverage in the integer world, assert that rounding
// will not round the rect incorrectly.
- ASSERT_TRUE(floatRectCanBeSafelyRoundedToIntRect(floatQuadRect));
+ ASSERT_TRUE(canRectFBeSafelyRoundedToRect(quadRectF));
- cc::IntRect quadRect = enclosingIntRect(floatQuadRect);
+ gfx::Rect quadRect = gfx::ToEnclosingRect(quadRectF);
- EXPECT_TRUE(rect.contains(quadRect)) << quadString << i;
- EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i;
- remaining.subtract(cc::Region(quadRect));
+ EXPECT_TRUE(rect.Contains(quadRect)) << quadString << i;
+ EXPECT_TRUE(remaining.contains(cc::IntRect(quadRect))) << quadString << i;
+ remaining.subtract(cc::IntRect(quadRect));
}
EXPECT_TRUE(remaining.isEmpty());
diff --git a/cc/test/layer_test_common.h b/cc/test/layer_test_common.h
index d3ed729..4b32d82 100644
--- a/cc/test/layer_test_common.h
+++ b/cc/test/layer_test_common.h
@@ -5,15 +5,19 @@
#ifndef CCLayerTestCommon_h
#define CCLayerTestCommon_h
-#include "IntRect.h"
-#include "Region.h"
-#include "cc/render_pass.h"
+namespace cc {
+class QuadList;
+}
+
+namespace gfx {
+class Rect;
+}
namespace LayerTestCommon {
extern const char* quadString;
-void verifyQuadsExactlyCoverRect(const cc::QuadList&, const cc::IntRect&);
+void verifyQuadsExactlyCoverRect(const cc::QuadList&, const gfx::Rect&);
} // namespace LayerTestCommon
#endif // CCLayerTestCommon_h
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index 56b3049..6ed95ca 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -49,15 +49,15 @@ void FakeLayerUpdater::prepareToUpdate(const gfx::Rect& contentRect, const gfx::
{
m_prepareCount++;
m_lastUpdateRect = contentRect;
- if (!m_rectToInvalidate.isEmpty()) {
+ if (!m_rectToInvalidate.IsEmpty()) {
m_layer->invalidateContentRect(m_rectToInvalidate);
- m_rectToInvalidate = IntRect();
+ m_rectToInvalidate = gfx::Rect();
m_layer = NULL;
}
resultingOpaqueRect = m_opaquePaintRect;
}
-void FakeLayerUpdater::setRectToInvalidate(const IntRect& rect, FakeTiledLayer* layer)
+void FakeLayerUpdater::setRectToInvalidate(const gfx::Rect& rect, FakeTiledLayer* layer)
{
m_rectToInvalidate = rect;
m_layer = layer;
@@ -101,7 +101,7 @@ FakeTiledLayer::~FakeTiledLayer()
{
}
-void FakeTiledLayer::setNeedsDisplayRect(const FloatRect& rect)
+void FakeTiledLayer::setNeedsDisplayRect(const gfx::RectF& rect)
{
m_lastNeedsDisplayRect = rect;
TiledLayer::setNeedsDisplayRect(rect);
@@ -134,7 +134,7 @@ cc::LayerUpdater* FakeTiledLayer::updater() const
return m_fakeUpdater.get();
}
-cc::IntSize FakeTiledLayerWithScaledBounds::contentBounds() const
+gfx::Size FakeTiledLayerWithScaledBounds::contentBounds() const
{
return m_forcedContentBounds;
}
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 3dac556..2b95222 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -5,8 +5,6 @@
#ifndef CCTiledLayerTestCommon_h
#define CCTiledLayerTestCommon_h
-#include "IntRect.h"
-#include "IntSize.h"
#include "Region.h"
#include "cc/layer_updater.h"
#include "cc/prioritized_texture.h"
@@ -16,6 +14,8 @@
#include "cc/texture_uploader.h"
#include "cc/tiled_layer.h"
#include "cc/tiled_layer_impl.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/size.h"
namespace WebKitTests {
@@ -42,7 +42,7 @@ public:
virtual void prepareToUpdate(const gfx::Rect& contentRect, const gfx::Size&, float, float, gfx::Rect& resultingOpaqueRect, cc::RenderingStats&) OVERRIDE;
// Sets the rect to invalidate during the next call to prepareToUpdate(). After the next
// call to prepareToUpdate() the rect is reset.
- void setRectToInvalidate(const cc::IntRect&, FakeTiledLayer*);
+ void setRectToInvalidate(const gfx::Rect&, FakeTiledLayer*);
// Last rect passed to prepareToUpdate().
const gfx::Rect& lastUpdateRect() const { return m_lastUpdateRect; }
@@ -63,7 +63,7 @@ protected:
private:
int m_prepareCount;
int m_updateCount;
- cc::IntRect m_rectToInvalidate;
+ gfx::Rect m_rectToInvalidate;
gfx::Rect m_lastUpdateRect;
gfx::Rect m_opaquePaintRect;
scoped_refptr<FakeTiledLayer> m_layer;
@@ -82,7 +82,7 @@ class FakeTiledLayer : public cc::TiledLayer {
public:
explicit FakeTiledLayer(cc::PrioritizedTextureManager*);
- static cc::IntSize tileSize() { return cc::IntSize(100, 100); }
+ static gfx::Size tileSize() { return gfx::Size(100, 100); }
using cc::TiledLayer::invalidateContentRect;
using cc::TiledLayer::needsIdlePaint;
@@ -90,14 +90,14 @@ public:
using cc::TiledLayer::numPaintedTiles;
using cc::TiledLayer::idlePaintRect;
- virtual void setNeedsDisplayRect(const cc::FloatRect&) OVERRIDE;
- const cc::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
+ virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
+ const gfx::RectF& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; }
virtual void setTexturePriorities(const cc::PriorityCalculator&) OVERRIDE;
virtual cc::PrioritizedTextureManager* textureManager() const OVERRIDE;
FakeLayerUpdater* fakeLayerUpdater() { return m_fakeUpdater.get(); }
- cc::FloatRect updateRect() { return m_updateRect; }
+ gfx::RectF updateRect() { return m_updateRect; }
protected:
virtual cc::LayerUpdater* updater() const OVERRIDE;
@@ -107,22 +107,22 @@ protected:
private:
scoped_refptr<FakeLayerUpdater> m_fakeUpdater;
cc::PrioritizedTextureManager* m_textureManager;
- cc::FloatRect m_lastNeedsDisplayRect;
+ gfx::RectF m_lastNeedsDisplayRect;
};
class FakeTiledLayerWithScaledBounds : public FakeTiledLayer {
public:
explicit FakeTiledLayerWithScaledBounds(cc::PrioritizedTextureManager*);
- void setContentBounds(const cc::IntSize& contentBounds) { m_forcedContentBounds = contentBounds; }
- virtual cc::IntSize contentBounds() const OVERRIDE;
+ void setContentBounds(const gfx::Size& contentBounds) { m_forcedContentBounds = contentBounds; }
+ virtual gfx::Size contentBounds() const OVERRIDE;
virtual float contentsScaleX() const OVERRIDE;
virtual float contentsScaleY() const OVERRIDE;
virtual void setContentsScale(float) OVERRIDE;
protected:
virtual ~FakeTiledLayerWithScaledBounds();
- cc::IntSize m_forcedContentBounds;
+ gfx::Size m_forcedContentBounds;
};
}
diff --git a/cc/texture_layer.cc b/cc/texture_layer.cc
index f24b5e91..80d87fe 100644
--- a/cc/texture_layer.cc
+++ b/cc/texture_layer.cc
@@ -52,7 +52,7 @@ void TextureLayer::setFlipped(bool flipped)
setNeedsCommit();
}
-void TextureLayer::setUVRect(const FloatRect& rect)
+void TextureLayer::setUVRect(const gfx::RectF& rect)
{
m_uvRect = rect;
setNeedsCommit();
@@ -90,7 +90,7 @@ void TextureLayer::willModifyTexture()
}
}
-void TextureLayer::setNeedsDisplayRect(const FloatRect& dirtyRect)
+void TextureLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
{
Layer::setNeedsDisplayRect(dirtyRect);
diff --git a/cc/texture_layer.h b/cc/texture_layer.h
index 51e4536..5fe9eeb 100644
--- a/cc/texture_layer.h
+++ b/cc/texture_layer.h
@@ -31,7 +31,7 @@ public:
void setFlipped(bool);
// Sets a UV transform to be used at draw time. Defaults to (0, 0, 1, 1).
- void setUVRect(const FloatRect&);
+ void setUVRect(const gfx::RectF&);
// Sets whether the alpha channel is premultiplied or unpremultiplied. Defaults to true.
void setPremultipliedAlpha(bool);
@@ -46,7 +46,7 @@ public:
void willModifyTexture();
- virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
+ virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
virtual void setLayerTreeHost(LayerTreeHost*) OVERRIDE;
virtual bool drawsContent() const OVERRIDE;
@@ -61,7 +61,7 @@ private:
TextureLayerClient* m_client;
bool m_flipped;
- FloatRect m_uvRect;
+ gfx::RectF m_uvRect;
bool m_premultipliedAlpha;
bool m_rateLimitContext;
bool m_contextLost;
diff --git a/cc/texture_layer_impl.cc b/cc/texture_layer_impl.cc
index 85c65e7..ff5b33c 100644
--- a/cc/texture_layer_impl.cc
+++ b/cc/texture_layer_impl.cc
@@ -43,7 +43,7 @@ void TextureLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQu
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData);
- IntRect quadRect(IntPoint(), contentBounds());
+ gfx::Rect quadRect(gfx::Point(), contentBounds());
quadSink.append(TextureDrawQuad::create(sharedQuadState, quadRect, m_externalTextureResource, m_premultipliedAlpha, m_uvRect, m_flipped).PassAs<DrawQuad>(), appendQuadsData);
}
diff --git a/cc/texture_layer_impl.h b/cc/texture_layer_impl.h
index af80284..4293be8 100644
--- a/cc/texture_layer_impl.h
+++ b/cc/texture_layer_impl.h
@@ -29,7 +29,7 @@ public:
void setTextureId(unsigned id) { m_textureId = id; }
void setPremultipliedAlpha(bool premultipliedAlpha) { m_premultipliedAlpha = premultipliedAlpha; }
void setFlipped(bool flipped) { m_flipped = flipped; }
- void setUVRect(const FloatRect& rect) { m_uvRect = rect; }
+ void setUVRect(const gfx::RectF& rect) { m_uvRect = rect; }
private:
explicit TextureLayerImpl(int);
@@ -40,7 +40,7 @@ private:
ResourceProvider::ResourceId m_externalTextureResource;
bool m_premultipliedAlpha;
bool m_flipped;
- FloatRect m_uvRect;
+ gfx::RectF m_uvRect;
};
}
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index 64152f6..ac58216 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -66,7 +66,7 @@ ThreadProxy::~ThreadProxy()
DCHECK(!m_started);
}
-bool ThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
+bool ThreadProxy::compositeAndReadback(void *pixels, const gfx::Rect& rect)
{
TRACE_EVENT0("cc", "ThreadPRoxy::compositeAndReadback");
DCHECK(isMainThread());
diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h
index 534bb33..1249687 100644
--- a/cc/thread_proxy.h
+++ b/cc/thread_proxy.h
@@ -29,7 +29,7 @@ public:
virtual ~ThreadProxy();
// Proxy implementation
- virtual bool compositeAndReadback(void *pixels, const IntRect&) OVERRIDE;
+ virtual bool compositeAndReadback(void *pixels, const gfx::Rect&) OVERRIDE;
virtual void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE;
virtual void finishAllRendering() OVERRIDE;
virtual bool isStarted() const OVERRIDE;
@@ -105,7 +105,7 @@ private:
CompletionEvent completion;
bool success;
void* pixels;
- IntRect rect;
+ gfx::Rect rect;
};
void forceBeginFrameOnImplThread(CompletionEvent*);
void beginFrameCompleteOnImplThread(CompletionEvent*, ResourceUpdateQueue*);
diff --git a/cc/tile_draw_quad.cc b/cc/tile_draw_quad.cc
index d70163d..b4b6b47 100644
--- a/cc/tile_draw_quad.cc
+++ b/cc/tile_draw_quad.cc
@@ -11,12 +11,12 @@
namespace cc {
-scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
+scoped_ptr<TileDrawQuad> TileDrawQuad::create(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
{
return make_scoped_ptr(new TileDrawQuad(sharedQuadState, quadRect, opaqueRect, resourceId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));
}
-TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
+TileDrawQuad::TileDrawQuad(const SharedQuadState* sharedQuadState, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)
: DrawQuad(sharedQuadState, DrawQuad::TiledContent, quadRect)
, m_resourceId(resourceId)
, m_textureOffset(textureOffset)
diff --git a/cc/tile_draw_quad.h b/cc/tile_draw_quad.h
index da02ea6..2e4e89c 100644
--- a/cc/tile_draw_quad.h
+++ b/cc/tile_draw_quad.h
@@ -17,10 +17,10 @@ namespace cc {
class TileDrawQuad : public DrawQuad {
public:
- static scoped_ptr<TileDrawQuad> create(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
+ static scoped_ptr<TileDrawQuad> create(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
unsigned resourceId() const { return m_resourceId; }
- gfx::Point textureOffset() const { return m_textureOffset; }
+ gfx::Vector2d textureOffset() const { return m_textureOffset; }
gfx::Size textureSize() const { return m_textureSize; }
GLint textureFilter() const { return m_textureFilter; }
bool swizzleContents() const { return m_swizzleContents; }
@@ -34,10 +34,10 @@ public:
static const TileDrawQuad* materialCast(const DrawQuad*);
private:
- TileDrawQuad(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Point& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
+ TileDrawQuad(const SharedQuadState*, const gfx::Rect& quadRect, const gfx::Rect& opaqueRect, unsigned resourceId, const gfx::Vector2d& textureOffset, const gfx::Size& textureSize, GLint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);
unsigned m_resourceId;
- gfx::Point m_textureOffset;
+ gfx::Vector2d m_textureOffset;
gfx::Size m_textureSize;
GLint m_textureFilter;
bool m_swizzleContents;
diff --git a/cc/tiled_layer.cc b/cc/tiled_layer.cc
index 7232042..fd2b4d5 100644
--- a/cc/tiled_layer.cc
+++ b/cc/tiled_layer.cc
@@ -8,11 +8,13 @@
#include "Region.h"
#include "base/basictypes.h"
+#include "cc/geometry.h"
#include "cc/layer_impl.h"
#include "cc/layer_tree_host.h"
#include "cc/overdraw_metrics.h"
#include "cc/tiled_layer_impl.h"
#include "third_party/khronos/GLES2/gl2.h"
+#include "ui/gfx/rect_conversions.h"
using namespace std;
using WebKit::WebTransformationMatrix;
@@ -39,7 +41,7 @@ public:
LayerUpdater::Resource* updaterResource() { return m_updaterResource.get(); }
PrioritizedTexture* managedTexture() { return m_updaterResource->texture(); }
- bool isDirty() const { return !dirtyRect.isEmpty(); }
+ bool isDirty() const { return !dirtyRect.IsEmpty(); }
// Reset update state for the current frame. This should occur before painting
// for all layers. Since painting one layer can invalidate another layer
@@ -47,7 +49,7 @@ public:
// such that invalidations during painting won't prevent them from being pushed.
void resetUpdateState()
{
- updateRect = IntRect();
+ updateRect = gfx::Rect();
occluded = false;
partialUpdate = false;
validForFrame = !isDirty();
@@ -60,11 +62,11 @@ public:
{
validForFrame = true;
updateRect = dirtyRect;
- dirtyRect = IntRect();
+ dirtyRect = gfx::Rect();
}
- IntRect dirtyRect;
- IntRect updateRect;
+ gfx::Rect dirtyRect;
+ gfx::Rect updateRect;
bool partialUpdate;
bool validForFrame;
bool occluded;
@@ -90,7 +92,7 @@ TiledLayer::TiledLayer()
, m_failedUpdate(false)
, m_tilingOption(AutoTile)
{
- m_tiler = LayerTilingData::create(IntSize(), LayerTilingData::HasBorderTexels);
+ m_tiler = LayerTilingData::create(gfx::Size(), LayerTilingData::HasBorderTexels);
}
TiledLayer::~TiledLayer()
@@ -106,22 +108,22 @@ void TiledLayer::updateTileSizeAndTilingOption()
{
DCHECK(layerTreeHost());
- const IntSize& defaultTileSize = layerTreeHost()->settings().defaultTileSize;
- const IntSize& maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledLayerSize;
+ gfx::Size defaultTileSize = layerTreeHost()->settings().defaultTileSize;
+ gfx::Size maxUntiledLayerSize = layerTreeHost()->settings().maxUntiledLayerSize;
int layerWidth = contentBounds().width();
int layerHeight = contentBounds().height();
- const IntSize tileSize(min(defaultTileSize.width(), layerWidth), min(defaultTileSize.height(), layerHeight));
+ gfx::Size tileSize(min(defaultTileSize.width(), layerWidth), min(defaultTileSize.height(), layerHeight));
// Tile if both dimensions large, or any one dimension large and the other
// extends into a second tile but the total layer area isn't larger than that
// of the largest possible untiled layer. This heuristic allows for long skinny layers
// (e.g. scrollbars) that are Nx1 tiles to minimize wasted texture space but still avoids
// creating very large tiles.
- const bool anyDimensionLarge = layerWidth > maxUntiledLayerSize.width() || layerHeight > maxUntiledLayerSize.height();
- const bool anyDimensionOneTile = (layerWidth <= defaultTileSize.width() || layerHeight <= defaultTileSize.height())
+ bool anyDimensionLarge = layerWidth > maxUntiledLayerSize.width() || layerHeight > maxUntiledLayerSize.height();
+ bool anyDimensionOneTile = (layerWidth <= defaultTileSize.width() || layerHeight <= defaultTileSize.height())
&& (layerWidth * layerHeight) <= (maxUntiledLayerSize.width() * maxUntiledLayerSize.height());
- const bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
+ bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
bool isTiled;
if (m_tilingOption == AlwaysTile)
@@ -131,30 +133,30 @@ void TiledLayer::updateTileSizeAndTilingOption()
else
isTiled = autoTiled;
- IntSize requestedSize = isTiled ? tileSize : contentBounds();
+ gfx::Size requestedSize = isTiled ? tileSize : contentBounds();
const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
- IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize));
+ gfx::Size clampedSize = ClampSizeFromAbove(requestedSize, gfx::Size(maxSize, maxSize));
setTileSize(clampedSize);
}
void TiledLayer::updateBounds()
{
- IntSize oldBounds = m_tiler->bounds();
- IntSize newBounds = contentBounds();
+ gfx::Size oldBounds = m_tiler->bounds();
+ gfx::Size newBounds = contentBounds();
if (oldBounds == newBounds)
return;
m_tiler->setBounds(newBounds);
// Invalidate any areas that the new bounds exposes.
- Region oldRegion(IntRect(IntPoint(), oldBounds));
- Region newRegion(IntRect(IntPoint(), newBounds));
+ Region oldRegion = IntRect(IntPoint(), cc::IntSize(oldBounds));
+ Region newRegion = IntRect(IntPoint(), cc::IntSize(newBounds));
newRegion.subtract(oldRegion);
Vector<WebCore::IntRect> rects = newRegion.rects();
for (size_t i = 0; i < rects.size(); ++i)
- invalidateContentRect(rects[i]);
+ invalidateContentRect(cc::IntRect(rects[i]));
}
-void TiledLayer::setTileSize(const IntSize& size)
+void TiledLayer::setTileSize(const gfx::Size& size)
{
m_tiler->setTileSize(size);
}
@@ -269,7 +271,7 @@ UpdatableTile* TiledLayer::createTile(int i, int j)
return addedTile;
}
-void TiledLayer::setNeedsDisplayRect(const FloatRect& dirtyRect)
+void TiledLayer::setNeedsDisplayRect(const gfx::RectF& dirtyRect)
{
invalidateContentRect(layerRectToContentRect(dirtyRect));
ContentsScalingLayer::setNeedsDisplayRect(dirtyRect);
@@ -289,10 +291,10 @@ void TiledLayer::setUseLCDText(bool useLCDText)
setBorderTexelOption(borderTexelOption);
}
-void TiledLayer::invalidateContentRect(const IntRect& contentRect)
+void TiledLayer::invalidateContentRect(const gfx::Rect& contentRect)
{
updateBounds();
- if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw)
+ if (m_tiler->isEmpty() || contentRect.IsEmpty() || m_skipsDraw)
return;
for (LayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) {
@@ -301,16 +303,16 @@ void TiledLayer::invalidateContentRect(const IntRect& contentRect)
// FIXME: This should not ever be null.
if (!tile)
continue;
- IntRect bound = m_tiler->tileRect(tile);
- bound.intersect(contentRect);
- tile->dirtyRect.unite(bound);
+ gfx::Rect bound = m_tiler->tileRect(tile);
+ bound.Intersect(contentRect);
+ tile->dirtyRect.Union(bound);
}
}
// Returns true if tile is dirty and only part of it needs to be updated.
bool TiledLayer::tileOnlyNeedsPartialUpdate(UpdatableTile* tile)
{
- return !tile->dirtyRect.contains(m_tiler->tileRect(tile)) && tile->managedTexture()->haveBackingTexture();
+ return !tile->dirtyRect.Contains(m_tiler->tileRect(tile)) && tile->managedTexture()->haveBackingTexture();
}
bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats, bool& didPaint)
@@ -324,12 +326,12 @@ bool TiledLayer::updateTiles(int left, int top, int right, int bottom, ResourceU
return false;
}
- IntRect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclusions);
+ gfx::Rect paintRect = markTilesForUpdate(left, top, right, bottom, ignoreOcclusions);
if (occlusion)
- occlusion->overdrawMetrics().didPaint(paintRect);
+ occlusion->overdrawMetrics().didPaint(cc::IntRect(paintRect));
- if (paintRect.isEmpty())
+ if (paintRect.IsEmpty())
return true;
didPaint = true;
@@ -355,7 +357,7 @@ void TiledLayer::markOcclusionsAndRequestTextures(int left, int top, int right,
if (!tile)
continue;
DCHECK(!tile->occluded); // Did resetUpdateState get skipped? Are we doing more than one occlusion pass?
- IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect());
+ gfx::Rect visibleTileRect = gfx::IntersectRects(m_tiler->tileBounds(i, j), visibleContentRect());
if (occlusion && occlusion->occluded(renderTarget(), visibleTileRect, drawTransform(), drawTransformIsAnimating(), drawableContentRect())) {
tile->occluded = true;
occludedTileCount++;
@@ -397,9 +399,9 @@ bool TiledLayer::haveTexturesForTiles(int left, int top, int right, int bottom,
return true;
}
-IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions)
+gfx::Rect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions)
{
- IntRect paintRect;
+ gfx::Rect paintRect;
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
@@ -424,20 +426,19 @@ IntRect TiledLayer::markTilesForUpdate(int left, int top, int right, int bottom,
}
}
- paintRect.unite(tile->dirtyRect);
+ paintRect.Union(tile->dirtyRect);
tile->markForUpdate();
}
}
return paintRect;
}
-void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats)
+void TiledLayer::updateTileTextures(const gfx::Rect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue& queue, const OcclusionTracker* occlusion, RenderingStats& stats)
{
// The updateRect should be in layer space. So we have to convert the paintRect from content space to layer space.
- m_updateRect = FloatRect(paintRect);
float widthScale = bounds().width() / static_cast<float>(contentBounds().width());
float heightScale = bounds().height() / static_cast<float>(contentBounds().height());
- m_updateRect.scale(widthScale, heightScale);
+ m_updateRect = gfx::ScaleRect(paintRect, widthScale, heightScale);
// Calling prepareToUpdate() calls into WebKit to paint, which may have the side
// effect of disabling compositing, which causes our reference to the texture updater to be deleted.
@@ -455,49 +456,49 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
if (!tile)
continue;
- IntRect tileRect = m_tiler->tileBounds(i, j);
+ gfx::Rect tileRect = m_tiler->tileBounds(i, j);
// Use updateRect as the above loop copied the dirty rect for this frame to updateRect.
- const IntRect& dirtyRect = tile->updateRect;
- if (dirtyRect.isEmpty())
+ const gfx::Rect& dirtyRect = tile->updateRect;
+ if (dirtyRect.IsEmpty())
continue;
// Save what was painted opaque in the tile. Keep the old area if the paint didn't touch it, and didn't paint some
// other part of the tile opaque.
- IntRect tilePaintedRect = intersection(tileRect, paintRect);
- IntRect tilePaintedOpaqueRect = intersection(tileRect, cc::IntRect(paintedOpaqueRect));
- if (!tilePaintedRect.isEmpty()) {
- IntRect paintInsideTileOpaqueRect = intersection(tile->opaqueRect(), tilePaintedRect);
- bool paintInsideTileOpaqueRectIsNonOpaque = !tilePaintedOpaqueRect.contains(paintInsideTileOpaqueRect);
- bool opaquePaintNotInsideTileOpaqueRect = !tilePaintedOpaqueRect.isEmpty() && !tile->opaqueRect().contains(tilePaintedOpaqueRect);
+ gfx::Rect tilePaintedRect = gfx::IntersectRects(tileRect, paintRect);
+ gfx::Rect tilePaintedOpaqueRect = gfx::IntersectRects(tileRect, paintedOpaqueRect);
+ if (!tilePaintedRect.IsEmpty()) {
+ gfx::Rect paintInsideTileOpaqueRect = gfx::IntersectRects(tile->opaqueRect(), tilePaintedRect);
+ bool paintInsideTileOpaqueRectIsNonOpaque = !tilePaintedOpaqueRect.Contains(paintInsideTileOpaqueRect);
+ bool opaquePaintNotInsideTileOpaqueRect = !tilePaintedOpaqueRect.IsEmpty() && !tile->opaqueRect().Contains(tilePaintedOpaqueRect);
if (paintInsideTileOpaqueRectIsNonOpaque || opaquePaintNotInsideTileOpaqueRect)
tile->setOpaqueRect(tilePaintedOpaqueRect);
}
// sourceRect starts as a full-sized tile with border texels included.
- IntRect sourceRect = m_tiler->tileRect(tile);
- sourceRect.intersect(dirtyRect);
+ gfx::Rect sourceRect = m_tiler->tileRect(tile);
+ sourceRect.Intersect(dirtyRect);
// Paint rect not guaranteed to line up on tile boundaries, so
// make sure that sourceRect doesn't extend outside of it.
- sourceRect.intersect(paintRect);
+ sourceRect.Intersect(paintRect);
tile->updateRect = sourceRect;
- if (sourceRect.isEmpty())
+ if (sourceRect.IsEmpty())
continue;
- const IntPoint anchor = m_tiler->tileRect(tile).location();
+ const gfx::Point anchor = m_tiler->tileRect(tile).origin();
// Calculate tile-space rectangle to upload into.
- gfx::Vector2d destOffset(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y());
+ gfx::Vector2d destOffset = sourceRect.origin() - anchor;
if (destOffset.x() < 0)
CRASH();
if (destOffset.y() < 0)
CRASH();
// Offset from paint rectangle to this tile's dirty rectangle.
- gfx::Vector2d paintOffset(sourceRect.x() - paintRect.x(), sourceRect.y() - paintRect.y());
+ gfx::Vector2d paintOffset = sourceRect.origin() - paintRect.origin();
if (paintOffset.x() < 0)
CRASH();
if (paintOffset.y() < 0)
@@ -509,7 +510,7 @@ void TiledLayer::updateTileTextures(const IntRect& paintRect, int left, int top,
tile->updaterResource()->update(queue, sourceRect, destOffset, tile->partialUpdate, stats);
if (occlusion)
- occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), sourceRect, tile->opaqueRect());
+ occlusion->overdrawMetrics().didUpload(WebTransformationMatrix(), cc::IntRect(sourceRect), cc::IntRect(tile->opaqueRect()));
}
}
@@ -523,8 +524,8 @@ bool isSmallAnimatedLayer(TiledLayer* layer)
{
if (!layer->drawTransformIsAnimating() && !layer->screenSpaceTransformIsAnimating())
return false;
- IntSize viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->deviceViewportSize() : IntSize();
- IntRect contentRect(IntPoint::zero(), layer->contentBounds());
+ gfx::Size viewportSize = layer->layerTreeHost() ? layer->layerTreeHost()->deviceViewportSize() : gfx::Size();
+ gfx::Rect contentRect(gfx::Point(), layer->contentBounds());
return contentRect.width() <= viewportSize.width() + 64
&& contentRect.height() <= viewportSize.height() + 64;
}
@@ -532,14 +533,14 @@ bool isSmallAnimatedLayer(TiledLayer* layer)
// FIXME: Remove this and make this based on distance once distance can be calculated
// for offscreen layers. For now, prioritize all small animated layers after 512
// pixels of pre-painting.
-void setPriorityForTexture(const IntRect& visibleRect,
- const IntRect& tileRect,
+void setPriorityForTexture(const gfx::Rect& visibleRect,
+ const gfx::Rect& tileRect,
bool drawsToRoot,
bool isSmallAnimatedLayer,
PrioritizedTexture* texture)
{
int priority = PriorityCalculator::lowestPriority();
- if (!visibleRect.isEmpty())
+ if (!visibleRect.IsEmpty())
priority = PriorityCalculator::priorityFromDistance(visibleRect, tileRect, drawsToRoot);
if (isSmallAnimatedLayer)
priority = PriorityCalculator::maxPriority(priority, PriorityCalculator::smallAnimatedLayerMinPriority());
@@ -561,10 +562,10 @@ void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
bool smallAnimatedLayer = isSmallAnimatedLayer(this);
// Minimally create the tiles in the desired pre-paint rect.
- IntRect createTilesRect = idlePaintRect();
+ gfx::Rect createTilesRect = idlePaintRect();
if (smallAnimatedLayer)
- createTilesRect = IntRect(IntPoint::zero(), contentBounds());
- if (!createTilesRect.isEmpty()) {
+ createTilesRect = gfx::Rect(gfx::Point(), contentBounds());
+ if (!createTilesRect.IsEmpty()) {
int left, top, right, bottom;
m_tiler->contentRectToTileIndices(createTilesRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
@@ -581,7 +582,7 @@ void TiledLayer::setTexturePriorities(const PriorityCalculator& priorityCalc)
// FIXME: This should not ever be null.
if (!tile)
continue;
- IntRect tileRect = m_tiler->tileRect(tile);
+ gfx::Rect tileRect = m_tiler->tileRect(tile);
setPriorityForTexture(m_predictedVisibleRect, tileRect, drawsToRoot, smallAnimatedLayer, tile->managedTexture());
}
}
@@ -591,7 +592,7 @@ Region TiledLayer::visibleContentOpaqueRegion() const
if (m_skipsDraw)
return Region();
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return m_tiler->opaqueRegionInContentRect(visibleContentRect());
}
@@ -611,12 +612,12 @@ void TiledLayer::resetUpdateState()
}
namespace {
-IntRect expandRectByDelta(IntRect rect, IntSize delta) {
- int width = rect.width() + abs(delta.width());
- int height = rect.height() + abs(delta.height());
- int x = rect.x() + ((delta.width() < 0) ? delta.width() : 0);
- int y = rect.y() + ((delta.height() < 0) ? delta.height() : 0);
- return IntRect(x, y, width, height);
+gfx::Rect expandRectByDelta(gfx::Rect rect, gfx::Vector2d delta) {
+ int width = rect.width() + abs(delta.x());
+ int height = rect.height() + abs(delta.y());
+ int x = rect.x() + ((delta.x() < 0) ? delta.x() : 0);
+ int y = rect.y() + ((delta.y() < 0) ? delta.y() : 0);
+ return gfx::Rect(x, y, width, height);
}
}
@@ -630,21 +631,21 @@ void TiledLayer::updateScrollPrediction()
// - visibleRect.size() hasn't changed.
// These two conditions prevent rotations, scales, pinch-zooms etc. where
// the prediction would be incorrect.
- IntSize delta = visibleContentRect().center() - m_previousVisibleRect.center();
+ gfx::Vector2d delta = visibleContentRect().CenterPoint() - m_previousVisibleRect.CenterPoint();
m_predictedScroll = -delta;
m_predictedVisibleRect = visibleContentRect();
if (m_previousContentBounds == contentBounds() && m_previousVisibleRect.size() == visibleContentRect().size()) {
// Only expand the visible rect in the major scroll direction, to prevent
// massive paints due to diagonal scrolls.
- IntSize majorScrollDelta = (abs(delta.width()) > abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
+ gfx::Vector2d majorScrollDelta = (abs(delta.x()) > abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
m_predictedVisibleRect = expandRectByDelta(visibleContentRect(), majorScrollDelta);
// Bound the prediction to prevent unbounded paints, and clamp to content bounds.
- IntRect bound = visibleContentRect();
- bound.inflateX(m_tiler->tileSize().width() * maxPredictiveTilesCount);
- bound.inflateY(m_tiler->tileSize().height() * maxPredictiveTilesCount);
- bound.intersect(IntRect(IntPoint::zero(), contentBounds()));
- m_predictedVisibleRect.intersect(bound);
+ gfx::Rect bound = visibleContentRect();
+ bound.Inset(-m_tiler->tileSize().width() * maxPredictiveTilesCount,
+ -m_tiler->tileSize().height() * maxPredictiveTilesCount);
+ bound.Intersect(gfx::Rect(gfx::Point(), contentBounds()));
+ m_predictedVisibleRect.Intersect(bound);
}
m_previousContentBounds = contentBounds();
m_previousVisibleRect = visibleContentRect();
@@ -664,7 +665,7 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
// hiccups while it is animating.
if (isSmallAnimatedLayer(this)) {
int left, top, right, bottom;
- m_tiler->contentRectToTileIndices(IntRect(IntPoint::zero(), contentBounds()), left, top, right, bottom);
+ m_tiler->contentRectToTileIndices(gfx::Rect(gfx::Point(), contentBounds()), left, top, right, bottom);
updateTiles(left, top, right, bottom, queue, 0, stats, didPaint);
if (didPaint)
return;
@@ -673,7 +674,7 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
m_failedUpdate = false;
}
- if (m_predictedVisibleRect.isEmpty())
+ if (m_predictedVisibleRect.IsEmpty())
return;
// Visible painting. First occlude visible tiles and paint the non-occluded tiles.
@@ -687,8 +688,8 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
return;
// If we have already painting everything visible. Do some pre-painting while idle.
- IntRect idlePaintContentRect = idlePaintRect();
- if (idlePaintContentRect.isEmpty())
+ gfx::Rect idlePaintContentRect = idlePaintRect();
+ if (idlePaintContentRect.IsEmpty())
return;
// Prepaint anything that was occluded but inside the layer's visible region.
@@ -700,35 +701,35 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
// Then expand outwards one row/column at a time until we find a dirty row/column
// to update. Increment along the major and minor scroll directions first.
- IntSize delta = -m_predictedScroll;
- delta = IntSize(delta.width() == 0 ? 1 : delta.width(),
- delta.height() == 0 ? 1 : delta.height());
- IntSize majorDelta = (abs(delta.width()) > abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
- IntSize minorDelta = (abs(delta.width()) <= abs(delta.height())) ? IntSize(delta.width(), 0) : IntSize(0, delta.height());
- IntSize deltas[4] = {majorDelta, minorDelta, -majorDelta, -minorDelta};
+ gfx::Vector2d delta = -m_predictedScroll;
+ delta = gfx::Vector2d(delta.x() == 0 ? 1 : delta.x(),
+ delta.y() == 0 ? 1 : delta.y());
+ gfx::Vector2d majorDelta = (abs(delta.x()) > abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
+ gfx::Vector2d minorDelta = (abs(delta.x()) <= abs(delta.y())) ? gfx::Vector2d(delta.x(), 0) : gfx::Vector2d(0, delta.y());
+ gfx::Vector2d deltas[4] = {majorDelta, minorDelta, -majorDelta, -minorDelta};
for(int i = 0; i < 4; i++) {
- if (deltas[i].height() > 0) {
+ if (deltas[i].y() > 0) {
while (bottom < prepaintBottom) {
++bottom;
if (!updateTiles(left, bottom, right, bottom, queue, 0, stats, didPaint) || didPaint)
return;
}
}
- if (deltas[i].height() < 0) {
+ if (deltas[i].y() < 0) {
while (top > prepaintTop) {
--top;
if (!updateTiles(left, top, right, top, queue, 0, stats, didPaint) || didPaint)
return;
}
}
- if (deltas[i].width() < 0) {
+ if (deltas[i].x() < 0) {
while (left > prepaintLeft) {
--left;
if (!updateTiles(left, top, left, bottom, queue, 0, stats, didPaint) || didPaint)
return;
}
}
- if (deltas[i].width() > 0) {
+ if (deltas[i].x() > 0) {
while (right < prepaintRight) {
++right;
if (!updateTiles(right, top, right, bottom, queue, 0, stats, didPaint) || didPaint)
@@ -741,11 +742,11 @@ void TiledLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* occl
bool TiledLayer::needsIdlePaint()
{
// Don't trigger more paints if we failed (as we'll just fail again).
- if (m_failedUpdate || visibleContentRect().isEmpty() || m_tiler->hasEmptyBounds() || !drawsContent())
+ if (m_failedUpdate || visibleContentRect().IsEmpty() || m_tiler->hasEmptyBounds() || !drawsContent())
return false;
- IntRect idlePaintContentRect = idlePaintRect();
- if (idlePaintContentRect.isEmpty())
+ gfx::Rect idlePaintContentRect = idlePaintRect();
+ if (idlePaintContentRect.IsEmpty())
return false;
int left, top, right, bottom;
@@ -758,7 +759,7 @@ bool TiledLayer::needsIdlePaint()
if (!tile)
continue;
- bool updated = !tile->updateRect.isEmpty();
+ bool updated = !tile->updateRect.IsEmpty();
bool canAcquire = tile->managedTexture()->canAcquireBackingTexture();
bool dirty = tile->isDirty() || !tile->managedTexture()->haveBackingTexture();
if (!updated && canAcquire && dirty)
@@ -768,17 +769,17 @@ bool TiledLayer::needsIdlePaint()
return false;
}
-IntRect TiledLayer::idlePaintRect()
+gfx::Rect TiledLayer::idlePaintRect()
{
// Don't inflate an empty rect.
- if (visibleContentRect().isEmpty())
- return IntRect();
-
- IntRect prepaintRect = visibleContentRect();
- prepaintRect.inflateX(m_tiler->tileSize().width() * prepaintColumns);
- prepaintRect.inflateY(m_tiler->tileSize().height() * prepaintRows);
- IntRect contentRect(IntPoint::zero(), contentBounds());
- prepaintRect.intersect(contentRect);
+ if (visibleContentRect().IsEmpty())
+ return gfx::Rect();
+
+ gfx::Rect prepaintRect = visibleContentRect();
+ prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns,
+ -m_tiler->tileSize().height() * prepaintRows);
+ gfx::Rect contentRect(gfx::Point(), contentBounds());
+ prepaintRect.Intersect(contentRect);
return prepaintRect;
}
diff --git a/cc/tiled_layer.h b/cc/tiled_layer.h
index 7994d2c..b468a8a 100644
--- a/cc/tiled_layer.h
+++ b/cc/tiled_layer.h
@@ -22,7 +22,7 @@ public:
virtual bool drawsContent() const OVERRIDE;
- virtual void setNeedsDisplayRect(const FloatRect&) OVERRIDE;
+ virtual void setNeedsDisplayRect(const gfx::RectF&) OVERRIDE;
virtual void setUseLCDText(bool) OVERRIDE;
@@ -42,7 +42,7 @@ protected:
void updateBounds();
// Exposed to subclasses for testing.
- void setTileSize(const IntSize&);
+ void setTileSize(const gfx::Size&);
void setTextureFormat(GLenum textureFormat) { m_textureFormat = textureFormat; }
void setBorderTexelOption(LayerTilingData::BorderTexelOption);
size_t numPaintedTiles() { return m_tiler->tiles().size(); }
@@ -51,14 +51,14 @@ protected:
virtual void createUpdaterIfNeeded() = 0;
// Set invalidations to be potentially repainted during update().
- void invalidateContentRect(const IntRect& contentRect);
+ void invalidateContentRect(const gfx::Rect& contentRect);
// Reset state on tiles that will be used for updating the layer.
void resetUpdateState();
// After preparing an update, returns true if more painting is needed.
bool needsIdlePaint();
- IntRect idlePaintRect();
+ gfx::Rect idlePaintRect();
bool skipsDraw() const { return m_skipsDraw; }
@@ -78,8 +78,8 @@ private:
bool updateTiles(int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&, bool& didPaint);
bool haveTexturesForTiles(int left, int top, int right, int bottom, bool ignoreOcclusions);
- IntRect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
- void updateTileTextures(const IntRect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&);
+ gfx::Rect markTilesForUpdate(int left, int top, int right, int bottom, bool ignoreOcclusions);
+ void updateTileTextures(const gfx::Rect& paintRect, int left, int top, int right, int bottom, ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&);
void updateScrollPrediction();
UpdatableTile* tileAt(int, int) const;
@@ -90,10 +90,10 @@ private:
bool m_failedUpdate;
// Used for predictive painting.
- IntSize m_predictedScroll;
- IntRect m_predictedVisibleRect;
- IntRect m_previousVisibleRect;
- IntSize m_previousContentBounds;
+ gfx::Vector2d m_predictedScroll;
+ gfx::Rect m_predictedVisibleRect;
+ gfx::Rect m_previousVisibleRect;
+ gfx::Size m_previousContentBounds;
TilingOption m_tilingOption;
scoped_ptr<LayerTilingData> m_tiler;
diff --git a/cc/tiled_layer_impl.cc b/cc/tiled_layer_impl.cc
index b7a12af..785742c 100644
--- a/cc/tiled_layer_impl.cc
+++ b/cc/tiled_layer_impl.cc
@@ -118,9 +118,9 @@ DrawableTile* TiledLayerImpl::createTile(int i, int j)
void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuadsData)
{
- const IntRect& contentRect = visibleContentRect();
+ const gfx::Rect& contentRect = visibleContentRect();
- if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty())
+ if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.IsEmpty())
return;
SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQuadState());
@@ -133,7 +133,7 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
DrawableTile* tile = tileAt(i, j);
- IntRect tileRect = m_tiler->tileBounds(i, j);
+ gfx::Rect tileRect = m_tiler->tileBounds(i, j);
SkColor borderColor;
if (m_skipsDraw || !tile || !tile->resourceId())
@@ -151,12 +151,12 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
DrawableTile* tile = tileAt(i, j);
- IntRect tileRect = m_tiler->tileBounds(i, j);
- IntRect displayRect = tileRect;
- tileRect.intersect(contentRect);
+ gfx::Rect tileRect = m_tiler->tileBounds(i, j);
+ gfx::Rect displayRect = tileRect;
+ tileRect.Intersect(contentRect);
// Skip empty tiles.
- if (tileRect.isEmpty())
+ if (tileRect.IsEmpty())
continue;
if (!tile || !tile->resourceId()) {
@@ -177,16 +177,16 @@ void TiledLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
continue;
}
- IntRect tileOpaqueRect = tile->opaqueRect();
- tileOpaqueRect.intersect(contentRect);
+ gfx::Rect tileOpaqueRect = tile->opaqueRect();
+ tileOpaqueRect.Intersect(contentRect);
// Keep track of how the top left has moved, so the texture can be
// offset the same amount.
- IntSize displayOffset = tileRect.minXMinYCorner() - displayRect.minXMinYCorner();
- IntPoint textureOffset = m_tiler->textureOffset(i, j) + displayOffset;
+ gfx::Vector2d displayOffset = tileRect.origin() - displayRect.origin();
+ gfx::Vector2d textureOffset = m_tiler->textureOffset(i, j) + displayOffset;
float tileWidth = static_cast<float>(m_tiler->tileSize().width());
float tileHeight = static_cast<float>(m_tiler->tileSize().height());
- IntSize textureSize(tileWidth, tileHeight);
+ gfx::Size textureSize(tileWidth, tileHeight);
bool clipped = false;
FloatQuad visibleContentInTargetQuad = MathUtil::mapQuad(drawTransform(), FloatQuad(visibleContentRect()), clipped);
@@ -213,7 +213,7 @@ void TiledLayerImpl::setTilingData(const LayerTilingData& tiler)
*m_tiler = tiler;
}
-void TiledLayerImpl::pushTileProperties(int i, int j, ResourceProvider::ResourceId resourceId, const IntRect& opaqueRect, bool contentsSwizzled)
+void TiledLayerImpl::pushTileProperties(int i, int j, ResourceProvider::ResourceId resourceId, const gfx::Rect& opaqueRect, bool contentsSwizzled)
{
DrawableTile* tile = tileAt(i, j);
if (!tile)
@@ -229,7 +229,7 @@ void TiledLayerImpl::pushInvalidTile(int i, int j)
if (!tile)
tile = createTile(i, j);
tile->setResourceId(0);
- tile->setOpaqueRect(IntRect());
+ tile->setOpaqueRect(gfx::Rect());
tile->setContentsSwizzled(false);
}
@@ -238,7 +238,7 @@ Region TiledLayerImpl::visibleContentOpaqueRegion() const
if (m_skipsDraw)
return Region();
if (contentsOpaque())
- return visibleContentRect();
+ return cc::IntRect(visibleContentRect());
return m_tiler->opaqueRegionInContentRect(visibleContentRect());
}
diff --git a/cc/tiled_layer_impl.h b/cc/tiled_layer_impl.h
index fb6a63b..ce1ca83 100644
--- a/cc/tiled_layer_impl.h
+++ b/cc/tiled_layer_impl.h
@@ -29,7 +29,7 @@ public:
void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; }
void setTilingData(const LayerTilingData& tiler);
- void pushTileProperties(int, int, ResourceProvider::ResourceId, const IntRect& opaqueRect, bool contentsSwizzled);
+ void pushTileProperties(int, int, ResourceProvider::ResourceId, const gfx::Rect& opaqueRect, bool contentsSwizzled);
void pushInvalidTile(int, int);
virtual Region visibleContentOpaqueRegion() const OVERRIDE;
diff --git a/cc/tiled_layer_impl_unittest.cc b/cc/tiled_layer_impl_unittest.cc
index e8c066f..35c4962 100644
--- a/cc/tiled_layer_impl_unittest.cc
+++ b/cc/tiled_layer_impl_unittest.cc
@@ -22,14 +22,14 @@ namespace {
// Create a default tiled layer with textures for all tiles and a default
// visibility of the entire layer size.
-static scoped_ptr<TiledLayerImpl> createLayer(const IntSize& tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexels)
+static scoped_ptr<TiledLayerImpl> createLayer(const gfx::Size& tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexels)
{
scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(1);
scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(tileSize, borderTexels);
tiler->setBounds(layerSize);
layer->setTilingData(*tiler);
layer->setSkipsDraw(false);
- layer->setVisibleContentRect(IntRect(IntPoint(), layerSize));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layerSize));
layer->setDrawOpacity(1);
layer->setBounds(layerSize);
layer->setContentBounds(layerSize);
@@ -39,7 +39,7 @@ static scoped_ptr<TiledLayerImpl> createLayer(const IntSize& tileSize, const Int
ResourceProvider::ResourceId resourceId = 1;
for (int i = 0; i < tiler->numTilesX(); ++i)
for (int j = 0; j < tiler->numTilesY(); ++j)
- layer->pushTileProperties(i, j, resourceId++, IntRect(0, 0, 1, 1), false);
+ layer->pushTileProperties(i, j, resourceId++, gfx::Rect(0, 0, 1, 1), false);
return layer.Pass();
}
@@ -48,10 +48,10 @@ TEST(TiledLayerImplTest, emptyQuadList)
{
DebugScopedSetImplThread scopedImplThread;
- const IntSize tileSize(90, 90);
+ const gfx::Size tileSize(90, 90);
const int numTilesX = 8;
const int numTilesY = 4;
- const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
+ const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
// Verify default layer does creates quads
{
@@ -66,7 +66,7 @@ TEST(TiledLayerImplTest, emptyQuadList)
// Layer with empty visible layer rect produces no quads
{
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
- layer->setVisibleContentRect(IntRect());
+ layer->setVisibleContentRect(gfx::Rect());
MockQuadCuller quadCuller;
AppendQuadsData data;
@@ -78,7 +78,7 @@ TEST(TiledLayerImplTest, emptyQuadList)
{
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
- IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50));
+ gfx::Rect outsideBounds(gfx::Point(-100, -100), gfx::Size(50, 50));
layer->setVisibleContentRect(outsideBounds);
MockQuadCuller quadCuller;
@@ -103,10 +103,10 @@ TEST(TiledLayerImplTest, checkerboarding)
{
DebugScopedSetImplThread scopedImplThread;
- const IntSize tileSize(10, 10);
+ const gfx::Size tileSize(10, 10);
const int numTilesX = 2;
const int numTilesY = 2;
- const IntSize layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
+ const gfx::Size layerSize(tileSize.width() * numTilesX, tileSize.height() * numTilesY);
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, LayerTilingData::NoBorderTexels);
@@ -124,7 +124,7 @@ TEST(TiledLayerImplTest, checkerboarding)
for (int i = 0; i < numTilesX; ++i)
for (int j = 0; j < numTilesY; ++j)
- layer->pushTileProperties(i, j, 0, IntRect(), false);
+ layer->pushTileProperties(i, j, 0, gfx::Rect(), false);
// All checkerboarding
{
@@ -138,7 +138,7 @@ TEST(TiledLayerImplTest, checkerboarding)
}
}
-static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, IntSize tileSize, const IntSize& layerSize, LayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect)
+static void getQuads(QuadList& quads, SharedQuadStateList& sharedStates, gfx::Size tileSize, const gfx::Size& layerSize, LayerTilingData::BorderTexelOption borderTexelOption, const gfx::Rect& visibleContentRect)
{
scoped_ptr<TiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption);
layer->setVisibleContentRect(visibleContentRect);
@@ -164,11 +164,11 @@ static void coverageVisibleRectOnTileBoundaries(LayerTilingData::BorderTexelOpti
{
DebugScopedSetImplThread scopedImplThread;
- IntSize layerSize(1000, 1000);
+ gfx::Size layerSize(1000, 1000);
QuadList quads;
SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize));
- verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize));
+ getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, borders, gfx::Rect(gfx::Point(), layerSize));
+ verifyQuadsExactlyCoverRect(quads, gfx::Rect(gfx::Point(), layerSize));
}
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectOnTileBoundaries);
@@ -177,14 +177,14 @@ static void coverageVisibleRectIntersectsTiles(LayerTilingData::BorderTexelOptio
DebugScopedSetImplThread scopedImplThread;
// This rect intersects the middle 3x3 of the 5x5 tiles.
- IntPoint topLeft(65, 73);
- IntPoint bottomRight(182, 198);
- IntRect visibleContentRect(topLeft, bottomRight - topLeft);
+ gfx::Point topLeft(65, 73);
+ gfx::Point bottomRight(182, 198);
+ gfx::Rect visibleContentRect = gfx::BoundingRect(topLeft, bottomRight);
- IntSize layerSize(250, 250);
+ gfx::Size layerSize(250, 250);
QuadList quads;
SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, IntSize(50, 50), IntSize(250, 250), LayerTilingData::NoBorderTexels, visibleContentRect);
+ getQuads(quads, sharedStates, gfx::Size(50, 50), gfx::Size(250, 250), LayerTilingData::NoBorderTexels, visibleContentRect);
verifyQuadsExactlyCoverRect(quads, visibleContentRect);
}
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles);
@@ -193,11 +193,11 @@ static void coverageVisibleRectIntersectsBounds(LayerTilingData::BorderTexelOpti
{
DebugScopedSetImplThread scopedImplThread;
- IntSize layerSize(220, 210);
- IntRect visibleContentRect(IntPoint(), layerSize);
+ gfx::Size layerSize(220, 210);
+ gfx::Rect visibleContentRect(gfx::Point(), layerSize);
QuadList quads;
SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, IntSize(100, 100), layerSize, LayerTilingData::NoBorderTexels, visibleContentRect);
+ getQuads(quads, sharedStates, gfx::Size(100, 100), layerSize, LayerTilingData::NoBorderTexels, visibleContentRect);
verifyQuadsExactlyCoverRect(quads, visibleContentRect);
}
WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds);
@@ -206,18 +206,18 @@ TEST(TiledLayerImplTest, textureInfoForLayerNoBorders)
{
DebugScopedSetImplThread scopedImplThread;
- IntSize tileSize(50, 50);
- IntSize layerSize(250, 250);
+ gfx::Size tileSize(50, 50);
+ gfx::Size layerSize(250, 250);
QuadList quads;
SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize));
+ getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
for (size_t i = 0; i < quads.size(); ++i) {
ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i;
TileDrawQuad* quad = static_cast<TileDrawQuad*>(quads[i]);
EXPECT_NE(quad->resourceId(), 0u) << quadString << i;
- EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i;
+ EXPECT_EQ(quad->textureOffset(), gfx::Vector2d()) << quadString << i;
EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i;
EXPECT_EQ(gfx::Rect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i;
}
@@ -227,11 +227,11 @@ TEST(TiledLayerImplTest, tileOpaqueRectForLayerNoBorders)
{
DebugScopedSetImplThread scopedImplThread;
- IntSize tileSize(50, 50);
- IntSize layerSize(250, 250);
+ gfx::Size tileSize(50, 50);
+ gfx::Size layerSize(250, 250);
QuadList quads;
SharedQuadStateList sharedStates;
- getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize));
+ getQuads(quads, sharedStates, tileSize, layerSize, LayerTilingData::NoBorderTexels, gfx::Rect(gfx::Point(), layerSize));
for (size_t i = 0; i < quads.size(); ++i) {
ASSERT_EQ(quads[i]->material(), DrawQuad::TiledContent) << quadString << i;
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index 2b5e4bd..681e423 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -18,6 +18,7 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/tiled_layer_test_common.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/rect_conversions.h"
#include <public/WebTransformationMatrix.h>
using namespace cc;
@@ -170,9 +171,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer->invalidateContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
// We should have both tiles on the impl side.
@@ -180,9 +181,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
// Invalidates both tiles, but then only update one of them.
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
- layer->invalidateContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
// We should only have the first tile since the other tile was invalidated but not painted.
@@ -198,10 +199,10 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
m_occlusion = &occluded;
// The tile size is 100x100, so this invalidates and then paints two tiles.
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
- layer->invalidateContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
@@ -213,9 +214,9 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
// Invalidates part of the top tile...
- layer->invalidateContentRect(IntRect(0, 0, 50, 50));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
// ....but the area is occluded.
- occluded.setOcclusion(IntRect(0, 0, 50, 50));
+ occluded.setOcclusion(cc::IntRect(0, 0, 50, 50));
updateAndPush(layer.get(), layerImpl.get());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
@@ -233,9 +234,9 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer->invalidateContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
// We should have both tiles on the impl side.
@@ -254,7 +255,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1));
// This should recreate and update one of the deleted textures.
- layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
updateAndPush(layer.get(), layerImpl.get());
// We should have one tiles on the impl side.
@@ -269,9 +270,9 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
// The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
// This paints 1 visible of the 25 invalid tiles.
- layer->setBounds(IntSize(500, 500));
- layer->setVisibleContentRect(IntRect(200, 200, 100, 100));
- layer->invalidateContentRect(IntRect(0, 0, 500, 500));
+ layer->setBounds(gfx::Size(500, 500));
+ layer->setVisibleContentRect(gfx::Rect(200, 200, 100, 100));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 500, 500));
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
// We should need idle-painting for surrounding tiles.
EXPECT_TRUE(needsUpdate);
@@ -305,35 +306,35 @@ TEST_F(TiledLayerTest, predictivePainting)
// Prepainting should occur in the scroll direction first, and the
// visible rect should be extruded only along the dominant axis.
- IntSize directions[6] = { IntSize(-10, 0),
- IntSize(10, 0),
- IntSize(0, -10),
- IntSize(0, 10),
- IntSize(10, 20),
- IntSize(-20, 10) };
+ gfx::Vector2d directions[6] = { gfx::Vector2d(-10, 0),
+ gfx::Vector2d(10, 0),
+ gfx::Vector2d(0, -10),
+ gfx::Vector2d(0, 10),
+ gfx::Vector2d(10, 20),
+ gfx::Vector2d(-20, 10) };
// We should push all tiles that touch the extruded visible rect.
- IntRect pushedVisibleTiles[6] = { IntRect(2, 2, 2, 1),
- IntRect(1, 2, 2, 1),
- IntRect(2, 2, 1, 2),
- IntRect(2, 1, 1, 2),
- IntRect(2, 1, 1, 2),
- IntRect(2, 2, 2, 1) };
+ gfx::Rect pushedVisibleTiles[6] = { gfx::Rect(2, 2, 2, 1),
+ gfx::Rect(1, 2, 2, 1),
+ gfx::Rect(2, 2, 1, 2),
+ gfx::Rect(2, 1, 1, 2),
+ gfx::Rect(2, 1, 1, 2),
+ gfx::Rect(2, 2, 2, 1) };
// The first pre-paint should also paint first in the scroll
// direction so we should find one additional tile in the scroll direction.
- IntRect pushedPrepaintTiles[6] = { IntRect(2, 2, 3, 1),
- IntRect(0, 2, 3, 1),
- IntRect(2, 2, 1, 3),
- IntRect(2, 0, 1, 3),
- IntRect(2, 0, 1, 3),
- IntRect(2, 2, 3, 1) };
+ gfx::Rect pushedPrepaintTiles[6] = { gfx::Rect(2, 2, 3, 1),
+ gfx::Rect(0, 2, 3, 1),
+ gfx::Rect(2, 2, 1, 3),
+ gfx::Rect(2, 0, 1, 3),
+ gfx::Rect(2, 0, 1, 3),
+ gfx::Rect(2, 2, 3, 1) };
for(int k = 0; k < 6; k++) {
// The tile size is 100x100. Setup 5x5 tiles with one visible tile
// in the center.
- IntSize contentBounds = IntSize(500, 500);
- IntRect contentRect = IntRect(0, 0, 500, 500);
- IntRect visibleRect = IntRect(200, 200, 100, 100);
- IntRect previousVisibleRect = IntRect(visibleRect.location() + directions[k], visibleRect.size());
- IntRect nextVisibleRect = IntRect(visibleRect.location() - directions[k], visibleRect.size());
+ gfx::Size contentBounds = gfx::Size(500, 500);
+ gfx::Rect contentRect = gfx::Rect(0, 0, 500, 500);
+ gfx::Rect visibleRect = gfx::Rect(200, 200, 100, 100);
+ gfx::Rect previousVisibleRect = gfx::Rect(visibleRect.origin() + directions[k], visibleRect.size());
+ gfx::Rect nextVisibleRect = gfx::Rect(visibleRect.origin() - directions[k], visibleRect.size());
// Setup. Use the previousVisibleRect to setup the prediction for next frame.
layer->setBounds(contentBounds);
@@ -348,7 +349,7 @@ TEST_F(TiledLayerTest, predictivePainting)
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++)
- EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].contains(i, j));
+ EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].Contains(i, j));
}
// Move the transform in the same direction without invalidating.
@@ -359,7 +360,7 @@ TEST_F(TiledLayerTest, predictivePainting)
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++)
- EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].contains(i, j));
+ EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].Contains(i, j));
}
}
@@ -384,16 +385,16 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
// layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state.
// This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
- IntRect layer1Rect(0, 0, 100, 2400);
+ gfx::Rect layer1Rect(0, 0, 100, 2400);
// This requires 4*30000 bytes of memory.
- IntRect layer2Rect(0, 0, 100, 300);
+ gfx::Rect layer2Rect(0, 0, 100, 300);
// Paint a single tile in layer2 so that it will idle paint.
layer1->setBounds(layer1Rect.size());
layer1->setVisibleContentRect(layer1Rect);
layer2->setBounds(layer2Rect.size());
- layer2->setVisibleContentRect(IntRect(0, 0, 100, 100));
+ layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
bool needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(),
layer2.get(), layerImpl2.get());
// We should need idle-painting for both remaining tiles in layer2.
@@ -432,10 +433,10 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
m_occlusion = &occluded;
// The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
- occluded.setOcclusion(IntRect(0, 0, 100, 100));
+ occluded.setOcclusion(cc::IntRect(0, 0, 100, 100));
- layer->setBounds(IntSize(100, 100));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
+ layer->setBounds(gfx::Size(100, 100));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
updateAndPush(layer.get(), layerImpl.get());
// We should have the prepainted tile on the impl side, but culled it during paint.
@@ -451,9 +452,9 @@ TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
// The tile size is 100x100, so this invalidates and then paints two tiles.
// However, during the paint, we invalidate one of the tiles. This should
// not prevent the tile from being pushed.
- layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
+ layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer.get());
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
// We should have both tiles on the impl side.
@@ -469,11 +470,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
ScopedFakeTiledLayerImpl layer2Impl(2);
// Invalidate a tile on layer1, during update of layer 2.
- layer2->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
- layer1->setBounds(IntSize(100, 200));
- layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer2->setBounds(IntSize(100, 200));
- layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
+ layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get());
+ layer1->setBounds(gfx::Size(100, 200));
+ layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer2->setBounds(gfx::Size(100, 200));
+ layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer1.get(), layer1Impl.get(),
layer2.get(), layer2Impl.get());
@@ -491,11 +492,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
ScopedFakeTiledLayerImpl layer1Impl(1);
ScopedFakeTiledLayerImpl layer2Impl(2);
- layer1->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
- layer1->setBounds(IntSize(100, 200));
- layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer2->setBounds(IntSize(100, 200));
- layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
+ layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get());
+ layer1->setBounds(gfx::Size(100, 200));
+ layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer2->setBounds(gfx::Size(100, 200));
+ layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer1.get(), layer1Impl.get(),
layer2.get(), layer2Impl.get());
@@ -519,7 +520,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
int layerWidth = 4 * FakeTiledLayer::tileSize().width();
int layerHeight = 4 * FakeTiledLayer::tileSize().height();
int memoryForLayer = layerWidth * layerHeight * 4;
- IntSize viewportSize = IntSize(layerWidth, layerHeight);
+ gfx::Size viewportSize = gfx::Size(layerWidth, layerHeight);
layerTreeHost->setViewportSize(viewportSize, viewportSize);
// Use 8x4 tiles to run out of memory.
@@ -532,9 +533,9 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
ScopedFakeTiledLayerImpl layerImpl(1);
// Full size layer with half being visible.
- IntSize contentBounds(layerWidth, layerHeight);
- IntRect contentRect(IntPoint::zero(), contentBounds);
- IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight));
+ gfx::Size contentBounds(layerWidth, layerHeight);
+ gfx::Rect contentRect(gfx::Point(), contentBounds);
+ gfx::Rect visibleRect(gfx::Point(), gfx::Size(layerWidth / 2, layerHeight));
// Pretend the layer is animating.
layer->setDrawTransformIsAnimating(true);
@@ -579,8 +580,8 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
// The tile size is 100x100, so this invalidates and then paints two tiles.
bool needsUpdate = false;
- layer->setBounds(IntSize(300, 300));
- layer->setVisibleContentRect(IntRect(100, 100, 100, 100));
+ layer->setBounds(gfx::Size(300, 300));
+ layer->setVisibleContentRect(gfx::Rect(100, 100, 100, 100));
for (int i = 0; i < 2; i++)
needsUpdate = updateAndPush(layer.get(), layerImpl.get());
@@ -603,8 +604,8 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
// The layer's bounds are empty.
// Empty layers don't paint or idle-paint.
- layer->setBounds(IntSize());
- layer->setVisibleContentRect(IntRect());
+ layer->setBounds(gfx::Size());
+ layer->setVisibleContentRect(gfx::Rect());
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
// Empty layers don't have tiles.
@@ -624,9 +625,9 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
ScopedFakeTiledLayerImpl layerImpl(1);
// Alternate between not visible and visible.
- IntRect v(0, 0, 100, 100);
- IntRect nv(0, 0, 0, 0);
- IntRect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
+ gfx::Rect v(0, 0, 100, 100);
+ gfx::Rect nv(0, 0, 0, 0);
+ gfx::Rect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
bool invalidate[10] = {true, true, true, true, true, true, true, true, false, false };
// We should not have any tiles except for when the layer was visible
@@ -634,11 +635,11 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true };
for (int i = 0; i < 10; i++) {
- layer->setBounds(IntSize(100, 100));
+ layer->setBounds(gfx::Size(100, 100));
layer->setVisibleContentRect(visibleRect[i]);
if (invalidate[i])
- layer->invalidateContentRect(IntRect(0, 0, 100, 100));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 100));
bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
// We should never signal idle paint, as we painted the entire layer
@@ -654,8 +655,8 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
ScopedFakeTiledLayerImpl layerImpl(1);
// The tile size is 100x100, so this invalidates and then paints two tiles.
- layer->setBounds(IntSize(100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
updateAndPush(layer.get(), layerImpl.get());
// We should have both tiles on the impl side.
@@ -669,9 +670,9 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
EXPECT_EQ(0, layer->fakeLayerUpdater()->prepareCount());
// setRectToInvalidate triggers invalidateContentRect() being invoked from update.
- layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
+ layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(25, 25, 50, 50), layer.get());
layer->fakeLayerUpdater()->clearPrepareCount();
- layer->invalidateContentRect(IntRect(0, 0, 50, 50));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
updateAndPush(layer.get(), layerImpl.get());
EXPECT_EQ(1, layer->fakeLayerUpdater()->prepareCount());
layer->fakeLayerUpdater()->clearPrepareCount();
@@ -687,8 +688,8 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
// layer space, not the content space.
scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
- IntRect layerBounds(0, 0, 300, 200);
- IntRect contentBounds(0, 0, 200, 250);
+ gfx::Rect layerBounds(0, 0, 300, 200);
+ gfx::Rect contentBounds(0, 0, 200, 250);
layer->setBounds(layerBounds.size());
layer->setContentBounds(contentBounds.size());
@@ -701,7 +702,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->updateRect());
updateTextures();
// After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
@@ -709,16 +710,16 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
m_textureManager->prioritizeTextures();
layer->invalidateContentRect(contentBounds);
layer->update(*m_queue.get(), 0, m_stats);
- EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(layerBounds), layer->updateRect());
updateTextures();
// Partial re-paint should also be represented by the updateRect in layer space, not content space.
- IntRect partialDamage(30, 100, 10, 10);
+ gfx::Rect partialDamage(30, 100, 10, 10);
layer->invalidateContentRect(partialDamage);
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
- EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->updateRect());
}
TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
@@ -727,12 +728,12 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
ScopedFakeTiledLayerImpl layerImpl(1);
// Create a layer with one tile.
- layer->setBounds(IntSize(100, 100));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
+ layer->setBounds(gfx::Size(100, 100));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
// Invalidate the entire layer.
layer->setNeedsDisplay();
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
// Push the tiles to the impl side and check that there is exactly one.
layer->setTexturePriorities(m_priorityCalculator);
@@ -748,8 +749,8 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
// Change the contents scale and verify that the content rectangle requiring painting
// is not scaled.
layer->setContentsScale(2);
- layer->setVisibleContentRect(IntRect(0, 0, 200, 200));
- EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 200, 200));
+ EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
// The impl side should get 2x2 tiles now.
layer->setTexturePriorities(m_priorityCalculator);
@@ -782,8 +783,8 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
// Create two 300 x 300 tiled layers.
- IntSize contentBounds(300, 300);
- IntRect contentRect(IntPoint::zero(), contentBounds);
+ gfx::Size contentBounds(300, 300);
+ gfx::Rect contentRect(gfx::Point(), contentBounds);
// We have enough memory for only one of the two layers.
int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
@@ -794,15 +795,15 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
rootLayer->setBounds(contentBounds);
rootLayer->setVisibleContentRect(contentRect);
- rootLayer->setPosition(FloatPoint(0, 0));
+ rootLayer->setPosition(gfx::PointF(0, 0));
childLayer->setBounds(contentBounds);
childLayer->setVisibleContentRect(contentRect);
- childLayer->setPosition(FloatPoint(0, 0));
+ childLayer->setPosition(gfx::PointF(0, 0));
rootLayer->invalidateContentRect(contentRect);
childLayer->invalidateContentRect(contentRect);
layerTreeHost->setRootLayer(rootLayer);
- layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300));
+ layerTreeHost->setViewportSize(gfx::Size(300, 300), gfx::Size(300, 300));
layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
@@ -826,16 +827,16 @@ TEST_F(TiledLayerTest, resizeToSmaller)
{
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
- layer->setBounds(IntSize(700, 700));
- layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
- layer->invalidateContentRect(IntRect(0, 0, 700, 700));
+ layer->setBounds(gfx::Size(700, 700));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 700, 700));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), 0, m_stats);
- layer->setBounds(IntSize(200, 200));
- layer->invalidateContentRect(IntRect(0, 0, 200, 200));
+ layer->setBounds(gfx::Size(200, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 200, 200));
}
TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
@@ -843,9 +844,9 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
int size = 1 << 30;
- layer->setBounds(IntSize(size, size));
- layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
- layer->invalidateContentRect(IntRect(0, 0, size, size));
+ layer->setBounds(gfx::Size(size, size));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
+ layer->invalidateContentRect(gfx::Rect(0, 0, size, size));
// Ensure no crash for bounds where size * size would overflow an int.
layer->setTexturePriorities(m_priorityCalculator);
@@ -863,17 +864,17 @@ TEST_F(TiledLayerTest, partialUpdates)
ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
// Create one 300 x 200 tiled layer with 3 x 2 tiles.
- IntSize contentBounds(300, 200);
- IntRect contentRect(IntPoint::zero(), contentBounds);
+ gfx::Size contentBounds(300, 200);
+ gfx::Rect contentRect(gfx::Point(), contentBounds);
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
layer->setBounds(contentBounds);
- layer->setPosition(FloatPoint(0, 0));
+ layer->setPosition(gfx::PointF(0, 0));
layer->setVisibleContentRect(contentRect);
layer->invalidateContentRect(contentRect);
layerTreeHost->setRootLayer(layer);
- layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200));
+ layerTreeHost->setViewportSize(gfx::Size(300, 200), gfx::Size(300, 200));
// Full update of all 6 tiles.
layerTreeHost->updateLayers(
@@ -891,7 +892,7 @@ TEST_F(TiledLayerTest, partialUpdates)
layerTreeHost->commitComplete();
// Full update of 3 tiles and partial update of 3 tiles.
- layer->invalidateContentRect(IntRect(0, 0, 300, 150));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150));
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
{
ScopedFakeTiledLayerImpl layerImpl(1);
@@ -906,7 +907,7 @@ TEST_F(TiledLayerTest, partialUpdates)
layerTreeHost->commitComplete();
// Partial update of 6 tiles.
- layer->invalidateContentRect(IntRect(50, 50, 200, 100));
+ layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
ScopedFakeTiledLayerImpl layerImpl(1);
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
@@ -921,7 +922,7 @@ TEST_F(TiledLayerTest, partialUpdates)
layerTreeHost->commitComplete();
// Checkerboard all tiles.
- layer->invalidateContentRect(IntRect(0, 0, 300, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200));
{
ScopedFakeTiledLayerImpl layerImpl(1);
layerPushPropertiesTo(layer.get(), layerImpl.get());
@@ -929,7 +930,7 @@ TEST_F(TiledLayerTest, partialUpdates)
layerTreeHost->commitComplete();
// Partial update of 6 checkerboard tiles.
- layer->invalidateContentRect(IntRect(50, 50, 200, 100));
+ layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
{
ScopedFakeTiledLayerImpl layerImpl(1);
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
@@ -944,7 +945,7 @@ TEST_F(TiledLayerTest, partialUpdates)
layerTreeHost->commitComplete();
// Partial update of 4 tiles.
- layer->invalidateContentRect(IntRect(50, 50, 100, 100));
+ layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100));
{
ScopedFakeTiledLayerImpl layerImpl(1);
layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
@@ -967,10 +968,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
// The tile size is 100x100, so this invalidates and then paints two tiles.
- layer->setBounds(IntSize(100, 200));
- layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
- layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
- layer->invalidateContentRect(IntRect(0, 0, 100, 200));
+ layer->setBounds(gfx::Size(100, 200));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
@@ -985,12 +986,12 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
// The tile size is 100x100.
- layer->setBounds(IntSize(600, 600));
+ layer->setBounds(gfx::Size(600, 600));
- occluded.setOcclusion(IntRect(200, 200, 300, 100));
- layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
+ layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
@@ -1005,8 +1006,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
- occluded.setOcclusion(IntRect(250, 200, 300, 100));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(250, 200, 300, 100));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(36-2, layer->fakeLayerUpdater()->updateCount());
@@ -1018,8 +1019,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
- occluded.setOcclusion(IntRect(250, 250, 300, 100));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(250, 250, 300, 100));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->update(*m_queue.get(), &occluded, m_stats);
EXPECT_EQ(36, layer->fakeLayerUpdater()->updateCount());
@@ -1035,13 +1036,13 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
// The tile size is 100x100.
- layer->setBounds(IntSize(600, 600));
+ layer->setBounds(gfx::Size(600, 600));
// The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled.
- occluded.setOcclusion(IntRect(200, 200, 300, 150));
- layer->setDrawableContentRect(IntRect(0, 0, 600, 360));
- layer->setVisibleContentRect(IntRect(0, 0, 600, 360));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 360));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 360));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
@@ -1055,10 +1056,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->fakeLayerUpdater()->clearUpdateCount();
// Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded.
- occluded.setOcclusion(IntRect(200, 200, 300, 150));
- layer->setDrawableContentRect(IntRect(0, 0, 600, 350));
- layer->setVisibleContentRect(IntRect(0, 0, 600, 350));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 350));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 350));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1071,10 +1072,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
layer->fakeLayerUpdater()->clearUpdateCount();
// Now the visible region is even smaller than the occlusion, it should have the same result.
- occluded.setOcclusion(IntRect(200, 200, 300, 150));
- layer->setDrawableContentRect(IntRect(0, 0, 600, 340));
- layer->setVisibleContentRect(IntRect(0, 0, 600, 340));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 340));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 340));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1093,12 +1094,12 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
// The tile size is 100x100.
- layer->setBounds(IntSize(600, 600));
+ layer->setBounds(gfx::Size(600, 600));
- occluded.setOcclusion(IntRect(200, 200, 300, 100));
- layer->setDrawableContentRect(IntRect(0, 0, 600, 600));
- layer->setVisibleContentRect(IntRect(0, 0, 600, 600));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
+ layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 600));
+ layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 600));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1133,16 +1134,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
// This makes sure the painting works when the occluded region (in screen space)
// is transformed differently than the layer.
- layer->setBounds(IntSize(600, 600));
+ layer->setBounds(gfx::Size(600, 600));
WebTransformationMatrix screenTransform;
screenTransform.scale(0.5);
layer->setScreenSpaceTransform(screenTransform);
layer->setDrawTransform(screenTransform);
- occluded.setOcclusion(IntRect(100, 100, 150, 50));
- layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(100, 100, 150, 50));
+ layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1165,16 +1166,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
// pixels, which means none should be occluded.
layer->setContentsScale(0.5);
EXPECT_FLOAT_EQ(layer->contentsScaleX(), layer->contentsScaleY());
- layer->setBounds(IntSize(600, 600));
+ layer->setBounds(gfx::Size(600, 600));
WebTransformationMatrix drawTransform;
drawTransform.scale(1 / layer->contentsScaleX());
layer->setDrawTransform(drawTransform);
layer->setScreenSpaceTransform(drawTransform);
- occluded.setOcclusion(IntRect(200, 200, 300, 100));
- layer->setDrawableContentRect(IntRect(IntPoint(), layer->bounds()));
- layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
+ layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->bounds()));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1192,10 +1193,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
// This makes sure the painting works when the content space is scaled to
// a different layer space. In this case the occluded region catches the
// blown up tiles.
- occluded.setOcclusion(IntRect(200, 200, 300, 200));
- layer->setDrawableContentRect(IntRect(IntPoint(), layer->bounds()));
- layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ occluded.setOcclusion(cc::IntRect(200, 200, 300, 200));
+ layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->bounds()));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1213,13 +1214,12 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
layer->setScreenSpaceTransform(screenTransform);
layer->setDrawTransform(screenTransform);
- occluded.setOcclusion(IntRect(100, 100, 150, 100));
+ occluded.setOcclusion(cc::IntRect(100, 100, 150, 100));
- IntRect drawableContentRect(IntPoint(), layer->bounds());
- drawableContentRect.scale(0.5);
- layer->setDrawableContentRect(drawableContentRect);
- layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
- layer->invalidateContentRect(IntRect(0, 0, 600, 600));
+ gfx::Rect layerBoundsRect(gfx::Point(), layer->bounds());
+ layer->setDrawableContentRect(gfx::ToEnclosingRect(gfx::ScaleRect(layerBoundsRect, 0.5)));
+ layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
+ layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
layer->setTexturePriorities(m_priorityCalculator);
m_textureManager->prioritizeTextures();
layer->update(*m_queue.get(), &occluded, m_stats);
@@ -1237,11 +1237,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
- IntRect opaquePaintRect;
+ gfx::Rect opaquePaintRect;
Region opaqueContents;
- IntRect contentBounds = IntRect(0, 0, 100, 200);
- IntRect visibleBounds = IntRect(0, 0, 100, 150);
+ gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 200);
+ gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 150);
layer->setBounds(contentBounds.size());
layer->setDrawableContentRect(visibleBounds);
@@ -1252,7 +1252,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
m_textureManager->prioritizeTextures();
// If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
layer->invalidateContentRect(contentBounds);
layer->update(*m_queue.get(), &occluded, m_stats);
opaqueContents = layer->visibleContentOpaqueRegion();
@@ -1264,13 +1264,13 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
// visibleContentOpaqueRegion should match the visible part of what is painted opaque.
- opaquePaintRect = IntRect(10, 10, 90, 190);
+ opaquePaintRect = gfx::Rect(10, 10, 90, 190);
layer->fakeLayerUpdater()->setOpaquePaintRect(opaquePaintRect);
layer->invalidateContentRect(contentBounds);
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
opaqueContents = layer->visibleContentOpaqueRegion();
- EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
+ EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
@@ -1279,11 +1279,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
// If we paint again without invalidating, the same stuff should be opaque.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
opaqueContents = layer->visibleContentOpaqueRegion();
- EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
+ EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
@@ -1293,12 +1293,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
// If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should
// not be affected.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
- layer->invalidateContentRect(IntRect(0, 0, 1, 1));
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
+ layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
opaqueContents = layer->visibleContentOpaqueRegion();
- EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
+ EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1);
@@ -1308,12 +1308,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
// If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still
// not be affected.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
- layer->invalidateContentRect(IntRect(10, 10, 1, 1));
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
+ layer->invalidateContentRect(gfx::Rect(10, 10, 1, 1));
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
opaqueContents = layer->visibleContentOpaqueRegion();
- EXPECT_RECT_EQ(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
+ EXPECT_RECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
EXPECT_EQ(1u, opaqueContents.rects().size());
EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
@@ -1329,11 +1329,11 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
// The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
- IntRect opaquePaintRect;
+ gfx::Rect opaquePaintRect;
Region opaqueContents;
- IntRect contentBounds = IntRect(0, 0, 100, 300);
- IntRect visibleBounds = IntRect(0, 0, 100, 300);
+ gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 300);
+ gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 300);
layer->setBounds(contentBounds.size());
layer->setDrawableContentRect(visibleBounds);
@@ -1344,7 +1344,7 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
m_textureManager->prioritizeTextures();
// Invalidates and paints the whole layer.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
layer->invalidateContentRect(contentBounds);
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
@@ -1358,9 +1358,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
// Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle,
// even though it is not dirty and will not be uploaded.
- layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
- layer->invalidateContentRect(IntRect(0, 0, 1, 1));
- layer->invalidateContentRect(IntRect(50, 200, 10, 10));
+ layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
+ layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
+ layer->invalidateContentRect(gfx::Rect(50, 200, 10, 10));
layer->update(*m_queue.get(), &occluded, m_stats);
updateTextures();
opaqueContents = layer->visibleContentOpaqueRegion();
@@ -1377,9 +1377,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
{
// Tile size is 100x100.
- IntRect rootRect(0, 0, 300, 200);
- IntRect childRect(0, 0, 300, 100);
- IntRect child2Rect(0, 100, 300, 100);
+ gfx::Rect rootRect(0, 0, 300, 200);
+ gfx::Rect childRect(0, 0, 300, 100);
+ gfx::Rect child2Rect(0, 100, 300, 100);
LayerTreeSettings settings;
FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
@@ -1392,26 +1392,26 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
root->setBounds(rootRect.size());
- root->setAnchorPoint(FloatPoint());
+ root->setAnchorPoint(gfx::PointF());
root->setDrawableContentRect(rootRect);
root->setVisibleContentRect(rootRect);
root->addChild(surface);
surface->setForceRenderSurface(true);
- surface->setAnchorPoint(FloatPoint());
+ surface->setAnchorPoint(gfx::PointF());
surface->setOpacity(0.5);
surface->addChild(child);
surface->addChild(child2);
child->setBounds(childRect.size());
- child->setAnchorPoint(FloatPoint());
- child->setPosition(childRect.location());
+ child->setAnchorPoint(gfx::PointF());
+ child->setPosition(childRect.origin());
child->setVisibleContentRect(childRect);
child->setDrawableContentRect(rootRect);
child2->setBounds(child2Rect.size());
- child2->setAnchorPoint(FloatPoint());
- child2->setPosition(child2Rect.location());
+ child2->setAnchorPoint(gfx::PointF());
+ child2->setPosition(child2Rect.origin());
child2->setVisibleContentRect(child2Rect);
child2->setDrawableContentRect(rootRect);
@@ -1570,12 +1570,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
{
scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
- IntRect layerRect(0, 0, 30, 31);
- layer->setPosition(layerRect.location());
+ gfx::Rect layerRect(0, 0, 30, 31);
+ layer->setPosition(layerRect.origin());
layer->setBounds(layerRect.size());
layer->setContentsScale(1.5);
- IntRect contentRect(0, 0, 45, 47);
+ gfx::Rect contentRect(0, 0, 45, 47);
EXPECT_EQ(contentRect.size(), layer->contentBounds());
layer->setVisibleContentRect(contentRect);
layer->setDrawableContentRect(contentRect);
@@ -1587,7 +1587,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
layer->update(*m_queue.get(), 0, m_stats);
layer->trackingLayerPainter()->resetPaintedRect();
- EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
+ EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
updateTextures();
// Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds.
@@ -1601,12 +1601,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
{
scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
- IntRect layerRect(0, 0, 30, 31);
- layer->setPosition(layerRect.location());
+ gfx::Rect layerRect(0, 0, 30, 31);
+ layer->setPosition(layerRect.origin());
layer->setBounds(layerRect.size());
layer->setContentsScale(1.3f);
- IntRect contentRect(IntPoint(), layer->contentBounds());
+ gfx::Rect contentRect(gfx::Point(), layer->contentBounds());
layer->setVisibleContentRect(contentRect);
layer->setDrawableContentRect(contentRect);
@@ -1617,7 +1617,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
layer->update(*m_queue.get(), 0, m_stats);
layer->trackingLayerPainter()->resetPaintedRect();
- EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
+ EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
updateTextures();
// Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
diff --git a/cc/tree_synchronizer_unittest.cc b/cc/tree_synchronizer_unittest.cc
index 3f30f34..88654df 100644
--- a/cc/tree_synchronizer_unittest.cc
+++ b/cc/tree_synchronizer_unittest.cc
@@ -228,26 +228,26 @@ TEST(TreeSynchronizerTest, syncSimpleTreeAndProperties)
layerTreeRoot->addChild(Layer::create());
// Pick some random properties to set. The values are not important, we're just testing that at least some properties are making it through.
- FloatPoint rootPosition = FloatPoint(2.3f, 7.4f);
+ gfx::PointF rootPosition = gfx::PointF(2.3f, 7.4f);
layerTreeRoot->setPosition(rootPosition);
float firstChildOpacity = 0.25f;
layerTreeRoot->children()[0]->setOpacity(firstChildOpacity);
- IntSize secondChildBounds = IntSize(25, 53);
+ gfx::Size secondChildBounds = gfx::Size(25, 53);
layerTreeRoot->children()[1]->setBounds(secondChildBounds);
scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get());
expectTreesAreIdentical(layerTreeRoot.get(), layerImplTreeRoot.get(), hostImpl.get());
// Check that the property values we set on the Layer tree are reflected in the LayerImpl tree.
- FloatPoint rootLayerImplPosition = layerImplTreeRoot->position();
+ gfx::PointF rootLayerImplPosition = layerImplTreeRoot->position();
EXPECT_EQ(rootPosition.x(), rootLayerImplPosition.x());
EXPECT_EQ(rootPosition.y(), rootLayerImplPosition.y());
EXPECT_EQ(firstChildOpacity, layerImplTreeRoot->children()[0]->opacity());
- IntSize secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds();
+ gfx::Size secondLayerImplChildBounds = layerImplTreeRoot->children()[1]->bounds();
EXPECT_EQ(secondChildBounds.width(), secondLayerImplChildBounds.width());
EXPECT_EQ(secondChildBounds.height(), secondLayerImplChildBounds.height());
}
diff --git a/cc/video_layer_impl.cc b/cc/video_layer_impl.cc
index 3380402..45f6ed6 100644
--- a/cc/video_layer_impl.cc
+++ b/cc/video_layer_impl.cc
@@ -202,7 +202,7 @@ void VideoLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& appendQuad
// FIXME: When we pass quads out of process, we need to double-buffer, or
// otherwise synchonize use of all textures in the quad.
- gfx::Rect quadRect(contentBounds());
+ gfx::Rect quadRect(gfx::Point(), contentBounds());
switch (m_format) {
case GL_LUMINANCE: {