OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/occlusion_tracker.h" | 7 #include "cc/occlusion_tracker.h" |
8 | 8 |
9 #include "Region.h" | 9 #include "Region.h" |
10 #include "cc/layer.h" | 10 #include "cc/layer.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 TestContentLayer() | 34 TestContentLayer() |
35 : Layer() | 35 : Layer() |
36 , m_overrideOpaqueContentsRect(false) | 36 , m_overrideOpaqueContentsRect(false) |
37 { | 37 { |
38 } | 38 } |
39 | 39 |
40 virtual bool drawsContent() const OVERRIDE { return true; } | 40 virtual bool drawsContent() const OVERRIDE { return true; } |
41 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 41 virtual Region visibleContentOpaqueRegion() const OVERRIDE |
42 { | 42 { |
43 if (m_overrideOpaqueContentsRect) | 43 if (m_overrideOpaqueContentsRect) |
44 return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visible
ContentRect())); | 44 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect(
)); |
45 return Layer::visibleContentOpaqueRegion(); | 45 return Layer::visibleContentOpaqueRegion(); |
46 } | 46 } |
47 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) | 47 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) |
48 { | 48 { |
49 m_overrideOpaqueContentsRect = true; | 49 m_overrideOpaqueContentsRect = true; |
50 m_opaqueContentsRect = opaqueContentsRect; | 50 m_opaqueContentsRect = opaqueContentsRect; |
51 } | 51 } |
52 | 52 |
53 private: | 53 private: |
54 virtual ~TestContentLayer() | 54 virtual ~TestContentLayer() |
55 { | 55 { |
56 } | 56 } |
57 | 57 |
58 bool m_overrideOpaqueContentsRect; | 58 bool m_overrideOpaqueContentsRect; |
59 gfx::Rect m_opaqueContentsRect; | 59 gfx::Rect m_opaqueContentsRect; |
60 }; | 60 }; |
61 | 61 |
62 class TestContentLayerImpl : public LayerImpl { | 62 class TestContentLayerImpl : public LayerImpl { |
63 public: | 63 public: |
64 TestContentLayerImpl(int id) | 64 TestContentLayerImpl(int id) |
65 : LayerImpl(id) | 65 : LayerImpl(id) |
66 , m_overrideOpaqueContentsRect(false) | 66 , m_overrideOpaqueContentsRect(false) |
67 { | 67 { |
68 setDrawsContent(true); | 68 setDrawsContent(true); |
69 } | 69 } |
70 | 70 |
71 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 71 virtual Region visibleContentOpaqueRegion() const OVERRIDE |
72 { | 72 { |
73 if (m_overrideOpaqueContentsRect) | 73 if (m_overrideOpaqueContentsRect) |
74 return cc::IntRect(gfx::IntersectRects(m_opaqueContentsRect, visible
ContentRect())); | 74 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect(
)); |
75 return LayerImpl::visibleContentOpaqueRegion(); | 75 return LayerImpl::visibleContentOpaqueRegion(); |
76 } | 76 } |
77 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) | 77 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) |
78 { | 78 { |
79 m_overrideOpaqueContentsRect = true; | 79 m_overrideOpaqueContentsRect = true; |
80 m_opaqueContentsRect = opaqueContentsRect; | 80 m_opaqueContentsRect = opaqueContentsRect; |
81 } | 81 } |
82 | 82 |
83 private: | 83 private: |
84 bool m_overrideOpaqueContentsRect; | 84 bool m_overrideOpaqueContentsRect; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 virtual void TearDown() | 193 virtual void TearDown() |
194 { | 194 { |
195 Types::destroyLayer(m_root); | 195 Types::destroyLayer(m_root); |
196 m_renderSurfaceLayerList.clear(); | 196 m_renderSurfaceLayerList.clear(); |
197 m_renderSurfaceLayerListImpl.clear(); | 197 m_renderSurfaceLayerListImpl.clear(); |
198 m_replicaLayers.clear(); | 198 m_replicaLayers.clear(); |
199 m_maskLayers.clear(); | 199 m_maskLayers.clear(); |
200 LayerTreeHost::setNeedsFilterContext(false); | 200 LayerTreeHost::setNeedsFilterContext(false); |
201 } | 201 } |
202 | 202 |
203 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix&
transform, const FloatPoint& position, const gfx::Size& bounds) | 203 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix&
transform, const gfx::PointF& position, const gfx::Size& bounds) |
204 { | 204 { |
205 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 205 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
206 typename Types::ContentLayerType* layerPtr = layer.get(); | 206 typename Types::ContentLayerType* layerPtr = layer.get(); |
207 setProperties(layerPtr, transform, position, bounds); | 207 setProperties(layerPtr, transform, position, bounds); |
208 | 208 |
209 DCHECK(!m_root); | 209 DCHECK(!m_root); |
210 m_root = Types::passLayerPtr(layer); | 210 m_root = Types::passLayerPtr(layer); |
211 return layerPtr; | 211 return layerPtr; |
212 } | 212 } |
213 | 213 |
214 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst WebTransformationMatrix& transform, const FloatPoint& position, const gfx::S
ize& bounds) | 214 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst WebTransformationMatrix& transform, const gfx::PointF& position, const gfx::
Size& bounds) |
215 { | 215 { |
216 typename Types::LayerPtrType layer(Types::createLayer()); | 216 typename Types::LayerPtrType layer(Types::createLayer()); |
217 typename Types::LayerType* layerPtr = layer.get(); | 217 typename Types::LayerType* layerPtr = layer.get(); |
218 setProperties(layerPtr, transform, position, bounds); | 218 setProperties(layerPtr, transform, position, bounds); |
219 parent->addChild(Types::passLayerPtr(layer)); | 219 parent->addChild(Types::passLayerPtr(layer)); |
220 return layerPtr; | 220 return layerPtr; |
221 } | 221 } |
222 | 222 |
223 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const WebTransformationMatrix& transform, const FloatPoint& position, const gfx:
:Size& bounds) | 223 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const WebTransformationMatrix& transform, const gfx::PointF& position, const gfx
::Size& bounds) |
224 { | 224 { |
225 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); | 225 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); |
226 WebFilterOperations filters; | 226 WebFilterOperations filters; |
227 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 227 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
228 layer->setFilters(filters); | 228 layer->setFilters(filters); |
229 return layer; | 229 return layer; |
230 } | 230 } |
231 | 231 |
232 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const WebTransformationMatrix& transform, const FloatPoint& position
, const gfx::Size& bounds, bool opaque) | 232 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const WebTransformationMatrix& transform, const gfx::PointF& positio
n, const gfx::Size& bounds, bool opaque) |
233 { | 233 { |
234 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 234 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
235 typename Types::ContentLayerType* layerPtr = layer.get(); | 235 typename Types::ContentLayerType* layerPtr = layer.get(); |
236 setProperties(layerPtr, transform, position, bounds); | 236 setProperties(layerPtr, transform, position, bounds); |
237 | 237 |
238 if (m_opaqueLayers) | 238 if (m_opaqueLayers) |
239 layerPtr->setContentsOpaque(opaque); | 239 layerPtr->setContentsOpaque(opaque); |
240 else { | 240 else { |
241 layerPtr->setContentsOpaque(false); | 241 layerPtr->setContentsOpaque(false); |
242 if (opaque) | 242 if (opaque) |
243 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; | 243 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; |
244 else | 244 else |
245 layerPtr->setOpaqueContentsRect(gfx::Rect()); | 245 layerPtr->setOpaqueContentsRect(gfx::Rect()); |
246 } | 246 } |
247 | 247 |
248 parent->addChild(Types::passLayerPtr(layer)); | 248 parent->addChild(Types::passLayerPtr(layer)); |
249 return layerPtr; | 249 return layerPtr; |
250 } | 250 } |
251 | 251 |
252 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const WebTransformationMatrix& transform, const FloatPoint& position,
const gfx::Size& bounds) | 252 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const WebTransformationMatrix& transform, const gfx::PointF& position,
const gfx::Size& bounds) |
253 { | 253 { |
254 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 254 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
255 typename Types::ContentLayerType* layerPtr = layer.get(); | 255 typename Types::ContentLayerType* layerPtr = layer.get(); |
256 setProperties(layerPtr, transform, position, bounds); | 256 setProperties(layerPtr, transform, position, bounds); |
257 setReplica(owningLayer, Types::passLayerPtr(layer)); | 257 setReplica(owningLayer, Types::passLayerPtr(layer)); |
258 return layerPtr; | 258 return layerPtr; |
259 } | 259 } |
260 | 260 |
261 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) |
262 { | 262 { |
263 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 263 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
264 typename Types::ContentLayerType* layerPtr = layer.get(); | 264 typename Types::ContentLayerType* layerPtr = layer.get(); |
265 setProperties(layerPtr, identityMatrix, FloatPoint(), bounds); | 265 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); |
266 setMask(owningLayer, Types::passLayerPtr(layer)); | 266 setMask(owningLayer, Types::passLayerPtr(layer)); |
267 return layerPtr; | 267 return layerPtr; |
268 } | 268 } |
269 | 269 |
270 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const WebTransformationMatrix& transform, const FloatPoint& positi
on, const gfx::Size& bounds, bool opaque) | 270 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const WebTransformationMatrix& transform, const gfx::PointF& posit
ion, const gfx::Size& bounds, bool opaque) |
271 { | 271 { |
272 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); | 272 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); |
273 WebFilterOperations filters; | 273 WebFilterOperations filters; |
274 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 274 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
275 layer->setFilters(filters); | 275 layer->setFilters(filters); |
276 return layer; | 276 return layer; |
277 } | 277 } |
278 | 278 |
279 void calcDrawEtc(TestContentLayerImpl* root) | 279 void calcDrawEtc(TestContentLayerImpl* root) |
280 { | 280 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 } | 348 } |
349 | 349 |
350 void resetLayerIterator() | 350 void resetLayerIterator() |
351 { | 351 { |
352 m_layerIterator = m_layerIteratorBegin; | 352 m_layerIterator = m_layerIteratorBegin; |
353 } | 353 } |
354 | 354 |
355 const WebTransformationMatrix identityMatrix; | 355 const WebTransformationMatrix identityMatrix; |
356 | 356 |
357 private: | 357 private: |
358 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma
tionMatrix& transform, const FloatPoint& position, const gfx::Size& bounds) | 358 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma
tionMatrix& transform, const gfx::PointF& position, const gfx::Size& bounds) |
359 { | 359 { |
360 layer->setTransform(transform); | 360 layer->setTransform(transform); |
361 layer->setSublayerTransform(WebTransformationMatrix()); | 361 layer->setSublayerTransform(WebTransformationMatrix()); |
362 layer->setAnchorPoint(FloatPoint(0, 0)); | 362 layer->setAnchorPoint(gfx::PointF(0, 0)); |
363 layer->setPosition(position); | 363 layer->setPosition(position); |
364 layer->setBounds(bounds); | 364 layer->setBounds(bounds); |
365 } | 365 } |
366 | 366 |
367 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c
onst FloatPoint& position, const gfx::Size& bounds) | 367 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c
onst gfx::PointF& position, const gfx::Size& bounds) |
368 { | 368 { |
369 setBaseProperties(layer, transform, position, bounds); | 369 setBaseProperties(layer, transform, position, bounds); |
370 } | 370 } |
371 | 371 |
372 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor
m, const FloatPoint& position, const gfx::Size& bounds) | 372 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor
m, const gfx::PointF& position, const gfx::Size& bounds) |
373 { | 373 { |
374 setBaseProperties(layer, transform, position, bounds); | 374 setBaseProperties(layer, transform, position, bounds); |
375 | 375 |
376 layer->setContentBounds(layer->bounds()); | 376 layer->setContentBounds(layer->bounds()); |
377 } | 377 } |
378 | 378 |
379 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) | 379 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) |
380 { | 380 { |
381 owningLayer->setReplicaLayer(layer.get()); | 381 owningLayer->setReplicaLayer(layer.get()); |
382 m_replicaLayers.push_back(layer); | 382 m_replicaLayers.push_back(layer); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 452 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
453 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) | 453 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) |
454 | 454 |
455 template<class Types> | 455 template<class Types> |
456 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types
> { | 456 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types
> { |
457 protected: | 457 protected: |
458 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 458 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
459 | 459 |
460 void runMyTest() | 460 void runMyTest() |
461 { | 461 { |
462 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 462 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
463 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), gfx::Size(500, 500), true); | 463 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
464 this->calcDrawEtc(parent); | 464 this->calcDrawEtc(parent); |
465 | 465 |
466 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 466 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
467 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 467 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
468 | 468 |
469 this->visitLayer(layer, occlusion); | 469 this->visitLayer(layer, occlusion); |
470 this->enterLayer(parent, occlusion); | 470 this->enterLayer(parent, occlusion); |
471 | 471 |
472 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 472 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
473 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 473 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 30 matching lines...) Expand all Loading... |
504 | 504 |
505 template<class Types> | 505 template<class Types> |
506 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { | 506 class OcclusionTrackerTestQuadsMismatchLayer : public OcclusionTrackerTest<Types
> { |
507 protected: | 507 protected: |
508 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 508 OcclusionTrackerTestQuadsMismatchLayer(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
509 void runMyTest() | 509 void runMyTest() |
510 { | 510 { |
511 WebTransformationMatrix layerTransform; | 511 WebTransformationMatrix layerTransform; |
512 layerTransform.translate(10, 10); | 512 layerTransform.translate(10, 10); |
513 | 513 |
514 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 514 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::Point(0, 0), gfx::Size(100, 100)); |
515 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, FloatPoint(0, 0), IntSize(90, 90), true); | 515 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layerTransform, gfx::PointF(0, 0), gfx::Size(90, 90), true); |
516 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, FloatPoint(0, 0), IntSize(50, 50), true); | 516 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layerTransform, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
517 this->calcDrawEtc(parent); | 517 this->calcDrawEtc(parent); |
518 | 518 |
519 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 519 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
520 | 520 |
521 this->visitLayer(layer2, occlusion); | 521 this->visitLayer(layer2, occlusion); |
522 this->enterLayer(layer1, occlusion); | 522 this->enterLayer(layer1, occlusion); |
523 | 523 |
524 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 524 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
525 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 525 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
526 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 526 EXPECT_RECT_EQ(gfx::Rect(20, 20, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
(...skipping 21 matching lines...) Expand all Loading... |
548 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { | 548 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types> { |
549 protected: | 549 protected: |
550 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} | 550 OcclusionTrackerTestRotatedChild(bool opaqueLayers) : OcclusionTrackerTest<T
ypes>(opaqueLayers) {} |
551 void runMyTest() | 551 void runMyTest() |
552 { | 552 { |
553 WebTransformationMatrix layerTransform; | 553 WebTransformationMatrix layerTransform; |
554 layerTransform.translate(250, 250); | 554 layerTransform.translate(250, 250); |
555 layerTransform.rotate(90); | 555 layerTransform.rotate(90); |
556 layerTransform.translate(-250, -250); | 556 layerTransform.translate(-250, -250); |
557 | 557 |
558 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 558 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
559 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true); | 559 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
560 this->calcDrawEtc(parent); | 560 this->calcDrawEtc(parent); |
561 | 561 |
562 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 562 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
563 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 563 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
564 | 564 |
565 this->visitLayer(layer, occlusion); | 565 this->visitLayer(layer, occlusion); |
566 this->enterLayer(parent, occlusion); | 566 this->enterLayer(parent, occlusion); |
567 | 567 |
568 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 568 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
569 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 569 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 30 matching lines...) Expand all Loading... |
600 | 600 |
601 template<class Types> | 601 template<class Types> |
602 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { | 602 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types> { |
603 protected: | 603 protected: |
604 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 604 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
605 void runMyTest() | 605 void runMyTest() |
606 { | 606 { |
607 WebTransformationMatrix layerTransform; | 607 WebTransformationMatrix layerTransform; |
608 layerTransform.translate(20, 20); | 608 layerTransform.translate(20, 20); |
609 | 609 |
610 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 610 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
611 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true); | 611 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
612 this->calcDrawEtc(parent); | 612 this->calcDrawEtc(parent); |
613 | 613 |
614 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 614 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
615 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 615 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
616 | 616 |
617 this->visitLayer(layer, occlusion); | 617 this->visitLayer(layer, occlusion); |
618 this->enterLayer(parent, occlusion); | 618 this->enterLayer(parent, occlusion); |
619 | 619 |
620 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 620 EXPECT_RECT_EQ(gfx::Rect(50, 50, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
621 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 621 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { | 666 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s> { |
667 protected: | 667 protected: |
668 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 668 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
669 void runMyTest() | 669 void runMyTest() |
670 { | 670 { |
671 WebTransformationMatrix childTransform; | 671 WebTransformationMatrix childTransform; |
672 childTransform.translate(250, 250); | 672 childTransform.translate(250, 250); |
673 childTransform.rotate(90); | 673 childTransform.rotate(90); |
674 childTransform.translate(-250, -250); | 674 childTransform.translate(-250, -250); |
675 | 675 |
676 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 676 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
677 parent->setMasksToBounds(true); | 677 parent->setMasksToBounds(true); |
678 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), gfx::Size(500, 500)); | 678 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
679 child->setMasksToBounds(true); | 679 child->setMasksToBounds(true); |
680 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true); | 680 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
681 this->calcDrawEtc(parent); | 681 this->calcDrawEtc(parent); |
682 | 682 |
683 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 683 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
684 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 684 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
685 | 685 |
686 this->visitLayer(layer, occlusion); | 686 this->visitLayer(layer, occlusion); |
687 this->enterContributingSurface(child, occlusion); | 687 this->enterContributingSurface(child, occlusion); |
688 | 688 |
689 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 689 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
690 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 690 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 743 |
744 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild); | 744 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild); |
745 | 745 |
746 template<class Types> | 746 template<class Types> |
747 class OcclusionTrackerTestScaledRenderSurface : public OcclusionTrackerTest<Type
s> { | 747 class OcclusionTrackerTestScaledRenderSurface : public OcclusionTrackerTest<Type
s> { |
748 protected: | 748 protected: |
749 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 749 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
750 | 750 |
751 void runMyTest() | 751 void runMyTest() |
752 { | 752 { |
753 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(200, 200)); | 753 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
754 | 754 |
755 WebTransformationMatrix layer1Matrix; | 755 WebTransformationMatrix layer1Matrix; |
756 layer1Matrix.scale(2); | 756 layer1Matrix.scale(2); |
757 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, FloatPoint(0, 0), IntSize(100, 100), true); | 757 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
758 layer1->setForceRenderSurface(true); | 758 layer1->setForceRenderSurface(true); |
759 | 759 |
760 WebTransformationMatrix layer2Matrix; | 760 WebTransformationMatrix layer2Matrix; |
761 layer2Matrix.translate(25, 25); | 761 layer2Matrix.translate(25, 25); |
762 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, FloatPoint(0, 0), IntSize(50, 50), true); | 762 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
763 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 100), IntSize(500, 500), true); | 763 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); |
764 this->calcDrawEtc(parent); | 764 this->calcDrawEtc(parent); |
765 | 765 |
766 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 766 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
767 | 767 |
768 this->visitLayer(occluder, occlusion); | 768 this->visitLayer(occluder, occlusion); |
769 this->enterLayer(layer2, occlusion); | 769 this->enterLayer(layer2, occlusion); |
770 | 770 |
771 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScree
nSpace().bounds()); | 771 EXPECT_RECT_EQ(gfx::Rect(100, 100, 100, 100), occlusion.occlusionInScree
nSpace().bounds()); |
772 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 772 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
773 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 773 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
774 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 774 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
775 | 775 |
776 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); | 776 EXPECT_RECT_EQ(gfx::Rect(0, 0, 25, 25), occlusion.unoccludedLayerContent
Rect(layer2, gfx::Rect(0, 0, 25, 25))); |
777 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); | 777 EXPECT_RECT_EQ(gfx::Rect(10, 25, 15, 25), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(10, 25, 25, 25))); |
778 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); | 778 EXPECT_RECT_EQ(gfx::Rect(25, 10, 25, 15), occlusion.unoccludedLayerConte
ntRect(layer2, gfx::Rect(25, 10, 25, 25))); |
779 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); | 779 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer2, gfx::Rect(25, 2
5, 25, 25)).IsEmpty()); |
780 } | 780 } |
781 }; | 781 }; |
782 | 782 |
783 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); | 783 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestScaledRenderSurface); |
784 | 784 |
785 template<class Types> | 785 template<class Types> |
786 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type
s> { | 786 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type
s> { |
787 protected: | 787 protected: |
788 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 788 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
789 void runMyTest() | 789 void runMyTest() |
790 { | 790 { |
791 WebTransformationMatrix childTransform; | 791 WebTransformationMatrix childTransform; |
792 childTransform.translate(250, 250); | 792 childTransform.translate(250, 250); |
793 childTransform.rotate(90); | 793 childTransform.rotate(90); |
794 childTransform.translate(-250, -250); | 794 childTransform.translate(-250, -250); |
795 | 795 |
796 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 796 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
797 parent->setMasksToBounds(true); | 797 parent->setMasksToBounds(true); |
798 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), gfx::Size(500, 500)); | 798 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
799 child->setMasksToBounds(true); | 799 child->setMasksToBounds(true); |
800 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true); | 800 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
801 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in | 801 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in |
802 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 802 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
803 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, FloatPoint(30, 30), gfx::Size(60, 20), true); | 803 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); |
804 this->calcDrawEtc(parent); | 804 this->calcDrawEtc(parent); |
805 | 805 |
806 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 806 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
807 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); | 807 occlusion.setLayerClipRect(gfx::Rect(-10, -10, 1000, 1000)); |
808 | 808 |
809 this->visitLayer(child2, occlusion); | 809 this->visitLayer(child2, occlusion); |
810 | 810 |
811 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa
ce().bounds()); | 811 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInScreenSpa
ce().bounds()); |
812 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 812 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur
face().bounds()); | 813 EXPECT_RECT_EQ(gfx::Rect(30, 30, 60, 20), occlusion.occlusionInTargetSur
face().bounds()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 void runMyTest() | 902 void runMyTest() |
903 { | 903 { |
904 WebTransformationMatrix childTransform; | 904 WebTransformationMatrix childTransform; |
905 childTransform.translate(250, 250); | 905 childTransform.translate(250, 250); |
906 childTransform.rotate(95); | 906 childTransform.rotate(95); |
907 childTransform.translate(-250, -250); | 907 childTransform.translate(-250, -250); |
908 | 908 |
909 WebTransformationMatrix layerTransform; | 909 WebTransformationMatrix layerTransform; |
910 layerTransform.translate(10, 10); | 910 layerTransform.translate(10, 10); |
911 | 911 |
912 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 912 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
913 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), gfx::Size(500, 500)); | 913 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
914 child->setMasksToBounds(true); | 914 child->setMasksToBounds(true); |
915 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, FloatPoint(0, 0), gfx::Size(500, 500), true); | 915 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
916 this->calcDrawEtc(parent); | 916 this->calcDrawEtc(parent); |
917 | 917 |
918 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 918 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
919 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 919 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
920 | 920 |
921 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 921 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); |
922 | 922 |
923 this->visitLayer(layer, occlusion); | 923 this->visitLayer(layer, occlusion); |
924 this->enterContributingSurface(child, occlusion); | 924 this->enterContributingSurface(child, occlusion); |
925 | 925 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { | 966 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types> { |
967 protected: | 967 protected: |
968 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 968 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
969 void runMyTest() | 969 void runMyTest() |
970 { | 970 { |
971 WebTransformationMatrix childTransform; | 971 WebTransformationMatrix childTransform; |
972 childTransform.translate(250, 250); | 972 childTransform.translate(250, 250); |
973 childTransform.rotate(90); | 973 childTransform.rotate(90); |
974 childTransform.translate(-250, -250); | 974 childTransform.translate(-250, -250); |
975 | 975 |
976 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 976 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
977 parent->setMasksToBounds(true); | 977 parent->setMasksToBounds(true); |
978 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), gfx::Size(500, 500)); | 978 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
979 child->setMasksToBounds(true); | 979 child->setMasksToBounds(true); |
980 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 10), gfx::Size(500, 500), true); | 980 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
981 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 450), gfx::Size(500, 60), true); | 981 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); |
982 this->calcDrawEtc(parent); | 982 this->calcDrawEtc(parent); |
983 | 983 |
984 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 984 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
985 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 985 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
986 | 986 |
987 this->visitLayer(layer2, occlusion); | 987 this->visitLayer(layer2, occlusion); |
988 this->visitLayer(layer1, occlusion); | 988 this->visitLayer(layer1, occlusion); |
989 this->enterContributingSurface(child, occlusion); | 989 this->enterContributingSurface(child, occlusion); |
990 | 990 |
991 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); | 991 EXPECT_RECT_EQ(gfx::Rect(30, 40, 70, 60), occlusion.occlusionInScreenSpa
ce().bounds()); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe
st<Types> { | 1056 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe
st<Types> { |
1057 protected: | 1057 protected: |
1058 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} | 1058 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} |
1059 void runMyTest() | 1059 void runMyTest() |
1060 { | 1060 { |
1061 WebTransformationMatrix childTransform; | 1061 WebTransformationMatrix childTransform; |
1062 childTransform.translate(250, 250); | 1062 childTransform.translate(250, 250); |
1063 childTransform.rotate(90); | 1063 childTransform.rotate(90); |
1064 childTransform.translate(-250, -250); | 1064 childTransform.translate(-250, -250); |
1065 | 1065 |
1066 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 1066 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
1067 parent->setMasksToBounds(true); | 1067 parent->setMasksToBounds(true); |
1068 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, FloatPoint(30, 30), gfx::Size(10, 10)); | 1068 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, gfx::PointF(30, 30), gfx::Size(10, 10)); |
1069 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, FloatPoint(20, 40), gfx::Size(10, 10)); | 1069 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, gfx::PointF(20, 40), gfx::Size(10, 10)); |
1070 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true); | 1070 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1071 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true); | 1071 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1072 this->calcDrawEtc(parent); | 1072 this->calcDrawEtc(parent); |
1073 | 1073 |
1074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1074 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1075 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); | 1075 occlusion.setLayerClipRect(gfx::Rect(-20, -20, 1000, 1000)); |
1076 | 1076 |
1077 this->visitLayer(layer2, occlusion); | 1077 this->visitLayer(layer2, occlusion); |
1078 this->enterContributingSurface(child2, occlusion); | 1078 this->enterContributingSurface(child2, occlusion); |
1079 | 1079 |
1080 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1080 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1081 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1081 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 WebTransformationMatrix child1Transform; | 1172 WebTransformationMatrix child1Transform; |
1173 child1Transform.translate(250, 250); | 1173 child1Transform.translate(250, 250); |
1174 child1Transform.rotate(-90); | 1174 child1Transform.rotate(-90); |
1175 child1Transform.translate(-250, -250); | 1175 child1Transform.translate(-250, -250); |
1176 | 1176 |
1177 WebTransformationMatrix child2Transform; | 1177 WebTransformationMatrix child2Transform; |
1178 child2Transform.translate(250, 250); | 1178 child2Transform.translate(250, 250); |
1179 child2Transform.rotate(90); | 1179 child2Transform.rotate(90); |
1180 child2Transform.translate(-250, -250); | 1180 child2Transform.translate(-250, -250); |
1181 | 1181 |
1182 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 1182 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
1183 parent->setMasksToBounds(true); | 1183 parent->setMasksToBounds(true); |
1184 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, FloatPoint(30, 20), gfx::Size(10, 10)); | 1184 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); |
1185 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, FloatPoint(20, 40), gfx::Size(10, 10), false); | 1185 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); |
1186 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -20), gfx::Size(510, 510), true); | 1186 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); |
1187 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), gfx::Size(510, 510), true); | 1187 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
1188 this->calcDrawEtc(parent); | 1188 this->calcDrawEtc(parent); |
1189 | 1189 |
1190 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1190 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1191 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); | 1191 occlusion.setLayerClipRect(gfx::Rect(-30, -30, 1000, 1000)); |
1192 | 1192 |
1193 this->visitLayer(layer2, occlusion); | 1193 this->visitLayer(layer2, occlusion); |
1194 this->enterLayer(child2, occlusion); | 1194 this->enterLayer(child2, occlusion); |
1195 | 1195 |
1196 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1196 EXPECT_RECT_EQ(gfx::Rect(20, 30, 80, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1197 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1197 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { | 1276 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types> { |
1277 protected: | 1277 protected: |
1278 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} | 1278 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} |
1279 void runMyTest() | 1279 void runMyTest() |
1280 { | 1280 { |
1281 WebTransformationMatrix layerTransform; | 1281 WebTransformationMatrix layerTransform; |
1282 layerTransform.translate(250, 250); | 1282 layerTransform.translate(250, 250); |
1283 layerTransform.rotate(90); | 1283 layerTransform.rotate(90); |
1284 layerTransform.translate(-250, -250); | 1284 layerTransform.translate(-250, -250); |
1285 | 1285 |
1286 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 1286 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
1287 parent->setMasksToBounds(true); | 1287 parent->setMasksToBounds(true); |
1288 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true); | 1288 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1289 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true); | 1289 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1290 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, FloatPoint(30, 30), gfx::Size(500, 500), true); | 1290 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
1291 | 1291 |
1292 WebFilterOperations filters; | 1292 WebFilterOperations filters; |
1293 filters.append(WebFilterOperation::createBlurFilter(10)); | 1293 filters.append(WebFilterOperation::createBlurFilter(10)); |
1294 blurLayer->setFilters(filters); | 1294 blurLayer->setFilters(filters); |
1295 | 1295 |
1296 filters.clear(); | 1296 filters.clear(); |
1297 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 1297 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
1298 opaqueLayer->setFilters(filters); | 1298 opaqueLayer->setFilters(filters); |
1299 | 1299 |
1300 filters.clear(); | 1300 filters.clear(); |
1301 filters.append(WebFilterOperation::createOpacityFilter(0.5)); | 1301 filters.append(WebFilterOperation::createOpacityFilter(0.5)); |
1302 opacityLayer->setFilters(filters); | 1302 opacityLayer->setFilters(filters); |
1303 | 1303 |
1304 this->calcDrawEtc(parent); | 1304 this->calcDrawEtc(parent); |
1305 | 1305 |
1306 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1306 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1307 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1307 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1308 | 1308 |
1309 // Opacity layer won't contribute to occlusion. | 1309 // Opacity layer won't contribute to occlusion. |
1310 this->visitLayer(opacityLayer, occlusion); | 1310 this->visitLayer(opacityLayer, occlusion); |
1311 this->enterContributingSurface(opacityLayer, occlusion); | 1311 this->enterContributingSurface(opacityLayer, occlusion); |
1312 | 1312 |
1313 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1313 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1314 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1314 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1315 | 1315 |
1316 // And has nothing to contribute to its parent surface. | 1316 // And has nothing to contribute to its parent surface. |
1317 this->leaveContributingSurface(opacityLayer, occlusion); | 1317 this->leaveContributingSurface(opacityLayer, occlusion); |
1318 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1318 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1319 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1319 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1320 | 1320 |
1321 // Opaque layer will contribute to occlusion. | 1321 // Opaque layer will contribute to occlusion. |
1322 this->visitLayer(opaqueLayer, occlusion); | 1322 this->visitLayer(opaqueLayer, occlusion); |
1323 this->enterContributingSurface(opaqueLayer, occlusion); | 1323 this->enterContributingSurface(opaqueLayer, occlusion); |
1324 | 1324 |
1325 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1325 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1326 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1326 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
1327 EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1327 EXPECT_RECT_EQ(gfx::Rect(0, 430, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1328 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1328 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
1329 | 1329 |
1330 // And it gets translated to the parent surface. | 1330 // And it gets translated to the parent surface. |
1331 this->leaveContributingSurface(opaqueLayer, occlusion); | 1331 this->leaveContributingSurface(opaqueLayer, occlusion); |
1332 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1332 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1333 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1333 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
1334 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1334 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1335 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1335 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
1336 | 1336 |
1337 // The blur layer needs to throw away any occlusion from outside its sub
tree. | 1337 // The blur layer needs to throw away any occlusion from outside its sub
tree. |
1338 this->enterLayer(blurLayer, occlusion); | 1338 this->enterLayer(blurLayer, occlusion); |
1339 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1339 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1340 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1340 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1341 | 1341 |
1342 // And it won't contribute to occlusion. | 1342 // And it won't contribute to occlusion. |
1343 this->leaveLayer(blurLayer, occlusion); | 1343 this->leaveLayer(blurLayer, occlusion); |
1344 this->enterContributingSurface(blurLayer, occlusion); | 1344 this->enterContributingSurface(blurLayer, occlusion); |
1345 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1345 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1346 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1346 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1347 | 1347 |
1348 // But the opaque layer's occlusion is preserved on the parent. | 1348 // But the opaque layer's occlusion is preserved on the parent. |
1349 this->leaveContributingSurface(blurLayer, occlusion); | 1349 this->leaveContributingSurface(blurLayer, occlusion); |
1350 this->enterLayer(parent, occlusion); | 1350 this->enterLayer(parent, occlusion); |
1351 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); | 1351 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInScreenSpa
ce().bounds()); |
1352 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1352 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
1353 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); | 1353 EXPECT_RECT_EQ(gfx::Rect(30, 30, 70, 70), occlusion.occlusionInTargetSur
face().bounds()); |
1354 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1354 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
1355 } | 1355 } |
1356 }; | 1356 }; |
1357 | 1357 |
1358 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); | 1358 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); |
1359 | 1359 |
1360 template<class Types> | 1360 template<class Types> |
1361 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types
> { | 1361 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types
> { |
1362 protected: | 1362 protected: |
1363 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 1363 OcclusionTrackerTestReplicaDoesOcclude(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
1364 void runMyTest() | 1364 void runMyTest() |
1365 { | 1365 { |
1366 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 1366 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1367 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true); | 1367 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1368 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), gfx::Size()); | 1368 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1369 this->calcDrawEtc(parent); | 1369 this->calcDrawEtc(parent); |
1370 | 1370 |
1371 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1371 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1372 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1372 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1373 | 1373 |
1374 this->visitLayer(surface, occlusion); | 1374 this->visitLayer(surface, occlusion); |
1375 | 1375 |
1376 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1376 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1377 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1377 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
1378 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1378 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
1379 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1379 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
1380 | 1380 |
1381 this->visitContributingSurface(surface, occlusion); | 1381 this->visitContributingSurface(surface, occlusion); |
1382 this->enterLayer(parent, occlusion); | 1382 this->enterLayer(parent, occlusion); |
1383 | 1383 |
1384 // The surface and replica should both be occluding the parent. | 1384 // The surface and replica should both be occluding the parent. |
1385 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); | 1385 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInTargetS
urface().bounds()); |
1386 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1386 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
1387 } | 1387 } |
1388 }; | 1388 }; |
1389 | 1389 |
1390 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); | 1390 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); |
1391 | 1391 |
1392 template<class Types> | 1392 template<class Types> |
1393 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { | 1393 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { |
1394 protected: | 1394 protected: |
1395 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 1395 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
1396 void runMyTest() | 1396 void runMyTest() |
1397 { | 1397 { |
1398 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 170)); | 1398 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); |
1399 parent->setMasksToBounds(true); | 1399 parent->setMasksToBounds(true); |
1400 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true); | 1400 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1401 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), gfx::Size()); | 1401 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
1402 this->calcDrawEtc(parent); | 1402 this->calcDrawEtc(parent); |
1403 | 1403 |
1404 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1404 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1405 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1405 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1406 | 1406 |
1407 this->visitLayer(surface, occlusion); | 1407 this->visitLayer(surface, occlusion); |
1408 | 1408 |
1409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1409 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1410 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1410 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
1411 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1411 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
1412 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1412 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
1413 | 1413 |
1414 this->visitContributingSurface(surface, occlusion); | 1414 this->visitContributingSurface(surface, occlusion); |
1415 this->enterLayer(parent, occlusion); | 1415 this->enterLayer(parent, occlusion); |
1416 | 1416 |
1417 // The surface and replica should both be occluding the parent. | 1417 // The surface and replica should both be occluding the parent. |
1418 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu
rface().bounds()); | 1418 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 70), occlusion.occlusionInTargetSu
rface().bounds()); |
1419 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1419 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
1420 } | 1420 } |
1421 }; | 1421 }; |
1422 | 1422 |
1423 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); | 1423 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); |
1424 | 1424 |
1425 template<class Types> | 1425 template<class Types> |
1426 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { | 1426 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types> { |
1427 protected: | 1427 protected: |
1428 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 1428 OcclusionTrackerTestReplicaWithMask(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
1429 void runMyTest() | 1429 void runMyTest() |
1430 { | 1430 { |
1431 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 1431 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
1432 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 50), true); | 1432 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
1433 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, FloatPoint(50, 50), gfx::Size()); | 1433 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, gfx::PointF(50, 50), gfx::Size()); |
1434 this->createMaskLayer(replica, gfx::Size(10, 10)); | 1434 this->createMaskLayer(replica, gfx::Size(10, 10)); |
1435 this->calcDrawEtc(parent); | 1435 this->calcDrawEtc(parent); |
1436 | 1436 |
1437 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1437 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1438 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1438 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1439 | 1439 |
1440 this->visitLayer(surface, occlusion); | 1440 this->visitLayer(surface, occlusion); |
1441 | 1441 |
1442 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); | 1442 EXPECT_RECT_EQ(gfx::Rect(0, 100, 50, 50), occlusion.occlusionInScreenSpa
ce().bounds()); |
1443 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1443 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 10 matching lines...) Expand all Loading... |
1454 }; | 1454 }; |
1455 | 1455 |
1456 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); | 1456 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
1457 | 1457 |
1458 template<class Types> | 1458 template<class Types> |
1459 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { | 1459 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { |
1460 protected: | 1460 protected: |
1461 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} | 1461 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} |
1462 void runMyTest() | 1462 void runMyTest() |
1463 { | 1463 { |
1464 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1464 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1465 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1465 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1466 this->calcDrawEtc(parent); | 1466 this->calcDrawEtc(parent); |
1467 | 1467 |
1468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1468 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1469 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); | 1469 occlusion.setLayerClipRect(gfx::Rect(200, 100, 100, 100)); |
1470 | 1470 |
1471 this->enterLayer(layer, occlusion); | 1471 this->enterLayer(layer, occlusion); |
1472 | 1472 |
1473 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1473 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1474 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1474 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1475 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1475 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
(...skipping 23 matching lines...) Expand all Loading... |
1499 }; | 1499 }; |
1500 | 1500 |
1501 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); | 1501 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); |
1502 | 1502 |
1503 template<class Types> | 1503 template<class Types> |
1504 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest
<Types> { | 1504 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest
<Types> { |
1505 protected: | 1505 protected: |
1506 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} | 1506 OcclusionTrackerTestViewportRectOutsideChild(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} |
1507 void runMyTest() | 1507 void runMyTest() |
1508 { | 1508 { |
1509 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1509 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1510 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1510 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1511 this->calcDrawEtc(parent); | 1511 this->calcDrawEtc(parent); |
1512 | 1512 |
1513 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100)); | 1513 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(200, 100, 100, 100)); |
1514 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1514 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1515 | 1515 |
1516 this->enterLayer(layer, occlusion); | 1516 this->enterLayer(layer, occlusion); |
1517 | 1517 |
1518 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1518 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1519 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1519 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
1520 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1520 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
(...skipping 23 matching lines...) Expand all Loading... |
1544 }; | 1544 }; |
1545 | 1545 |
1546 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); | 1546 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); |
1547 | 1547 |
1548 template<class Types> | 1548 template<class Types> |
1549 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { | 1549 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { |
1550 protected: | 1550 protected: |
1551 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} | 1551 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} |
1552 void runMyTest() | 1552 void runMyTest() |
1553 { | 1553 { |
1554 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1554 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1555 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1555 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1556 this->calcDrawEtc(parent); | 1556 this->calcDrawEtc(parent); |
1557 | 1557 |
1558 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1558 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1559 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100)); | 1559 occlusion.setLayerClipRect(gfx::Rect(100, 100, 100, 100)); |
1560 | 1560 |
1561 this->enterLayer(layer, occlusion); | 1561 this->enterLayer(layer, occlusion); |
1562 | 1562 |
1563 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1563 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1564 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1564 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1565 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1565 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
(...skipping 18 matching lines...) Expand all Loading... |
1584 }; | 1584 }; |
1585 | 1585 |
1586 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); | 1586 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); |
1587 | 1587 |
1588 template<class Types> | 1588 template<class Types> |
1589 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty
pes> { | 1589 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty
pes> { |
1590 protected: | 1590 protected: |
1591 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} | 1591 OcclusionTrackerTestViewportRectOverChild(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} |
1592 void runMyTest() | 1592 void runMyTest() |
1593 { | 1593 { |
1594 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1594 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1595 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1595 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1596 this->calcDrawEtc(parent); | 1596 this->calcDrawEtc(parent); |
1597 | 1597 |
1598 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); | 1598 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(100, 100, 100, 100)); |
1599 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1599 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1600 | 1600 |
1601 this->enterLayer(layer, occlusion); | 1601 this->enterLayer(layer, occlusion); |
1602 | 1602 |
1603 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1603 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1604 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1604 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1605 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1605 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
(...skipping 18 matching lines...) Expand all Loading... |
1624 }; | 1624 }; |
1625 | 1625 |
1626 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); | 1626 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); |
1627 | 1627 |
1628 template<class Types> | 1628 template<class Types> |
1629 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { | 1629 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { |
1630 protected: | 1630 protected: |
1631 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 1631 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
1632 void runMyTest() | 1632 void runMyTest() |
1633 { | 1633 { |
1634 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1634 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1635 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1635 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1636 this->calcDrawEtc(parent); | 1636 this->calcDrawEtc(parent); |
1637 | 1637 |
1638 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1638 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1639 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200)); | 1639 occlusion.setLayerClipRect(gfx::Rect(50, 50, 200, 200)); |
1640 | 1640 |
1641 this->enterLayer(layer, occlusion); | 1641 this->enterLayer(layer, occlusion); |
1642 | 1642 |
1643 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1643 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1644 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1644 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1645 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1645 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
(...skipping 22 matching lines...) Expand all Loading... |
1668 }; | 1668 }; |
1669 | 1669 |
1670 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); | 1670 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); |
1671 | 1671 |
1672 template<class Types> | 1672 template<class Types> |
1673 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT
est<Types> { | 1673 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT
est<Types> { |
1674 protected: | 1674 protected: |
1675 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi
onTrackerTest<Types>(opaqueLayers) {} | 1675 OcclusionTrackerTestViewportRectPartlyOverChild(bool opaqueLayers) : Occlusi
onTrackerTest<Types>(opaqueLayers) {} |
1676 void runMyTest() | 1676 void runMyTest() |
1677 { | 1677 { |
1678 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1678 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1679 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1679 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1680 this->calcDrawEtc(parent); | 1680 this->calcDrawEtc(parent); |
1681 | 1681 |
1682 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); | 1682 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(50, 50, 200, 200)); |
1683 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1683 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1684 | 1684 |
1685 this->enterLayer(layer, occlusion); | 1685 this->enterLayer(layer, occlusion); |
1686 | 1686 |
1687 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1687 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1688 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1688 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1689 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1689 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
(...skipping 22 matching lines...) Expand all Loading... |
1712 }; | 1712 }; |
1713 | 1713 |
1714 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); | 1714 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); |
1715 | 1715 |
1716 template<class Types> | 1716 template<class Types> |
1717 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest
<Types> { | 1717 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest
<Types> { |
1718 protected: | 1718 protected: |
1719 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} | 1719 OcclusionTrackerTestLayerClipRectOverNothing(bool opaqueLayers) : OcclusionT
rackerTest<Types>(opaqueLayers) {} |
1720 void runMyTest() | 1720 void runMyTest() |
1721 { | 1721 { |
1722 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1722 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1723 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1723 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1724 this->calcDrawEtc(parent); | 1724 this->calcDrawEtc(parent); |
1725 | 1725 |
1726 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1726 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1727 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100)); | 1727 occlusion.setLayerClipRect(gfx::Rect(500, 500, 100, 100)); |
1728 | 1728 |
1729 this->enterLayer(layer, occlusion); | 1729 this->enterLayer(layer, occlusion); |
1730 | 1730 |
1731 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1731 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1732 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1732 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1733 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1733 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
(...skipping 22 matching lines...) Expand all Loading... |
1756 }; | 1756 }; |
1757 | 1757 |
1758 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); | 1758 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); |
1759 | 1759 |
1760 template<class Types> | 1760 template<class Types> |
1761 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<
Types> { | 1761 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<
Types> { |
1762 protected: | 1762 protected: |
1763 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr
ackerTest<Types>(opaqueLayers) {} | 1763 OcclusionTrackerTestViewportRectOverNothing(bool opaqueLayers) : OcclusionTr
ackerTest<Types>(opaqueLayers) {} |
1764 void runMyTest() | 1764 void runMyTest() |
1765 { | 1765 { |
1766 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1766 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1767 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1767 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1768 this->calcDrawEtc(parent); | 1768 this->calcDrawEtc(parent); |
1769 | 1769 |
1770 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); | 1770 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(500, 500, 100, 100)); |
1771 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1771 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1772 | 1772 |
1773 this->enterLayer(layer, occlusion); | 1773 this->enterLayer(layer, occlusion); |
1774 | 1774 |
1775 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1775 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1776 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1776 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
1777 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1777 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
(...skipping 22 matching lines...) Expand all Loading... |
1800 }; | 1800 }; |
1801 | 1801 |
1802 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); | 1802 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); |
1803 | 1803 |
1804 template<class Types> | 1804 template<class Types> |
1805 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack
erTest<Types> { | 1805 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack
erTest<Types> { |
1806 protected: | 1806 protected: |
1807 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} | 1807 OcclusionTrackerTestLayerClipRectForLayerOffOrigin(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} |
1808 void runMyTest() | 1808 void runMyTest() |
1809 { | 1809 { |
1810 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1810 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1811 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), true); | 1811 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), true); |
1812 this->calcDrawEtc(parent); | 1812 this->calcDrawEtc(parent); |
1813 | 1813 |
1814 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1814 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1815 this->enterLayer(layer, occlusion); | 1815 this->enterLayer(layer, occlusion); |
1816 | 1816 |
1817 // This layer is translated when drawn into its target. So if the clip r
ect given from the target surface | 1817 // This layer is translated when drawn into its target. So if the clip r
ect given from the target surface |
1818 // is not in that target space, then after translating these query rects
into the target, they will fall outside | 1818 // is not in that target space, then after translating these query rects
into the target, they will fall outside |
1819 // the clip and be considered occluded. | 1819 // the clip and be considered occluded. |
1820 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1820 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1821 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1821 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1822 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1822 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
1823 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1823 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1824 } | 1824 } |
1825 }; | 1825 }; |
1826 | 1826 |
1827 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); | 1827 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); |
1828 | 1828 |
1829 template<class Types> | 1829 template<class Types> |
1830 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes
t<Types> { | 1830 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes
t<Types> { |
1831 protected: | 1831 protected: |
1832 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} | 1832 OcclusionTrackerTestOpaqueContentsRegionEmpty(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} |
1833 void runMyTest() | 1833 void runMyTest() |
1834 { | 1834 { |
1835 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1835 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1836 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 200), false); | 1836 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), false); |
1837 this->calcDrawEtc(parent); | 1837 this->calcDrawEtc(parent); |
1838 | 1838 |
1839 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1839 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1840 this->enterLayer(layer, occlusion); | 1840 this->enterLayer(layer, occlusion); |
1841 | 1841 |
1842 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1842 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
1843 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1843 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
1844 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1844 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
1845 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); | 1845 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 100, 100, 100
))); |
1846 | 1846 |
1847 // Occluded since its outside the surface bounds. | 1847 // Occluded since its outside the surface bounds. |
1848 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)
)); | 1848 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100)
)); |
1849 | 1849 |
1850 // Test without any clip rect. | 1850 // Test without any clip rect. |
1851 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 1851 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
1852 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); | 1852 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(200, 100, 100, 100
))); |
1853 occlusion.useDefaultLayerClipRect(); | 1853 occlusion.useDefaultLayerClipRect(); |
1854 | 1854 |
1855 this->leaveLayer(layer, occlusion); | 1855 this->leaveLayer(layer, occlusion); |
1856 this->visitContributingSurface(layer, occlusion); | 1856 this->visitContributingSurface(layer, occlusion); |
1857 this->enterLayer(parent, occlusion); | 1857 this->enterLayer(parent, occlusion); |
1858 | 1858 |
1859 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty()); | 1859 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().IsEmpty()); |
1860 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 1860 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
1861 } | 1861 } |
1862 }; | 1862 }; |
1863 | 1863 |
1864 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); | 1864 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); |
1865 | 1865 |
1866 template<class Types> | 1866 template<class Types> |
1867 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker
Test<Types> { | 1867 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker
Test<Types> { |
1868 protected: | 1868 protected: |
1869 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 1869 OcclusionTrackerTestOpaqueContentsRegionNonEmpty(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
1870 void runMyTest() | 1870 void runMyTest() |
1871 { | 1871 { |
1872 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1872 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1873 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(100, 100), gfx::Size(200, 200), false); | 1873 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(200, 200), false); |
1874 this->calcDrawEtc(parent); | 1874 this->calcDrawEtc(parent); |
1875 | 1875 |
1876 { | 1876 { |
1877 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1877 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1878 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); | 1878 layer->setOpaqueContentsRect(gfx::Rect(0, 0, 100, 100)); |
1879 | 1879 |
1880 this->resetLayerIterator(); | 1880 this->resetLayerIterator(); |
1881 this->visitLayer(layer, occlusion); | 1881 this->visitLayer(layer, occlusion); |
1882 this->enterLayer(parent, occlusion); | 1882 this->enterLayer(parent, occlusion); |
1883 | 1883 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1927 | 1927 |
1928 template<class Types> | 1928 template<class Types> |
1929 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { | 1929 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types> { |
1930 protected: | 1930 protected: |
1931 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty
pes>(opaqueLayers) {} | 1931 OcclusionTrackerTest3dTransform(bool opaqueLayers) : OcclusionTrackerTest<Ty
pes>(opaqueLayers) {} |
1932 void runMyTest() | 1932 void runMyTest() |
1933 { | 1933 { |
1934 WebTransformationMatrix transform; | 1934 WebTransformationMatrix transform; |
1935 transform.rotate3d(0, 30, 0); | 1935 transform.rotate3d(0, 30, 0); |
1936 | 1936 |
1937 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1937 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1938 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1938 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1939 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true); | 1939 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); |
1940 this->calcDrawEtc(parent); | 1940 this->calcDrawEtc(parent); |
1941 | 1941 |
1942 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1942 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1943 this->enterLayer(layer, occlusion); | 1943 this->enterLayer(layer, occlusion); |
1944 | 1944 |
1945 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. | 1945 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. |
1946 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); | 1946 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); |
1947 } | 1947 } |
1948 }; | 1948 }; |
1949 | 1949 |
(...skipping 10 matching lines...) Expand all Loading... |
1960 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes | 1960 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes |
1961 // other layers that have not yet been iterated over. For now, the expec
ted | 1961 // other layers that have not yet been iterated over. For now, the expec
ted |
1962 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion | 1962 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion |
1963 // tracker. | 1963 // tracker. |
1964 | 1964 |
1965 WebTransformationMatrix translationToFront; | 1965 WebTransformationMatrix translationToFront; |
1966 translationToFront.translate3d(0, 0, -10); | 1966 translationToFront.translate3d(0, 0, -10); |
1967 WebTransformationMatrix translationToBack; | 1967 WebTransformationMatrix translationToBack; |
1968 translationToFront.translate3d(0, 0, -100); | 1968 translationToFront.translate3d(0, 0, -100); |
1969 | 1969 |
1970 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 1970 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
1971 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, FloatPoint(0, 0), gfx::Size(100, 100), true); | 1971 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
1972 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, FloatPoint(50, 50), gfx::Size(100, 100), true); | 1972 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); |
1973 parent->setPreserves3D(true); | 1973 parent->setPreserves3D(true); |
1974 | 1974 |
1975 this->calcDrawEtc(parent); | 1975 this->calcDrawEtc(parent); |
1976 | 1976 |
1977 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1977 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1978 this->visitLayer(child2, occlusion); | 1978 this->visitLayer(child2, occlusion); |
1979 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1979 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1980 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1980 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1981 | 1981 |
1982 this->visitLayer(child1, occlusion); | 1982 this->visitLayer(child1, occlusion); |
1983 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1983 EXPECT_TRUE(occlusion.occlusionInScreenSpace().IsEmpty()); |
1984 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1984 EXPECT_TRUE(occlusion.occlusionInTargetSurface().IsEmpty()); |
1985 } | 1985 } |
1986 }; | 1986 }; |
1987 | 1987 |
1988 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. | 1988 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. |
1989 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); | 1989 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); |
1990 | 1990 |
1991 template<class Types> | 1991 template<class Types> |
1992 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ
es> { | 1992 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ
es> { |
1993 protected: | 1993 protected: |
1994 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack
erTest<Types>(opaqueLayers) {} | 1994 OcclusionTrackerTestPerspectiveTransform(bool opaqueLayers) : OcclusionTrack
erTest<Types>(opaqueLayers) {} |
1995 void runMyTest() | 1995 void runMyTest() |
1996 { | 1996 { |
1997 WebTransformationMatrix transform; | 1997 WebTransformationMatrix transform; |
1998 transform.translate(150, 150); | 1998 transform.translate(150, 150); |
1999 transform.applyPerspective(400); | 1999 transform.applyPerspective(400); |
2000 transform.rotate3d(1, 0, 0, -30); | 2000 transform.rotate3d(1, 0, 0, -30); |
2001 transform.translate(-150, -150); | 2001 transform.translate(-150, -150); |
2002 | 2002 |
2003 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2003 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2004 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2004 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2005 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), gfx::Size(200, 200), true); | 2005 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); |
2006 container->setPreserves3D(true); | 2006 container->setPreserves3D(true); |
2007 layer->setPreserves3D(true); | 2007 layer->setPreserves3D(true); |
2008 this->calcDrawEtc(parent); | 2008 this->calcDrawEtc(parent); |
2009 | 2009 |
2010 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2010 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2011 this->enterLayer(layer, occlusion); | 2011 this->enterLayer(layer, occlusion); |
2012 | 2012 |
2013 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); | 2013 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); |
2014 } | 2014 } |
2015 }; | 2015 }; |
2016 | 2016 |
2017 // 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. | 2017 // 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. |
2018 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); | 2018 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); |
2019 | 2019 |
2020 template<class Types> | 2020 template<class Types> |
2021 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra
ckerTest<Types> { | 2021 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra
ckerTest<Types> { |
2022 protected: | 2022 protected: |
2023 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 2023 OcclusionTrackerTestPerspectiveTransformBehindCamera(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
2024 void runMyTest() | 2024 void runMyTest() |
2025 { | 2025 { |
2026 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. | 2026 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. |
2027 WebTransformationMatrix transform; | 2027 WebTransformationMatrix transform; |
2028 transform.translate(250, 50); | 2028 transform.translate(250, 50); |
2029 transform.applyPerspective(10); | 2029 transform.applyPerspective(10); |
2030 transform.translate(-250, -50); | 2030 transform.translate(-250, -50); |
2031 transform.translate(250, 50); | 2031 transform.translate(250, 50); |
2032 transform.rotate3d(1, 0, 0, -167); | 2032 transform.rotate3d(1, 0, 0, -167); |
2033 transform.translate(-250, -50); | 2033 transform.translate(-250, -50); |
2034 | 2034 |
2035 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(500, 100)); | 2035 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 100)); |
2036 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), gfx::Size(500, 500)); | 2036 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); |
2037 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(0, 0), gfx::Size(500, 500), true); | 2037 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
2038 container->setPreserves3D(true); | 2038 container->setPreserves3D(true); |
2039 layer->setPreserves3D(true); | 2039 layer->setPreserves3D(true); |
2040 this->calcDrawEtc(parent); | 2040 this->calcDrawEtc(parent); |
2041 | 2041 |
2042 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2042 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2043 this->enterLayer(layer, occlusion); | 2043 this->enterLayer(layer, occlusion); |
2044 | 2044 |
2045 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, | 2045 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, |
2046 // this will include many more pixels but must include at least the bott
om 11 rows. | 2046 // this will include many more pixels but must include at least the bott
om 11 rows. |
2047 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); | 2047 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); |
2048 } | 2048 } |
2049 }; | 2049 }; |
2050 | 2050 |
2051 // 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. | 2051 // 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. |
2052 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); | 2052 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); |
2053 | 2053 |
2054 template<class Types> | 2054 template<class Types> |
2055 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { | 2055 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { |
2056 protected: | 2056 protected: |
2057 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} | 2057 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} |
2058 void runMyTest() | 2058 void runMyTest() |
2059 { | 2059 { |
2060 WebTransformationMatrix transform; | 2060 WebTransformationMatrix transform; |
2061 transform.translate(50, 50); | 2061 transform.translate(50, 50); |
2062 transform.applyPerspective(100); | 2062 transform.applyPerspective(100); |
2063 transform.translate3d(0, 0, 110); | 2063 transform.translate3d(0, 0, 110); |
2064 transform.translate(-50, -50); | 2064 transform.translate(-50, -50); |
2065 | 2065 |
2066 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 2066 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
2067 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2067 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2068 parent->setPreserves3D(true); | 2068 parent->setPreserves3D(true); |
2069 layer->setPreserves3D(true); | 2069 layer->setPreserves3D(true); |
2070 this->calcDrawEtc(parent); | 2070 this->calcDrawEtc(parent); |
2071 | 2071 |
2072 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2072 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2073 | 2073 |
2074 // The |layer| is entirely behind the camera and should not occlude. | 2074 // The |layer| is entirely behind the camera and should not occlude. |
2075 this->visitLayer(layer, occlusion); | 2075 this->visitLayer(layer, occlusion); |
2076 this->enterLayer(parent, occlusion); | 2076 this->enterLayer(parent, occlusion); |
2077 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 2077 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
2078 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 2078 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
2079 } | 2079 } |
2080 }; | 2080 }; |
2081 | 2081 |
2082 // 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. | 2082 // 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. |
2083 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); | 2083 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); |
2084 | 2084 |
2085 template<class Types> | 2085 template<class Types> |
2086 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { | 2086 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { |
2087 protected: | 2087 protected: |
2088 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 2088 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
2089 void runMyTest() | 2089 void runMyTest() |
2090 { | 2090 { |
2091 WebTransformationMatrix transform; | 2091 WebTransformationMatrix transform; |
2092 transform.translate(50, 50); | 2092 transform.translate(50, 50); |
2093 transform.applyPerspective(100); | 2093 transform.applyPerspective(100); |
2094 transform.translate3d(0, 0, 99); | 2094 transform.translate3d(0, 0, 99); |
2095 transform.translate(-50, -50); | 2095 transform.translate(-50, -50); |
2096 | 2096 |
2097 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 100)); | 2097 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
2098 parent->setMasksToBounds(true); | 2098 parent->setMasksToBounds(true); |
2099 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2099 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2100 parent->setPreserves3D(true); | 2100 parent->setPreserves3D(true); |
2101 layer->setPreserves3D(true); | 2101 layer->setPreserves3D(true); |
2102 this->calcDrawEtc(parent); | 2102 this->calcDrawEtc(parent); |
2103 | 2103 |
2104 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2104 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2105 | 2105 |
2106 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. | 2106 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. |
2107 // Ensure that those pixels don't occlude things outside the clipRect. | 2107 // Ensure that those pixels don't occlude things outside the clipRect. |
2108 this->visitLayer(layer, occlusion); | 2108 this->visitLayer(layer, occlusion); |
2109 this->enterLayer(parent, occlusion); | 2109 this->enterLayer(parent, occlusion); |
2110 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2110 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
2111 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2111 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); | 2112 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); |
2113 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2113 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
2114 } | 2114 } |
2115 }; | 2115 }; |
2116 | 2116 |
2117 // 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. | 2117 // 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. |
2118 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); | 2118 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); |
2119 | 2119 |
2120 template<class Types> | 2120 template<class Types> |
2121 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { | 2121 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types> { |
2122 protected: | 2122 protected: |
2123 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 2123 OcclusionTrackerTestAnimationOpacity1OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
2124 void runMyTest() | 2124 void runMyTest() |
2125 { | 2125 { |
2126 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2126 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2127 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2127 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2128 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2128 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2129 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true); | 2129 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
2130 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true); | 2130 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
2131 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false); | 2131 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2132 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true); | 2132 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
2133 | 2133 |
2134 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); | 2134 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); |
2135 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); | 2135 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); |
2136 this->calcDrawEtc(parent); | 2136 this->calcDrawEtc(parent); |
2137 | 2137 |
2138 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 2138 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
2139 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 2139 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
2140 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 2140 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
2141 | 2141 |
2142 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2142 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 26 matching lines...) Expand all Loading... |
2169 }; | 2169 }; |
2170 | 2170 |
2171 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); | 2171 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); |
2172 | 2172 |
2173 template<class Types> | 2173 template<class Types> |
2174 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke
rTest<Types> { | 2174 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke
rTest<Types> { |
2175 protected: | 2175 protected: |
2176 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 2176 OcclusionTrackerTestAnimationOpacity0OnMainThread(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
2177 void runMyTest() | 2177 void runMyTest() |
2178 { | 2178 { |
2179 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2179 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2180 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2180 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2181 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2181 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2182 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true); | 2182 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
2183 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true); | 2183 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
2184 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), false); | 2184 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2185 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), gfx::Size(50, 300), true); | 2185 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
2186 | 2186 |
2187 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
1, 0, false); | 2187 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
1, 0, false); |
2188 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 1, 0, false); | 2188 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 1, 0, false); |
2189 this->calcDrawEtc(parent); | 2189 this->calcDrawEtc(parent); |
2190 | 2190 |
2191 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 2191 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
2192 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 2192 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
2193 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 2193 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
2194 | 2194 |
2195 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2195 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 26 matching lines...) Expand all Loading... |
2222 }; | 2222 }; |
2223 | 2223 |
2224 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); | 2224 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); |
2225 | 2225 |
2226 template<class Types> | 2226 template<class Types> |
2227 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack
erTest<Types> { | 2227 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack
erTest<Types> { |
2228 protected: | 2228 protected: |
2229 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} | 2229 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} |
2230 void runMyTest() | 2230 void runMyTest() |
2231 { | 2231 { |
2232 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2232 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2233 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2233 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2234 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 300), true); | 2234 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
2235 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(200, 300), true); | 2235 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
2236 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true); | 2236 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
2237 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(50, 300), true); | 2237 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 300), true); |
2238 | 2238 |
2239 addAnimatedTransformToController(*layer->layerAnimationController(), 10,
30, 0); | 2239 addAnimatedTransformToController(*layer->layerAnimationController(), 10,
30, 0); |
2240 addAnimatedTransformToController(*surface->layerAnimationController(), 1
0, 30, 0); | 2240 addAnimatedTransformToController(*surface->layerAnimationController(), 1
0, 30, 0); |
2241 addAnimatedTransformToController(*surfaceChild->layerAnimationController
(), 10, 30, 0); | 2241 addAnimatedTransformToController(*surfaceChild->layerAnimationController
(), 10, 30, 0); |
2242 this->calcDrawEtc(parent); | 2242 this->calcDrawEtc(parent); |
2243 | 2243 |
2244 EXPECT_TRUE(layer->drawTransformIsAnimating()); | 2244 EXPECT_TRUE(layer->drawTransformIsAnimating()); |
2245 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); | 2245 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); |
2246 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin
g()); | 2246 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin
g()); |
2247 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating(
)); | 2247 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating(
)); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT
rackerTest<Types> { | 2320 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT
rackerTest<Types> { |
2321 protected: | 2321 protected: |
2322 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) :
OcclusionTrackerTest<Types>(opaqueLayers) {} | 2322 OcclusionTrackerTestSurfaceOcclusionTranslatesToParent(bool opaqueLayers) :
OcclusionTrackerTest<Types>(opaqueLayers) {} |
2323 void runMyTest() | 2323 void runMyTest() |
2324 { | 2324 { |
2325 WebTransformationMatrix surfaceTransform; | 2325 WebTransformationMatrix surfaceTransform; |
2326 surfaceTransform.translate(300, 300); | 2326 surfaceTransform.translate(300, 300); |
2327 surfaceTransform.scale(2); | 2327 surfaceTransform.scale(2); |
2328 surfaceTransform.translate(-150, -150); | 2328 surfaceTransform.translate(-150, -150); |
2329 | 2329 |
2330 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(500, 500)); | 2330 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); |
2331 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), gfx::Size(300, 300), false); | 2331 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2332 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(300, 300), false); | 2332 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(300, 300), false); |
2333 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2333 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
2334 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); | 2334 surface2->setOpaqueContentsRect(gfx::Rect(0, 0, 200, 200)); |
2335 this->calcDrawEtc(parent); | 2335 this->calcDrawEtc(parent); |
2336 | 2336 |
2337 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2337 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2338 | 2338 |
2339 this->visitLayer(surface2, occlusion); | 2339 this->visitLayer(surface2, occlusion); |
2340 this->visitContributingSurface(surface2, occlusion); | 2340 this->visitContributingSurface(surface2, occlusion); |
2341 | 2341 |
2342 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS
pace().bounds()); | 2342 EXPECT_RECT_EQ(gfx::Rect(50, 50, 200, 200), occlusion.occlusionInScreenS
pace().bounds()); |
(...skipping 16 matching lines...) Expand all Loading... |
2359 }; | 2359 }; |
2360 | 2360 |
2361 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); | 2361 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); |
2362 | 2362 |
2363 template<class Types> | 2363 template<class Types> |
2364 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { | 2364 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { |
2365 protected: | 2365 protected: |
2366 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2366 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2367 void runMyTest() | 2367 void runMyTest() |
2368 { | 2368 { |
2369 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 300)); | 2369 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
2370 parent->setMasksToBounds(true); | 2370 parent->setMasksToBounds(true); |
2371 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(500, 300), false); | 2371 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); |
2372 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); | 2372 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); |
2373 this->calcDrawEtc(parent); | 2373 this->calcDrawEtc(parent); |
2374 | 2374 |
2375 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2375 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2376 | 2376 |
2377 this->visitLayer(surface, occlusion); | 2377 this->visitLayer(surface, occlusion); |
2378 this->visitContributingSurface(surface, occlusion); | 2378 this->visitContributingSurface(surface, occlusion); |
2379 | 2379 |
2380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2380 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
2381 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2381 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur
face().bounds()); | 2382 EXPECT_RECT_EQ(gfx::Rect(0, 0, 300, 200), occlusion.occlusionInTargetSur
face().bounds()); |
2383 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2383 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
2384 } | 2384 } |
2385 }; | 2385 }; |
2386 | 2386 |
2387 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip
ping); | 2387 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip
ping); |
2388 | 2388 |
2389 template<class Types> | 2389 template<class Types> |
2390 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { | 2390 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types> { |
2391 protected: | 2391 protected: |
2392 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 2392 OcclusionTrackerTestReplicaOccluded(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
2393 void runMyTest() | 2393 void runMyTest() |
2394 { | 2394 { |
2395 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 2395 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2396 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2396 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2397 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), gfx::Size(100, 100)); | 2397 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2398 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 100), gfx::Size(100, 100), true); | 2398 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 100), gfx::Size(100, 100), true); |
2399 this->calcDrawEtc(parent); | 2399 this->calcDrawEtc(parent); |
2400 | 2400 |
2401 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2401 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2402 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2402 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2403 | 2403 |
2404 // |topmost| occludes the replica, but not the surface itself. | 2404 // |topmost| occludes the replica, but not the surface itself. |
2405 this->visitLayer(topmost, occlusion); | 2405 this->visitLayer(topmost, occlusion); |
2406 | 2406 |
2407 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS
pace().bounds()); | 2407 EXPECT_RECT_EQ(gfx::Rect(0, 100, 100, 100), occlusion.occlusionInScreenS
pace().bounds()); |
2408 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2408 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 15 matching lines...) Expand all Loading... |
2424 }; | 2424 }; |
2425 | 2425 |
2426 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); | 2426 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); |
2427 | 2427 |
2428 template<class Types> | 2428 template<class Types> |
2429 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker
Test<Types> { | 2429 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker
Test<Types> { |
2430 protected: | 2430 protected: |
2431 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 2431 OcclusionTrackerTestSurfaceWithReplicaUnoccluded(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
2432 void runMyTest() | 2432 void runMyTest() |
2433 { | 2433 { |
2434 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 2434 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2435 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2435 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2436 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), gfx::Size(100, 100)); | 2436 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2437 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 110), true); | 2437 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 110), true); |
2438 this->calcDrawEtc(parent); | 2438 this->calcDrawEtc(parent); |
2439 | 2439 |
2440 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2440 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2441 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2441 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2442 | 2442 |
2443 // |topmost| occludes the surface, but not the entire surface's replica. | 2443 // |topmost| occludes the surface, but not the entire surface's replica. |
2444 this->visitLayer(topmost, occlusion); | 2444 this->visitLayer(topmost, occlusion); |
2445 | 2445 |
2446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); | 2446 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 110), occlusion.occlusionInScreenSpa
ce().bounds()); |
2447 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2447 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 16 matching lines...) Expand all Loading... |
2464 }; | 2464 }; |
2465 | 2465 |
2466 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); | 2466 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); |
2467 | 2467 |
2468 template<class Types> | 2468 template<class Types> |
2469 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio
nTrackerTest<Types> { | 2469 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio
nTrackerTest<Types> { |
2470 protected: | 2470 protected: |
2471 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers)
: OcclusionTrackerTest<Types>(opaqueLayers) {} | 2471 OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently(bool opaqueLayers)
: OcclusionTrackerTest<Types>(opaqueLayers) {} |
2472 void runMyTest() | 2472 void runMyTest() |
2473 { | 2473 { |
2474 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 2474 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2475 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2475 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2476 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), gfx::Size(100, 100)); | 2476 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(0, 1
00), gfx::Size(100, 100)); |
2477 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 0), gfx::Size(40, 100), true); | 2477 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(40, 100), true); |
2478 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 100), gfx::Size(50, 100), true); | 2478 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 100), true); |
2479 this->calcDrawEtc(parent); | 2479 this->calcDrawEtc(parent); |
2480 | 2480 |
2481 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2481 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2482 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2482 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2483 | 2483 |
2484 // These occlude the surface and replica differently, so we can test eac
h one. | 2484 // These occlude the surface and replica differently, so we can test eac
h one. |
2485 this->visitLayer(overReplica, occlusion); | 2485 this->visitLayer(overReplica, occlusion); |
2486 this->visitLayer(overSurface, occlusion); | 2486 this->visitLayer(overSurface, occlusion); |
2487 | 2487 |
2488 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac
e().bounds()); | 2488 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 200), occlusion.occlusionInScreenSpac
e().bounds()); |
(...skipping 19 matching lines...) Expand all Loading... |
2508 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent
ly); | 2508 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent
ly); |
2509 | 2509 |
2510 template<class Types> | 2510 template<class Types> |
2511 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty
pes> { | 2511 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty
pes> { |
2512 protected: | 2512 protected: |
2513 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} | 2513 OcclusionTrackerTestSurfaceChildOfSurface(bool opaqueLayers) : OcclusionTrac
kerTest<Types>(opaqueLayers) {} |
2514 void runMyTest() | 2514 void runMyTest() |
2515 { | 2515 { |
2516 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2516 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
2517 | 2517 |
2518 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 2518 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2519 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2519 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2520 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 10), gfx::Size(100, 50), true); | 2520 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 10), gfx::Size(100, 50), true); |
2521 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true); | 2521 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
2522 this->calcDrawEtc(parent); | 2522 this->calcDrawEtc(parent); |
2523 | 2523 |
2524 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); | 2524 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(-100, -100, 1000, 1000)); |
2525 | 2525 |
2526 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2526 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
2527 this->visitLayer(topmost, occlusion); | 2527 this->visitLayer(topmost, occlusion); |
2528 | 2528 |
2529 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac
e().bounds()); | 2529 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInScreenSpac
e().bounds()); |
2530 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2530 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); | 2531 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 50), occlusion.occlusionInTargetSurf
ace().bounds()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2567 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); | 2567 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); |
2568 | 2568 |
2569 template<class Types> | 2569 template<class Types> |
2570 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr
ackerTest<Types> { | 2570 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr
ackerTest<Types> { |
2571 protected: | 2571 protected: |
2572 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O
cclusionTrackerTest<Types>(opaqueLayers) {} | 2572 OcclusionTrackerTestTopmostSurfaceIsClippedToViewport(bool opaqueLayers) : O
cclusionTrackerTest<Types>(opaqueLayers) {} |
2573 void runMyTest() | 2573 void runMyTest() |
2574 { | 2574 { |
2575 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. | 2575 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. |
2576 | 2576 |
2577 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(100, 200)); | 2577 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 200)); |
2578 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 300), true); | 2578 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
2579 this->calcDrawEtc(parent); | 2579 this->calcDrawEtc(parent); |
2580 | 2580 |
2581 { | 2581 { |
2582 // Make a viewport rect that is larger than the root layer. | 2582 // Make a viewport rect that is larger than the root layer. |
2583 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2583 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2584 | 2584 |
2585 this->visitLayer(surface, occlusion); | 2585 this->visitLayer(surface, occlusion); |
2586 | 2586 |
2587 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. | 2587 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. |
2588 this->enterContributingSurface(surface, occlusion); | 2588 this->enterContributingSurface(surface, occlusion); |
(...skipping 18 matching lines...) Expand all Loading... |
2607 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport)
; | 2607 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport)
; |
2608 | 2608 |
2609 template<class Types> | 2609 template<class Types> |
2610 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke
rTest<Types> { | 2610 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke
rTest<Types> { |
2611 protected: | 2611 protected: |
2612 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 2612 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
2613 void runMyTest() | 2613 void runMyTest() |
2614 { | 2614 { |
2615 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2615 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
2616 | 2616 |
2617 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(80, 200)); | 2617 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(80, 200)); |
2618 parent->setMasksToBounds(true); | 2618 parent->setMasksToBounds(true); |
2619 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), true); | 2619 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
2620 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 100), false); | 2620 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
2621 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), gfx::Size(100, 50), true); | 2621 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
2622 this->calcDrawEtc(parent); | 2622 this->calcDrawEtc(parent); |
2623 | 2623 |
2624 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2624 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2625 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2625 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
2626 | 2626 |
2627 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2627 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
2628 this->visitLayer(topmost, occlusion); | 2628 this->visitLayer(topmost, occlusion); |
2629 | 2629 |
2630 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); | 2630 EXPECT_RECT_EQ(gfx::Rect(0, 0, 80, 50), occlusion.occlusionInScreenSpace
().bounds()); |
2631 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2631 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2663 protected: | 2663 protected: |
2664 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa
yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2664 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter(bool opaqueLa
yers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2665 void runMyTest() | 2665 void runMyTest() |
2666 { | 2666 { |
2667 WebTransformationMatrix scaleByHalf; | 2667 WebTransformationMatrix scaleByHalf; |
2668 scaleByHalf.scale(0.5); | 2668 scaleByHalf.scale(0.5); |
2669 | 2669 |
2670 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2670 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
2671 // 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 | 2671 // 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 |
2672 // appears at 50, 50 and the replica at 200, 50. | 2672 // appears at 50, 50 and the replica at 200, 50. |
2673 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150)); | 2673 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2674 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false); | 2674 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
2675 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), gfx::Size()); | 2675 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2676 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true); | 2676 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
2677 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true); | 2677 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
2678 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true); | 2678 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
2679 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true); | 2679 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
2680 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true); | 2680 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
2681 | 2681 |
2682 // Filters make the layer own a surface. | 2682 // Filters make the layer own a surface. |
2683 WebFilterOperations filters; | 2683 WebFilterOperations filters; |
2684 filters.append(WebFilterOperation::createBlurFilter(10)); | 2684 filters.append(WebFilterOperation::createBlurFilter(10)); |
2685 filteredSurface->setBackgroundFilters(filters); | 2685 filteredSurface->setBackgroundFilters(filters); |
2686 | 2686 |
2687 // Save the distance of influence for the blur effect. | 2687 // Save the distance of influence for the blur effect. |
2688 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2688 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2689 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2689 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2690 | 2690 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2783 template<class Types> | 2783 template<class Types> |
2784 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl
usionTrackerTest<Types> { | 2784 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl
usionTrackerTest<Types> { |
2785 protected: | 2785 protected: |
2786 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2786 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2787 void runMyTest() | 2787 void runMyTest() |
2788 { | 2788 { |
2789 WebTransformationMatrix scaleByHalf; | 2789 WebTransformationMatrix scaleByHalf; |
2790 scaleByHalf.scale(0.5); | 2790 scaleByHalf.scale(0.5); |
2791 | 2791 |
2792 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2792 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
2793 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, FloatPoint(0, 0), gfx::Size(75, 75)); | 2793 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); |
2794 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, FloatPoint(0, 0), gfx::Size(150, 150)); | 2794 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); |
2795 parent->setMasksToBounds(true); | 2795 parent->setMasksToBounds(true); |
2796 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false); | 2796 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2797 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), gfx::Size(300, 300), false); | 2797 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
2798 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, FloatPoint(100, 100), gfx::Size(50, 50), true); | 2798 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); |
2799 | 2799 |
2800 // Filters make the layers own surfaces. | 2800 // Filters make the layers own surfaces. |
2801 WebFilterOperations filters; | 2801 WebFilterOperations filters; |
2802 filters.append(WebFilterOperation::createBlurFilter(1)); | 2802 filters.append(WebFilterOperation::createBlurFilter(1)); |
2803 filteredSurface1->setBackgroundFilters(filters); | 2803 filteredSurface1->setBackgroundFilters(filters); |
2804 filteredSurface2->setBackgroundFilters(filters); | 2804 filteredSurface2->setBackgroundFilters(filters); |
2805 | 2805 |
2806 // Save the distance of influence for the blur effect. | 2806 // Save the distance of influence for the blur effect. |
2807 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2807 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2808 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2808 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
(...skipping 28 matching lines...) Expand all Loading... |
2837 | 2837 |
2838 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio
nTwice); | 2838 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio
nTwice); |
2839 | 2839 |
2840 template<class Types> | 2840 template<class Types> |
2841 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { | 2841 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { |
2842 protected: | 2842 protected: |
2843 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2843 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2844 void runMyTest() | 2844 void runMyTest() |
2845 { | 2845 { |
2846 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2846 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
2847 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150)); | 2847 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2848 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for | 2848 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for |
2849 // the background filter. | 2849 // the background filter. |
2850 typename Types::LayerType* clippingSurface = this->createSurface(parent,
this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 70)); | 2850 typename Types::LayerType* clippingSurface = this->createSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 70)); |
2851 clippingSurface->setMasksToBounds(true); | 2851 clippingSurface->setMasksToBounds(true); |
2852 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), fals
e); | 2852 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), fal
se); |
2853 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(150, 0), gfx::Size()); | 2853 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(150, 0), gfx::Size()); |
2854 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), gfx::Size(300, 50), true); | 2854 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
2855 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), gfx::Size(300, 50), true); | 2855 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
2856 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), gfx::Size(50, 50), true); | 2856 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
2857 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), gfx::Size(100, 50), true); | 2857 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
2858 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), gfx::Size(50, 50), true); | 2858 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
2859 | 2859 |
2860 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. | 2860 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. |
2861 WebFilterOperations filters; | 2861 WebFilterOperations filters; |
2862 filters.append(WebFilterOperation::createBlurFilter(12)); | 2862 filters.append(WebFilterOperation::createBlurFilter(12)); |
2863 filteredSurface->setBackgroundFilters(filters); | 2863 filteredSurface->setBackgroundFilters(filters); |
2864 | 2864 |
2865 // Save the distance of influence for the blur effect. | 2865 // Save the distance of influence for the blur effect. |
2866 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2866 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
2867 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2867 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
2868 | 2868 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 protected: | 2964 protected: |
2965 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2965 OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
2966 void runMyTest() | 2966 void runMyTest() |
2967 { | 2967 { |
2968 WebTransformationMatrix scaleByHalf; | 2968 WebTransformationMatrix scaleByHalf; |
2969 scaleByHalf.scale(0.5); | 2969 scaleByHalf.scale(0.5); |
2970 | 2970 |
2971 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. | 2971 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. |
2972 // 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 | 2972 // 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 |
2973 // appears at 50, 50 and the replica at 200, 50. | 2973 // appears at 50, 50 and the replica at 200, 50. |
2974 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150)); | 2974 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
2975 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(60, 60), gfx::Size(30, 30), true); | 2975 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); |
2976 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(210, 60), gfx::Size(30, 30), true); | 2976 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); |
2977 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false); | 2977 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
2978 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), gfx::Size()); | 2978 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
2979 | 2979 |
2980 // Filters make the layer own a surface. | 2980 // Filters make the layer own a surface. |
2981 WebFilterOperations filters; | 2981 WebFilterOperations filters; |
2982 filters.append(WebFilterOperation::createBlurFilter(3)); | 2982 filters.append(WebFilterOperation::createBlurFilter(3)); |
2983 filteredSurface->setBackgroundFilters(filters); | 2983 filteredSurface->setBackgroundFilters(filters); |
2984 | 2984 |
2985 this->calcDrawEtc(parent); | 2985 this->calcDrawEtc(parent); |
2986 | 2986 |
2987 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2987 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
2988 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 2988 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 25 matching lines...) Expand all Loading... |
3014 protected: | 3014 protected: |
3015 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 3015 OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded(bool opa
queLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
3016 void runMyTest() | 3016 void runMyTest() |
3017 { | 3017 { |
3018 WebTransformationMatrix scaleByHalf; | 3018 WebTransformationMatrix scaleByHalf; |
3019 scaleByHalf.scale(0.5); | 3019 scaleByHalf.scale(0.5); |
3020 | 3020 |
3021 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. | 3021 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. |
3022 // 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 | 3022 // 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 |
3023 // appears at 50, 50 and the replica at 200, 50. | 3023 // appears at 50, 50 and the replica at 200, 50. |
3024 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150)); | 3024 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
3025 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false); | 3025 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
3026 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), gfx::Size()); | 3026 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
3027 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(50, 50), gfx::Size(50, 50), true); | 3027 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); |
3028 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(50, 50), true); | 3028 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); |
3029 | 3029 |
3030 // Filters make the layer own a surface. | 3030 // Filters make the layer own a surface. |
3031 WebFilterOperations filters; | 3031 WebFilterOperations filters; |
3032 filters.append(WebFilterOperation::createBlurFilter(3)); | 3032 filters.append(WebFilterOperation::createBlurFilter(3)); |
3033 filteredSurface->setBackgroundFilters(filters); | 3033 filteredSurface->setBackgroundFilters(filters); |
3034 | 3034 |
3035 this->calcDrawEtc(parent); | 3035 this->calcDrawEtc(parent); |
3036 | 3036 |
3037 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 3037 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
3038 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 3038 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
(...skipping 24 matching lines...) Expand all Loading... |
3063 protected: | 3063 protected: |
3064 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 3064 OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded(b
ool opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
3065 void runMyTest() | 3065 void runMyTest() |
3066 { | 3066 { |
3067 WebTransformationMatrix scaleByHalf; | 3067 WebTransformationMatrix scaleByHalf; |
3068 scaleByHalf.scale(0.5); | 3068 scaleByHalf.scale(0.5); |
3069 | 3069 |
3070 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. | 3070 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. |
3071 // 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 | 3071 // 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 |
3072 // appears at 50, 50 and the replica at 200, 50. | 3072 // appears at 50, 50 and the replica at 200, 50. |
3073 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(300, 150)); | 3073 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
3074 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), gfx::Size(100, 100), false); | 3074 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
3075 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), gfx::Size()); | 3075 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
3076 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(70, 50), gfx::Size(30, 50), true); | 3076 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); |
3077 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), gfx::Size(30, 50), true); | 3077 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); |
3078 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(90, 40), gfx::Size(10, 10), true); | 3078 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); |
3079 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(200, 40), gfx::Size(10, 10), true); | 3079 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(200, 40), gfx::Size(10, 10), true); |
3080 | 3080 |
3081 // Filters make the layer own a surface. | 3081 // Filters make the layer own a surface. |
3082 WebFilterOperations filters; | 3082 WebFilterOperations filters; |
3083 filters.append(WebFilterOperation::createBlurFilter(3)); | 3083 filters.append(WebFilterOperation::createBlurFilter(3)); |
3084 filteredSurface->setBackgroundFilters(filters); | 3084 filteredSurface->setBackgroundFilters(filters); |
3085 | 3085 |
3086 // Save the distance of influence for the blur effect. | 3086 // Save the distance of influence for the blur effect. |
3087 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 3087 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
3088 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 3088 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
3089 | 3089 |
(...skipping 14 matching lines...) Expand all Loading... |
3104 // The filter in the surface and replica are partially unoccluded. Only
the unoccluded parts should reduce occlusion. | 3104 // The filter in the surface and replica are partially unoccluded. Only
the unoccluded parts should reduce occlusion. |
3105 // This means it will push back the occlusion that touches the unocclude
d part (occlusionAbove___), but it will not | 3105 // This means it will push back the occlusion that touches the unocclude
d part (occlusionAbove___), but it will not |
3106 // touch occlusionBeside____ since that is not beside the unoccluded par
t of the surface, even though it is beside | 3106 // touch occlusionBeside____ since that is not beside the unoccluded par
t of the surface, even though it is beside |
3107 // the occluded part of the surface. | 3107 // the occluded part of the surface. |
3108 gfx::Rect occlusionAboveSurface = gfx::Rect(70 + outsetRight, 50, 30 - o
utsetRight, 50); | 3108 gfx::Rect occlusionAboveSurface = gfx::Rect(70 + outsetRight, 50, 30 - o
utsetRight, 50); |
3109 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50
); | 3109 gfx::Rect occlusionAboveReplica = gfx::Rect(200, 50, 30 - outsetLeft, 50
); |
3110 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10); | 3110 gfx::Rect occlusionBesideSurface = gfx::Rect(90, 40, 10, 10); |
3111 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10); | 3111 gfx::Rect occlusionBesideReplica = gfx::Rect(200, 40, 10, 10); |
3112 | 3112 |
3113 Region expectedOcclusion; | 3113 Region expectedOcclusion; |
3114 expectedOcclusion.unite(cc::IntRect(occlusionAboveSurface)); | 3114 expectedOcclusion.Union(occlusionAboveSurface); |
3115 expectedOcclusion.unite(cc::IntRect(occlusionAboveReplica)); | 3115 expectedOcclusion.Union(occlusionAboveReplica); |
3116 expectedOcclusion.unite(cc::IntRect(occlusionBesideSurface)); | 3116 expectedOcclusion.Union(occlusionBesideSurface); |
3117 expectedOcclusion.unite(cc::IntRect(occlusionBesideReplica)); | 3117 expectedOcclusion.Union(occlusionBesideReplica); |
3118 | 3118 |
3119 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetS
urface().rects().size()); | 3119 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInTargetS
urface().rects().size()); |
3120 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenS
pace().rects().size()); | 3120 ASSERT_EQ(expectedOcclusion.rects().size(), occlusion.occlusionInScreenS
pace().rects().size()); |
3121 | 3121 |
3122 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { | 3122 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { |
3123 cc::IntRect expectedRect = expectedOcclusion.rects()[i]; | 3123 cc::IntRect expectedRect = expectedOcclusion.rects()[i]; |
3124 cc::IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[
i]; | 3124 cc::IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[
i]; |
3125 cc::IntRect targetRect = occlusion.occlusionInTargetSurface().rects(
)[i]; | 3125 cc::IntRect targetRect = occlusion.occlusionInTargetSurface().rects(
)[i]; |
3126 EXPECT_EQ(expectedRect, screenRect); | 3126 EXPECT_EQ(expectedRect, screenRect); |
3127 EXPECT_EQ(expectedRect, targetRect); | 3127 EXPECT_EQ(expectedRect, targetRect); |
3128 } | 3128 } |
3129 } | 3129 } |
3130 }; | 3130 }; |
3131 | 3131 |
3132 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte
rIsPartiallyOccluded); | 3132 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte
rIsPartiallyOccluded); |
3133 | 3133 |
3134 template<class Types> | 3134 template<class Types> |
3135 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type
s> { | 3135 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type
s> { |
3136 protected: | 3136 protected: |
3137 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 3137 OcclusionTrackerTestMinimumTrackingSize(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
3138 void runMyTest() | 3138 void runMyTest() |
3139 { | 3139 { |
3140 gfx::Size trackingSize(100, 100); | 3140 gfx::Size trackingSize(100, 100); |
3141 gfx::Size belowTrackingSize(99, 99); | 3141 gfx::Size belowTrackingSize(99, 99); |
3142 | 3142 |
3143 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), gfx::Size(400, 400)); | 3143 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); |
3144 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), trackingSize, true); | 3144 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), trackingSize, true); |
3145 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); | 3145 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, gfx::PointF(0, 0), belowTrackingSize, true); |
3146 this->calcDrawEtc(parent); | 3146 this->calcDrawEtc(parent); |
3147 | 3147 |
3148 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 3148 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
3149 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); | 3149 occlusion.setLayerClipRect(gfx::Rect(0, 0, 1000, 1000)); |
3150 occlusion.setMinimumTrackingSize(trackingSize); | 3150 occlusion.setMinimumTrackingSize(trackingSize); |
3151 | 3151 |
3152 // The small layer is not tracked because it is too small. | 3152 // The small layer is not tracked because it is too small. |
3153 this->visitLayer(small, occlusion); | 3153 this->visitLayer(small, occlusion); |
3154 | 3154 |
3155 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; | 3155 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInScreenSpace().bounds())
; |
3156 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 3156 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
3157 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); | 3157 EXPECT_RECT_EQ(gfx::Rect(), occlusion.occlusionInTargetSurface().bounds(
)); |
3158 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 3158 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
3159 | 3159 |
3160 // The large layer is tracked as it is large enough. | 3160 // The large layer is tracked as it is large enough. |
3161 this->visitLayer(large, occlusion); | 3161 this->visitLayer(large, occlusion); |
3162 | 3162 |
3163 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInScreenSpace().bounds()); | 3163 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInScreenSpace().bounds()); |
3164 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 3164 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
3165 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInTargetSurface().bounds()); | 3165 EXPECT_RECT_EQ(gfx::Rect(gfx::Point(), trackingSize), occlusion.occlusio
nInTargetSurface().bounds()); |
3166 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 3166 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
3167 } | 3167 } |
3168 }; | 3168 }; |
3169 | 3169 |
3170 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); | 3170 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
3171 | 3171 |
3172 } // namespace | 3172 } // namespace |
OLD | NEW |