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 "cc/occlusion_tracker.h" | 5 #include "cc/occlusion_tracker.h" |
6 | 6 |
7 #include <public/WebFilterOperation.h> | 7 #include <public/WebFilterOperation.h> |
8 #include <public/WebFilterOperations.h> | 8 #include <public/WebFilterOperations.h> |
9 | 9 |
10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
11 #include "cc/layer_animation_controller.h" | 11 #include "cc/layer_animation_controller.h" |
12 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
13 #include "cc/layer_tree_host_common.h" | 13 #include "cc/layer_tree_host_common.h" |
14 #include "cc/math_util.h" | 14 #include "cc/math_util.h" |
15 #include "cc/overdraw_metrics.h" | 15 #include "cc/overdraw_metrics.h" |
16 #include "cc/single_thread_proxy.h" | 16 #include "cc/single_thread_proxy.h" |
17 #include "cc/test/animation_test_common.h" | 17 #include "cc/test/animation_test_common.h" |
18 #include "cc/test/fake_impl_proxy.h" | 18 #include "cc/test/fake_impl_proxy.h" |
19 #include "cc/test/fake_layer_tree_host_impl.h" | 19 #include "cc/test/fake_layer_tree_host_impl.h" |
20 #include "cc/test/geometry_test_utils.h" | 20 #include "cc/test/geometry_test_utils.h" |
21 #include "cc/test/occlusion_tracker_test_common.h" | 21 #include "cc/test/occlusion_tracker_test_common.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
25 | 25 |
26 using namespace WebKit; | |
27 using namespace WebKitTests; | |
28 | |
29 namespace cc { | 26 namespace cc { |
30 namespace { | 27 namespace { |
31 | 28 |
32 class TestContentLayer : public Layer { | 29 class TestContentLayer : public Layer { |
33 public: | 30 public: |
34 TestContentLayer() | 31 TestContentLayer() |
35 : Layer() | 32 : Layer() |
36 , m_overrideOpaqueContentsRect(false) | 33 , m_overrideOpaqueContentsRect(false) |
37 { | 34 { |
38 } | 35 } |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 typename Types::LayerPtrType layer(Types::createLayer(getHost())); | 223 typename Types::LayerPtrType layer(Types::createLayer(getHost())); |
227 typename Types::LayerType* layerPtr = layer.get(); | 224 typename Types::LayerType* layerPtr = layer.get(); |
228 setProperties(layerPtr, transform, position, bounds); | 225 setProperties(layerPtr, transform, position, bounds); |
229 parent->addChild(Types::passLayerPtr(layer)); | 226 parent->addChild(Types::passLayerPtr(layer)); |
230 return layerPtr; | 227 return layerPtr; |
231 } | 228 } |
232 | 229 |
233 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& b
ounds) | 230 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& b
ounds) |
234 { | 231 { |
235 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); | 232 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); |
236 WebFilterOperations filters; | 233 WebKit::WebFilterOperations filters; |
237 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 234 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
238 layer->setFilters(filters); | 235 layer->setFilters(filters); |
239 return layer; | 236 return layer; |
240 } | 237 } |
241 | 238 |
242 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const gfx::Transform& transform, const gfx::PointF& position, const
gfx::Size& bounds, bool opaque) | 239 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const gfx::Transform& transform, const gfx::PointF& position, const
gfx::Size& bounds, bool opaque) |
243 { | 240 { |
244 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); | 241 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); |
245 typename Types::ContentLayerType* layerPtr = layer.get(); | 242 typename Types::ContentLayerType* layerPtr = layer.get(); |
246 setProperties(layerPtr, transform, position, bounds); | 243 setProperties(layerPtr, transform, position, bounds); |
247 | 244 |
(...skipping 25 matching lines...) Expand all Loading... |
273 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); | 270 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); |
274 typename Types::ContentLayerType* layerPtr = layer.get(); | 271 typename Types::ContentLayerType* layerPtr = layer.get(); |
275 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); | 272 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); |
276 setMask(owningLayer, Types::passLayerPtr(layer)); | 273 setMask(owningLayer, Types::passLayerPtr(layer)); |
277 return layerPtr; | 274 return layerPtr; |
278 } | 275 } |
279 | 276 |
280 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const gfx::Transform& transform, const gfx::PointF& position, cons
t gfx::Size& bounds, bool opaque) | 277 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const gfx::Transform& transform, const gfx::PointF& position, cons
t gfx::Size& bounds, bool opaque) |
281 { | 278 { |
282 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); | 279 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); |
283 WebFilterOperations filters; | 280 WebKit::WebFilterOperations filters; |
284 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 281 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
285 layer->setFilters(filters); | 282 layer->setFilters(filters); |
286 return layer; | 283 return layer; |
287 } | 284 } |
288 | 285 |
289 void calcDrawEtc(TestContentLayerImpl* root) | 286 void calcDrawEtc(TestContentLayerImpl* root) |
290 { | 287 { |
291 DCHECK(root == m_root.get()); | 288 DCHECK(root == m_root.get()); |
292 int dummyMaxTextureSize = 512; | 289 int dummyMaxTextureSize = 512; |
293 | 290 |
294 DCHECK(!root->renderSurface()); | 291 DCHECK(!root->renderSurface()); |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 layerTransform.Translate(250, 250); | 1260 layerTransform.Translate(250, 250); |
1264 layerTransform.Rotate(90); | 1261 layerTransform.Rotate(90); |
1265 layerTransform.Translate(-250, -250); | 1262 layerTransform.Translate(-250, -250); |
1266 | 1263 |
1267 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1264 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
1268 parent->setMasksToBounds(true); | 1265 parent->setMasksToBounds(true); |
1269 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1266 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1270 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1267 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1271 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1268 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1272 | 1269 |
1273 WebFilterOperations filters; | 1270 WebKit::WebFilterOperations filters; |
1274 filters.append(WebFilterOperation::createBlurFilter(10)); | 1271 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); |
1275 blurLayer->setFilters(filters); | 1272 blurLayer->setFilters(filters); |
1276 | 1273 |
1277 filters.clear(); | 1274 filters.clear(); |
1278 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 1275 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
1279 opaqueLayer->setFilters(filters); | 1276 opaqueLayer->setFilters(filters); |
1280 | 1277 |
1281 filters.clear(); | 1278 filters.clear(); |
1282 filters.append(WebFilterOperation::createOpacityFilter(0.5)); | 1279 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)); |
1283 opacityLayer->setFilters(filters); | 1280 opacityLayer->setFilters(filters); |
1284 | 1281 |
1285 this->calcDrawEtc(parent); | 1282 this->calcDrawEtc(parent); |
1286 | 1283 |
1287 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1284 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1288 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1285 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1289 | 1286 |
1290 // Opacity layer won't contribute to occlusion. | 1287 // Opacity layer won't contribute to occlusion. |
1291 this->visitLayer(opacityLayer, occlusion); | 1288 this->visitLayer(opacityLayer, occlusion); |
1292 this->enterContributingSurface(opacityLayer, occlusion); | 1289 this->enterContributingSurface(opacityLayer, occlusion); |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2598 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2595 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2599 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2596 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
2600 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2597 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2601 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); | 2598 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
2602 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); | 2599 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
2603 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); | 2600 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
2604 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); | 2601 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
2605 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); | 2602 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
2606 | 2603 |
2607 // Filters make the layer own a surface. | 2604 // Filters make the layer own a surface. |
2608 WebFilterOperations filters; | 2605 WebKit::WebFilterOperations filters; |
2609 filters.append(WebFilterOperation::createBlurFilter(10)); | 2606 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); |
2610 filteredSurface->setBackgroundFilters(filters); | 2607 filteredSurface->setBackgroundFilters(filters); |
2611 | 2608 |
2612 // Save the distance of influence for the blur effect. | 2609 // Save the distance of influence for the blur effect. |
2613 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2610 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2614 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2611 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2615 | 2612 |
2616 this->calcDrawEtc(parent); | 2613 this->calcDrawEtc(parent); |
2617 | 2614 |
2618 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2615 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2619 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2616 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2725 | 2722 |
2726 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2723 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
2727 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); | 2724 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); |
2728 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); | 2725 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); |
2729 parent->setMasksToBounds(true); | 2726 parent->setMasksToBounds(true); |
2730 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2727 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2731 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2728 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2732 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); | 2729 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); |
2733 | 2730 |
2734 // Filters make the layers own surfaces. | 2731 // Filters make the layers own surfaces. |
2735 WebFilterOperations filters; | 2732 WebKit::WebFilterOperations filters; |
2736 filters.append(WebFilterOperation::createBlurFilter(1)); | 2733 filters.append(WebKit::WebFilterOperation::createBlurFilter(1)); |
2737 filteredSurface1->setBackgroundFilters(filters); | 2734 filteredSurface1->setBackgroundFilters(filters); |
2738 filteredSurface2->setBackgroundFilters(filters); | 2735 filteredSurface2->setBackgroundFilters(filters); |
2739 | 2736 |
2740 // Save the distance of influence for the blur effect. | 2737 // Save the distance of influence for the blur effect. |
2741 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2738 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2742 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2739 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2743 | 2740 |
2744 this->calcDrawEtc(root); | 2741 this->calcDrawEtc(root); |
2745 | 2742 |
2746 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2743 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 clippingSurface->setMasksToBounds(true); | 2777 clippingSurface->setMasksToBounds(true); |
2781 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), fal
se); | 2778 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), fal
se); |
2782 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(150, 0), gfx::Size()); | 2779 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(150, 0), gfx::Size()); |
2783 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); | 2780 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
2784 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); | 2781 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
2785 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); | 2782 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
2786 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); | 2783 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
2787 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); | 2784 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
2788 | 2785 |
2789 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. | 2786 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. |
2790 WebFilterOperations filters; | 2787 WebKit::WebFilterOperations filters; |
2791 filters.append(WebFilterOperation::createBlurFilter(12)); | 2788 filters.append(WebKit::WebFilterOperation::createBlurFilter(12)); |
2792 filteredSurface->setBackgroundFilters(filters); | 2789 filteredSurface->setBackgroundFilters(filters); |
2793 | 2790 |
2794 // Save the distance of influence for the blur effect. | 2791 // Save the distance of influence for the blur effect. |
2795 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2792 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2796 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2793 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2797 | 2794 |
2798 this->calcDrawEtc(parent); | 2795 this->calcDrawEtc(parent); |
2799 | 2796 |
2800 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2797 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2801 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2798 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2911 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. | 2908 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. |
2912 // The surface is scaled to test that the pixel moving is done in the ta
rget space, where the background filter is applied, but the surface | 2909 // The surface is scaled to test that the pixel moving is done in the ta
rget space, where the background filter is applied, but the surface |
2913 // appears at 50, 50 and the replica at 200, 50. | 2910 // appears at 50, 50 and the replica at 200, 50. |
2914 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2911 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2915 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); | 2912 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); |
2916 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); | 2913 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); |
2917 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2914 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
2918 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2915 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2919 | 2916 |
2920 // Filters make the layer own a surface. | 2917 // Filters make the layer own a surface. |
2921 WebFilterOperations filters; | 2918 WebKit::WebFilterOperations filters; |
2922 filters.append(WebFilterOperation::createBlurFilter(3)); | 2919 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
2923 filteredSurface->setBackgroundFilters(filters); | 2920 filteredSurface->setBackgroundFilters(filters); |
2924 | 2921 |
2925 this->calcDrawEtc(parent); | 2922 this->calcDrawEtc(parent); |
2926 | 2923 |
2927 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2924 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2928 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2925 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2929 | 2926 |
2930 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2927 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
2931 this->visitLayer(filteredSurface, occlusion); | 2928 this->visitLayer(filteredSurface, occlusion); |
2932 this->visitContributingSurface(filteredSurface, occlusion); | 2929 this->visitContributingSurface(filteredSurface, occlusion); |
(...skipping 26 matching lines...) Expand all Loading... |
2959 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. | 2956 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. |
2960 // The surface is scaled to test that the pixel moving is done in the ta
rget space, where the background filter is applied, but the surface | 2957 // The surface is scaled to test that the pixel moving is done in the ta
rget space, where the background filter is applied, but the surface |
2961 // appears at 50, 50 and the replica at 200, 50. | 2958 // appears at 50, 50 and the replica at 200, 50. |
2962 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2959 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2963 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2960 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
2964 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2961 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2965 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); | 2962 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); |
2966 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); | 2963 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); |
2967 | 2964 |
2968 // Filters make the layer own a surface. | 2965 // Filters make the layer own a surface. |
2969 WebFilterOperations filters; | 2966 WebKit::WebFilterOperations filters; |
2970 filters.append(WebFilterOperation::createBlurFilter(3)); | 2967 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
2971 filteredSurface->setBackgroundFilters(filters); | 2968 filteredSurface->setBackgroundFilters(filters); |
2972 | 2969 |
2973 this->calcDrawEtc(parent); | 2970 this->calcDrawEtc(parent); |
2974 | 2971 |
2975 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2972 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2976 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2973 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2977 | 2974 |
2978 this->visitLayer(aboveReplicaLayer, occlusion); | 2975 this->visitLayer(aboveReplicaLayer, occlusion); |
2979 this->visitLayer(aboveSurfaceLayer, occlusion); | 2976 this->visitLayer(aboveSurfaceLayer, occlusion); |
2980 | 2977 |
(...skipping 27 matching lines...) Expand all Loading... |
3008 // appears at 50, 50 and the replica at 200, 50. | 3005 // appears at 50, 50 and the replica at 200, 50. |
3009 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 3006 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
3010 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 3007 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
3011 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 3008 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
3012 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); | 3009 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); |
3013 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); | 3010 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); |
3014 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); | 3011 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); |
3015 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(200, 40), gfx::Size(10, 10), true); | 3012 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(200, 40), gfx::Size(10, 10), true); |
3016 | 3013 |
3017 // Filters make the layer own a surface. | 3014 // Filters make the layer own a surface. |
3018 WebFilterOperations filters; | 3015 WebKit::WebFilterOperations filters; |
3019 filters.append(WebFilterOperation::createBlurFilter(3)); | 3016 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
3020 filteredSurface->setBackgroundFilters(filters); | 3017 filteredSurface->setBackgroundFilters(filters); |
3021 | 3018 |
3022 // Save the distance of influence for the blur effect. | 3019 // Save the distance of influence for the blur effect. |
3023 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 3020 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
3024 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 3021 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
3025 | 3022 |
3026 this->calcDrawEtc(parent); | 3023 this->calcDrawEtc(parent); |
3027 | 3024 |
3028 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 3025 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
3029 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 3026 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 | 3095 |
3099 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInScreenSpace().ToString()); | 3096 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInScreenSpace().ToString()); |
3100 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInTargetSurface().ToString()); | 3097 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInTargetSurface().ToString()); |
3101 } | 3098 } |
3102 }; | 3099 }; |
3103 | 3100 |
3104 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 3101 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
3105 | 3102 |
3106 } // namespace | 3103 } // namespace |
3107 } // namespace cc | 3104 } // namespace cc |
OLD | NEW |