| 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> |
| 8 #include <public/WebFilterOperations.h> |
| 9 |
| 7 #include "cc/layer.h" | 10 #include "cc/layer.h" |
| 8 #include "cc/layer_animation_controller.h" | 11 #include "cc/layer_animation_controller.h" |
| 9 #include "cc/layer_impl.h" | 12 #include "cc/layer_impl.h" |
| 10 #include "cc/layer_tree_host_common.h" | 13 #include "cc/layer_tree_host_common.h" |
| 11 #include "cc/math_util.h" | 14 #include "cc/math_util.h" |
| 12 #include "cc/overdraw_metrics.h" | 15 #include "cc/overdraw_metrics.h" |
| 13 #include "cc/single_thread_proxy.h" | 16 #include "cc/single_thread_proxy.h" |
| 14 #include "cc/test/animation_test_common.h" | 17 #include "cc/test/animation_test_common.h" |
| 15 #include "cc/test/geometry_test_utils.h" | 18 #include "cc/test/geometry_test_utils.h" |
| 16 #include "cc/test/occlusion_tracker_test_common.h" | 19 #include "cc/test/occlusion_tracker_test_common.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 18 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include <public/WebFilterOperation.h> | 22 #include "ui/gfx/transform.h" |
| 20 #include <public/WebFilterOperations.h> | |
| 21 #include <public/WebTransformationMatrix.h> | |
| 22 | 23 |
| 23 using namespace WebKit; | 24 using namespace WebKit; |
| 24 using namespace WebKitTests; | 25 using namespace WebKitTests; |
| 25 | 26 |
| 26 namespace cc { | 27 namespace cc { |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 class TestContentLayer : public Layer { | 30 class TestContentLayer : public Layer { |
| 30 public: | 31 public: |
| 31 TestContentLayer() | 32 TestContentLayer() |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 virtual void TearDown() | 191 virtual void TearDown() |
| 191 { | 192 { |
| 192 Types::destroyLayer(m_root); | 193 Types::destroyLayer(m_root); |
| 193 m_renderSurfaceLayerList.clear(); | 194 m_renderSurfaceLayerList.clear(); |
| 194 m_renderSurfaceLayerListImpl.clear(); | 195 m_renderSurfaceLayerListImpl.clear(); |
| 195 m_replicaLayers.clear(); | 196 m_replicaLayers.clear(); |
| 196 m_maskLayers.clear(); | 197 m_maskLayers.clear(); |
| 197 LayerTreeHost::setNeedsFilterContext(false); | 198 LayerTreeHost::setNeedsFilterContext(false); |
| 198 } | 199 } |
| 199 | 200 |
| 200 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix&
transform, const gfx::PointF& position, const gfx::Size& bounds) | 201 typename Types::ContentLayerType* createRoot(const gfx::Transform& transform
, const gfx::PointF& position, const gfx::Size& bounds) |
| 201 { | 202 { |
| 202 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 203 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
| 203 typename Types::ContentLayerType* layerPtr = layer.get(); | 204 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 204 setProperties(layerPtr, transform, position, bounds); | 205 setProperties(layerPtr, transform, position, bounds); |
| 205 | 206 |
| 206 DCHECK(!m_root); | 207 DCHECK(!m_root); |
| 207 m_root = Types::passLayerPtr(layer); | 208 m_root = Types::passLayerPtr(layer); |
| 208 return layerPtr; | 209 return layerPtr; |
| 209 } | 210 } |
| 210 | 211 |
| 211 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst WebTransformationMatrix& transform, const gfx::PointF& position, const gfx::
Size& bounds) | 212 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& bou
nds) |
| 212 { | 213 { |
| 213 typename Types::LayerPtrType layer(Types::createLayer()); | 214 typename Types::LayerPtrType layer(Types::createLayer()); |
| 214 typename Types::LayerType* layerPtr = layer.get(); | 215 typename Types::LayerType* layerPtr = layer.get(); |
| 215 setProperties(layerPtr, transform, position, bounds); | 216 setProperties(layerPtr, transform, position, bounds); |
| 216 parent->addChild(Types::passLayerPtr(layer)); | 217 parent->addChild(Types::passLayerPtr(layer)); |
| 217 return layerPtr; | 218 return layerPtr; |
| 218 } | 219 } |
| 219 | 220 |
| 220 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const WebTransformationMatrix& transform, const gfx::PointF& position, const gfx
::Size& bounds) | 221 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& b
ounds) |
| 221 { | 222 { |
| 222 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); | 223 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); |
| 223 WebFilterOperations filters; | 224 WebFilterOperations filters; |
| 224 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 225 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
| 225 layer->setFilters(filters); | 226 layer->setFilters(filters); |
| 226 return layer; | 227 return layer; |
| 227 } | 228 } |
| 228 | 229 |
| 229 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const WebTransformationMatrix& transform, const gfx::PointF& positio
n, const gfx::Size& bounds, bool opaque) | 230 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const gfx::Transform& transform, const gfx::PointF& position, const
gfx::Size& bounds, bool opaque) |
| 230 { | 231 { |
| 231 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 232 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
| 232 typename Types::ContentLayerType* layerPtr = layer.get(); | 233 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 233 setProperties(layerPtr, transform, position, bounds); | 234 setProperties(layerPtr, transform, position, bounds); |
| 234 | 235 |
| 235 if (m_opaqueLayers) | 236 if (m_opaqueLayers) |
| 236 layerPtr->setContentsOpaque(opaque); | 237 layerPtr->setContentsOpaque(opaque); |
| 237 else { | 238 else { |
| 238 layerPtr->setContentsOpaque(false); | 239 layerPtr->setContentsOpaque(false); |
| 239 if (opaque) | 240 if (opaque) |
| 240 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; | 241 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; |
| 241 else | 242 else |
| 242 layerPtr->setOpaqueContentsRect(gfx::Rect()); | 243 layerPtr->setOpaqueContentsRect(gfx::Rect()); |
| 243 } | 244 } |
| 244 | 245 |
| 245 parent->addChild(Types::passLayerPtr(layer)); | 246 parent->addChild(Types::passLayerPtr(layer)); |
| 246 return layerPtr; | 247 return layerPtr; |
| 247 } | 248 } |
| 248 | 249 |
| 249 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const WebTransformationMatrix& transform, const gfx::PointF& position,
const gfx::Size& bounds) | 250 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const gfx::Transform& transform, const gfx::PointF& position, const gf
x::Size& bounds) |
| 250 { | 251 { |
| 251 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 252 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
| 252 typename Types::ContentLayerType* layerPtr = layer.get(); | 253 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 253 setProperties(layerPtr, transform, position, bounds); | 254 setProperties(layerPtr, transform, position, bounds); |
| 254 setReplica(owningLayer, Types::passLayerPtr(layer)); | 255 setReplica(owningLayer, Types::passLayerPtr(layer)); |
| 255 return layerPtr; | 256 return layerPtr; |
| 256 } | 257 } |
| 257 | 258 |
| 258 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning
Layer, const gfx::Size& bounds) | 259 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning
Layer, const gfx::Size& bounds) |
| 259 { | 260 { |
| 260 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 261 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
| 261 typename Types::ContentLayerType* layerPtr = layer.get(); | 262 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 262 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); | 263 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); |
| 263 setMask(owningLayer, Types::passLayerPtr(layer)); | 264 setMask(owningLayer, Types::passLayerPtr(layer)); |
| 264 return layerPtr; | 265 return layerPtr; |
| 265 } | 266 } |
| 266 | 267 |
| 267 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const WebTransformationMatrix& transform, const gfx::PointF& posit
ion, const gfx::Size& bounds, bool opaque) | 268 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const gfx::Transform& transform, const gfx::PointF& position, cons
t gfx::Size& bounds, bool opaque) |
| 268 { | 269 { |
| 269 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); | 270 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); |
| 270 WebFilterOperations filters; | 271 WebFilterOperations filters; |
| 271 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 272 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
| 272 layer->setFilters(filters); | 273 layer->setFilters(filters); |
| 273 return layer; | 274 return layer; |
| 274 } | 275 } |
| 275 | 276 |
| 276 void calcDrawEtc(TestContentLayerImpl* root) | 277 void calcDrawEtc(TestContentLayerImpl* root) |
| 277 { | 278 { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 { | 343 { |
| 343 enterContributingSurface(layer, occlusion); | 344 enterContributingSurface(layer, occlusion); |
| 344 leaveContributingSurface(layer, occlusion); | 345 leaveContributingSurface(layer, occlusion); |
| 345 } | 346 } |
| 346 | 347 |
| 347 void resetLayerIterator() | 348 void resetLayerIterator() |
| 348 { | 349 { |
| 349 m_layerIterator = m_layerIteratorBegin; | 350 m_layerIterator = m_layerIteratorBegin; |
| 350 } | 351 } |
| 351 | 352 |
| 352 const WebTransformationMatrix identityMatrix; | 353 const gfx::Transform identityMatrix; |
| 353 | 354 |
| 354 private: | 355 private: |
| 355 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma
tionMatrix& transform, const gfx::PointF& position, const gfx::Size& bounds) | 356 void setBaseProperties(typename Types::LayerType* layer, const gfx::Transfor
m& transform, const gfx::PointF& position, const gfx::Size& bounds) |
| 356 { | 357 { |
| 357 layer->setTransform(transform); | 358 layer->setTransform(transform); |
| 358 layer->setSublayerTransform(WebTransformationMatrix()); | 359 layer->setSublayerTransform(gfx::Transform()); |
| 359 layer->setAnchorPoint(gfx::PointF(0, 0)); | 360 layer->setAnchorPoint(gfx::PointF(0, 0)); |
| 360 layer->setPosition(position); | 361 layer->setPosition(position); |
| 361 layer->setBounds(bounds); | 362 layer->setBounds(bounds); |
| 362 } | 363 } |
| 363 | 364 |
| 364 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c
onst gfx::PointF& position, const gfx::Size& bounds) | 365 void setProperties(Layer* layer, const gfx::Transform& transform, const gfx:
:PointF& position, const gfx::Size& bounds) |
| 365 { | 366 { |
| 366 setBaseProperties(layer, transform, position, bounds); | 367 setBaseProperties(layer, transform, position, bounds); |
| 367 } | 368 } |
| 368 | 369 |
| 369 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor
m, const gfx::PointF& position, const gfx::Size& bounds) | 370 void setProperties(LayerImpl* layer, const gfx::Transform& transform, const
gfx::PointF& position, const gfx::Size& bounds) |
| 370 { | 371 { |
| 371 setBaseProperties(layer, transform, position, bounds); | 372 setBaseProperties(layer, transform, position, bounds); |
| 372 | 373 |
| 373 layer->setContentBounds(layer->bounds()); | 374 layer->setContentBounds(layer->bounds()); |
| 374 } | 375 } |
| 375 | 376 |
| 376 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) | 377 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) |
| 377 { | 378 { |
| 378 owningLayer->setReplicaLayer(layer.get()); | 379 owningLayer->setReplicaLayer(layer.get()); |
| 379 m_replicaLayers.push_back(layer); | 380 m_replicaLayers.push_back(layer); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 }; | 497 }; |
| 497 | 498 |
| 498 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); | 499 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); |
| 499 | 500 |
| 500 template<class Types> | 501 template<class Types> |
| 501 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { | 502 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { |
| 502 protected: | 503 protected: |
| 503 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 504 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
| 504 void runMyTest() | 505 void runMyTest() |
| 505 { | 506 { |
| 506 WebTransformationMatrix layerTransform; | 507 gfx::Transform layerTransform; |
| 507 layerTransform.translate(10, 10); | 508 layerTransform.Translate(10, 10); |
| 508 | 509 |
| 509 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::Point(0, 0), gfx::Size(100, 100)); | 510 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::Point(0, 0), gfx::Size(100, 100)); |
| 510 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); | 511 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); |
| 511 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); | 512 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
| 512 this->calcDrawEtc(parent); | 513 this->calcDrawEtc(parent); |
| 513 | 514 |
| 514 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 515 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 515 | 516 |
| 516 this->visitLayer(layer2, occlusion); | 517 this->visitLayer(layer2, occlusion); |
| 517 this->enterLayer(layer1, occlusion); | 518 this->enterLayer(layer1, occlusion); |
| 518 | 519 |
| 519 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInScr
eenSpace().ToString()); | 520 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInScr
eenSpace().ToString()); |
| 520 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInTar
getSurface().ToString()); | 521 EXPECT_EQ(gfx::Rect(20, 20, 50, 50).ToString(), occlusion.occlusionInTar
getSurface().ToString()); |
| 521 | 522 |
| 522 // This checks cases where the quads don't match their "containing" | 523 // This checks cases where the quads don't match their "containing" |
| 523 // layers, e.g. in terms of transforms or clip rect. This is typical for | 524 // layers, e.g. in terms of transforms or clip rect. This is typical for |
| 524 // DelegatedRendererLayer. | 525 // DelegatedRendererLayer. |
| 525 | 526 |
| 526 WebTransformationMatrix quadTransform; | 527 gfx::Transform quadTransform; |
| 527 quadTransform.translate(30, 30); | 528 quadTransform.Translate(30, 30); |
| 528 gfx::Rect clipRectInTarget(0, 0, 100, 100); | 529 gfx::Rect clipRectInTarget(0, 0, 100, 100); |
| 529 | 530 |
| 530 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, clipRectInTarget).IsEmpty()); | 531 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, gfx::Rect(0, 0, 10,
10), quadTransform, false, clipRectInTarget).IsEmpty()); |
| 531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(
parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, clipRectInTarget)); | 532 EXPECT_RECT_EQ(gfx::Rect(0, 0, 10, 10), occlusion.unoccludedContentRect(
parent, gfx::Rect(0, 0, 10, 10), quadTransform, true, clipRectInTarget)); |
| 532 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRec
t(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, clipRectInTarget)); | 533 EXPECT_RECT_EQ(gfx::Rect(40, 40, 10, 10), occlusion.unoccludedContentRec
t(parent, gfx::Rect(40, 40, 10, 10), quadTransform, false, clipRectInTarget)); |
| 533 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect
(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, clipRectInTarget)); | 534 EXPECT_RECT_EQ(gfx::Rect(40, 30, 5, 10), occlusion.unoccludedContentRect
(parent, gfx::Rect(35, 30, 10, 10), quadTransform, false, clipRectInTarget)); |
| 534 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)
)); | 535 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)
)); |
| 535 } | 536 } |
| 536 }; | 537 }; |
| 537 | 538 |
| 538 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); | 539 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestQuadsMismatchLayer); |
| 539 | 540 |
| 540 template<class Types> | 541 template<class Types> |
| 541 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { | 542 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { |
| 542 protected: | 543 protected: |
| 543 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} | 544 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} |
| 544 void runMyTest() | 545 void runMyTest() |
| 545 { | 546 { |
| 546 WebTransformationMatrix layerTransform; | 547 gfx::Transform layerTransform; |
| 547 layerTransform.translate(250, 250); | 548 layerTransform.Translate(250, 250); |
| 548 layerTransform.rotate(90); | 549 layerTransform.Rotate(90); |
| 549 layerTransform.translate(-250, -250); | 550 layerTransform.Translate(-250, -250); |
| 550 | 551 |
| 551 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 552 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 552 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 553 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 553 this->calcDrawEtc(parent); | 554 this->calcDrawEtc(parent); |
| 554 | 555 |
| 555 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 556 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 556 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 557 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
| 557 | 558 |
| 558 this->visitLayer(layer, occlusion); | 559 this->visitLayer(layer, occlusion); |
| 559 this->enterLayer(parent, occlusion); | 560 this->enterLayer(parent, occlusion); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 588 }; | 589 }; |
| 589 | 590 |
| 590 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); | 591 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); |
| 591 | 592 |
| 592 template<class Types> | 593 template<class Types> |
| 593 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { | 594 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { |
| 594 protected: | 595 protected: |
| 595 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 596 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
| 596 void runMyTest() | 597 void runMyTest() |
| 597 { | 598 { |
| 598 WebTransformationMatrix layerTransform; | 599 gfx::Transform layerTransform; |
| 599 layerTransform.translate(20, 20); | 600 layerTransform.Translate(20, 20); |
| 600 | 601 |
| 601 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 602 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 602 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 603 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 603 this->calcDrawEtc(parent); | 604 this->calcDrawEtc(parent); |
| 604 | 605 |
| 605 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 606 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 606 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 607 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
| 607 | 608 |
| 608 this->visitLayer(layer, occlusion); | 609 this->visitLayer(layer, occlusion); |
| 609 this->enterLayer(parent, occlusion); | 610 this->enterLayer(parent, occlusion); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 }; | 651 }; |
| 651 | 652 |
| 652 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); | 653 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); |
| 653 | 654 |
| 654 template<class Types> | 655 template<class Types> |
| 655 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { | 656 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { |
| 656 protected: | 657 protected: |
| 657 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 658 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 658 void runMyTest() | 659 void runMyTest() |
| 659 { | 660 { |
| 660 WebTransformationMatrix childTransform; | 661 gfx::Transform childTransform; |
| 661 childTransform.translate(250, 250); | 662 childTransform.Translate(250, 250); |
| 662 childTransform.rotate(90); | 663 childTransform.Rotate(90); |
| 663 childTransform.translate(-250, -250); | 664 childTransform.Translate(-250, -250); |
| 664 | 665 |
| 665 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 666 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 666 parent->setMasksToBounds(true); | 667 parent->setMasksToBounds(true); |
| 667 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 668 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 668 child->setMasksToBounds(true); | 669 child->setMasksToBounds(true); |
| 669 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 670 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 670 this->calcDrawEtc(parent); | 671 this->calcDrawEtc(parent); |
| 671 | 672 |
| 672 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 673 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 673 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 674 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 | 731 |
| 731 template<class Types> | 732 template<class Types> |
| 732 class OcclusionTrackerTestScaledRenderSurface : public OcclusionTrackerTest<Type
s> { | 733 class OcclusionTrackerTestScaledRenderSurface : public OcclusionTrackerTest<Type
s> { |
| 733 protected: | 734 protected: |
| 734 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 735 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 735 | 736 |
| 736 void runMyTest() | 737 void runMyTest() |
| 737 { | 738 { |
| 738 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 739 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
| 739 | 740 |
| 740 WebTransformationMatrix layer1Matrix; | 741 gfx::Transform layer1Matrix; |
| 741 layer1Matrix.scale(2); | 742 layer1Matrix.Scale(2, 2); |
| 742 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 743 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 743 layer1->setForceRenderSurface(true); | 744 layer1->setForceRenderSurface(true); |
| 744 | 745 |
| 745 WebTransformationMatrix layer2Matrix; | 746 gfx::Transform layer2Matrix; |
| 746 layer2Matrix.translate(25, 25); | 747 layer2Matrix.Translate(25, 25); |
| 747 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); | 748 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
| 748 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); | 749 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); |
| 749 this->calcDrawEtc(parent); | 750 this->calcDrawEtc(parent); |
| 750 | 751 |
| 751 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 752 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 752 | 753 |
| 753 this->visitLayer(occluder, occlusion); | 754 this->visitLayer(occluder, occlusion); |
| 754 this->enterLayer(layer2, occlusion); | 755 this->enterLayer(layer2, occlusion); |
| 755 | 756 |
| 756 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionI
nScreenSpace().ToString()); | 757 EXPECT_EQ(gfx::Rect(100, 100, 100, 100).ToString(), occlusion.occlusionI
nScreenSpace().ToString()); |
| 757 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T
oString()); | 758 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusionInTargetSurface().T
oString()); |
| 758 | 759 |
| 759 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); | 760 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); |
| 760 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); | 761 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); |
| 761 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); | 762 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); |
| 762 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); | 763 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); |
| 763 } | 764 } |
| 764 }; | 765 }; |
| 765 | 766 |
| 766 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); | 767 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); |
| 767 | 768 |
| 768 template<class Types> | 769 template<class Types> |
| 769 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type
s> { | 770 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type
s> { |
| 770 protected: | 771 protected: |
| 771 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 772 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 772 void runMyTest() | 773 void runMyTest() |
| 773 { | 774 { |
| 774 WebTransformationMatrix childTransform; | 775 gfx::Transform childTransform; |
| 775 childTransform.translate(250, 250); | 776 childTransform.Translate(250, 250); |
| 776 childTransform.rotate(90); | 777 childTransform.Rotate(90); |
| 777 childTransform.translate(-250, -250); | 778 childTransform.Translate(-250, -250); |
| 778 | 779 |
| 779 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 780 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 780 parent->setMasksToBounds(true); | 781 parent->setMasksToBounds(true); |
| 781 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 782 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 782 child->setMasksToBounds(true); | 783 child->setMasksToBounds(true); |
| 783 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 784 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 784 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in | 785 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in |
| 785 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 786 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
| 786 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); | 787 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); |
| 787 this->calcDrawEtc(parent); | 788 this->calcDrawEtc(parent); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 }; | 870 }; |
| 870 | 871 |
| 871 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes); | 872 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes); |
| 872 | 873 |
| 873 template<class Types> | 874 template<class Types> |
| 874 class OcclusionTrackerTestSurfaceRotatedOffAxis : public OcclusionTrackerTest<Ty
pes> { | 875 class OcclusionTrackerTestSurfaceRotatedOffAxis : public OcclusionTrackerTest<Ty
pes> { |
| 875 protected: | 876 protected: |
| 876 OcclusionTrackerTestSurfaceRotatedOffAxis(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} | 877 OcclusionTrackerTestSurfaceRotatedOffAxis(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} |
| 877 void runMyTest() | 878 void runMyTest() |
| 878 { | 879 { |
| 879 WebTransformationMatrix childTransform; | 880 gfx::Transform childTransform; |
| 880 childTransform.translate(250, 250); | 881 childTransform.Translate(250, 250); |
| 881 childTransform.rotate(95); | 882 childTransform.Rotate(95); |
| 882 childTransform.translate(-250, -250); | 883 childTransform.Translate(-250, -250); |
| 883 | 884 |
| 884 WebTransformationMatrix layerTransform; | 885 gfx::Transform layerTransform; |
| 885 layerTransform.translate(10, 10); | 886 layerTransform.Translate(10, 10); |
| 886 | 887 |
| 887 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 888 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 888 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 889 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 889 child->setMasksToBounds(true); | 890 child->setMasksToBounds(true); |
| 890 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); | 891 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
| 891 this->calcDrawEtc(parent); | 892 this->calcDrawEtc(parent); |
| 892 | 893 |
| 893 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 894 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 894 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 895 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
| 895 | 896 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 }; | 933 }; |
| 933 | 934 |
| 934 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); | 935 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); |
| 935 | 936 |
| 936 template<class Types> | 937 template<class Types> |
| 937 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { | 938 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { |
| 938 protected: | 939 protected: |
| 939 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 940 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
| 940 void runMyTest() | 941 void runMyTest() |
| 941 { | 942 { |
| 942 WebTransformationMatrix childTransform; | 943 gfx::Transform childTransform; |
| 943 childTransform.translate(250, 250); | 944 childTransform.Translate(250, 250); |
| 944 childTransform.rotate(90); | 945 childTransform.Rotate(90); |
| 945 childTransform.translate(-250, -250); | 946 childTransform.Translate(-250, -250); |
| 946 | 947 |
| 947 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 948 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 948 parent->setMasksToBounds(true); | 949 parent->setMasksToBounds(true); |
| 949 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 950 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 950 child->setMasksToBounds(true); | 951 child->setMasksToBounds(true); |
| 951 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 952 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 952 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); | 953 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); |
| 953 this->calcDrawEtc(parent); | 954 this->calcDrawEtc(parent); |
| 954 | 955 |
| 955 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 956 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 }; | 1019 }; |
| 1019 | 1020 |
| 1020 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren); | 1021 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren); |
| 1021 | 1022 |
| 1022 template<class Types> | 1023 template<class Types> |
| 1023 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe
st<Types> { | 1024 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe
st<Types> { |
| 1024 protected: | 1025 protected: |
| 1025 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} | 1026 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} |
| 1026 void runMyTest() | 1027 void runMyTest() |
| 1027 { | 1028 { |
| 1028 WebTransformationMatrix childTransform; | 1029 gfx::Transform childTransform; |
| 1029 childTransform.translate(250, 250); | 1030 childTransform.Translate(250, 250); |
| 1030 childTransform.rotate(90); | 1031 childTransform.Rotate(90); |
| 1031 childTransform.translate(-250, -250); | 1032 childTransform.Translate(-250, -250); |
| 1032 | 1033 |
| 1033 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1034 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1034 parent->setMasksToBounds(true); | 1035 parent->setMasksToBounds(true); |
| 1035 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, gfx::PointF(30, 30), gfx::Size(10, 10)); | 1036 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, gfx::PointF(30, 30), gfx::Size(10, 10)); |
| 1036 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, gfx::PointF(20, 40), gfx::Size(10, 10)); | 1037 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, gfx::PointF(20, 40), gfx::Size(10, 10)); |
| 1037 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1038 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 1038 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1039 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 1039 this->calcDrawEtc(parent); | 1040 this->calcDrawEtc(parent); |
| 1040 | 1041 |
| 1041 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1042 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 }; | 1124 }; |
| 1124 | 1125 |
| 1125 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings); | 1126 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings); |
| 1126 | 1127 |
| 1127 template<class Types> | 1128 template<class Types> |
| 1128 class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public O
cclusionTrackerTest<Types> { | 1129 class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public O
cclusionTrackerTest<Types> { |
| 1129 protected: | 1130 protected: |
| 1130 OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms(bool opaqueL
ayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 1131 OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms(bool opaqueL
ayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 1131 void runMyTest() | 1132 void runMyTest() |
| 1132 { | 1133 { |
| 1133 WebTransformationMatrix child1Transform; | 1134 gfx::Transform child1Transform; |
| 1134 child1Transform.translate(250, 250); | 1135 child1Transform.Translate(250, 250); |
| 1135 child1Transform.rotate(-90); | 1136 child1Transform.Rotate(-90); |
| 1136 child1Transform.translate(-250, -250); | 1137 child1Transform.Translate(-250, -250); |
| 1137 | 1138 |
| 1138 WebTransformationMatrix child2Transform; | 1139 gfx::Transform child2Transform; |
| 1139 child2Transform.translate(250, 250); | 1140 child2Transform.Translate(250, 250); |
| 1140 child2Transform.rotate(90); | 1141 child2Transform.Rotate(90); |
| 1141 child2Transform.translate(-250, -250); | 1142 child2Transform.Translate(-250, -250); |
| 1142 | 1143 |
| 1143 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1144 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1144 parent->setMasksToBounds(true); | 1145 parent->setMasksToBounds(true); |
| 1145 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); | 1146 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); |
| 1146 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); | 1147 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); |
| 1147 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); | 1148 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); |
| 1148 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1149 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 1149 this->calcDrawEtc(parent); | 1150 this->calcDrawEtc(parent); |
| 1150 | 1151 |
| 1151 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1152 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 }; | 1227 }; |
| 1227 | 1228 |
| 1228 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoT
ransforms); | 1229 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoT
ransforms); |
| 1229 | 1230 |
| 1230 template<class Types> | 1231 template<class Types> |
| 1231 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { | 1232 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { |
| 1232 protected: | 1233 protected: |
| 1233 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} | 1234 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} |
| 1234 void runMyTest() | 1235 void runMyTest() |
| 1235 { | 1236 { |
| 1236 WebTransformationMatrix layerTransform; | 1237 gfx::Transform layerTransform; |
| 1237 layerTransform.translate(250, 250); | 1238 layerTransform.Translate(250, 250); |
| 1238 layerTransform.rotate(90); | 1239 layerTransform.Rotate(90); |
| 1239 layerTransform.translate(-250, -250); | 1240 layerTransform.Translate(-250, -250); |
| 1240 | 1241 |
| 1241 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1242 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1242 parent->setMasksToBounds(true); | 1243 parent->setMasksToBounds(true); |
| 1243 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1244 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1244 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1245 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1245 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1246 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1246 | 1247 |
| 1247 WebFilterOperations filters; | 1248 WebFilterOperations filters; |
| 1248 filters.append(WebFilterOperation::createBlurFilter(10)); | 1249 filters.append(WebFilterOperation::createBlurFilter(10)); |
| 1249 blurLayer->setFilters(filters); | 1250 blurLayer->setFilters(filters); |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 }; | 1861 }; |
| 1861 | 1862 |
| 1862 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); | 1863 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); |
| 1863 | 1864 |
| 1864 template<class Types> | 1865 template<class Types> |
| 1865 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { | 1866 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { |
| 1866 protected: | 1867 protected: |
| 1867 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty
pes>(opaqueLayers) {} | 1868 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty
pes>(opaqueLayers) {} |
| 1868 void runMyTest() | 1869 void runMyTest() |
| 1869 { | 1870 { |
| 1870 WebTransformationMatrix transform; | 1871 gfx::Transform transform; |
| 1871 transform.rotate3d(0, 30, 0); | 1872 MathUtil::rotateEulerAngles(&transform, 0, 30, 0); |
| 1872 | 1873 |
| 1873 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1874 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1874 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1875 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); | 1876 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); |
| 1876 this->calcDrawEtc(parent); | 1877 this->calcDrawEtc(parent); |
| 1877 | 1878 |
| 1878 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1879 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1879 this->enterLayer(layer, occlusion); | 1880 this->enterLayer(layer, occlusion); |
| 1880 | 1881 |
| 1881 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. | 1882 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. |
| 1882 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); | 1883 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); |
| 1883 } | 1884 } |
| 1884 }; | 1885 }; |
| 1885 | 1886 |
| 1886 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTest3dTransform); | 1887 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTest3dTransform); |
| 1887 | 1888 |
| 1888 template<class Types> | 1889 template<class Types> |
| 1889 class OcclusionTrackerTestUnsorted3dLayers : public OcclusionTrackerTest<Types>
{ | 1890 class OcclusionTrackerTestUnsorted3dLayers : public OcclusionTrackerTest<Types>
{ |
| 1890 protected: | 1891 protected: |
| 1891 OcclusionTrackerTestUnsorted3dLayers(bool opaqueLayers) : OcclusionTrackerTe
st<Types>(opaqueLayers) {} | 1892 OcclusionTrackerTestUnsorted3dLayers(bool opaqueLayers) : OcclusionTrackerTe
st<Types>(opaqueLayers) {} |
| 1892 void runMyTest() | 1893 void runMyTest() |
| 1893 { | 1894 { |
| 1894 // Currently, the main thread layer iterator does not iterate over 3d it
ems in | 1895 // Currently, the main thread layer iterator does not iterate over 3d it
ems in |
| 1895 // sorted order, because layer sorting is not performed on the main thre
ad. | 1896 // sorted order, because layer sorting is not performed on the main thre
ad. |
| 1896 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes | 1897 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes |
| 1897 // other layers that have not yet been iterated over. For now, the expec
ted | 1898 // other layers that have not yet been iterated over. For now, the expec
ted |
| 1898 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion | 1899 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion |
| 1899 // tracker. | 1900 // tracker. |
| 1900 | 1901 |
| 1901 WebTransformationMatrix translationToFront; | 1902 gfx::Transform translationToFront; |
| 1902 translationToFront.translate3d(0, 0, -10); | 1903 translationToFront.Translate3d(0, 0, -10); |
| 1903 WebTransformationMatrix translationToBack; | 1904 gfx::Transform translationToBack; |
| 1904 translationToFront.translate3d(0, 0, -100); | 1905 translationToFront.Translate3d(0, 0, -100); |
| 1905 | 1906 |
| 1906 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1907 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1907 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 1908 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 1908 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); | 1909 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); |
| 1909 parent->setPreserves3D(true); | 1910 parent->setPreserves3D(true); |
| 1910 | 1911 |
| 1911 this->calcDrawEtc(parent); | 1912 this->calcDrawEtc(parent); |
| 1912 | 1913 |
| 1913 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1914 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1914 this->visitLayer(child2, occlusion); | 1915 this->visitLayer(child2, occlusion); |
| 1915 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 1916 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
| 1916 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 1917 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
| 1917 | 1918 |
| 1918 this->visitLayer(child1, occlusion); | 1919 this->visitLayer(child1, occlusion); |
| 1919 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 1920 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
| 1920 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 1921 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
| 1921 } | 1922 } |
| 1922 }; | 1923 }; |
| 1923 | 1924 |
| 1924 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. | 1925 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. |
| 1925 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); | 1926 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); |
| 1926 | 1927 |
| 1927 template<class Types> | 1928 template<class Types> |
| 1928 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ
es> { | 1929 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ
es> { |
| 1929 protected: | 1930 protected: |
| 1930 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack
erTest<Types>(opaqueLayers) {} | 1931 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack
erTest<Types>(opaqueLayers) {} |
| 1931 void runMyTest() | 1932 void runMyTest() |
| 1932 { | 1933 { |
| 1933 WebTransformationMatrix transform; | 1934 gfx::Transform transform; |
| 1934 transform.translate(150, 150); | 1935 transform.Translate(150, 150); |
| 1935 transform.applyPerspective(400); | 1936 transform.ApplyPerspectiveDepth(400); |
| 1936 transform.rotate3d(1, 0, 0, -30); | 1937 MathUtil::rotateAxisAngle(&transform, 1, 0, 0, -30); |
| 1937 transform.translate(-150, -150); | 1938 transform.Translate(-150, -150); |
| 1938 | 1939 |
| 1939 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1940 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1940 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1941 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1941 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); | 1942 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); |
| 1942 container->setPreserves3D(true); | 1943 container->setPreserves3D(true); |
| 1943 layer->setPreserves3D(true); | 1944 layer->setPreserves3D(true); |
| 1944 this->calcDrawEtc(parent); | 1945 this->calcDrawEtc(parent); |
| 1945 | 1946 |
| 1946 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1947 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1947 this->enterLayer(layer, occlusion); | 1948 this->enterLayer(layer, occlusion); |
| 1948 | 1949 |
| 1949 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); | 1950 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); |
| 1950 } | 1951 } |
| 1951 }; | 1952 }; |
| 1952 | 1953 |
| 1953 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. | 1954 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. |
| 1954 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); | 1955 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); |
| 1955 | 1956 |
| 1956 template<class Types> | 1957 template<class Types> |
| 1957 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra
ckerTest<Types> { | 1958 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra
ckerTest<Types> { |
| 1958 protected: | 1959 protected: |
| 1959 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 1960 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
| 1960 void runMyTest() | 1961 void runMyTest() |
| 1961 { | 1962 { |
| 1962 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. | 1963 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. |
| 1963 WebTransformationMatrix transform; | 1964 gfx::Transform transform; |
| 1964 transform.translate(250, 50); | 1965 transform.Translate(250, 50); |
| 1965 transform.applyPerspective(10); | 1966 transform.ApplyPerspectiveDepth(10); |
| 1966 transform.translate(-250, -50); | 1967 transform.Translate(-250, -50); |
| 1967 transform.translate(250, 50); | 1968 transform.Translate(250, 50); |
| 1968 transform.rotate3d(1, 0, 0, -167); | 1969 MathUtil::rotateAxisAngle(&transform, 1, 0, 0, -167); |
| 1969 transform.translate(-250, -50); | 1970 transform.Translate(-250, -50); |
| 1970 | 1971 |
| 1971 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 100)); | 1972 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 100)); |
| 1972 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); | 1973 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); |
| 1973 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(0, 0), gfx::Size(500, 500), true); | 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
| 1974 container->setPreserves3D(true); | 1975 container->setPreserves3D(true); |
| 1975 layer->setPreserves3D(true); | 1976 layer->setPreserves3D(true); |
| 1976 this->calcDrawEtc(parent); | 1977 this->calcDrawEtc(parent); |
| 1977 | 1978 |
| 1978 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1979 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1979 this->enterLayer(layer, occlusion); | 1980 this->enterLayer(layer, occlusion); |
| 1980 | 1981 |
| 1981 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, | 1982 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, |
| 1982 // this will include many more pixels but must include at least the bott
om 11 rows. | 1983 // this will include many more pixels but must include at least the bott
om 11 rows. |
| 1983 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); | 1984 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); |
| 1984 } | 1985 } |
| 1985 }; | 1986 }; |
| 1986 | 1987 |
| 1987 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. | 1988 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. |
| 1988 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); | 1989 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); |
| 1989 | 1990 |
| 1990 template<class Types> | 1991 template<class Types> |
| 1991 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { | 1992 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { |
| 1992 protected: | 1993 protected: |
| 1993 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} | 1994 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} |
| 1994 void runMyTest() | 1995 void runMyTest() |
| 1995 { | 1996 { |
| 1996 WebTransformationMatrix transform; | 1997 gfx::Transform transform; |
| 1997 transform.translate(50, 50); | 1998 transform.Translate(50, 50); |
| 1998 transform.applyPerspective(100); | 1999 transform.ApplyPerspectiveDepth(100); |
| 1999 transform.translate3d(0, 0, 110); | 2000 transform.Translate3d(0, 0, 110); |
| 2000 transform.translate(-50, -50); | 2001 transform.Translate(-50, -50); |
| 2001 | 2002 |
| 2002 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 2003 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 2003 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2004 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 2004 parent->setPreserves3D(true); | 2005 parent->setPreserves3D(true); |
| 2005 layer->setPreserves3D(true); | 2006 layer->setPreserves3D(true); |
| 2006 this->calcDrawEtc(parent); | 2007 this->calcDrawEtc(parent); |
| 2007 | 2008 |
| 2008 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2009 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2009 | 2010 |
| 2010 // The |layer| is entirely behind the camera and should not occlude. | 2011 // The |layer| is entirely behind the camera and should not occlude. |
| 2011 this->visitLayer(layer, occlusion); | 2012 this->visitLayer(layer, occlusion); |
| 2012 this->enterLayer(parent, occlusion); | 2013 this->enterLayer(parent, occlusion); |
| 2013 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); | 2014 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
| 2014 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); | 2015 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
| 2015 } | 2016 } |
| 2016 }; | 2017 }; |
| 2017 | 2018 |
| 2018 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. | 2019 // This test requires accumulating occlusion of 3d layers, which are skipped by
the occlusion tracker on the main thread. So this test should run on the impl th
read. |
| 2019 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); | 2020 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); |
| 2020 | 2021 |
| 2021 template<class Types> | 2022 template<class Types> |
| 2022 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { | 2023 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { |
| 2023 protected: | 2024 protected: |
| 2024 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 2025 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
| 2025 void runMyTest() | 2026 void runMyTest() |
| 2026 { | 2027 { |
| 2027 WebTransformationMatrix transform; | 2028 gfx::Transform transform; |
| 2028 transform.translate(50, 50); | 2029 transform.Translate(50, 50); |
| 2029 transform.applyPerspective(100); | 2030 transform.ApplyPerspectiveDepth(100); |
| 2030 transform.translate3d(0, 0, 99); | 2031 transform.Translate3d(0, 0, 99); |
| 2031 transform.translate(-50, -50); | 2032 transform.Translate(-50, -50); |
| 2032 | 2033 |
| 2033 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 2034 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 2034 parent->setMasksToBounds(true); | 2035 parent->setMasksToBounds(true); |
| 2035 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2036 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 2036 parent->setPreserves3D(true); | 2037 parent->setPreserves3D(true); |
| 2037 layer->setPreserves3D(true); | 2038 layer->setPreserves3D(true); |
| 2038 this->calcDrawEtc(parent); | 2039 this->calcDrawEtc(parent); |
| 2039 | 2040 |
| 2040 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2041 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2041 | 2042 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2242 }; | 2243 }; |
| 2243 | 2244 |
| 2244 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationTranslateOnMainThread); | 2245 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationTranslateOnMainThread); |
| 2245 | 2246 |
| 2246 template<class Types> | 2247 template<class Types> |
| 2247 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT
rackerTest<Types> { | 2248 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT
rackerTest<Types> { |
| 2248 protected: | 2249 protected: |
| 2249 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) :
OcclusionTrackerTest<Types>(opaqueLayers) {} | 2250 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) :
OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2250 void runMyTest() | 2251 void runMyTest() |
| 2251 { | 2252 { |
| 2252 WebTransformationMatrix surfaceTransform; | 2253 gfx::Transform surfaceTransform; |
| 2253 surfaceTransform.translate(300, 300); | 2254 surfaceTransform.Translate(300, 300); |
| 2254 surfaceTransform.scale(2); | 2255 surfaceTransform.Scale(2, 2); |
| 2255 surfaceTransform.translate(-150, -150); | 2256 surfaceTransform.Translate(-150, -150); |
| 2256 | 2257 |
| 2257 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); | 2258 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); |
| 2258 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2259 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 2259 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(300, 300), false); | 2260 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(300, 300), false); |
| 2260 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2261 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
| 2261 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2262 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
| 2262 this->calcDrawEtc(parent); | 2263 this->calcDrawEtc(parent); |
| 2263 | 2264 |
| 2264 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2265 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2265 | 2266 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 }; | 2557 }; |
| 2557 | 2558 |
| 2558 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface); | 2559 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface); |
| 2559 | 2560 |
| 2560 template<class Types> | 2561 template<class Types> |
| 2561 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public Oc
clusionTrackerTest<Types> { | 2562 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public Oc
clusionTrackerTest<Types> { |
| 2562 protected: | 2563 protected: |
| 2563 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa
yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2564 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa
yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2564 void runMyTest() | 2565 void runMyTest() |
| 2565 { | 2566 { |
| 2566 WebTransformationMatrix scaleByHalf; | 2567 gfx::Transform scaleByHalf; |
| 2567 scaleByHalf.scale(0.5); | 2568 scaleByHalf.Scale(0.5, 0.5); |
| 2568 | 2569 |
| 2569 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2570 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
| 2570 // 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 | 2571 // 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 |
| 2571 // appears at 50, 50 and the replica at 200, 50. | 2572 // appears at 50, 50 and the replica at 200, 50. |
| 2572 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2573 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2573 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2574 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2574 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2575 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2575 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); | 2576 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
| 2576 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); | 2577 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
| 2577 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); | 2578 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2687 }; | 2688 }; |
| 2688 | 2689 |
| 2689 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilter); | 2690 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilter); |
| 2690 | 2691 |
| 2691 template<class Types> | 2692 template<class Types> |
| 2692 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl
usionTrackerTest<Types> { | 2693 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl
usionTrackerTest<Types> { |
| 2693 protected: | 2694 protected: |
| 2694 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2695 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2695 void runMyTest() | 2696 void runMyTest() |
| 2696 { | 2697 { |
| 2697 WebTransformationMatrix scaleByHalf; | 2698 gfx::Transform scaleByHalf; |
| 2698 scaleByHalf.scale(0.5); | 2699 scaleByHalf.Scale(0.5, 0.5); |
| 2699 | 2700 |
| 2700 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2701 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
| 2701 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); | 2702 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); |
| 2702 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); | 2703 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); |
| 2703 parent->setMasksToBounds(true); | 2704 parent->setMasksToBounds(true); |
| 2704 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2705 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 2705 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2706 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 2706 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); | 2707 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); |
| 2707 | 2708 |
| 2708 // Filters make the layers own surfaces. | 2709 // Filters make the layers own surfaces. |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2872 }; | 2873 }; |
| 2873 | 2874 |
| 2874 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilterWithClip); | 2875 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilterWithClip); |
| 2875 | 2876 |
| 2876 template<class Types> | 2877 template<class Types> |
| 2877 class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public Occl
usionTrackerTest<Types> { | 2878 class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public Occl
usionTrackerTest<Types> { |
| 2878 protected: | 2879 protected: |
| 2879 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2880 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2880 void runMyTest() | 2881 void runMyTest() |
| 2881 { | 2882 { |
| 2882 WebTransformationMatrix scaleByHalf; | 2883 gfx::Transform scaleByHalf; |
| 2883 scaleByHalf.scale(0.5); | 2884 scaleByHalf.Scale(0.5, 0.5); |
| 2884 | 2885 |
| 2885 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. | 2886 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. |
| 2886 // 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 | 2887 // 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 |
| 2887 // appears at 50, 50 and the replica at 200, 50. | 2888 // appears at 50, 50 and the replica at 200, 50. |
| 2888 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2889 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2889 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); | 2890 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); |
| 2890 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); | 2891 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); |
| 2891 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2892 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2892 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2893 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2893 | 2894 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2920 }; | 2921 }; |
| 2921 | 2922 |
| 2922 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground
Filter); | 2923 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground
Filter); |
| 2923 | 2924 |
| 2924 template<class Types> | 2925 template<class Types> |
| 2925 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ
ic OcclusionTrackerTest<Types> { | 2926 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ
ic OcclusionTrackerTest<Types> { |
| 2926 protected: | 2927 protected: |
| 2927 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2928 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2928 void runMyTest() | 2929 void runMyTest() |
| 2929 { | 2930 { |
| 2930 WebTransformationMatrix scaleByHalf; | 2931 gfx::Transform scaleByHalf; |
| 2931 scaleByHalf.scale(0.5); | 2932 scaleByHalf.Scale(0.5, 0.5); |
| 2932 | 2933 |
| 2933 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. | 2934 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. |
| 2934 // 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 | 2935 // 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 |
| 2935 // appears at 50, 50 and the replica at 200, 50. | 2936 // appears at 50, 50 and the replica at 200, 50. |
| 2936 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2937 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2937 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2938 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2938 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2939 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2939 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); | 2940 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); |
| 2940 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); | 2941 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); |
| 2941 | 2942 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2967 }; | 2968 }; |
| 2968 | 2969 |
| 2969 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil
terIsOccluded); | 2970 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil
terIsOccluded); |
| 2970 | 2971 |
| 2971 template<class Types> | 2972 template<class Types> |
| 2972 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
: public OcclusionTrackerTest<Types> { | 2973 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
: public OcclusionTrackerTest<Types> { |
| 2973 protected: | 2974 protected: |
| 2974 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2975 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2975 void runMyTest() | 2976 void runMyTest() |
| 2976 { | 2977 { |
| 2977 WebTransformationMatrix scaleByHalf; | 2978 gfx::Transform scaleByHalf; |
| 2978 scaleByHalf.scale(0.5); | 2979 scaleByHalf.Scale(0.5, 0.5); |
| 2979 | 2980 |
| 2980 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. | 2981 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. |
| 2981 // 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 | 2982 // 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 |
| 2982 // appears at 50, 50 and the replica at 200, 50. | 2983 // appears at 50, 50 and the replica at 200, 50. |
| 2983 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2984 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2984 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2985 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2985 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2986 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2986 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); | 2987 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); |
| 2987 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); | 2988 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); |
| 2988 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); | 2989 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 | 3073 |
| 3073 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInScreenSpace().ToString()); | 3074 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInScreenSpace().ToString()); |
| 3074 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInTargetSurface().ToString()); | 3075 EXPECT_EQ(gfx::Rect(gfx::Point(), trackingSize).ToString(), occlusion.oc
clusionInTargetSurface().ToString()); |
| 3075 } | 3076 } |
| 3076 }; | 3077 }; |
| 3077 | 3078 |
| 3078 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 3079 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
| 3079 | 3080 |
| 3080 } // namespace | 3081 } // namespace |
| 3081 } // namespace cc | 3082 } // namespace cc |
| OLD | NEW |