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