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

Unified Diff: cc/occlusion_tracker.cc

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/occlusion_tracker.cc
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index 513b330ce62718566053dc15ddb57e59c78b20fe..db2ddd452f4edf9c6a996aed35bddbdc231e3720 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -14,7 +14,7 @@
#include "ui/gfx/rect_conversions.h"
using namespace std;
-using WebKit::WebTransformationMatrix;
+using gfx::Transform;
namespace cc {
@@ -121,7 +121,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::finishedRenderTarget(co
}
template<typename RenderSurfaceType>
-static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surface, const Region& region, const WebTransformationMatrix& transform)
+static inline Region transformSurfaceOpaqueRegion(const RenderSurfaceType* surface, const Region& region, const Transform& transform)
{
// Verify that rects within the |surface| will remain rects in its target surface after applying |transform|. If this is true, then
// apply |transform| to each rect within |region| in order to transform the entire Region.
@@ -182,7 +182,7 @@ static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec
}
template<typename LayerType>
-static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const gfx::Rect& surfaceRect, const WebTransformationMatrix& surfaceTransform, LayerType* renderTarget, Region& occlusionInTarget, Region& occlusionInScreen)
+static void reduceOcclusionBelowSurface(LayerType* contributingLayer, const gfx::Rect& surfaceRect, const Transform& surfaceTransform, LayerType* renderTarget, Region& occlusionInTarget, Region& occlusionInScreen)
{
if (surfaceRect.IsEmpty())
return;
@@ -249,7 +249,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 gfx::Rect& clipRectInTarget, const gfx::Size& minimumTrackingSize, std::vector<gfx::Rect>* occludingScreenSpaceRects, std::vector<gfx::Rect>* nonOccludingScreenSpaceRects)
+static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const Transform& transform, const Region& opaqueContents, const gfx::Rect& clipRectInTarget, const gfx::Size& minimumTrackingSize, std::vector<gfx::Rect>* occludingScreenSpaceRects, std::vector<gfx::Rect>* nonOccludingScreenSpaceRects)
{
DCHECK(layer->visibleContentRect().Contains(opaqueContents.bounds()));
@@ -309,7 +309,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
// remain rectilinear, then we don't add any occlusion in screen space.
if (layerTransformsToScreenKnown(layer)) {
- WebTransformationMatrix targetToScreenTransform = m_stack.back().target->renderSurface()->screenSpaceTransform();
+ Transform targetToScreenTransform = m_stack.back().target->renderSurface()->screenSpaceTransform();
bool clipped;
gfx::QuadF clipQuadInScreen = MathUtil::mapQuad(targetToScreenTransform, gfx::QuadF(clipRectInTarget), clipped);
// FIXME: Find a rect interior to the transformed clip quad.
@@ -320,7 +320,7 @@ void OcclusionTrackerBase<LayerType, RenderSurfaceType>::markOccludedBehindLayer
}
}
-static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
+static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const Transform& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
{
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
// Take the gfx::ToEnclosingRect, as we want to include partial pixels in the test.
@@ -329,7 +329,7 @@ static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const W
}
template<typename LayerType, typename RenderSurfaceType>
-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
+bool OcclusionTrackerBase<LayerType, RenderSurfaceType>::occluded(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
if (hasOcclusionFromOutsideTargetSurface)
*hasOcclusionFromOutsideTargetSurface = false;
@@ -368,21 +368,21 @@ static inline gfx::Rect rectSubtractRegion(const gfx::Rect& rect, const Region&
return rectRegion.bounds();
}
-static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRect, const WebTransformationMatrix& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
+static inline gfx::Rect computeUnoccludedContentRect(const gfx::Rect& contentRect, const Transform& contentSpaceTransform, const gfx::Rect& clipRectInTarget, const Region& occlusion)
{
- if (!contentSpaceTransform.isInvertible())
+ if (!contentSpaceTransform.IsInvertible())
return contentRect;
// Take the ToEnclosingRect at each step, as we want to contain any unoccluded partial pixels in the resulting Rect.
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
gfx::Rect shrunkRect = rectSubtractRegion(gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget), occlusion);
- gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(contentSpaceTransform.inverse(), gfx::RectF(shrunkRect)));
+ gfx::Rect unoccludedRect = gfx::ToEnclosingRect(MathUtil::projectClippedRect(MathUtil::inverse(contentSpaceTransform), gfx::RectF(shrunkRect)));
// The rect back in content space is a bounding box and may extend outside of the original contentRect, so clamp it to the contentRectBounds.
return gfx::IntersectRects(unoccludedRect, contentRect);
}
template<typename LayerType, typename RenderSurfaceType>
-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
+gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContentRect(const LayerType* renderTarget, const gfx::Rect& contentRect, const gfx::Transform& drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const
{
DCHECK(!m_stack.empty());
if (m_stack.empty())
@@ -439,8 +439,8 @@ gfx::Rect OcclusionTrackerBase<LayerType, RenderSurfaceType>::unoccludedContribu
// found just below the top of the stack (if it exists).
bool hasOcclusion = m_stack.size() > 1;
- const WebTransformationMatrix& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform();
- const WebTransformationMatrix& transformToTarget = forReplica ? surface->replicaDrawTransform() : surface->drawTransform();
+ const Transform& transformToScreen = forReplica ? surface->replicaScreenSpaceTransform() : surface->screenSpaceTransform();
+ const Transform& transformToTarget = forReplica ? surface->replicaDrawTransform() : surface->drawTransform();
gfx::Rect unoccludedInScreen = contentRect;
if (surfaceTransformsToScreenKnown(surface)) {

Powered by Google App Engine
This is Rietveld 408576698