summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-31 20:47:58 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-31 20:47:58 +0000
commit167ed9d5a08fcc5a08fce241912682f7ade30874 (patch)
treecc1c422be75072e3198e450762d301c1d5113ca5
parent5222f545d0d1c54f3beaaedc0ba21376946c2452 (diff)
downloadchromium_src-167ed9d5a08fcc5a08fce241912682f7ade30874.zip
chromium_src-167ed9d5a08fcc5a08fce241912682f7ade30874.tar.gz
chromium_src-167ed9d5a08fcc5a08fce241912682f7ade30874.tar.bz2
Use gfx::Rect types for occlusion tracker and quad culler classes.
This depends on the non-mutating methods for Rect operations: https://codereview.chromium.org/11270042/ Covered by existing tests, just changing data types. BUG=147395 R=enne Review URL: https://codereview.chromium.org/11272045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165220 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/debug_rect_history.cc6
-rw-r--r--cc/debug_rect_history.h6
-rw-r--r--cc/gl_renderer.cc4
-rw-r--r--cc/layer_tree_host_impl.h3
-rw-r--r--cc/math_util.cc2
-rw-r--r--cc/occlusion_tracker.cc151
-rw-r--r--cc/occlusion_tracker.h25
-rw-r--r--cc/occlusion_tracker_unittest.cc1314
-rw-r--r--cc/quad_culler.cc10
-rw-r--r--cc/stubs/float_point.h4
-rw-r--r--cc/stubs/float_quad.h19
-rw-r--r--cc/test/occlusion_tracker_test_common.h3
-rw-r--r--cc/tiled_layer_unittest.cc8
13 files changed, 786 insertions, 769 deletions
diff --git a/cc/debug_rect_history.cc b/cc/debug_rect_history.cc
index 339d78b..c085eef 100644
--- a/cc/debug_rect_history.cc
+++ b/cc/debug_rect_history.cc
@@ -26,7 +26,7 @@ DebugRectHistory::~DebugRectHistory()
{
}
-void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<IntRect>& occludingScreenSpaceRects, const LayerTreeSettings& settings)
+void DebugRectHistory::saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>& occludingScreenSpaceRects, const LayerTreeSettings& settings)
{
// For now, clear all rects from previous frames. In the future we may want to store
// all debug rects for a history of many frames.
@@ -113,10 +113,10 @@ void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend
}
}
-void DebugRectHistory::saveOccludingRects(const std::vector<IntRect>& occludingRects)
+void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludingRects)
{
for (size_t i = 0; i < occludingRects.size(); ++i)
- m_debugRects.push_back(DebugRect(OccludingRectType, occludingRects[i]));
+ m_debugRects.push_back(DebugRect(OccludingRectType, cc::IntRect(occludingRects[i])));
}
} // namespace cc
diff --git a/cc/debug_rect_history.h b/cc/debug_rect_history.h
index e0dac2e..e61c4dd 100644
--- a/cc/debug_rect_history.h
+++ b/cc/debug_rect_history.h
@@ -7,8 +7,8 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "ui/gfx/rect.h"
#include "FloatRect.h"
-#include "IntRect.h"
#include <vector>
namespace cc {
@@ -56,7 +56,7 @@ public:
~DebugRectHistory();
// Note: Saving debug rects must happen before layers' change tracking is reset.
- void saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<IntRect>& occludingScreenSpaceRects, const LayerTreeSettings&);
+ void saveDebugRectsForCurrentFrame(LayerImpl* rootLayer, const std::vector<LayerImpl*>& renderSurfaceLayerList, const std::vector<gfx::Rect>& occludingScreenSpaceRects, const LayerTreeSettings&);
const std::vector<DebugRect>& debugRects() { return m_debugRects; }
@@ -67,7 +67,7 @@ private:
void savePropertyChangedRects(const std::vector<LayerImpl*>& renderSurfaceLayerList);
void saveSurfaceDamageRects(const std::vector<LayerImpl* >& renderSurfaceLayerList);
void saveScreenSpaceRects(const std::vector<LayerImpl* >& renderSurfaceLayerList);
- void saveOccludingRects(const std::vector<IntRect>& occludingScreenSpaceRects);
+ void saveOccludingRects(const std::vector<gfx::Rect>& occludingScreenSpaceRects);
std::vector<DebugRect> m_debugRects;
diff --git a/cc/gl_renderer.cc b/cc/gl_renderer.cc
index 3f19d5e..7172f93 100644
--- a/cc/gl_renderer.cc
+++ b/cc/gl_renderer.cc
@@ -457,7 +457,7 @@ scoped_ptr<ScopedTexture> GLRenderer::drawBackgroundFilters(DrawingFrame& frame,
DCHECK(!frame.currentTexture);
// FIXME: Do a single readback for both the surface and replica and cache the filtered results (once filter textures are not reused).
- gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(contentsDeviceTransform, sharedGeometryQuad().boundingBox()));
+ gfx::Rect deviceRect = gfx::ToEnclosingRect(MathUtil::mapClippedRect(contentsDeviceTransform, cc::FloatRect(sharedGeometryQuad().boundingBox())));
int top, right, bottom, left;
filters.getOutsets(top, right, bottom, left);
@@ -552,7 +552,7 @@ void GLRenderer::drawRenderPassQuad(DrawingFrame& frame, const RenderPassDrawQua
LayerQuad deviceLayerEdges = LayerQuad(deviceQuad);
// Use anti-aliasing programs only when necessary.
- bool useAA = (!deviceQuad.isRectilinear() || !deviceQuad.boundingBox().isExpressibleAsIntRect());
+ bool useAA = (!deviceQuad.isRectilinear() || !cc::FloatRect(deviceQuad.boundingBox()).isExpressibleAsIntRect());
if (useAA) {
deviceLayerBounds.inflateAntiAliasingDistance();
deviceLayerEdges.inflateAntiAliasingDistance();
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index f6a4c65..f26a7b7 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -15,6 +15,7 @@
#include "cc/render_pass_sink.h"
#include "cc/renderer.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/gfx/rect.h"
#include <public/WebCompositorOutputSurfaceClient.h>
namespace cc {
@@ -121,7 +122,7 @@ public:
FrameData();
~FrameData();
- std::vector<IntRect> occludingScreenSpaceRects;
+ std::vector<gfx::Rect> occludingScreenSpaceRects;
RenderPassList renderPasses;
RenderPassIdHashMap renderPassesById;
LayerList* renderSurfaceLayerList;
diff --git a/cc/math_util.cc b/cc/math_util.cc
index 7e3cba6..66fcc7c 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -195,7 +195,7 @@ FloatRect MathUtil::computeEnclosingClippedRect(const HomogeneousCoordinate& h1,
bool somethingClipped = h1.shouldBeClipped() || h2.shouldBeClipped() || h3.shouldBeClipped() || h4.shouldBeClipped();
if (!somethingClipped) {
FloatQuad mappedQuad = FloatQuad(h1.cartesianPoint2d(), h2.cartesianPoint2d(), h3.cartesianPoint2d(), h4.cartesianPoint2d());
- return mappedQuad.boundingBox();
+ return cc::FloatRect(mappedQuad.boundingBox());
}
bool everythingClipped = h1.shouldBeClipped() && h2.shouldBeClipped() && h3.shouldBeClipped() && h4.shouldBeClipped();
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index 01aac3a..abe2661 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -12,6 +12,7 @@
#include "cc/layer_impl.h"
#include "cc/math_util.h"
#include "cc/overdraw_metrics.h"
+#include "ui/gfx/rect_conversions.h"
using namespace std;
using WebKit::WebTransformationMatrix;
@@ -19,7 +20,7 @@ using WebKit::WebTransformationMatrix;
namespace cc {
template<typename LayerType, typename RenderSurfaceType>
-OcclusionTrackerBase<LayerType, RenderSurfaceType>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame)
+OcclusionTrackerBase<LayerType, RenderSurfaceType>::OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame)
: m_rootTargetRect(rootTargetRect)
, m_overdrawMetrics(OverdrawMetrics::create(recordMetricsForFrame))
, m_occludingScreenSpaceRects(0)
@@ -131,44 +132,44 @@ static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surfa
Vector<WebCore::IntRect> rects = region.rects();
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.
- IntRect transformedRect = enclosedIntRect(MathUtil::mapClippedRect(transform, FloatRect(rects[i])));
+ gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(rects[i])));
if (!surface->clipRect().isEmpty())
- transformedRect.intersect(surface->clipRect());
- transformedRegion.unite(transformedRect);
+ transformedRect.Intersect(surface->clipRect());
+ transformedRegion.unite(cc::IntRect(transformedRect));
}
return transformedRegion;
}
-static inline void reduceOcclusion(const IntRect& affectedArea, const IntRect& expandedPixel, Region& occlusion)
+static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rect& expandedPixel, Region& occlusion)
{
- if (affectedArea.isEmpty())
+ if (affectedArea.IsEmpty())
return;
- Region affectedOcclusion = intersect(occlusion, affectedArea);
+ Region affectedOcclusion = intersect(occlusion, cc::IntRect(affectedArea));
Vector<WebCore::IntRect> affectedOcclusionRects = affectedOcclusion.rects();
- occlusion.subtract(affectedArea);
+ occlusion.subtract(cc::IntRect(affectedArea));
for (size_t j = 0; j < affectedOcclusionRects.size(); ++j) {
WebCore::IntRect& occlusionRect = affectedOcclusionRects[j];
// Shrink the rect by expanding the non-opaque pixels outside the rect.
- // The expandedPixel is the IntRect for a single pixel after being
+ // The expandedPixel is the Rect for a single pixel after being
// expanded by filters on the layer. The original pixel would be
- // IntRect(0, 0, 1, 1), and the expanded pixel is the rect, relative
+ // Rect(0, 0, 1, 1), and the expanded pixel is the rect, relative
// to this original rect, that the original pixel can influence after
// being filtered.
- // To convert the expandedPixel IntRect back to filter outsets:
+ // To convert the expandedPixel Rect back to filter outsets:
// x = -leftOutset
// width = leftOutset + rightOutset
- // maxX = x + width = -leftOutset + leftOutset + rightOutset = rightOutset
+ // right = x + width = -leftOutset + leftOutset + rightOutset = rightOutset
// The leftOutset of the filters moves pixels on the right side of
// the occlusionRect into it, shrinking its right edge.
- int shrinkLeft = occlusionRect.x() == affectedArea.x() ? 0 : expandedPixel.maxX();
- int shrinkTop = occlusionRect.y() == affectedArea.y() ? 0 : expandedPixel.maxY();
- int shrinkRight = occlusionRect.maxX() == affectedArea.maxX() ? 0 : -expandedPixel.x();
- int shrinkBottom = occlusionRect.maxY() == affectedArea.maxY() ? 0 : -expandedPixel.y();
+ int shrinkLeft = occlusionRect.x() == affectedArea.x() ? 0 : expandedPixel.right();
+ int shrinkTop = occlusionRect.y() == affectedArea.y() ? 0 : expandedPixel.bottom();
+ int shrinkRight = occlusionRect.maxX() == affectedArea.right() ? 0 : -expandedPixel.x();
+ int shrinkBottom = occlusionRect.maxY() == affectedArea.bottom() ? 0 : -expandedPixel.y();
occlusionRect.move(shrinkLeft, shrinkTop);
occlusionRect.contract(shrinkLeft + shrinkRight, shrinkTop + shrinkBottom);
@@ -178,26 +179,25 @@ static inline void reduceOcclusion(const IntRect& affectedArea, const IntRect& e
}
template<typename LayerType>
-static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const IntRect& surfaceRect, const WebTransformationMatrix& surfaceTransform, LayerType* renderTarget, Region& occlusionInTarget, Region& occlusionInScreen)
+static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const gfx::Rect& surfaceRect, const WebTransformationMatrix& surfaceTransform, LayerType* renderTarget, Region& occlusionInTarget, Region& occlusionInScreen)
{
- if (surfaceRect.isEmpty())
+ if (surfaceRect.IsEmpty())
return;
- IntRect boundsInTarget = enclosingIntRect(MathUtil::mapClippedRect(surfaceTransform, FloatRect(surfaceRect)));
+ gfx::Rect boundsInTarget = gfx::ToEnclosingRect(MathUtil::mapClippedRect(surfaceTransform, cc::FloatRect(surfaceRect)));
if (!contributingLayer->renderSurface()->clipRect().isEmpty())
- boundsInTarget.intersect(contributingLayer->renderSurface()->clipRect());
+ boundsInTarget.Intersect(contributingLayer->renderSurface()->clipRect());
int outsetTop, outsetRight, outsetBottom, outsetLeft;
contributingLayer->backgroundFilters().getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft);
// The filter can move pixels from outside of the clip, so allow affectedArea to expand outside the clip.
- boundsInTarget.move(-outsetLeft, -outsetTop);
- boundsInTarget.expand(outsetLeft + outsetRight, outsetTop + outsetBottom);
+ boundsInTarget.Inset(-outsetLeft, -outsetTop, -outsetRight, -outsetBottom);
- IntRect boundsInScreen = enclosingIntRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(boundsInTarget)));
+ gfx::Rect boundsInScreen = gfx::ToEnclosingRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), cc::FloatRect(boundsInTarget)));
- IntRect filterOutsetsInTarget(-outsetLeft, -outsetTop, outsetLeft + outsetRight, outsetTop + outsetBottom);
- IntRect filterOutsetsInScreen = enclosingIntRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), FloatRect(filterOutsetsInTarget)));
+ gfx::Rect filterOutsetsInTarget(-outsetLeft, -outsetTop, outsetLeft + outsetRight, outsetTop + outsetBottom);
+ gfx::Rect filterOutsetsInScreen = gfx::ToEnclosingRect(MathUtil::mapClippedRect(renderTarget->renderSurface()->screenSpaceTransform(), cc::FloatRect(filterOutsetsInTarget)));
reduceOcclusion(boundsInTarget, filterOutsetsInTarget, occlusionInTarget);
reduceOcclusion(boundsInScreen, filterOutsetsInScreen, occlusionInScreen);
@@ -218,8 +218,8 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(con
if (oldTarget->hasReplica() && !oldTarget->replicaHasMask())
oldTargetOcclusionInNewTarget.unite(transformSurfaceOpaqueRegion<RenderSurfaceType>(oldSurface, m_stack[lastIndex].occlusionInTarget, oldSurface->replicaDrawTransform()));
- IntRect unoccludedSurfaceRect;
- IntRect unoccludedReplicaRect;
+ gfx::Rect unoccludedSurfaceRect;
+ gfx::Rect unoccludedReplicaRect;
if (oldTarget->backgroundFilters().hasFilterThatMovesPixels()) {
unoccludedSurfaceRect = unoccludedContributingSurfaceContentRect(oldTarget, false, oldSurface->contentRect());
if (oldTarget->hasReplica())
@@ -246,7 +246,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::leaveToRenderTarget(con
// FIXME: Remove usePaintTracking when paint tracking is on for paint culling.
template<typename LayerType>
-static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& clipRectInTarget, const IntSize& minimumTrackingSize, std::vector<IntRect>* occludingScreenSpaceRects)
+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()));
@@ -259,12 +259,12 @@ static inline void addOcclusionBehindLayer(Region& region, const LayerType* laye
Vector<WebCore::IntRect> contentRects = opaqueContents.rects();
for (size_t i = 0; i < contentRects.size(); ++i) {
// We've already checked for clipping in the mapQuad call above, these calls should not clip anything further.
- IntRect transformedRect = enclosedIntRect(MathUtil::mapClippedRect(transform, FloatRect(contentRects[i])));
- transformedRect.intersect(clipRectInTarget);
+ gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect(transform, cc::FloatRect(contentRects[i])));
+ transformedRect.Intersect(clipRectInTarget);
if (transformedRect.width() >= minimumTrackingSize.width() || transformedRect.height() >= minimumTrackingSize.height()) {
if (occludingScreenSpaceRects)
occludingScreenSpaceRects->push_back(transformedRect);
- region.unite(transformedRect);
+ region.unite(cc::IntRect(transformedRect));
}
}
}
@@ -287,7 +287,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
if (opaqueContents.isEmpty())
return;
- IntRect clipRectInTarget = layerClipRectInTarget(layer);
+ gfx::Rect clipRectInTarget = layerClipRectInTarget(layer);
if (layerTransformsToTargetKnown(layer))
addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInTarget, layer, layer->drawTransform(), opaqueContents, clipRectInTarget, m_minimumTrackingSize, 0);
@@ -301,21 +301,21 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
// FIXME: Find a rect interior to the transformed clip quad.
if (clipped || !clipQuadInScreen.isRectilinear())
return;
- IntRect clipRectInScreen = intersection(m_rootTargetRect, enclosedIntRect(clipQuadInScreen.boundingBox()));
+ gfx::Rect clipRectInScreen = gfx::IntersectRects(m_rootTargetRect, gfx::ToEnclosedRect(clipQuadInScreen.boundingBox()));
addOcclusionBehindLayer<LayerType>(m_stack.last().occlusionInScreen, layer, layer->screenSpaceTransform(), opaqueContents, clipRectInScreen, m_minimumTrackingSize, m_occludingScreenSpaceRects);
}
}
-static inline bool testContentRectOccluded(const IntRect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const IntRect& clipRectInTarget, const Region& occlusion)
+static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
{
- FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect));
- // Take the enclosingIntRect, as we want to include partial pixels in the test.
- IntRect targetRect = intersection(enclosingIntRect(transformedRect), clipRectInTarget);
- return targetRect.isEmpty() || occlusion.contains(targetRect);
+ gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, cc::FloatRect(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));
}
template<typename LayerType, typename RenderSurfaceType>
-bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* renderTarget, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
+bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
if (hasOcclusionFromOutsideTargetSurface)
*hasOcclusionFromOutsideTargetSurface = false;
@@ -323,7 +323,7 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp
DCHECK(!m_stack.isEmpty());
if (m_stack.isEmpty())
return false;
- if (contentRect.isEmpty())
+ if (contentRect.IsEmpty())
return true;
DCHECK(renderTarget == m_stack.last().target);
@@ -344,33 +344,34 @@ bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerTyp
// Determines what portion of rect, if any, is unoccluded (not occluded by region). If
// the resulting unoccluded region is not rectangular, we return a rect containing it.
-static inline IntRect rectSubtractRegion(const IntRect& rect, const Region& region)
+static inline gfx::Rect rectSubtractRegion(const gfx::Rect& rect, const Region& region)
{
- Region rectRegion(rect);
+ cc::IntRect intRect(rect);
+ Region rectRegion(intRect);
rectRegion.subtract(region);
- return rectRegion.bounds();
+ return cc::IntRect(rectRegion.bounds());
}
-static inline IntRect computeUnoccludedContentRect(const IntRect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const IntRect& clipRectInTarget, const Region& occlusion)
+static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
{
if (!contentSpaceTransform.isInvertible())
return contentRect;
- // Take the enclosingIntRect at each step, as we want to contain any unoccluded partial pixels in the resulting IntRect.
- FloatRect transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, FloatRect(contentRect));
- IntRect shrunkRect = rectSubtractRegion(intersection(enclosingIntRect(transformedRect), clipRectInTarget), occlusion);
- IntRect unoccludedRect = enclosingIntRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), FloatRect(shrunkRect)));
+ // 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::Rect shrunkRect = rectSubtractRegion(gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget), occlusion);
+ gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), cc::FloatRect(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 intersection(unoccludedRect, contentRect);
+ return gfx::IntersectRects(unoccludedRect, contentRect);
}
template<typename LayerType, typename RenderSurfaceType>
-IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* renderTarget, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
+gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
DCHECK(!m_stack.isEmpty());
if (m_stack.isEmpty())
return contentRect;
- if (contentRect.isEmpty())
+ if (contentRect.IsEmpty())
return contentRect;
DCHECK(renderTarget->renderTarget() == renderTarget);
@@ -380,22 +381,22 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRec
// We want to return a rect that contains all the visible parts of |contentRect| in both screen space and in the target surface.
// So we find the visible parts of |contentRect| in each space, and take the intersection.
- IntRect unoccludedInScreen = contentRect;
+ gfx::Rect unoccludedInScreen = contentRect;
if (layerTransformsToScreenKnown(renderTarget) && !implDrawTransformIsUnknown)
unoccludedInScreen = computeUnoccludedContentRect(contentRect, renderTarget->renderSurface()->screenSpaceTransform() * drawTransform, m_rootTargetRect, m_stack.last().occlusionInScreen);
- IntRect unoccludedInTarget = contentRect;
+ gfx::Rect unoccludedInTarget = contentRect;
if (!implDrawTransformIsUnknown)
unoccludedInTarget = computeUnoccludedContentRect(contentRect, drawTransform, clippedRectInTarget, m_stack.last().occlusionInTarget);
if (hasOcclusionFromOutsideTargetSurface)
- *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget);
+ *hasOcclusionFromOutsideTargetSurface = (gfx::IntersectRects(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget);
- return intersection(unoccludedInScreen, unoccludedInTarget);
+ return gfx::IntersectRects(unoccludedInScreen, unoccludedInTarget);
}
template<typename LayerType, typename RenderSurfaceType>
-IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const
+gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributingSurfaceContentRect(const LayerType* layer, bool forReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const
{
DCHECK(!m_stack.isEmpty());
// The layer is a contributing renderTarget so it should have a surface.
@@ -407,15 +408,15 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributi
// This should be called while the layer is still considered the current target in the occlusion tracker.
DCHECK(layer == m_stack.last().target);
- if (contentRect.isEmpty())
+ if (contentRect.IsEmpty())
return contentRect;
RenderSurfaceType* surface = layer->renderSurface();
- IntRect surfaceClipRect = surface->clipRect();
- if (surfaceClipRect.isEmpty()) {
+ gfx::Rect surfaceClipRect = surface->clipRect();
+ if (surfaceClipRect.IsEmpty()) {
LayerType* contributingSurfaceRenderTarget = layer->parent()->renderTarget();
- surfaceClipRect = intersection(contributingSurfaceRenderTarget->renderSurface()->contentRect(), enclosingIntRect(surface->drawableContentRect()));
+ surfaceClipRect = gfx::IntersectRects(contributingSurfaceRenderTarget->renderSurface()->contentRect(), gfx::ToEnclosingRect(surface->drawableContentRect()));
}
// A contributing surface doesn't get occluded by things inside its own surface, so only things outside the surface can occlude it. That occlusion is
@@ -425,7 +426,7 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributi
const WebTransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform();
const WebTransformationMatrix& transformToTarget = forReplica ? surface->replicaDrawTransform() : surface->drawTransform();
- IntRect unoccludedInScreen = contentRect;
+ gfx::Rect unoccludedInScreen = contentRect;
if (surfaceTransformsToScreenKnown(surface)) {
if (hasOcclusion) {
const StackObject& secondLast = m_stack[m_stack.size() - 2];
@@ -434,7 +435,7 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributi
unoccludedInScreen = computeUnoccludedContentRect(contentRect, transformToScreen, m_rootTargetRect, Region());
}
- IntRect unoccludedInTarget = contentRect;
+ gfx::Rect unoccludedInTarget = contentRect;
if (surfaceTransformsToTargetKnown(surface)) {
if (hasOcclusion) {
const StackObject& secondLast = m_stack[m_stack.size() - 2];
@@ -444,13 +445,13 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContributi
}
if (hasOcclusionFromOutsideTargetSurface)
- *hasOcclusionFromOutsideTargetSurface = (intersection(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget);
+ *hasOcclusionFromOutsideTargetSurface = (gfx::IntersectRects(unoccludedInScreen, unoccludedInTarget) != unoccludedInTarget);
- return intersection(unoccludedInScreen, unoccludedInTarget);
+ return gfx::IntersectRects(unoccludedInScreen, unoccludedInTarget);
}
template<typename LayerType, typename RenderSurfaceType>
-IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(const LayerType* layer) const
+gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(const LayerType* layer) const
{
// FIXME: we could remove this helper function, but unit tests currently override this
// function, and they need to be verified/adjusted before this can be removed.
@@ -458,29 +459,29 @@ IntRect OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarge
}
// Declare the possible functions here for the linker.
-template OcclusionTrackerBase<Layer, RenderSurface>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame);
+template OcclusionTrackerBase<Layer, RenderSurface>::OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame);
template void OcclusionTrackerBase<Layer, RenderSurface>::enterLayer(const LayerIteratorPosition<Layer>&);
template void OcclusionTrackerBase<Layer, RenderSurface>::leaveLayer(const LayerIteratorPosition<Layer>&);
template void OcclusionTrackerBase<Layer, RenderSurface>::enterRenderTarget(const Layer* newTarget);
template void OcclusionTrackerBase<Layer, RenderSurface>::finishedRenderTarget(const Layer* finishedTarget);
template void OcclusionTrackerBase<Layer, RenderSurface>::leaveToRenderTarget(const Layer* newTarget);
template void OcclusionTrackerBase<Layer, RenderSurface>::markOccludedBehindLayer(const Layer*);
-template bool OcclusionTrackerBase<Layer, RenderSurface>::occluded(const Layer*, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContentRect(const Layer*, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContributingSurfaceContentRect(const Layer*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<Layer, RenderSurface>::layerClipRectInTarget(const Layer*) const;
+template bool OcclusionTrackerBase<Layer, RenderSurface>::occluded(const Layer*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContentRect(const Layer*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<Layer, RenderSurface>::unoccludedContributingSurfaceContentRect(const Layer*, bool forReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<Layer, RenderSurface>::layerClipRectInTarget(const Layer*) const;
-template OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame);
+template OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::enterLayer(const LayerIteratorPosition<LayerImpl>&);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveLayer(const LayerIteratorPosition<LayerImpl>&);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::enterRenderTarget(const LayerImpl* newTarget);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::finishedRenderTarget(const LayerImpl* finishedTarget);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveToRenderTarget(const LayerImpl* newTarget);
template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::markOccludedBehindLayer(const LayerImpl*);
-template bool OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::occluded(const LayerImpl*, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContentRect(const LayerImpl*, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContributingSurfaceContentRect(const LayerImpl*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const;
-template IntRect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::layerClipRectInTarget(const LayerImpl*) const;
+template bool OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::occluded(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContentRect(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unoccludedContributingSurfaceContentRect(const LayerImpl*, bool forReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const;
+template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::layerClipRectInTarget(const LayerImpl*) const;
} // namespace cc
diff --git a/cc/occlusion_tracker.h b/cc/occlusion_tracker.h
index 5a7e73c..2c089d4 100644
--- a/cc/occlusion_tracker.h
+++ b/cc/occlusion_tracker.h
@@ -9,6 +9,7 @@
#include "Region.h"
#include "base/basictypes.h"
#include "cc/layer_iterator.h"
+#include "ui/gfx/rect.h"
namespace cc {
class OverdrawMetrics;
@@ -25,7 +26,7 @@ class RenderSurface;
template<typename LayerType, typename RenderSurfaceType>
class OcclusionTrackerBase {
public:
- OcclusionTrackerBase(IntRect rootTargetRect, bool recordMetricsForFrame);
+ OcclusionTrackerBase(gfx::Rect rootTargetRect, bool recordMetricsForFrame);
// Called at the beginning of each step in the LayerIterator's front-to-back traversal.
void enterLayer(const LayerIteratorPosition<LayerType>&);
@@ -33,24 +34,24 @@ public:
void leaveLayer(const LayerIteratorPosition<LayerType>&);
// Returns true if the given rect in content space for a layer is fully occluded in either screen space or the layer's target surface. |renderTarget| is the contributing layer's render target, and |drawTransform|, |transformsToTargetKnown| and |clippedRectInTarget| are relative to that.
- bool occluded(const LayerType* renderTarget, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ bool occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
// Gives an unoccluded sub-rect of |contentRect| in the content space of a layer. Used when considering occlusion for a layer that paints/draws something. |renderTarget| is the contributing layer's render target, and |drawTransform|, |transformsToTargetKnown| and |clippedRectInTarget| are relative to that.
- IntRect unoccludedContentRect(const LayerType* renderTarget, const IntRect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const IntRect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ gfx::Rect unoccludedContentRect(const LayerType* renderTarget, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
// Gives an unoccluded sub-rect of |contentRect| in the content space of the renderTarget owned by the layer.
// Used when considering occlusion for a contributing surface that is rendering into another target.
- IntRect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
+ gfx::Rect unoccludedContributingSurfaceContentRect(const LayerType*, bool forReplica, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const;
// Report operations for recording overdraw metrics.
OverdrawMetrics& overdrawMetrics() const { return *m_overdrawMetrics.get(); }
// Gives the region of the screen that is not occluded by something opaque.
- Region computeVisibleRegionInScreen() const { return subtract(Region(m_rootTargetRect), m_stack.last().occlusionInScreen); }
+ Region computeVisibleRegionInScreen() const { return subtract(Region(cc::IntRect(m_rootTargetRect)), m_stack.last().occlusionInScreen); }
- void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; }
+ void setMinimumTrackingSize(const gfx::Size& size) { m_minimumTrackingSize = size; }
- // The following is used for visualization purposes.
- void setOccludingScreenSpaceRectsContainer(std::vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; }
+ // The following is used for visualization purposes.
+ void setOccludingScreenSpaceRectsContainer(std::vector<gfx::Rect>* rects) { m_occludingScreenSpaceRects = rects; }
protected:
struct StackObject {
@@ -71,7 +72,7 @@ protected:
Vector<StackObject, 1> m_stack;
// Allow tests to override this.
- virtual IntRect layerClipRectInTarget(const LayerType*) const;
+ virtual gfx::Rect layerClipRectInTarget(const LayerType*) const;
private:
// Called when visiting a layer representing itself. If the target was not already current, then this indicates we have entered a new surface subtree.
@@ -88,12 +89,12 @@ private:
// Add the layer's occlusion to the tracked state.
void markOccludedBehindLayer(const LayerType*);
- IntRect m_rootTargetRect;
+ gfx::Rect m_rootTargetRect;
scoped_ptr<OverdrawMetrics> m_overdrawMetrics;
- IntSize m_minimumTrackingSize;
+ gfx::Size m_minimumTrackingSize;
// This is used for visualizing the occlusion tracking process.
- std::vector<IntRect>* m_occludingScreenSpaceRects;
+ std::vector<gfx::Rect>* m_occludingScreenSpaceRects;
DISALLOW_COPY_AND_ASSIGN(OcclusionTrackerBase);
};
diff --git a/cc/occlusion_tracker_unittest.cc b/cc/occlusion_tracker_unittest.cc
index e746262..cab12b1 100644
--- a/cc/occlusion_tracker_unittest.cc
+++ b/cc/occlusion_tracker_unittest.cc
@@ -91,32 +91,32 @@ static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa
template<typename LayerType, typename RenderSurfaceType>
class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType, RenderSurfaceType> {
public:
- TestOcclusionTrackerWithClip(IntRect viewportRect, bool recordMetricsForFrame = false)
+ TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFrame = false)
: TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, recordMetricsForFrame)
, m_overrideLayerClipRect(false)
{
}
- void setLayerClipRect(const IntRect& rect) { m_overrideLayerClipRect = true; m_layerClipRect = rect;}
+ void setLayerClipRect(const gfx::Rect& rect) { m_overrideLayerClipRect = true; m_layerClipRect = rect;}
void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; }
// Returns true if the given rect in content space for the layer is fully occluded in either screen space or the layer's target surface.
- bool occludedLayer(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
+ bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
{
return this->occluded(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTarget(layer), hasOcclusionFromOutsideTargetSurface);
}
// Gives an unoccluded sub-rect of |contentRect| in the content space of the layer. Simple wrapper around unoccludedContentRect.
- IntRect unoccludedLayerContentRect(const LayerType* layer, const IntRect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
+ gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const
{
return this->unoccludedContentRect(layer->renderTarget(), contentRect, layer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layerClipRectInTarget(layer), hasOcclusionFromOutsideTargetSurface);
}
protected:
- virtual IntRect layerClipRectInTarget(const LayerType* layer) const { return m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(layer); }
+ virtual gfx::Rect layerClipRectInTarget(const LayerType* layer) const { return m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, RenderSurfaceType>::layerClipRectInTarget(layer); }
private:
bool m_overrideLayerClipRect;
- IntRect m_layerClipRect;
+ gfx::Rect m_layerClipRect;
};
struct OcclusionTrackerTestMainThreadTypes {
@@ -465,40 +465,40 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 31, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 29, 70, 70)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(31, 30, 70, 70)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 31, 70, 70)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty());
- EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 30, 70, 70)));
- EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 30, 70, 70)));
- EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 31, 70, 70)));
- EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 31, 70, 70)));
- EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 31, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
}
};
@@ -518,14 +518,14 @@ protected:
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(layer1, layerTransform, FloatPoint(0, 0), IntSize(50, 50), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->enterLayer(layer1, occlusion);
- EXPECT_RECT_EQ(IntRect(20, 20, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(20, 20, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// This checks cases where the quads don't match their "containing"
@@ -534,13 +534,13 @@ protected:
WebTransformationMatrix quadTransform;
quadTransform.translate(30, 30);
- IntRect clipRectInTarget(0, 0, 100, 100);
+ gfx::Rect clipRectInTarget(0, 0, 100, 100);
- EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 10, 10), quadTransform, false, clipRectInTarget).isEmpty());
- EXPECT_RECT_EQ(IntRect(0, 0, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(0, 0, 10, 10), quadTransform, true, clipRectInTarget));
- EXPECT_RECT_EQ(IntRect(40, 40, 10, 10), occlusion.unoccludedContentRect(parent, IntRect(40, 40, 10, 10), quadTransform, false, clipRectInTarget));
- EXPECT_RECT_EQ(IntRect(40, 30, 5, 10), occlusion.unoccludedContentRect(parent, IntRect(35, 30, 10, 10), quadTransform, false, clipRectInTarget));
- EXPECT_RECT_EQ(IntRect(40, 40, 5, 5), occlusion.unoccludedContentRect(parent, IntRect(40, 40, 10, 10), quadTransform, false, IntRect(0, 0, 75, 75)));
+ EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, false, clipRectInTarget).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, clipRectInTarget));
+ EXPECT_RECT_EQ(gfx::Rect(40, 40, 5, 5), occlusion.unoccludedContentRect(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, gfx::Rect(0, 0, 75, 75)));
}
};
@@ -561,40 +561,40 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 29, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(31, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 31, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 30, 70, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 29, 70, 70)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(31, 30, 70, 70)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 31, 70, 70)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 30, 70, 70)).isEmpty());
- EXPECT_RECT_EQ(IntRect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 30, 70, 70)));
- EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 29, 70, 70)));
- EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 30, 70, 70)));
- EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 31, 70, 70)));
- EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 31, 70, 70)));
- EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 31, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 70, 70)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 29, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 30, 1, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(31, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(29, 31, 70, 70), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 31, 70, 70)));
}
};
@@ -613,52 +613,52 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(50, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(49, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(50, 49, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(51, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(50, 51, 50, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(50, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(49, 50, 50, 50)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(50, 49, 50, 50)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(51, 50, 50, 50)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(50, 51, 50, 50)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty());
- EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 50, 50, 50)));
- EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 49, 50, 50)));
- EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(50, 49, 50, 50)));
- EXPECT_RECT_EQ(IntRect(51, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(51, 49, 50, 50)));
- EXPECT_RECT_EQ(IntRect(100, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(51, 50, 50, 50)));
- EXPECT_RECT_EQ(IntRect(51, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(51, 51, 50, 50)));
- EXPECT_RECT_EQ(IntRect(50, 100, 50, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(50, 51, 50, 50)));
- EXPECT_RECT_EQ(IntRect(49, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 51, 50, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(49, 50, 50, 50)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(50, 49, 50, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(51, 50, 50, 50)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(50, 51, 50, 50)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 50, 50, 50)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 50, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 49, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 49, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(51, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 49, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 50, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(51, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 51, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 100, 50, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 51, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(49, 51, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 51, 50, 50)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(50, 50, 50, 50)).isEmpty());
- EXPECT_RECT_EQ(IntRect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 50, 50, 50)));
- EXPECT_RECT_EQ(IntRect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 49, 50, 50)));
- EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(50, 49, 50, 50)));
- EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(51, 49, 50, 50)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(51, 50, 50, 50)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(51, 51, 50, 50)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(50, 51, 50, 50)).isEmpty());
- EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedLayerContentRect(parent, IntRect(49, 51, 50, 50)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 50, 50, 50)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(49, 50, 1, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 50, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(49, 49, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 49, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 49, 50, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 49, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(51, 49, 49, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 49, 50, 50)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 50, 50, 50)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(51, 51, 50, 50)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(50, 51, 50, 50)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(49, 51, 1, 49), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(49, 51, 50, 50)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
}
};
@@ -682,38 +682,38 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer, occlusion);
this->enterContributingSurface(child, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->leaveContributingSurface(child, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 39, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(31, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 41, 70, 60)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 39, 70, 60)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(31, 40, 70, 60)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 41, 70, 60)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 41, 70, 60)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
/* Justification for the above occlusion from |layer|:
@@ -765,20 +765,20 @@ protected:
typename Types::ContentLayerType* occluder = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(occluder, occlusion);
this->enterLayer(layer2, occlusion);
- EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 25, 25), occlusion.unoccludedLayerContentRect(layer2, IntRect(0, 0, 25, 25)));
- EXPECT_RECT_EQ(IntRect(10, 25, 15, 25), occlusion.unoccludedLayerContentRect(layer2, IntRect(10, 25, 25, 25)));
- EXPECT_RECT_EQ(IntRect(25, 10, 25, 15), occlusion.unoccludedLayerContentRect(layer2, IntRect(25, 10, 25, 25)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, IntRect(25, 25, 25, 25)).isEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(0, 0, 25, 25)));
+ EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(10, 25, 25, 25)));
+ EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 10, 25, 25)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 25, 25, 25)).IsEmpty());
}
};
@@ -805,68 +805,68 @@ protected:
typename Types::ContentLayerType* child2 = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000));
this->visitLayer(child2, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(layer, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->enterContributingSurface(child, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// Occlusion in |child2| should get merged with the |child| surface we are leaving now.
this->leaveContributingSurface(child, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 30, 70, 70)));
- EXPECT_RECT_EQ(IntRect(90, 30, 10, 10), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 30, 70, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(90, 30, 10, 10), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 70, 70)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 30, 60, 10)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 30, 60, 10)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 29, 60, 10)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(31, 30, 60, 10)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 31, 60, 10)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 30, 60, 10)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 30, 60, 10)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 29, 60, 10)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(31, 30, 60, 10)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 31, 60, 10)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 30, 60, 10)).isEmpty());
- EXPECT_RECT_EQ(IntRect(29, 30, 1, 10), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 30, 60, 10)));
- EXPECT_RECT_EQ(IntRect(30, 29, 60, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 29, 60, 10)));
- EXPECT_RECT_EQ(IntRect(90, 30, 1, 10), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 30, 60, 10)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 31, 60, 10)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 30, 60, 10)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(29, 30, 1, 10), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 30, 60, 10)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 29, 60, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 60, 10)));
+ EXPECT_RECT_EQ(gfx::Rect(90, 30, 1, 10), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 30, 60, 10)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 31, 60, 10)).IsEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty());
- EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 40, 70, 60)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 40, 70, 60)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 40, 70, 60)));
// This rect is mostly occluded by |child2|.
- EXPECT_RECT_EQ(IntRect(90, 39, 10, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(90, 39, 10, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 39, 70, 60)));
// This rect extends past top/right ends of |child2|.
- EXPECT_RECT_EQ(IntRect(30, 29, 70, 11), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 29, 70, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 29, 70, 11), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 29, 70, 70)));
// This rect extends past left/right ends of |child2|.
- EXPECT_RECT_EQ(IntRect(20, 39, 80, 60), occlusion.unoccludedLayerContentRect(parent, IntRect(20, 39, 80, 60)));
- EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 40, 70, 60)));
- EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 41, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(20, 39, 80, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(20, 39, 80, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
/* Justification for the above occlusion from |layer|:
100
@@ -917,48 +917,48 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(child, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
- IntRect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
+ gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, layer->visibleContentRect());
this->visitLayer(layer, occlusion);
this->enterContributingSurface(child, occlusion);
- EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
EXPECT_TRUE(occlusion.occludedLayer(child, clippedLayerInChild));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(-1, 0);
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
+ clippedLayerInChild.Offset(-1, 0);
EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(1, 0);
- clippedLayerInChild.move(1, 0);
+ EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
+ clippedLayerInChild.Offset(1, 0);
+ clippedLayerInChild.Offset(1, 0);
EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(-1, 0);
- clippedLayerInChild.move(0, -1);
+ EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
+ clippedLayerInChild.Offset(-1, 0);
+ clippedLayerInChild.Offset(0, -1);
EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(0, 1);
- clippedLayerInChild.move(0, 1);
+ EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
+ clippedLayerInChild.Offset(0, 1);
+ clippedLayerInChild.Offset(0, 1);
EXPECT_FALSE(occlusion.occludedLayer(child, clippedLayerInChild));
- EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).isEmpty());
- clippedLayerInChild.move(0, -1);
+ EXPECT_FALSE(occlusion.unoccludedLayerContentRect(child, clippedLayerInChild).IsEmpty());
+ clippedLayerInChild.Offset(0, -1);
this->leaveContributingSurface(child, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(75, 55, 1, 1)));
- EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(75, 55, 1, 1)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(75, 55, 1, 1)));
+ EXPECT_RECT_EQ(gfx::Rect(75, 55, 1, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(75, 55, 1, 1)));
}
};
@@ -983,47 +983,47 @@ protected:
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->visitLayer(layer1, occlusion);
this->enterContributingSurface(child, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 430, 60, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(child, IntRect(10, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child, IntRect(9, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child, IntRect(10, 429, 60, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child, IntRect(11, 430, 60, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child, IntRect(10, 431, 60, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(child, gfx::Rect(10, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(9, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 429, 60, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(11, 430, 60, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child, gfx::Rect(10, 431, 60, 70)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, IntRect(10, 430, 60, 70)).isEmpty());
- EXPECT_RECT_EQ(IntRect(9, 430, 1, 70), occlusion.unoccludedLayerContentRect(child, IntRect(9, 430, 60, 70)));
- EXPECT_RECT_EQ(IntRect(10, 429, 60, 1), occlusion.unoccludedLayerContentRect(child, IntRect(10, 429, 60, 70)));
- EXPECT_RECT_EQ(IntRect(70, 430, 1, 70), occlusion.unoccludedLayerContentRect(child, IntRect(11, 430, 60, 70)));
- EXPECT_RECT_EQ(IntRect(10, 500, 60, 1), occlusion.unoccludedLayerContentRect(child, IntRect(10, 431, 60, 70)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 430, 60, 70)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(9, 430, 1, 70), occlusion.unoccludedLayerContentRect(child, gfx::Rect(9, 430, 60, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(10, 429, 60, 1), occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 429, 60, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(70, 430, 1, 70), occlusion.unoccludedLayerContentRect(child, gfx::Rect(11, 430, 60, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(10, 500, 60, 1), occlusion.unoccludedLayerContentRect(child, gfx::Rect(10, 431, 60, 70)));
this->leaveContributingSurface(child, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 40, 70, 60)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 39, 70, 60)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 40, 70, 60)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 39, 70, 60)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(30, 40, 70, 60)).isEmpty());
- EXPECT_RECT_EQ(IntRect(29, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, IntRect(29, 40, 70, 60)));
- EXPECT_RECT_EQ(IntRect(30, 39, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 39, 70, 60)));
- EXPECT_RECT_EQ(IntRect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, IntRect(31, 40, 70, 60)));
- EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, IntRect(30, 41, 70, 60)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 40, 70, 60)).IsEmpty());
+ EXPECT_RECT_EQ(gfx::Rect(29, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(29, 40, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 39, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 39, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 40, 1, 60), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(31, 40, 70, 60)));
+ EXPECT_RECT_EQ(gfx::Rect(30, 100, 70, 1), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(30, 41, 70, 60)));
/* Justification for the above occlusion from |layer1| and |layer2|:
@@ -1073,69 +1073,69 @@ protected:
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->enterContributingSurface(child2, occlusion);
- EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-11, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 419, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 420, 71, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 81)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-11, 420, 70, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 419, 70, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 420, 71, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 81)));
- occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)));
+ occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000));
// There is nothing above child2's surface in the z-order.
- EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80)));
+ EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80)));
this->leaveContributingSurface(child2, occlusion);
this->visitLayer(layer1, occlusion);
this->enterContributingSurface(child1, occlusion);
- EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(-10, 430, 80, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(child1, IntRect(-10, 430, 80, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(-11, 430, 80, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(-10, 429, 80, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(-10, 430, 81, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(-10, 430, 80, 71)));
+ EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-11, 430, 80, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 429, 80, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 81, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(-10, 430, 80, 71)));
// child2's contents will occlude child1 below it.
- EXPECT_RECT_EQ(IntRect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(-10, 430, 80, 70)));
+ EXPECT_RECT_EQ(gfx::Rect(-10, 430, 10, 70), occlusion.unoccludedContributingSurfaceContentRect(child1, false, gfx::Rect(-10, 430, 80, 70)));
this->leaveContributingSurface(child1, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 20, 80, 80), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(20, 20, 80, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 20, 80, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(30, 20, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(29, 20, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(30, 19, 70, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(30, 20, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(29, 20, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(30, 19, 70, 80)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(20, 30, 80, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(19, 30, 80, 70)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(20, 29, 80, 70)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(20, 30, 80, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(19, 30, 80, 70)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(20, 29, 80, 70)));
/* Justification for the above occlusion:
100
@@ -1189,62 +1189,62 @@ protected:
typename Types::ContentLayerType* layer2 = this->createDrawingLayer(child2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000));
this->visitLayer(layer2, occlusion);
this->enterLayer(child2, occlusion);
- EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-11, 420, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 419, 70, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 420, 71, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(child2, IntRect(-10, 420, 70, 81)));
+ EXPECT_TRUE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-11, 420, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 419, 70, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 71, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(child2, gfx::Rect(-10, 420, 70, 81)));
this->leaveLayer(child2, occlusion);
this->enterContributingSurface(child2, occlusion);
// There is nothing above child2's surface in the z-order.
- EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, IntRect(-10, 420, 70, 80)));
+ EXPECT_RECT_EQ(gfx::Rect(-10, 420, 70, 80), occlusion.unoccludedContributingSurfaceContentRect(child2, false, gfx::Rect(-10, 420, 70, 80)));
this->leaveContributingSurface(child2, occlusion);
this->visitLayer(layer1, occlusion);
this->enterContributingSurface(child1, occlusion);
- EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(child1, IntRect(420, -20, 80, 90)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(419, -20, 80, 90)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(420, -21, 80, 90)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(420, -19, 80, 90)));
- EXPECT_FALSE(occlusion.occludedLayer(child1, IntRect(421, -20, 80, 90)));
+ EXPECT_TRUE(occlusion.occludedLayer(child1, gfx::Rect(420, -20, 80, 90)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(419, -20, 80, 90)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -21, 80, 90)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(420, -19, 80, 90)));
+ EXPECT_FALSE(occlusion.occludedLayer(child1, gfx::Rect(421, -20, 80, 90)));
// child2's contents will occlude child1 below it.
- EXPECT_RECT_EQ(IntRect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 80, 90)));
- EXPECT_RECT_EQ(IntRect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -10, 80, 90)));
- EXPECT_RECT_EQ(IntRect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, IntRect(420, -20, 70, 90)));
+ EXPECT_RECT_EQ(gfx::Rect(420, -20, 80, 90), occlusion.unoccludedContributingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 80, 90)));
+ EXPECT_RECT_EQ(gfx::Rect(490, -10, 10, 80), occlusion.unoccludedContributingSurfaceContentRect(child1, false, gfx::Rect(420, -10, 80, 90)));
+ EXPECT_RECT_EQ(gfx::Rect(420, -20, 70, 10), occlusion.unoccludedContributingSurfaceContentRect(child1, false, gfx::Rect(420, -20, 70, 90)));
this->leaveContributingSurface(child1, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(10, 20, 90, 80), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(10, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(9, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(10, 19, 90, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(11, 20, 90, 80)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(10, 21, 90, 80)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(10, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(9, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 19, 90, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(11, 20, 90, 80)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(10, 21, 90, 80)));
/* Justification for the above occlusion:
100
@@ -1305,8 +1305,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// Opacity layer won't contribute to occlusion.
this->visitLayer(opacityLayer, occlusion);
@@ -1324,16 +1324,16 @@ protected:
this->visitLayer(opaqueLayer, occlusion);
this->enterContributingSurface(opaqueLayer, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// And it gets translated to the parent surface.
this->leaveContributingSurface(opaqueLayer, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// The blur layer needs to throw away any occlusion from outside its subtree.
@@ -1350,9 +1350,9 @@ protected:
// But the opaque layer's occlusion is preserved on the parent.
this->leaveContributingSurface(blurLayer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -1370,21 +1370,21 @@ protected:
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitContributingSurface(surface, occlusion);
this->enterLayer(parent, occlusion);
// The surface and replica should both be occluding the parent.
- EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -1403,21 +1403,21 @@ protected:
this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 50), IntSize());
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitContributingSurface(surface, occlusion);
this->enterLayer(parent, occlusion);
// The surface and replica should both be occluding the parent.
- EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -1436,21 +1436,21 @@ protected:
this->createMaskLayer(replica, IntSize(10, 10));
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitContributingSurface(surface, occlusion);
this->enterLayer(parent, occlusion);
// The replica should not be occluding the parent, since it has a mask applied to it.
- EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -1467,36 +1467,36 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(200, 100, 100, 100));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
- occlusion.setLayerClipRect(IntRect(200, 100, 100, 100));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
+ occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 100, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
}
};
@@ -1512,36 +1512,36 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
occlusion.useDefaultLayerClipRect();
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 100, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
}
};
@@ -1557,31 +1557,31 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(100, 100, 100, 100));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
}
};
@@ -1597,31 +1597,31 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
}
};
@@ -1637,35 +1637,35 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(50, 50, 200, 200));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200));
this->enterLayer(layer, occlusion);
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
-
- EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
- EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 100, 300, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(200, 100, 100, 100)));
- EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)));
}
};
@@ -1681,35 +1681,35 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
-
- EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
- EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 100, 300, 100)));
- EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, IntRect(200, 100, 100, 100)));
- EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedLayerContentRect(parent, IntRect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 50, 50, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 100, 50, 100), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 200, 100, 50), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)));
}
};
@@ -1725,35 +1725,35 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(500, 500, 100, 100));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 100, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(200, 100, 100, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(100, 200, 100, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)).IsEmpty());
}
};
@@ -1769,35 +1769,35 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
this->leaveLayer(layer, occlusion);
this->visitContributingSurface(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 0, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(0, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 200, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
-
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(0, 100, 300, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(200, 100, 100, 100)).isEmpty());
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, IntRect(100, 200, 100, 100)).isEmpty());
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 0, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(0, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 200, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
+
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 100, 300, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(200, 100, 100, 100)).IsEmpty());
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(parent, gfx::Rect(100, 200, 100, 100)).IsEmpty());
}
};
@@ -1813,16 +1813,16 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
// This layer is translated when drawn into its target. So if the clip rect given from the target surface
// is not in that target space, then after translating these query rects into the target, they will fall outside
// the clip and be considered occluded.
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
}
};
@@ -1838,20 +1838,20 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingSurface(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 0, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100)));
// Occluded since its outside the surface bounds.
- EXPECT_TRUE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
// Test without any clip rect.
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
- EXPECT_FALSE(occlusion.occludedLayer(layer, IntRect(200, 100, 100, 100)));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
+ EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)));
occlusion.useDefaultLayerClipRect();
this->leaveLayer(layer, occlusion);
@@ -1876,51 +1876,51 @@ protected:
this->calcDrawEtc(parent);
{
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
}
{
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(120, 120, 180, 180), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_TRUE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_TRUE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
}
{
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100));
this->resetLayerIterator();
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(250, 250, 50, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(0, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(100, 100, 100, 100)));
- EXPECT_FALSE(occlusion.occludedLayer(parent, IntRect(200, 200, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(0, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(100, 100, 100, 100)));
+ EXPECT_FALSE(occlusion.occludedLayer(parent, gfx::Rect(200, 200, 100, 100)));
}
}
};
@@ -1941,11 +1941,11 @@ protected:
typename Types::ContentLayerType* layer = this->createDrawingLayer(container, transform, FloatPoint(100, 100), IntSize(200, 200), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
// The layer is rotated in 3d but without preserving 3d, so it only gets resized.
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedLayerContentRect(layer, IntRect(0, 0, 200, 200)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200)));
}
};
@@ -1976,7 +1976,7 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(child2, occlusion);
EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty());
EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty());
@@ -2009,10 +2009,10 @@ protected:
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedLayerContentRect(layer, IntRect(0, 0, 200, 200)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0, 200, 200)));
}
};
@@ -2041,12 +2041,12 @@ protected:
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->enterLayer(layer, occlusion);
// The bottom 11 pixel rows of this layer remain visible inside the container, after translation to the target surface. When translated back,
// this will include many more pixels but must include at least the bottom 11 rows.
- EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, IntRect(0, 0, 500, 500)).contains(IntRect(0, 489, 500, 11)));
+ EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0, 500, 500)).Contains(gfx::Rect(0, 489, 500, 11)));
}
};
@@ -2071,7 +2071,7 @@ protected:
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
// The |layer| is entirely behind the camera and should not occlude.
this->visitLayer(layer, occlusion);
@@ -2103,15 +2103,15 @@ protected:
layer->setPreserves3D(true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
// This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect.
// Ensure that those pixels don't occlude things outside the clipRect.
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
}
};
@@ -2141,32 +2141,32 @@ protected:
EXPECT_FALSE(surface->drawOpacityIsAnimating());
EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(topmost, occlusion);
this->enterLayer(parent2, occlusion);
// This occlusion will affect all surfaces.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent2, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent2, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(parent2, occlusion);
this->visitLayer(surfaceChild2, occlusion);
this->enterLayer(surfaceChild, occlusion);
- EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surfaceChild, occlusion);
this->enterLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// Occlusion within the surface is lost when leaving the animating surface.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
this->leaveContributingSurface(surface, occlusion);
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
// Occlusion is not added for the animating |layer|.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
}
};
@@ -2194,32 +2194,32 @@ protected:
EXPECT_FALSE(surface->drawOpacityIsAnimating());
EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating());
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(topmost, occlusion);
this->enterLayer(parent2, occlusion);
// This occlusion will affect all surfaces.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(parent2, occlusion);
this->visitLayer(surfaceChild2, occlusion);
this->enterLayer(surfaceChild, occlusion);
- EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surfaceChild, occlusion);
this->enterLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(200, 0, 50, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// Occlusion within the surface is lost when leaving the animating surface.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
this->leaveContributingSurface(surface, occlusion);
this->visitLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
// Occlusion is not added for the animating |layer|.
- EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
}
};
@@ -2253,12 +2253,12 @@ protected:
EXPECT_TRUE(surfaceChild->drawTransformIsAnimating());
EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating());
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface2, occlusion);
this->enterContributingSurface(surface2, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
this->leaveContributingSurface(surface2, occlusion);
@@ -2266,53 +2266,53 @@ protected:
// surfaceChild2 is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
// It also means that things occluding in screen space (e.g. surface2) cannot occlude this layer.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild2, IntRect(0, 0, 100, 300)));
- EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, IntRect(0, 0, 50, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.unoccludedLayerContentRect(surfaceChild2, gfx::Rect(0, 0, 100, 300)));
+ EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 300)));
this->leaveLayer(surfaceChild2, occlusion);
this->enterLayer(surfaceChild, occlusion);
- EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, IntRect(0, 0, 100, 300)));
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 100, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
// The surfaceChild is occluded by the surfaceChild2, but is moving relative its target and the screen, so it
// can't be occluded.
- EXPECT_RECT_EQ(IntRect(0, 0, 200, 300), occlusion.unoccludedLayerContentRect(surfaceChild, IntRect(0, 0, 200, 300)));
- EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, IntRect(0, 0, 50, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 300), occlusion.unoccludedLayerContentRect(surfaceChild, gfx::Rect(0, 0, 200, 300)));
+ EXPECT_FALSE(occlusion.occludedLayer(surfaceChild, gfx::Rect(0, 0, 50, 300)));
this->leaveLayer(surfaceChild, occlusion);
this->enterLayer(surface, occlusion);
// The surfaceChild is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 300), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_RECT_EQ(IntRect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(100, 0, 200, 300), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(surface, occlusion);
// The surface's owning layer is moving in screen space but not relative to its target, so occlusion should happen in its target space only.
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 300), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedLayerContentRect(surface, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedLayerContentRect(surface, gfx::Rect(0, 0, 300, 300)));
this->enterContributingSurface(surface, occlusion);
// The contributing |surface| is animating so it can't be occluded.
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 300), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 300, 300)));
this->leaveContributingSurface(surface, occlusion);
this->enterLayer(layer, occlusion);
// The |surface| is moving in the screen and in its target, so all occlusion within the surface is lost when leaving it.
- EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
this->leaveLayer(layer, occlusion);
this->enterLayer(parent, occlusion);
// The |layer| is animating in the screen and in its target, so no occlusion is added.
- EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, IntRect(0, 0, 300, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 0, 250, 300), occlusion.unoccludedLayerContentRect(parent, gfx::Rect(0, 0, 300, 300)));
}
};
@@ -2336,14 +2336,14 @@ protected:
surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200));
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface2, occlusion);
this->visitContributingSurface(surface2, occlusion);
- EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// Clear any stored occlusion.
@@ -2353,9 +2353,9 @@ protected:
this->visitLayer(surface, occlusion);
this->visitContributingSurface(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 400, 400), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -2374,14 +2374,14 @@ protected:
surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200));
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
this->visitContributingSurface(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
@@ -2400,28 +2400,28 @@ protected:
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the replica, but not the surface itself.
this->visitLayer(topmost, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->enterContributingSurface(surface, occlusion);
// Surface is not occluded so it shouldn't think it is.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
}
};
@@ -2439,29 +2439,29 @@ protected:
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes the surface, but not the entire surface's replica.
this->visitLayer(topmost, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->enterContributingSurface(surface, occlusion);
// Surface is occluded, but only the top 10px of the replica.
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 90), occlusion.unoccludedContributingSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100)));
}
};
@@ -2480,30 +2480,30 @@ protected:
typename Types::LayerType* overReplica = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These occlude the surface and replica differently, so we can test each one.
this->visitLayer(overReplica, occlusion);
this->visitLayer(overSurface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->enterContributingSurface(surface, occlusion);
// Surface and replica are occluded different amounts.
- EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(40, 0, 60, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(50, 0, 50, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, true, gfx::Rect(0, 0, 100, 100)));
}
};
@@ -2523,23 +2523,23 @@ protected:
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000));
// |topmost| occludes everything partially so we know occlusion is happening at all.
this->visitLayer(topmost, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(surfaceChild, occlusion);
// surfaceChild increases the occlusion in the screen by a narrow sliver.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
// In its own surface, surfaceChild is at 0,0 as is its occlusion.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
@@ -2549,20 +2549,20 @@ protected:
this->enterContributingSurface(surfaceChild, occlusion);
// The surfaceChild's parent does not have a clipRect as it owns a render surface. Make sure the unoccluded rect
// does not get clipped away inappropriately.
- EXPECT_RECT_EQ(IntRect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 40, 100, 10), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 50)));
this->leaveContributingSurface(surfaceChild, occlusion);
// When the surfaceChild's occlusion is transformed up to its parent, make sure it is not clipped away inappropriately also.
this->enterLayer(surface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 60), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 10, 100, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->leaveLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// The surface's parent does have a clipRect as it is the root layer.
- EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 50, 100, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
}
};
@@ -2582,26 +2582,26 @@ protected:
{
// Make a viewport rect that is larger than the root layer.
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(surface, occlusion);
// The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
this->enterContributingSurface(surface, occlusion);
// Make sure the parent's clipRect clips the unoccluded region of the child surface.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 200), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 300)));
}
this->resetLayerIterator();
{
// Make a viewport rect that is smaller than the root layer.
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 100, 100));
this->visitLayer(surface, occlusion);
// The root layer always has a clipRect. So the parent of |surface| has a clipRect giving the surface itself a clipRect.
this->enterContributingSurface(surface, occlusion);
// Make sure the viewport rect clips the unoccluded region of the child surface.
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 300)));
}
}
};
@@ -2623,23 +2623,23 @@ protected:
typename Types::LayerType* topmost = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// |topmost| occludes everything partially so we know occlusion is happening at all.
this->visitLayer(topmost, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// surfaceChild is not opaque and does not occlude, so we have a non-empty unoccluded area on surface.
this->visitLayer(surfaceChild, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
// The root layer always has a clipRect. So the parent of |surface| has a clipRect. However, the owning layer for |surface| does not
@@ -2648,13 +2648,13 @@ protected:
this->enterContributingSurface(surfaceChild, occlusion);
// The surfaceChild's parent does not have a clipRect as it owns a render surface.
- EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surfaceChild, false, gfx::Rect(0, 0, 100, 100)));
this->leaveContributingSurface(surfaceChild, occlusion);
this->visitLayer(surface, occlusion);
this->enterContributingSurface(surface, occlusion);
// The surface's parent does have a clipRect as it is the root layer.
- EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 50, 80, 50), occlusion.unoccludedContributingSurfaceContentRect(surface, false, gfx::Rect(0, 0, 100, 100)));
}
};
@@ -2692,8 +2692,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
// need to see some of the pixels (up to radius far) underneath the occludingLayers.
@@ -2703,28 +2703,28 @@ protected:
this->visitLayer(occludingLayer2, occlusion);
this->visitLayer(occludingLayer1, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
// Everything outside the surface/replica is occluded but the surface/replica itself is not.
this->enterLayer(filteredSurface, occlusion);
- EXPECT_RECT_EQ(IntRect(1, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(1, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(0, 1, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(0, 1, 100, 100)));
- EXPECT_RECT_EQ(IntRect(0, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(-1, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(0, 0, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(0, -1, 100, 100)));
-
- EXPECT_RECT_EQ(IntRect(300 + 1, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(300 + 1, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(300 + 0, 1, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(300 + 0, 1, 100, 100)));
- EXPECT_RECT_EQ(IntRect(300 + 0, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(300 - 1, 0, 100, 100)));
- EXPECT_RECT_EQ(IntRect(300 + 0, 0, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(300 + 0, -1, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(1, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(1, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 1, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(0, 1, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(-1, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(0, -1, 100, 100)));
+
+ EXPECT_RECT_EQ(gfx::Rect(300 + 1, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(300 + 1, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(300 + 0, 1, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(300 + 0, 1, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 99, 100), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(300 - 1, 0, 100, 100)));
+ EXPECT_RECT_EQ(gfx::Rect(300 + 0, 0, 100, 99), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(300 + 0, -1, 100, 100)));
this->leaveLayer(filteredSurface, occlusion);
// The filtered layer/replica does not occlude.
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
// The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
@@ -2732,54 +2732,50 @@ protected:
this->visitContributingSurface(filteredSurface, occlusion);
this->enterLayer(parent, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
- IntRect outsetRect;
- IntRect testRect;
+ gfx::Rect outsetRect;
+ gfx::Rect testRect;
// Nothing in the blur outsets for the filteredSurface is occluded.
- outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
testRect = outsetRect;
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
// Stuff outside the blur outsets is still occluded though.
testRect = outsetRect;
- testRect.expand(1, 0);
+ testRect.Inset(0, 0, -1, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.expand(0, 1);
+ testRect.Inset(0, 0, 0, -1);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.move(-1, 0);
- testRect.expand(1, 0);
+ testRect.Inset(-1, 0, 0, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.move(0, -1);
- testRect.expand(0, 1);
+ testRect.Inset(0, -1, 0, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
// Nothing in the blur outsets for the filteredSurface's replica is occluded.
- outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ outsetRect = gfx::Rect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
testRect = outsetRect;
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
// Stuff outside the blur outsets is still occluded though.
testRect = outsetRect;
- testRect.expand(1, 0);
+ testRect.Inset(0, 0, -1, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.expand(0, 1);
+ testRect.Inset(0, 0, 0, -1);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.move(-1, 0);
- testRect.expand(1, 0);
+ testRect.Inset(-1, 0, 0, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
testRect = outsetRect;
- testRect.move(0, -1);
- testRect.expand(0, 1);
+ testRect.Inset(0, -1, 0, 0);
EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedLayerContentRect(parent, testRect));
}
};
@@ -2815,13 +2811,13 @@ protected:
this->calcDrawEtc(root);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(occludingLayerAbove, occlusion);
- EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
this->visitLayer(filteredSurface2, occlusion);
@@ -2833,7 +2829,7 @@ protected:
ASSERT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
// Test expectations in the target.
- IntRect expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outsetTop + outsetBottom) * 2);
+ gfx::Rect expectedOcclusion = gfx::Rect(100 / 2 + outsetRight * 2, 100 / 2 + outsetBottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 / 2 - (outsetTop + outsetBottom) * 2);
EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInTargetSurface().rects()[0]);
// Test expectations in the screen are the same as in the target, as the render surface is 1:1 with the screen.
@@ -2874,8 +2870,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// These layers occlude pixels directly beside the filteredSurface. Because filtered surface blends pixels in a radius, it will
// need to see some of the pixels (up to radius far) underneath the occludingLayers.
@@ -2885,28 +2881,28 @@ protected:
this->visitLayer(occludingLayer2, occlusion);
this->visitLayer(occludingLayer1, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(5u, occlusion.occlusionInTargetSurface().rects().size());
// Everything outside the surface/replica is occluded but the surface/replica itself is not.
this->enterLayer(filteredSurface, occlusion);
- EXPECT_RECT_EQ(IntRect(1, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(1, 0, 50, 50)));
- EXPECT_RECT_EQ(IntRect(0, 1, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(0, 1, 50, 50)));
- EXPECT_RECT_EQ(IntRect(0, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(-1, 0, 50, 50)));
- EXPECT_RECT_EQ(IntRect(0, 0, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(0, -1, 50, 50)));
-
- EXPECT_RECT_EQ(IntRect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(150 + 1, 0, 50, 50)));
- EXPECT_RECT_EQ(IntRect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(150 + 0, 1, 50, 50)));
- EXPECT_RECT_EQ(IntRect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(150 - 1, 0, 50, 50)));
- EXPECT_RECT_EQ(IntRect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, IntRect(150 + 0, -1, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(1, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(1, 0, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 1, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(0, 1, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(-1, 0, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(0, -1, 50, 50)));
+
+ EXPECT_RECT_EQ(gfx::Rect(150 + 1, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(150 + 1, 0, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(150 + 0, 1, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(150 + 0, 1, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 49, 50), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(150 - 1, 0, 50, 50)));
+ EXPECT_RECT_EQ(gfx::Rect(150 + 0, 0, 50, 49), occlusion.unoccludedLayerContentRect(filteredSurface, gfx::Rect(150 + 0, -1, 50, 50)));
this->leaveLayer(filteredSurface, occlusion);
// The filtered layer/replica does not occlude.
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 0, 0), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
// The surface has a background blur, so it needs pixels that are currently considered occluded in order to be drawn. So the pixels
@@ -2914,55 +2910,51 @@ protected:
this->visitContributingSurface(filteredSurface, occlusion);
this->enterContributingSurface(clippingSurface, occlusion);
- EXPECT_RECT_EQ(IntRect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 150), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(5u, occlusion.occlusionInScreenSpace().rects().size());
- IntRect outsetRect;
- IntRect clippedOutsetRect;
- IntRect testRect;
+ gfx::Rect outsetRect;
+ gfx::Rect clippedOutsetRect;
+ gfx::Rect testRect;
// Nothing in the (clipped) blur outsets for the filteredSurface is occluded.
- outsetRect = IntRect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
- clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
+ outsetRect = gfx::Rect(50 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
testRect = outsetRect;
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
// Stuff outside the (clipped) blur outsets is still occluded though.
testRect = outsetRect;
- testRect.expand(1, 0);
+ testRect.Inset(0, 0, -1, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.expand(0, 1);
+ testRect.Inset(0, 0, 0, -1);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.move(-1, 0);
- testRect.expand(1, 0);
+ testRect.Inset(-1, 0, 0, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.move(0, -1);
- testRect.expand(0, 1);
+ testRect.Inset(0, -1, 0, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
// Nothing in the (clipped) blur outsets for the filteredSurface's replica is occluded.
- outsetRect = IntRect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
- clippedOutsetRect = intersection(outsetRect, IntRect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
+ outsetRect = gfx::Rect(200 - outsetLeft, 50 - outsetTop, 50 + outsetLeft + outsetRight, 50 + outsetTop + outsetBottom);
+ clippedOutsetRect = gfx::IntersectRects(outsetRect, gfx::Rect(0 - outsetLeft, 0 - outsetTop, 300 + outsetLeft + outsetRight, 70 + outsetTop + outsetBottom));
testRect = outsetRect;
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
// Stuff outside the (clipped) blur outsets is still occluded though.
testRect = outsetRect;
- testRect.expand(1, 0);
+ testRect.Inset(0, 0, -1, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.expand(0, 1);
+ testRect.Inset(0, 0, 0, -1);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.move(-1, 0);
- testRect.expand(1, 0);
+ testRect.Inset(-1, 0, 0, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
testRect = outsetRect;
- testRect.move(0, -1);
- testRect.expand(0, 1);
+ testRect.Inset(0, -1, 0, 0);
EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedLayerContentRect(clippingSurface, testRect));
}
};
@@ -2994,8 +2986,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
// The surface has a background blur, so it blurs non-opaque pixels below it.
this->visitLayer(filteredSurface, occlusion);
@@ -3006,10 +2998,10 @@ protected:
// The layers behind the surface are not blurred, and their occlusion does not change, until we leave the surface.
// So it should not be modified by the filter here.
- IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30);
- IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30);
+ gfx::Rect occlusionBehindSurface = gfx::Rect(60, 60, 30, 30);
+ gfx::Rect occlusionBehindReplica = gfx::Rect(210, 60, 30, 30);
- IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusionBehindReplica);
+ gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionBehindSurface, occlusionBehindReplica);
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
@@ -3044,8 +3036,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(aboveReplicaLayer, occlusion);
this->visitLayer(aboveSurfaceLayer, occlusion);
@@ -3055,10 +3047,10 @@ protected:
this->visitContributingSurface(filteredSurface, occlusion);
// The filter is completely occluded, so it should not blur anything and reduce any occlusion.
- IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50);
- IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50);
+ gfx::Rect occlusionAboveSurface = gfx::Rect(50, 50, 50, 50);
+ gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 50, 50);
- IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusionAboveReplica);
+ gfx::Rect expectedOpaqueBounds = gfx::UnionRects(occlusionAboveSurface, occlusionAboveReplica);
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size());
EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface().bounds());
@@ -3099,8 +3091,8 @@ protected:
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
this->visitLayer(besideReplicaLayer, occlusion);
this->visitLayer(besideSurfaceLayer, occlusion);
@@ -3115,24 +3107,24 @@ protected:
// This means it will push back the occlusion that touches the unoccluded part (occlusionAbove___), but it will not
// touch occlusionBeside____ since that is not beside the unoccluded part of the surface, even though it is beside
// the occluded part of the surface.
- IntRect occlusionAboveSurface = IntRect(70 + outsetRight, 50, 30 - outsetRight, 50);
- IntRect occlusionAboveReplica = IntRect(200, 50, 30 - outsetLeft, 50);
- IntRect occlusionBesideSurface = IntRect(90, 40, 10, 10);
- IntRect occlusionBesideReplica = IntRect(200, 40, 10, 10);
+ gfx::Rect occlusionAboveSurface = gfx::Rect(70 + outsetRight, 50, 30 - outsetRight, 50);
+ gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50);
+ gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10);
+ gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10);
Region expectedOcclusion;
- expectedOcclusion.unite(occlusionAboveSurface);
- expectedOcclusion.unite(occlusionAboveReplica);
- expectedOcclusion.unite(occlusionBesideSurface);
- expectedOcclusion.unite(occlusionBesideReplica);
+ expectedOcclusion.unite(cc::IntRect(occlusionAboveSurface));
+ expectedOcclusion.unite(cc::IntRect(occlusionAboveReplica));
+ expectedOcclusion.unite(cc::IntRect(occlusionBesideSurface));
+ expectedOcclusion.unite(cc::IntRect(occlusionBesideReplica));
ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetSurface().rects().size());
ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenSpace().rects().size());
for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) {
- IntRect expectedRect = expectedOcclusion.rects()[i];
- IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i];
- IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i];
+ cc::IntRect expectedRect = expectedOcclusion.rects()[i];
+ cc::IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i];
+ cc::IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i];
EXPECT_EQ(expectedRect, screenRect);
EXPECT_EQ(expectedRect, targetRect);
}
@@ -3155,24 +3147,24 @@ protected:
typename Types::LayerType* small = this->createDrawingLayer(parent, this->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true);
this->calcDrawEtc(parent);
- TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000));
- occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000));
+ TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000));
+ occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000));
occlusion.setMinimumTrackingSize(trackingSize);
// The small layer is not tracked because it is too small.
this->visitLayer(small, occlusion);
- EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size());
// The large layer is tracked as it is large enough.
this->visitLayer(large, occlusion);
- EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInScreenSpace().bounds());
EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size());
- EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
+ EXPECT_RECT_EQ(gfx::Rect(IntPoint(), trackingSize), occlusion.occlusionInTargetSurface().bounds());
EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size());
}
};
diff --git a/cc/quad_culler.cc b/cc/quad_culler.cc
index 24c3d93..b4e7b21 100644
--- a/cc/quad_culler.cc
+++ b/cc/quad_culler.cc
@@ -47,14 +47,14 @@ SharedQuadState* QuadCuller::useSharedQuadState(scoped_ptr<SharedQuadState> shar
return m_currentSharedQuadState;
}
-static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const IntRect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads)
+static inline bool appendQuadInternal(scoped_ptr<DrawQuad> drawQuad, const gfx::Rect& culledRect, QuadList& quadList, const OcclusionTrackerImpl& occlusionTracker, bool createDebugBorderQuads)
{
- bool keepQuad = !culledRect.isEmpty();
+ bool keepQuad = !culledRect.IsEmpty();
if (keepQuad)
drawQuad->setQuadVisibleRect(culledRect);
- occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform(), cc::IntRect(drawQuad->quadRect()), culledRect);
- occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), culledRect, cc::IntRect(drawQuad->opaqueRect()));
+ occlusionTracker.overdrawMetrics().didCullForDrawing(drawQuad->quadTransform(), cc::IntRect(drawQuad->quadRect()), cc::IntRect(culledRect));
+ occlusionTracker.overdrawMetrics().didDraw(drawQuad->quadTransform(), cc::IntRect(culledRect), cc::IntRect(drawQuad->opaqueRect()));
if (keepQuad) {
if (createDebugBorderQuads && !drawQuad->isDebugQuad() && drawQuad->quadVisibleRect() != drawQuad->quadRect()) {
@@ -75,7 +75,7 @@ bool QuadCuller::append(scoped_ptr<DrawQuad> drawQuad, AppendQuadsData& appendQu
DCHECK(!m_sharedQuadStateList.isEmpty());
DCHECK(m_sharedQuadStateList.last() == m_currentSharedQuadState);
- IntRect culledRect;
+ gfx::Rect culledRect;
bool hasOcclusionFromOutsideTargetSurface;
bool implDrawTransformIsUnknown = false;
diff --git a/cc/stubs/float_point.h b/cc/stubs/float_point.h
index c762384..c5f5191 100644
--- a/cc/stubs/float_point.h
+++ b/cc/stubs/float_point.h
@@ -43,7 +43,11 @@ public:
FloatPoint(WebCore::FloatPoint point)
: WebCore::FloatPoint(point.x(), point.y())
{
+ }
+ explicit FloatPoint(gfx::PointF point)
+ : WebCore::FloatPoint(point.x(), point.y())
+ {
}
operator gfx::PointF() const { return gfx::PointF(x(), y()); }
diff --git a/cc/stubs/float_quad.h b/cc/stubs/float_quad.h
index 9e6b1f4..33b4c08 100644
--- a/cc/stubs/float_quad.h
+++ b/cc/stubs/float_quad.h
@@ -61,6 +61,25 @@ public:
: WebCore::FloatQuad(WebCore::FloatRect(rect.x(), rect.y(), rect.width(), rect.height()))
{
}
+
+ FloatQuad(const gfx::PointF& p1, const gfx::PointF& p2, const gfx::PointF& p3, const gfx::PointF& p4)
+ : WebCore::FloatQuad(cc::FloatPoint(p1), cc::FloatPoint(p2), cc::FloatPoint(p3), cc::FloatPoint(p4))
+ {
+ }
+
+ cc::FloatPoint p1() const { return cc::FloatPoint(WebCore::FloatQuad::p1()); }
+ cc::FloatPoint p2() const { return cc::FloatPoint(WebCore::FloatQuad::p2()); }
+ cc::FloatPoint p3() const { return cc::FloatPoint(WebCore::FloatQuad::p3()); }
+ cc::FloatPoint p4() const { return cc::FloatPoint(WebCore::FloatQuad::p4()); }
+
+ void setP1(gfx::PointF p) { WebCore::FloatQuad::setP1(cc::FloatPoint(p)); }
+ void setP2(gfx::PointF p) { WebCore::FloatQuad::setP2(cc::FloatPoint(p)); }
+ void setP3(gfx::PointF p) { WebCore::FloatQuad::setP3(cc::FloatPoint(p)); }
+ void setP4(gfx::PointF p) { WebCore::FloatQuad::setP4(cc::FloatPoint(p)); }
+
+ gfx::RectF boundingBox() const { return cc::FloatRect(WebCore::FloatQuad::boundingBox()); }
+
+ bool containsPoint(gfx::PointF p) { return WebCore::FloatQuad::containsPoint(cc::FloatPoint(p)); }
};
}
diff --git a/cc/test/occlusion_tracker_test_common.h b/cc/test/occlusion_tracker_test_common.h
index 875dd8a..c515155 100644
--- a/cc/test/occlusion_tracker_test_common.h
+++ b/cc/test/occlusion_tracker_test_common.h
@@ -5,7 +5,6 @@
#ifndef CCOcclusionTrackerTestCommon_h
#define CCOcclusionTrackerTestCommon_h
-#include "IntRect.h"
#include "Region.h"
#include "cc/occlusion_tracker.h"
#include "cc/render_surface.h"
@@ -17,7 +16,7 @@ namespace WebKitTests {
template<typename LayerType, typename RenderSurfaceType>
class TestOcclusionTrackerBase : public cc::OcclusionTrackerBase<LayerType, RenderSurfaceType> {
public:
- TestOcclusionTrackerBase(cc::IntRect screenScissorRect, bool recordMetricsForFrame = false)
+ TestOcclusionTrackerBase(gfx::Rect screenScissorRect, bool recordMetricsForFrame = false)
: cc::OcclusionTrackerBase<LayerType, RenderSurfaceType>(screenScissorRect, recordMetricsForFrame)
{
}
diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
index 4bc3ff0..c499cc3 100644
--- a/cc/tiled_layer_unittest.cc
+++ b/cc/tiled_layer_unittest.cc
@@ -29,8 +29,8 @@ namespace {
class TestOcclusionTracker : public OcclusionTracker {
public:
TestOcclusionTracker()
- : OcclusionTracker(IntRect(0, 0, 1000, 1000), true)
- , m_layerClipRectInTarget(IntRect(0, 0, 1000, 1000))
+ : OcclusionTracker(gfx::Rect(0, 0, 1000, 1000), true)
+ , m_layerClipRectInTarget(gfx::Rect(0, 0, 1000, 1000))
{
// Pretend we have visited a render surface.
m_stack.append(StackObject());
@@ -39,10 +39,10 @@ public:
void setOcclusion(const Region& occlusion) { m_stack.last().occlusionInTarget = occlusion; }
protected:
- virtual IntRect layerClipRectInTarget(const Layer* layer) const OVERRIDE { return m_layerClipRectInTarget; }
+ virtual gfx::Rect layerClipRectInTarget(const Layer* layer) const OVERRIDE { return m_layerClipRectInTarget; }
private:
- IntRect m_layerClipRectInTarget;
+ gfx::Rect m_layerClipRectInTarget;
};
class TiledLayerTest : public testing::Test {