Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "cc/occlusion_tracker.h" | 7 #include "cc/occlusion_tracker.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "FloatRect.h" | |
| 12 #include "cc/layer.h" | 11 #include "cc/layer.h" |
| 13 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
| 14 #include "cc/math_util.h" | 13 #include "cc/math_util.h" |
| 15 #include "cc/overdraw_metrics.h" | 14 #include "cc/overdraw_metrics.h" |
| 16 #include "ui/gfx/quad_f.h" | 15 #include "ui/gfx/quad_f.h" |
| 17 #include "ui/gfx/rect_conversions.h" | 16 #include "ui/gfx/rect_conversions.h" |
| 18 | 17 |
| 19 using namespace std; | 18 using namespace std; |
| 20 using WebKit::WebTransformationMatrix; | 19 using WebKit::WebTransformationMatrix; |
| 21 | 20 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 gfx::QuadF transformedBoundsQuad = MathUtil::mapQuad(transform, gfx::QuadF(r egion.bounds()), clipped); | 126 gfx::QuadF transformedBoundsQuad = MathUtil::mapQuad(transform, gfx::QuadF(r egion.bounds()), clipped); |
| 128 // FIXME: Find a rect interior to each transformed quad. | 127 // FIXME: Find a rect interior to each transformed quad. |
| 129 if (clipped || !transformedBoundsQuad.IsRectilinear()) | 128 if (clipped || !transformedBoundsQuad.IsRectilinear()) |
| 130 return Region(); | 129 return Region(); |
| 131 | 130 |
| 132 Region transformedRegion; | 131 Region transformedRegion; |
| 133 | 132 |
| 134 Vector<WebCore::IntRect> rects = region.rects(); | 133 Vector<WebCore::IntRect> rects = region.rects(); |
| 135 for (size_t i = 0; i < rects.size(); ++i) { | 134 for (size_t i = 0; i < rects.size(); ++i) { |
| 136 // We've already checked for clipping in the mapQuad call above, these c alls should not clip anything further. | 135 // We've already checked for clipping in the mapQuad call above, these c alls should not clip anything further. |
| 137 gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect (transform, cc::FloatRect(rects[i]))); | 136 gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect (transform, gfx::RectF(gfx::Rect(cc::IntRect(rects[i]))))); |
|
enne (OOO)
2012/11/02 18:05:51
This is one heck of a transformation sequence of r
danakj
2012/11/02 18:08:31
Yeh :|
WebCore->cc::IntRect so we can convert to
| |
| 138 if (!surface->clipRect().IsEmpty()) | 137 if (!surface->clipRect().IsEmpty()) |
| 139 transformedRect.Intersect(surface->clipRect()); | 138 transformedRect.Intersect(surface->clipRect()); |
| 140 transformedRegion.Union(transformedRect); | 139 transformedRegion.Union(transformedRect); |
| 141 } | 140 } |
| 142 return transformedRegion; | 141 return transformedRegion; |
| 143 } | 142 } |
| 144 | 143 |
| 145 static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec t& expandedPixel, Region& occlusion) | 144 static inline void reduceOcclusion(const gfx::Rect& affectedArea, const gfx::Rec t& expandedPixel, Region& occlusion) |
| 146 { | 145 { |
| 147 if (affectedArea.IsEmpty()) | 146 if (affectedArea.IsEmpty()) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 | 253 |
| 255 bool clipped; | 254 bool clipped; |
| 256 gfx::QuadF visibleTransformedQuad = MathUtil::mapQuad(transform, gfx::QuadF( layer->visibleContentRect()), clipped); | 255 gfx::QuadF visibleTransformedQuad = MathUtil::mapQuad(transform, gfx::QuadF( layer->visibleContentRect()), clipped); |
| 257 // FIXME: Find a rect interior to each transformed quad. | 256 // FIXME: Find a rect interior to each transformed quad. |
| 258 if (clipped || !visibleTransformedQuad.IsRectilinear()) | 257 if (clipped || !visibleTransformedQuad.IsRectilinear()) |
| 259 return; | 258 return; |
| 260 | 259 |
| 261 Vector<WebCore::IntRect> contentRects = opaqueContents.rects(); | 260 Vector<WebCore::IntRect> contentRects = opaqueContents.rects(); |
| 262 for (size_t i = 0; i < contentRects.size(); ++i) { | 261 for (size_t i = 0; i < contentRects.size(); ++i) { |
| 263 // We've already checked for clipping in the mapQuad call above, these c alls should not clip anything further. | 262 // We've already checked for clipping in the mapQuad call above, these c alls should not clip anything further. |
| 264 gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect (transform, cc::FloatRect(contentRects[i]))); | 263 gfx::Rect transformedRect = gfx::ToEnclosedRect(MathUtil::mapClippedRect (transform, gfx::RectF(gfx::Rect(cc::IntRect(contentRects[i]))))); |
| 265 transformedRect.Intersect(clipRectInTarget); | 264 transformedRect.Intersect(clipRectInTarget); |
| 266 if (transformedRect.width() >= minimumTrackingSize.width() || transforme dRect.height() >= minimumTrackingSize.height()) { | 265 if (transformedRect.width() >= minimumTrackingSize.width() || transforme dRect.height() >= minimumTrackingSize.height()) { |
| 267 if (occludingScreenSpaceRects) | 266 if (occludingScreenSpaceRects) |
| 268 occludingScreenSpaceRects->push_back(transformedRect); | 267 occludingScreenSpaceRects->push_back(transformedRect); |
| 269 region.Union(transformedRect); | 268 region.Union(transformedRect); |
| 270 } | 269 } |
| 271 } | 270 } |
| 272 } | 271 } |
| 273 | 272 |
| 274 template<typename LayerType, typename RenderSurfaceType> | 273 template<typename LayerType, typename RenderSurfaceType> |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::finishedRender Target(const LayerImpl* finishedTarget); | 478 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::finishedRender Target(const LayerImpl* finishedTarget); |
| 480 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveToRenderT arget(const LayerImpl* newTarget); | 479 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::leaveToRenderT arget(const LayerImpl* newTarget); |
| 481 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::markOccludedBe hindLayer(const LayerImpl*); | 480 template void OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::markOccludedBe hindLayer(const LayerImpl*); |
| 482 template bool OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::occluded(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix & drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectIn Target, bool* hasOcclusionFromOutsideTargetSurface) const; | 481 template bool OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::occluded(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTransformationMatrix & drawTransform, bool implDrawTransformIsUnknown, const gfx::Rect& clippedRectIn Target, bool* hasOcclusionFromOutsideTargetSurface) const; |
| 483 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unocclude dContentRect(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTr ansformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::R ect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const; | 482 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unocclude dContentRect(const LayerImpl*, const gfx::Rect& contentRect, const WebKit::WebTr ansformationMatrix& drawTransform, bool implDrawTransformIsUnknown, const gfx::R ect& clippedRectInTarget, bool* hasOcclusionFromOutsideTargetSurface) const; |
| 484 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unocclude dContributingSurfaceContentRect(const LayerImpl*, bool forReplica, const gfx::Re ct& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; | 483 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::unocclude dContributingSurfaceContentRect(const LayerImpl*, bool forReplica, const gfx::Re ct& contentRect, bool* hasOcclusionFromOutsideTargetSurface) const; |
| 485 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::layerClip RectInTarget(const LayerImpl*) const; | 484 template gfx::Rect OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>::layerClip RectInTarget(const LayerImpl*) const; |
| 486 | 485 |
| 487 | 486 |
| 488 } // namespace cc | 487 } // namespace cc |
| OLD | NEW |