| 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 "CCOcclusionTracker.h" | 7 #include "CCOcclusionTracker.h" |
| 8 | 8 |
| 9 #include "CCLayerAnimationController.h" | 9 #include "CCLayerAnimationController.h" |
| 10 #include "CCLayerImpl.h" | 10 #include "CCLayerImpl.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include <public/WebFilterOperation.h> | 22 #include <public/WebFilterOperation.h> |
| 23 #include <public/WebFilterOperations.h> | 23 #include <public/WebFilterOperations.h> |
| 24 #include <public/WebTransformationMatrix.h> | 24 #include <public/WebTransformationMatrix.h> |
| 25 | 25 |
| 26 using namespace cc; | 26 using namespace cc; |
| 27 using namespace WebKit; | 27 using namespace WebKit; |
| 28 using namespace WebKitTests; | 28 using namespace WebKitTests; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 class TestContentLayerChromium : public LayerChromium { | 32 class TestContentLayer : public Layer { |
| 33 public: | 33 public: |
| 34 TestContentLayerChromium() | 34 TestContentLayer() |
| 35 : LayerChromium() | 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 intersection(m_opaqueContentsRect, visibleContentRect()); | 44 return intersection(m_opaqueContentsRect, visibleContentRect()); |
| 45 return LayerChromium::visibleContentOpaqueRegion(); | 45 return Layer::visibleContentOpaqueRegion(); |
| 46 } | 46 } |
| 47 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) | 47 void setOpaqueContentsRect(const IntRect& 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 ~TestContentLayerChromium() | 54 virtual ~TestContentLayer() |
| 55 { | 55 { |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool m_overrideOpaqueContentsRect; | 58 bool m_overrideOpaqueContentsRect; |
| 59 IntRect m_opaqueContentsRect; | 59 IntRect m_opaqueContentsRect; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class TestContentLayerImpl : public CCLayerImpl { | 62 class TestContentLayerImpl : public LayerImpl { |
| 63 public: | 63 public: |
| 64 TestContentLayerImpl(int id) | 64 TestContentLayerImpl(int id) |
| 65 : CCLayerImpl(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 intersection(m_opaqueContentsRect, visibleContentRect()); | 74 return intersection(m_opaqueContentsRect, visibleContentRect()); |
| 75 return CCLayerImpl::visibleContentOpaqueRegion(); | 75 return LayerImpl::visibleContentOpaqueRegion(); |
| 76 } | 76 } |
| 77 void setOpaqueContentsRect(const IntRect& opaqueContentsRect) | 77 void setOpaqueContentsRect(const IntRect& 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; |
| 85 IntRect m_opaqueContentsRect; | 85 IntRect m_opaqueContentsRect; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 template<typename LayerType, typename RenderSurfaceType> | 88 template<typename LayerType, typename RenderSurfaceType> |
| 89 class TestCCOcclusionTrackerWithClip : public TestCCOcclusionTrackerBase<LayerTy
pe, RenderSurfaceType> { | 89 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
RenderSurfaceType> { |
| 90 public: | 90 public: |
| 91 TestCCOcclusionTrackerWithClip(IntRect viewportRect, bool recordMetricsForFr
ame = false) | 91 TestOcclusionTrackerWithClip(IntRect viewportRect, bool recordMetricsForFram
e = false) |
| 92 : TestCCOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect,
recordMetricsForFrame) | 92 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r
ecordMetricsForFrame) |
| 93 , m_overrideLayerClipRect(false) | 93 , m_overrideLayerClipRect(false) |
| 94 { | 94 { |
| 95 } | 95 } |
| 96 | 96 |
| 97 void setLayerClipRect(const IntRect& rect) { m_overrideLayerClipRect = true;
m_layerClipRect = rect;} | 97 void setLayerClipRect(const IntRect& rect) { m_overrideLayerClipRect = true;
m_layerClipRect = rect;} |
| 98 void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; } | 98 void useDefaultLayerClipRect() { m_overrideLayerClipRect = false; } |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 virtual IntRect layerClipRectInTarget(const LayerType* layer) const { return
m_overrideLayerClipRect ? m_layerClipRect : CCOcclusionTrackerBase<LayerType, R
enderSurfaceType>::layerClipRectInTarget(layer); } | 101 virtual IntRect layerClipRectInTarget(const LayerType* layer) const { return
m_overrideLayerClipRect ? m_layerClipRect : OcclusionTrackerBase<LayerType, Ren
derSurfaceType>::layerClipRectInTarget(layer); } |
| 102 | 102 |
| 103 private: | 103 private: |
| 104 bool m_overrideLayerClipRect; | 104 bool m_overrideLayerClipRect; |
| 105 IntRect m_layerClipRect; | 105 IntRect m_layerClipRect; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 struct CCOcclusionTrackerTestMainThreadTypes { | 108 struct OcclusionTrackerTestMainThreadTypes { |
| 109 typedef LayerChromium LayerType; | 109 typedef Layer LayerType; |
| 110 typedef RenderSurfaceChromium RenderSurfaceType; | 110 typedef RenderSurface RenderSurfaceType; |
| 111 typedef TestContentLayerChromium ContentLayerType; | 111 typedef TestContentLayer ContentLayerType; |
| 112 typedef scoped_refptr<LayerChromium> LayerPtrType; | 112 typedef scoped_refptr<Layer> LayerPtrType; |
| 113 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 113 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
| 114 typedef CCLayerIterator<LayerChromium, std::vector<scoped_refptr<LayerChromi
um> >, RenderSurfaceChromium, CCLayerIteratorActions::FrontToBack> LayerIterator
; | 114 typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurfa
ce, LayerIteratorActions::FrontToBack> LayerIterator; |
| 115 typedef CCOcclusionTracker OcclusionTrackerType; | 115 typedef OcclusionTracker OcclusionTrackerType; |
| 116 | 116 |
| 117 static LayerPtrType createLayer() | 117 static LayerPtrType createLayer() |
| 118 { | 118 { |
| 119 return LayerChromium::create(); | 119 return Layer::create(); |
| 120 } | 120 } |
| 121 static ContentLayerPtrType createContentLayer() { return make_scoped_refptr(
new ContentLayerType()); } | 121 static ContentLayerPtrType createContentLayer() { return make_scoped_refptr(
new ContentLayerType()); } |
| 122 | 122 |
| 123 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) | 123 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) |
| 124 { | 124 { |
| 125 return layer.release(); | 125 return layer.release(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 static LayerPtrType passLayerPtr(LayerPtrType& layer) | 128 static LayerPtrType passLayerPtr(LayerPtrType& layer) |
| 129 { | 129 { |
| 130 return layer.release(); | 130 return layer.release(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 static void destroyLayer(LayerPtrType& layer) | 133 static void destroyLayer(LayerPtrType& layer) |
| 134 { | 134 { |
| 135 layer = NULL; | 135 layer = NULL; |
| 136 } | 136 } |
| 137 }; | 137 }; |
| 138 | 138 |
| 139 struct CCOcclusionTrackerTestImplThreadTypes { | 139 struct OcclusionTrackerTestImplThreadTypes { |
| 140 typedef CCLayerImpl LayerType; | 140 typedef LayerImpl LayerType; |
| 141 typedef CCRenderSurface RenderSurfaceType; | 141 typedef RenderSurfaceImpl RenderSurfaceType; |
| 142 typedef TestContentLayerImpl ContentLayerType; | 142 typedef TestContentLayerImpl ContentLayerType; |
| 143 typedef scoped_ptr<CCLayerImpl> LayerPtrType; | 143 typedef scoped_ptr<LayerImpl> LayerPtrType; |
| 144 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; | 144 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; |
| 145 typedef CCLayerIterator<CCLayerImpl, std::vector<CCLayerImpl*>, CCRenderSurf
ace, CCLayerIteratorActions::FrontToBack> LayerIterator; | 145 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> LayerIterator; |
| 146 typedef CCOcclusionTrackerImpl OcclusionTrackerType; | 146 typedef OcclusionTrackerImpl OcclusionTrackerType; |
| 147 | 147 |
| 148 static LayerPtrType createLayer() { return CCLayerImpl::create(nextCCLayerIm
plId++); } | 148 static LayerPtrType createLayer() { return LayerImpl::create(nextLayerImplId
++); } |
| 149 static ContentLayerPtrType createContentLayer() { return make_scoped_ptr(new
ContentLayerType(nextCCLayerImplId++)); } | 149 static ContentLayerPtrType createContentLayer() { return make_scoped_ptr(new
ContentLayerType(nextLayerImplId++)); } |
| 150 static int nextCCLayerImplId; | 150 static int nextLayerImplId; |
| 151 | 151 |
| 152 static LayerPtrType passLayerPtr(LayerPtrType& layer) | 152 static LayerPtrType passLayerPtr(LayerPtrType& layer) |
| 153 { | 153 { |
| 154 return layer.Pass(); | 154 return layer.Pass(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) | 157 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) |
| 158 { | 158 { |
| 159 return layer.PassAs<LayerType>(); | 159 return layer.PassAs<LayerType>(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 static void destroyLayer(LayerPtrType& layer) | 162 static void destroyLayer(LayerPtrType& layer) |
| 163 { | 163 { |
| 164 layer.reset(); | 164 layer.reset(); |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 int CCOcclusionTrackerTestImplThreadTypes::nextCCLayerImplId = 1; | 168 int OcclusionTrackerTestImplThreadTypes::nextLayerImplId = 1; |
| 169 | 169 |
| 170 template<typename Types, bool opaqueLayers> | 170 template<typename Types, bool opaqueLayers> |
| 171 class CCOcclusionTrackerTest : public testing::Test { | 171 class OcclusionTrackerTest : public testing::Test { |
| 172 protected: | 172 protected: |
| 173 CCOcclusionTrackerTest() | 173 OcclusionTrackerTest() |
| 174 : testing::Test() | 174 : testing::Test() |
| 175 { } | 175 { } |
| 176 | 176 |
| 177 virtual void runMyTest() = 0; | 177 virtual void runMyTest() = 0; |
| 178 | 178 |
| 179 virtual void TearDown() | 179 virtual void TearDown() |
| 180 { | 180 { |
| 181 Types::destroyLayer(m_root); | 181 Types::destroyLayer(m_root); |
| 182 m_renderSurfaceLayerListChromium.clear(); | 182 m_renderSurfaceLayerList.clear(); |
| 183 m_renderSurfaceLayerListImpl.clear(); | 183 m_renderSurfaceLayerListImpl.clear(); |
| 184 m_replicaLayers.clear(); | 184 m_replicaLayers.clear(); |
| 185 m_maskLayers.clear(); | 185 m_maskLayers.clear(); |
| 186 CCLayerTreeHost::setNeedsFilterContext(false); | 186 LayerTreeHost::setNeedsFilterContext(false); |
| 187 } | 187 } |
| 188 | 188 |
| 189 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix&
transform, const FloatPoint& position, const IntSize& bounds) | 189 typename Types::ContentLayerType* createRoot(const WebTransformationMatrix&
transform, const FloatPoint& position, const IntSize& bounds) |
| 190 { | 190 { |
| 191 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); | 191 typename Types::ContentLayerPtrType layer(Types::createContentLayer()); |
| 192 typename Types::ContentLayerType* layerPtr = layer.get(); | 192 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 193 setProperties(layerPtr, transform, position, bounds); | 193 setProperties(layerPtr, transform, position, bounds); |
| 194 | 194 |
| 195 ASSERT(!m_root); | 195 ASSERT(!m_root); |
| 196 m_root = Types::passLayerPtr(layer); | 196 m_root = Types::passLayerPtr(layer); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 WebFilterOperations filters; | 259 WebFilterOperations filters; |
| 260 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 260 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
| 261 layer->setFilters(filters); | 261 layer->setFilters(filters); |
| 262 return layer; | 262 return layer; |
| 263 } | 263 } |
| 264 | 264 |
| 265 void calcDrawEtc(TestContentLayerImpl* root) | 265 void calcDrawEtc(TestContentLayerImpl* root) |
| 266 { | 266 { |
| 267 ASSERT(root == m_root.get()); | 267 ASSERT(root == m_root.get()); |
| 268 int dummyMaxTextureSize = 512; | 268 int dummyMaxTextureSize = 512; |
| 269 CCLayerSorter layerSorter; | 269 LayerSorter layerSorter; |
| 270 | 270 |
| 271 ASSERT(!root->renderSurface()); | 271 ASSERT(!root->renderSurface()); |
| 272 | 272 |
| 273 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
&layerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); | 273 LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, &l
ayerSorter, dummyMaxTextureSize, m_renderSurfaceLayerListImpl); |
| 274 | 274 |
| 275 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListImpl); | 275 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListImpl); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void calcDrawEtc(TestContentLayerChromium* root) | 278 void calcDrawEtc(TestContentLayer* root) |
| 279 { | 279 { |
| 280 ASSERT(root == m_root.get()); | 280 ASSERT(root == m_root.get()); |
| 281 int dummyMaxTextureSize = 512; | 281 int dummyMaxTextureSize = 512; |
| 282 | 282 |
| 283 ASSERT(!root->renderSurface()); | 283 ASSERT(!root->renderSurface()); |
| 284 | 284 |
| 285 CCLayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1,
dummyMaxTextureSize, m_renderSurfaceLayerListChromium); | 285 LayerTreeHostCommon::calculateDrawTransforms(root, root->bounds(), 1, du
mmyMaxTextureSize, m_renderSurfaceLayerList); |
| 286 | 286 |
| 287 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerListChromium); | 287 m_layerIterator = m_layerIteratorBegin = Types::LayerIterator::begin(&m_
renderSurfaceLayerList); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) | 290 void enterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) |
| 291 { | 291 { |
| 292 ASSERT_EQ(layer, *m_layerIterator); | 292 ASSERT_EQ(layer, *m_layerIterator); |
| 293 ASSERT_TRUE(m_layerIterator.representsItself()); | 293 ASSERT_TRUE(m_layerIterator.representsItself()); |
| 294 occlusion.enterLayer(m_layerIterator); | 294 occlusion.enterLayer(m_layerIterator); |
| 295 } | 295 } |
| 296 | 296 |
| 297 void leaveLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) | 297 void leaveLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 private: | 343 private: |
| 344 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma
tionMatrix& transform, const FloatPoint& position, const IntSize& bounds) | 344 void setBaseProperties(typename Types::LayerType* layer, const WebTransforma
tionMatrix& transform, const FloatPoint& position, const IntSize& bounds) |
| 345 { | 345 { |
| 346 layer->setTransform(transform); | 346 layer->setTransform(transform); |
| 347 layer->setSublayerTransform(WebTransformationMatrix()); | 347 layer->setSublayerTransform(WebTransformationMatrix()); |
| 348 layer->setAnchorPoint(FloatPoint(0, 0)); | 348 layer->setAnchorPoint(FloatPoint(0, 0)); |
| 349 layer->setPosition(position); | 349 layer->setPosition(position); |
| 350 layer->setBounds(bounds); | 350 layer->setBounds(bounds); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void setProperties(LayerChromium* layer, const WebTransformationMatrix& tran
sform, const FloatPoint& position, const IntSize& bounds) | 353 void setProperties(Layer* layer, const WebTransformationMatrix& transform, c
onst FloatPoint& position, const IntSize& bounds) |
| 354 { | 354 { |
| 355 setBaseProperties(layer, transform, position, bounds); | 355 setBaseProperties(layer, transform, position, bounds); |
| 356 } | 356 } |
| 357 | 357 |
| 358 void setProperties(CCLayerImpl* layer, const WebTransformationMatrix& transf
orm, const FloatPoint& position, const IntSize& bounds) | 358 void setProperties(LayerImpl* layer, const WebTransformationMatrix& transfor
m, const FloatPoint& position, const IntSize& bounds) |
| 359 { | 359 { |
| 360 setBaseProperties(layer, transform, position, bounds); | 360 setBaseProperties(layer, transform, position, bounds); |
| 361 | 361 |
| 362 layer->setContentBounds(layer->bounds()); | 362 layer->setContentBounds(layer->bounds()); |
| 363 } | 363 } |
| 364 | 364 |
| 365 void setReplica(LayerChromium* owningLayer, scoped_refptr<LayerChromium> lay
er) | 365 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) |
| 366 { | 366 { |
| 367 owningLayer->setReplicaLayer(layer.get()); | 367 owningLayer->setReplicaLayer(layer.get()); |
| 368 m_replicaLayers.push_back(layer); | 368 m_replicaLayers.push_back(layer); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void setReplica(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) | 371 void setReplica(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) |
| 372 { | 372 { |
| 373 owningLayer->setReplicaLayer(layer.Pass()); | 373 owningLayer->setReplicaLayer(layer.Pass()); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void setMask(LayerChromium* owningLayer, scoped_refptr<LayerChromium> layer) | 376 void setMask(Layer* owningLayer, scoped_refptr<Layer> layer) |
| 377 { | 377 { |
| 378 owningLayer->setMaskLayer(layer.get()); | 378 owningLayer->setMaskLayer(layer.get()); |
| 379 m_maskLayers.push_back(layer); | 379 m_maskLayers.push_back(layer); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void setMask(CCLayerImpl* owningLayer, scoped_ptr<CCLayerImpl> layer) | 382 void setMask(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) |
| 383 { | 383 { |
| 384 owningLayer->setMaskLayer(layer.Pass()); | 384 owningLayer->setMaskLayer(layer.Pass()); |
| 385 } | 385 } |
| 386 | 386 |
| 387 // These hold ownership of the layers for the duration of the test. | 387 // These hold ownership of the layers for the duration of the test. |
| 388 typename Types::LayerPtrType m_root; | 388 typename Types::LayerPtrType m_root; |
| 389 std::vector<scoped_refptr<LayerChromium> > m_renderSurfaceLayerListChromium; | 389 std::vector<scoped_refptr<Layer> > m_renderSurfaceLayerList; |
| 390 std::vector<CCLayerImpl*> m_renderSurfaceLayerListImpl; | 390 std::vector<LayerImpl*> m_renderSurfaceLayerListImpl; |
| 391 typename Types::LayerIterator m_layerIteratorBegin; | 391 typename Types::LayerIterator m_layerIteratorBegin; |
| 392 typename Types::LayerIterator m_layerIterator; | 392 typename Types::LayerIterator m_layerIterator; |
| 393 typename Types::LayerType* m_lastLayerVisited; | 393 typename Types::LayerType* m_lastLayerVisited; |
| 394 std::vector<scoped_refptr<LayerChromium> > m_replicaLayers; | 394 std::vector<scoped_refptr<Layer> > m_replicaLayers; |
| 395 std::vector<scoped_refptr<LayerChromium> > m_maskLayers; | 395 std::vector<scoped_refptr<Layer> > m_maskLayers; |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 398 #define RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 399 class ClassName##MainThreadOpaqueLayers : public ClassName<CCOcclusionTracke
rTestMainThreadTypes, true> { \ | 399 class ClassName##MainThreadOpaqueLayers : public ClassName<OcclusionTrackerT
estMainThreadTypes, true> { \ |
| 400 public: \ | 400 public: \ |
| 401 ClassName##MainThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestMa
inThreadTypes, true>() { } \ | 401 ClassName##MainThreadOpaqueLayers() : ClassName<OcclusionTrackerTestMain
ThreadTypes, true>() { } \ |
| 402 }; \ | 402 }; \ |
| 403 TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); } | 403 TEST_F(ClassName##MainThreadOpaqueLayers, runTest) { runMyTest(); } |
| 404 #define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ | 404 #define RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ |
| 405 class ClassName##MainThreadOpaquePaints : public ClassName<CCOcclusionTracke
rTestMainThreadTypes, false> { \ | 405 class ClassName##MainThreadOpaquePaints : public ClassName<OcclusionTrackerT
estMainThreadTypes, false> { \ |
| 406 public: \ | 406 public: \ |
| 407 ClassName##MainThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestMa
inThreadTypes, false>() { } \ | 407 ClassName##MainThreadOpaquePaints() : ClassName<OcclusionTrackerTestMain
ThreadTypes, false>() { } \ |
| 408 }; \ | 408 }; \ |
| 409 TEST_F(ClassName##MainThreadOpaquePaints, runTest) { runMyTest(); } | 409 TEST_F(ClassName##MainThreadOpaquePaints, runTest) { runMyTest(); } |
| 410 | 410 |
| 411 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ | 411 #define RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 412 class ClassName##ImplThreadOpaqueLayers : public ClassName<CCOcclusionTracke
rTestImplThreadTypes, true> { \ | 412 class ClassName##ImplThreadOpaqueLayers : public ClassName<OcclusionTrackerT
estImplThreadTypes, true> { \ |
| 413 DebugScopedSetImplThread impl; \ | 413 DebugScopedSetImplThread impl; \ |
| 414 public: \ | 414 public: \ |
| 415 ClassName##ImplThreadOpaqueLayers() : ClassName<CCOcclusionTrackerTestIm
plThreadTypes, true>() { } \ | 415 ClassName##ImplThreadOpaqueLayers() : ClassName<OcclusionTrackerTestImpl
ThreadTypes, true>() { } \ |
| 416 }; \ | 416 }; \ |
| 417 TEST_F(ClassName##ImplThreadOpaqueLayers, runTest) { runMyTest(); } | 417 TEST_F(ClassName##ImplThreadOpaqueLayers, runTest) { runMyTest(); } |
| 418 #define RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) \ | 418 #define RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) \ |
| 419 class ClassName##ImplThreadOpaquePaints : public ClassName<CCOcclusionTracke
rTestImplThreadTypes, false> { \ | 419 class ClassName##ImplThreadOpaquePaints : public ClassName<OcclusionTrackerT
estImplThreadTypes, false> { \ |
| 420 DebugScopedSetImplThread impl; \ | 420 DebugScopedSetImplThread impl; \ |
| 421 public: \ | 421 public: \ |
| 422 ClassName##ImplThreadOpaquePaints() : ClassName<CCOcclusionTrackerTestIm
plThreadTypes, false>() { } \ | 422 ClassName##ImplThreadOpaquePaints() : ClassName<OcclusionTrackerTestImpl
ThreadTypes, false>() { } \ |
| 423 }; \ | 423 }; \ |
| 424 TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); } | 424 TEST_F(ClassName##ImplThreadOpaquePaints, runTest) { runMyTest(); } |
| 425 | 425 |
| 426 #define ALL_CCOCCLUSIONTRACKER_TEST(ClassName) \ | 426 #define ALL_OCCLUSIONTRACKER_TEST(ClassName) \ |
| 427 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 427 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 428 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ | 428 RUN_TEST_MAIN_THREAD_OPAQUE_PAINTS(ClassName) \ |
| 429 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ | 429 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 430 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) | 430 RUN_TEST_IMPL_THREAD_OPAQUE_PAINTS(ClassName) |
| 431 | 431 |
| 432 #define MAIN_THREAD_TEST(ClassName) \ | 432 #define MAIN_THREAD_TEST(ClassName) \ |
| 433 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) | 433 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) |
| 434 | 434 |
| 435 #define IMPL_THREAD_TEST(ClassName) \ | 435 #define IMPL_THREAD_TEST(ClassName) \ |
| 436 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) | 436 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) |
| 437 | 437 |
| 438 #define MAIN_AND_IMPL_THREAD_TEST(ClassName) \ | 438 #define MAIN_AND_IMPL_THREAD_TEST(ClassName) \ |
| 439 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ | 439 RUN_TEST_MAIN_THREAD_OPAQUE_LAYERS(ClassName) \ |
| 440 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) | 440 RUN_TEST_IMPL_THREAD_OPAQUE_LAYERS(ClassName) |
| 441 | 441 |
| 442 template<class Types, bool opaqueLayers> | 442 template<class Types, bool opaqueLayers> |
| 443 class CCOcclusionTrackerTestIdentityTransforms : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { | 443 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types
, opaqueLayers> { |
| 444 protected: | 444 protected: |
| 445 void runMyTest() | 445 void runMyTest() |
| 446 { | 446 { |
| 447 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 447 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 448 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); | 448 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(30, 30), IntSize(500, 500), true); |
| 449 this->calcDrawEtc(parent); | 449 this->calcDrawEtc(parent); |
| 450 | 450 |
| 451 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 451 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 452 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 452 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 453 | 453 |
| 454 this->visitLayer(layer, occlusion); | 454 this->visitLayer(layer, occlusion); |
| 455 this->enterLayer(parent, occlusion); | 455 this->enterLayer(parent, occlusion); |
| 456 | 456 |
| 457 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); | 457 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 458 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 458 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 459 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); | 459 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 460 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 460 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 461 | 461 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 478 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); | 478 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); |
| 479 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); | 479 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); |
| 480 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); | 480 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); |
| 481 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); | 481 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); |
| 482 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); | 482 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); |
| 483 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); | 483 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); |
| 484 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); | 484 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); |
| 485 } | 485 } |
| 486 }; | 486 }; |
| 487 | 487 |
| 488 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestIdentityTransforms); | 488 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestIdentityTransforms); |
| 489 | 489 |
| 490 template<class Types, bool opaqueLayers> | 490 template<class Types, bool opaqueLayers> |
| 491 class CCOcclusionTrackerTestRotatedChild : public CCOcclusionTrackerTest<Types,
opaqueLayers> { | 491 class OcclusionTrackerTestRotatedChild : public OcclusionTrackerTest<Types, opaq
ueLayers> { |
| 492 protected: | 492 protected: |
| 493 void runMyTest() | 493 void runMyTest() |
| 494 { | 494 { |
| 495 WebTransformationMatrix layerTransform; | 495 WebTransformationMatrix layerTransform; |
| 496 layerTransform.translate(250, 250); | 496 layerTransform.translate(250, 250); |
| 497 layerTransform.rotate(90); | 497 layerTransform.rotate(90); |
| 498 layerTransform.translate(-250, -250); | 498 layerTransform.translate(-250, -250); |
| 499 | 499 |
| 500 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 500 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 501 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 501 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 502 this->calcDrawEtc(parent); | 502 this->calcDrawEtc(parent); |
| 503 | 503 |
| 504 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 504 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 505 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 505 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 506 | 506 |
| 507 this->visitLayer(layer, occlusion); | 507 this->visitLayer(layer, occlusion); |
| 508 this->enterLayer(parent, occlusion); | 508 this->enterLayer(parent, occlusion); |
| 509 | 509 |
| 510 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); | 510 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 511 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 511 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 512 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); | 512 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 513 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 513 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 514 | 514 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 531 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); | 531 EXPECT_RECT_EQ(IntRect(29, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 29, 70, 70))); |
| 532 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); | 532 EXPECT_RECT_EQ(IntRect(30, 29, 70, 1), occlusion.unoccludedContentRect(p
arent, IntRect(30, 29, 70, 70))); |
| 533 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); | 533 EXPECT_RECT_EQ(IntRect(31, 29, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 29, 70, 70))); |
| 534 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); | 534 EXPECT_RECT_EQ(IntRect(100, 30, 1, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 30, 70, 70))); |
| 535 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); | 535 EXPECT_RECT_EQ(IntRect(31, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(31, 31, 70, 70))); |
| 536 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); | 536 EXPECT_RECT_EQ(IntRect(30, 100, 70, 1), occlusion.unoccludedContentRect(
parent, IntRect(30, 31, 70, 70))); |
| 537 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); | 537 EXPECT_RECT_EQ(IntRect(29, 31, 70, 70), occlusion.unoccludedContentRect(
parent, IntRect(29, 31, 70, 70))); |
| 538 } | 538 } |
| 539 }; | 539 }; |
| 540 | 540 |
| 541 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestRotatedChild); | 541 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestRotatedChild); |
| 542 | 542 |
| 543 template<class Types, bool opaqueLayers> | 543 template<class Types, bool opaqueLayers> |
| 544 class CCOcclusionTrackerTestTranslatedChild : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 544 class OcclusionTrackerTestTranslatedChild : public OcclusionTrackerTest<Types, o
paqueLayers> { |
| 545 protected: | 545 protected: |
| 546 void runMyTest() | 546 void runMyTest() |
| 547 { | 547 { |
| 548 WebTransformationMatrix layerTransform; | 548 WebTransformationMatrix layerTransform; |
| 549 layerTransform.translate(20, 20); | 549 layerTransform.translate(20, 20); |
| 550 | 550 |
| 551 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 551 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 552 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 552 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 553 this->calcDrawEtc(parent); | 553 this->calcDrawEtc(parent); |
| 554 | 554 |
| 555 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 555 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 556 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 556 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 557 | 557 |
| 558 this->visitLayer(layer, occlusion); | 558 this->visitLayer(layer, occlusion); |
| 559 this->enterLayer(parent, occlusion); | 559 this->enterLayer(parent, occlusion); |
| 560 | 560 |
| 561 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); | 561 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 562 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 562 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 563 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 563 EXPECT_RECT_EQ(IntRect(50, 50, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 564 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 564 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 565 | 565 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 594 EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(p
arent, IntRect(50, 49, 50, 50))); | 594 EXPECT_RECT_EQ(IntRect(50, 49, 50, 1), occlusion.unoccludedContentRect(p
arent, IntRect(50, 49, 50, 50))); |
| 595 EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(p
arent, IntRect(51, 49, 50, 50))); | 595 EXPECT_RECT_EQ(IntRect(51, 49, 49, 1), occlusion.unoccludedContentRect(p
arent, IntRect(51, 49, 50, 50))); |
| 596 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50,
50)).isEmpty()); | 596 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 50, 50,
50)).isEmpty()); |
| 597 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50,
50)).isEmpty()); | 597 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(51, 51, 50,
50)).isEmpty()); |
| 598 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50,
50)).isEmpty()); | 598 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(50, 51, 50,
50)).isEmpty()); |
| 599 EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(p
arent, IntRect(49, 51, 50, 50))); | 599 EXPECT_RECT_EQ(IntRect(49, 51, 1, 49), occlusion.unoccludedContentRect(p
arent, IntRect(49, 51, 50, 50))); |
| 600 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 600 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 601 } | 601 } |
| 602 }; | 602 }; |
| 603 | 603 |
| 604 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTranslatedChild); | 604 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTranslatedChild); |
| 605 | 605 |
| 606 template<class Types, bool opaqueLayers> | 606 template<class Types, bool opaqueLayers> |
| 607 class CCOcclusionTrackerTestChildInRotatedChild : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 607 class OcclusionTrackerTestChildInRotatedChild : public OcclusionTrackerTest<Type
s, opaqueLayers> { |
| 608 protected: | 608 protected: |
| 609 void runMyTest() | 609 void runMyTest() |
| 610 { | 610 { |
| 611 WebTransformationMatrix childTransform; | 611 WebTransformationMatrix childTransform; |
| 612 childTransform.translate(250, 250); | 612 childTransform.translate(250, 250); |
| 613 childTransform.rotate(90); | 613 childTransform.rotate(90); |
| 614 childTransform.translate(-250, -250); | 614 childTransform.translate(-250, -250); |
| 615 | 615 |
| 616 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 616 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 617 parent->setMasksToBounds(true); | 617 parent->setMasksToBounds(true); |
| 618 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); | 618 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); |
| 619 child->setMasksToBounds(true); | 619 child->setMasksToBounds(true); |
| 620 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); | 620 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); |
| 621 this->calcDrawEtc(parent); | 621 this->calcDrawEtc(parent); |
| 622 | 622 |
| 623 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 623 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 624 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 624 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 625 | 625 |
| 626 this->visitLayer(layer, occlusion); | 626 this->visitLayer(layer, occlusion); |
| 627 this->enterContributingSurface(child, occlusion); | 627 this->enterContributingSurface(child, occlusion); |
| 628 | 628 |
| 629 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); | 629 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 630 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 630 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 631 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); | 631 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 632 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 632 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 633 | 633 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | | | | | |
| | | 674 | | | | | |
| | |
| 675 | | | | | |
|10| | 675 | | | | | |
|10| |
| 676 +--|-------------------------------+ | | +--
----------------------------|--+ | 676 +--|-------------------------------+ | | +--
----------------------------|--+ |
| 677 | | |
490 | | 677 | | |
490 | |
| 678 +---------------------------------+ +-----
----------------------------+ | 678 +---------------------------------+ +-----
----------------------------+ |
| 679 500
500 | 679 500
500 |
| 680 */ | 680 */ |
| 681 } | 681 } |
| 682 }; | 682 }; |
| 683 | 683 |
| 684 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestChildInRotatedChild); | 684 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestChildInRotatedChild); |
| 685 | 685 |
| 686 template<class Types, bool opaqueLayers> | 686 template<class Types, bool opaqueLayers> |
| 687 class CCOcclusionTrackerTestVisitTargetTwoTimes : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 687 class OcclusionTrackerTestVisitTargetTwoTimes : public OcclusionTrackerTest<Type
s, opaqueLayers> { |
| 688 protected: | 688 protected: |
| 689 void runMyTest() | 689 void runMyTest() |
| 690 { | 690 { |
| 691 WebTransformationMatrix childTransform; | 691 WebTransformationMatrix childTransform; |
| 692 childTransform.translate(250, 250); | 692 childTransform.translate(250, 250); |
| 693 childTransform.rotate(90); | 693 childTransform.rotate(90); |
| 694 childTransform.translate(-250, -250); | 694 childTransform.translate(-250, -250); |
| 695 | 695 |
| 696 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 696 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 697 parent->setMasksToBounds(true); | 697 parent->setMasksToBounds(true); |
| 698 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); | 698 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); |
| 699 child->setMasksToBounds(true); | 699 child->setMasksToBounds(true); |
| 700 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); | 700 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); |
| 701 // |child2| makes |parent|'s surface get considered by CCOcclusionTracke
r first, instead of |child|'s. This exercises different code in | 701 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in |
| 702 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 702 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
| 703 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); | 703 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, FloatPoint(30, 30), IntSize(60, 20), true); |
| 704 this->calcDrawEtc(parent); | 704 this->calcDrawEtc(parent); |
| 705 | 705 |
| 706 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 706 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 707 occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000)); | 707 occlusion.setLayerClipRect(IntRect(-10, -10, 1000, 1000)); |
| 708 | 708 |
| 709 this->visitLayer(child2, occlusion); | 709 this->visitLayer(child2, occlusion); |
| 710 | 710 |
| 711 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace
().bounds()); | 711 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInScreenSpace
().bounds()); |
| 712 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 712 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 713 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurfa
ce().bounds()); | 713 EXPECT_RECT_EQ(IntRect(30, 30, 60, 20), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 714 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 714 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 715 | 715 |
| 716 this->visitLayer(layer, occlusion); | 716 this->visitLayer(layer, occlusion); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 | | | | | |
| | | 786 | | | | | |
| | |
| 787 | | | | | |
|10| | 787 | | | | | |
|10| |
| 788 +--|-------------------------------+ | | +--
----------------------------|--+ | 788 +--|-------------------------------+ | | +--
----------------------------|--+ |
| 789 | | |
490 | | 789 | | |
490 | |
| 790 +---------------------------------+ +-----
----------------------------+ | 790 +---------------------------------+ +-----
----------------------------+ |
| 791 500
500 | 791 500
500 |
| 792 */ | 792 */ |
| 793 } | 793 } |
| 794 }; | 794 }; |
| 795 | 795 |
| 796 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestVisitTargetTwoTimes); | 796 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestVisitTargetTwoTimes); |
| 797 | 797 |
| 798 template<class Types, bool opaqueLayers> | 798 template<class Types, bool opaqueLayers> |
| 799 class CCOcclusionTrackerTestSurfaceRotatedOffAxis : public CCOcclusionTrackerTes
t<Types, opaqueLayers> { | 799 class OcclusionTrackerTestSurfaceRotatedOffAxis : public OcclusionTrackerTest<Ty
pes, opaqueLayers> { |
| 800 protected: | 800 protected: |
| 801 void runMyTest() | 801 void runMyTest() |
| 802 { | 802 { |
| 803 WebTransformationMatrix childTransform; | 803 WebTransformationMatrix childTransform; |
| 804 childTransform.translate(250, 250); | 804 childTransform.translate(250, 250); |
| 805 childTransform.rotate(95); | 805 childTransform.rotate(95); |
| 806 childTransform.translate(-250, -250); | 806 childTransform.translate(-250, -250); |
| 807 | 807 |
| 808 WebTransformationMatrix layerTransform; | 808 WebTransformationMatrix layerTransform; |
| 809 layerTransform.translate(10, 10); | 809 layerTransform.translate(10, 10); |
| 810 | 810 |
| 811 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 811 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 812 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); | 812 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); |
| 813 child->setMasksToBounds(true); | 813 child->setMasksToBounds(true); |
| 814 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true); | 814 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, FloatPoint(0, 0), IntSize(500, 500), true); |
| 815 this->calcDrawEtc(parent); | 815 this->calcDrawEtc(parent); |
| 816 | 816 |
| 817 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 817 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 818 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 818 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 819 | 819 |
| 820 IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 820 IntRect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform, l
ayer->visibleContentRect()); |
| 821 | 821 |
| 822 this->visitLayer(layer, occlusion); | 822 this->visitLayer(layer, occlusion); |
| 823 this->enterContributingSurface(child, occlusion); | 823 this->enterContributingSurface(child, occlusion); |
| 824 | 824 |
| 825 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); | 825 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 826 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 826 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 827 EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface()
.bounds()); | 827 EXPECT_RECT_EQ(clippedLayerInChild, occlusion.occlusionInTargetSurface()
.bounds()); |
| 828 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 828 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 829 | 829 |
| 830 EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); | 830 EXPECT_TRUE(occlusion.occluded(child, clippedLayerInChild)); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 852 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); | 852 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 853 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 853 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 854 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; | 854 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; |
| 855 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 855 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 856 | 856 |
| 857 EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); | 857 EXPECT_FALSE(occlusion.occluded(parent, IntRect(75, 55, 1, 1))); |
| 858 EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(pa
rent, IntRect(75, 55, 1, 1))); | 858 EXPECT_RECT_EQ(IntRect(75, 55, 1, 1), occlusion.unoccludedContentRect(pa
rent, IntRect(75, 55, 1, 1))); |
| 859 } | 859 } |
| 860 }; | 860 }; |
| 861 | 861 |
| 862 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceRotatedOffAxis); | 862 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceRotatedOffAxis); |
| 863 | 863 |
| 864 template<class Types, bool opaqueLayers> | 864 template<class Types, bool opaqueLayers> |
| 865 class CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 865 class OcclusionTrackerTestSurfaceWithTwoOpaqueChildren : public OcclusionTracker
Test<Types, opaqueLayers> { |
| 866 protected: | 866 protected: |
| 867 void runMyTest() | 867 void runMyTest() |
| 868 { | 868 { |
| 869 WebTransformationMatrix childTransform; | 869 WebTransformationMatrix childTransform; |
| 870 childTransform.translate(250, 250); | 870 childTransform.translate(250, 250); |
| 871 childTransform.rotate(90); | 871 childTransform.rotate(90); |
| 872 childTransform.translate(-250, -250); | 872 childTransform.translate(-250, -250); |
| 873 | 873 |
| 874 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 874 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 875 parent->setMasksToBounds(true); | 875 parent->setMasksToBounds(true); |
| 876 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); | 876 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, FloatPoint(30, 30), IntSize(500, 500)); |
| 877 child->setMasksToBounds(true); | 877 child->setMasksToBounds(true); |
| 878 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); | 878 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 10), IntSize(500, 500), true); |
| 879 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); | 879 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, FloatPoint(10, 450), IntSize(500, 60), true); |
| 880 this->calcDrawEtc(parent); | 880 this->calcDrawEtc(parent); |
| 881 | 881 |
| 882 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 882 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 883 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 883 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 884 | 884 |
| 885 this->visitLayer(layer2, occlusion); | 885 this->visitLayer(layer2, occlusion); |
| 886 this->visitLayer(layer1, occlusion); | 886 this->visitLayer(layer1, occlusion); |
| 887 this->enterContributingSurface(child, occlusion); | 887 this->enterContributingSurface(child, occlusion); |
| 888 | 888 |
| 889 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); | 889 EXPECT_RECT_EQ(IntRect(30, 40, 70, 60), occlusion.occlusionInScreenSpace
().bounds()); |
| 890 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 890 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 891 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); | 891 EXPECT_RECT_EQ(IntRect(10, 430, 60, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 892 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 892 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 | | | | | | 941 | | | | | |
| 942 | | | |10| | 942 | | | |10| |
| 943 | +------------|-----------------|--+ | 943 | +------------|-----------------|--+ |
| 944 | | 490 | | 944 | | 490 | |
| 945 +---------------+-----------------+ | 945 +---------------+-----------------+ |
| 946 60 440 | 946 60 440 |
| 947 */ | 947 */ |
| 948 } | 948 } |
| 949 }; | 949 }; |
| 950 | 950 |
| 951 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithTwoOpaqueChildren); | 951 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithTwoOpaqueChildren); |
| 952 | 952 |
| 953 template<class Types, bool opaqueLayers> | 953 template<class Types, bool opaqueLayers> |
| 954 class CCOcclusionTrackerTestOverlappingSurfaceSiblings : public CCOcclusionTrack
erTest<Types, opaqueLayers> { | 954 class OcclusionTrackerTestOverlappingSurfaceSiblings : public OcclusionTrackerTe
st<Types, opaqueLayers> { |
| 955 protected: | 955 protected: |
| 956 void runMyTest() | 956 void runMyTest() |
| 957 { | 957 { |
| 958 WebTransformationMatrix childTransform; | 958 WebTransformationMatrix childTransform; |
| 959 childTransform.translate(250, 250); | 959 childTransform.translate(250, 250); |
| 960 childTransform.rotate(90); | 960 childTransform.rotate(90); |
| 961 childTransform.translate(-250, -250); | 961 childTransform.translate(-250, -250); |
| 962 | 962 |
| 963 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 963 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 964 parent->setMasksToBounds(true); | 964 parent->setMasksToBounds(true); |
| 965 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, FloatPoint(30, 30), IntSize(10, 10)); | 965 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, FloatPoint(30, 30), IntSize(10, 10)); |
| 966 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, FloatPoint(20, 40), IntSize(10, 10)); | 966 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, FloatPoint(20, 40), IntSize(10, 10)); |
| 967 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 967 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 968 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 968 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 969 this->calcDrawEtc(parent); | 969 this->calcDrawEtc(parent); |
| 970 | 970 |
| 971 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 971 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 972 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); | 972 occlusion.setLayerClipRect(IntRect(-20, -20, 1000, 1000)); |
| 973 | 973 |
| 974 this->visitLayer(layer2, occlusion); | 974 this->visitLayer(layer2, occlusion); |
| 975 this->enterContributingSurface(child2, occlusion); | 975 this->enterContributingSurface(child2, occlusion); |
| 976 | 976 |
| 977 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); | 977 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 978 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 978 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 979 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); | 979 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); |
| 980 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 980 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 981 | 981 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 | | | | | 1051 | | | | |
| 1052 | | | | | 1052 | | | | |
| 1053 | +--------------------------------|-+ | 1053 | +--------------------------------|-+ |
| 1054 | | | 1054 | | |
| 1055 +----------------------------------+ | 1055 +----------------------------------+ |
| 1056 510 | 1056 510 |
| 1057 */ | 1057 */ |
| 1058 } | 1058 } |
| 1059 }; | 1059 }; |
| 1060 | 1060 |
| 1061 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblings); | 1061 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblings); |
| 1062 | 1062 |
| 1063 template<class Types, bool opaqueLayers> | 1063 template<class Types, bool opaqueLayers> |
| 1064 class CCOcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public
CCOcclusionTrackerTest<Types, opaqueLayers> { | 1064 class OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoTransforms : public O
cclusionTrackerTest<Types, opaqueLayers> { |
| 1065 protected: | 1065 protected: |
| 1066 void runMyTest() | 1066 void runMyTest() |
| 1067 { | 1067 { |
| 1068 WebTransformationMatrix child1Transform; | 1068 WebTransformationMatrix child1Transform; |
| 1069 child1Transform.translate(250, 250); | 1069 child1Transform.translate(250, 250); |
| 1070 child1Transform.rotate(-90); | 1070 child1Transform.rotate(-90); |
| 1071 child1Transform.translate(-250, -250); | 1071 child1Transform.translate(-250, -250); |
| 1072 | 1072 |
| 1073 WebTransformationMatrix child2Transform; | 1073 WebTransformationMatrix child2Transform; |
| 1074 child2Transform.translate(250, 250); | 1074 child2Transform.translate(250, 250); |
| 1075 child2Transform.rotate(90); | 1075 child2Transform.rotate(90); |
| 1076 child2Transform.translate(-250, -250); | 1076 child2Transform.translate(-250, -250); |
| 1077 | 1077 |
| 1078 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 1078 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 1079 parent->setMasksToBounds(true); | 1079 parent->setMasksToBounds(true); |
| 1080 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, FloatPoint(30, 20), IntSize(10, 10)); | 1080 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, FloatPoint(30, 20), IntSize(10, 10)); |
| 1081 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, FloatPoint(20, 40), IntSize(10, 10), false); | 1081 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, FloatPoint(20, 40), IntSize(10, 10), false); |
| 1082 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); | 1082 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, FloatPoint(-10, -20), IntSize(510, 510), true); |
| 1083 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); | 1083 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, FloatPoint(-10, -10), IntSize(510, 510), true); |
| 1084 this->calcDrawEtc(parent); | 1084 this->calcDrawEtc(parent); |
| 1085 | 1085 |
| 1086 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1086 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1087 occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000)); | 1087 occlusion.setLayerClipRect(IntRect(-30, -30, 1000, 1000)); |
| 1088 | 1088 |
| 1089 this->visitLayer(layer2, occlusion); | 1089 this->visitLayer(layer2, occlusion); |
| 1090 this->enterLayer(child2, occlusion); | 1090 this->enterLayer(child2, occlusion); |
| 1091 | 1091 |
| 1092 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); | 1092 EXPECT_RECT_EQ(IntRect(20, 30, 80, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1093 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1093 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1094 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); | 1094 EXPECT_RECT_EQ(IntRect(-10, 420, 70, 80), occlusion.occlusionInTargetSur
face().bounds()); |
| 1095 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1095 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1096 | 1096 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | | | | | 1159 | | | | |
| 1160 | | 520 | | | 1160 | | 520 | | |
| 1161 +----------------------------------+ | | 1161 +----------------------------------+ | |
| 1162 | | | 1162 | | |
| 1163 +----------------------------------+ | 1163 +----------------------------------+ |
| 1164 510 | 1164 510 |
| 1165 */ | 1165 */ |
| 1166 } | 1166 } |
| 1167 }; | 1167 }; |
| 1168 | 1168 |
| 1169 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestOverlappingSurfaceSiblingsWith
TwoTransforms); | 1169 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestOverlappingSurfaceSiblingsWithTwoT
ransforms); |
| 1170 | 1170 |
| 1171 template<class Types, bool opaqueLayers> | 1171 template<class Types, bool opaqueLayers> |
| 1172 class CCOcclusionTrackerTestFilters : public CCOcclusionTrackerTest<Types, opaqu
eLayers> { | 1172 class OcclusionTrackerTestFilters : public OcclusionTrackerTest<Types, opaqueLay
ers> { |
| 1173 protected: | 1173 protected: |
| 1174 void runMyTest() | 1174 void runMyTest() |
| 1175 { | 1175 { |
| 1176 WebTransformationMatrix layerTransform; | 1176 WebTransformationMatrix layerTransform; |
| 1177 layerTransform.translate(250, 250); | 1177 layerTransform.translate(250, 250); |
| 1178 layerTransform.rotate(90); | 1178 layerTransform.rotate(90); |
| 1179 layerTransform.translate(-250, -250); | 1179 layerTransform.translate(-250, -250); |
| 1180 | 1180 |
| 1181 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 1181 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 1182 parent->setMasksToBounds(true); | 1182 parent->setMasksToBounds(true); |
| 1183 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 1183 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 1184 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 1184 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 1185 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); | 1185 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, FloatPoint(30, 30), IntSize(500, 500), true); |
| 1186 | 1186 |
| 1187 WebFilterOperations filters; | 1187 WebFilterOperations filters; |
| 1188 filters.append(WebFilterOperation::createBlurFilter(10)); | 1188 filters.append(WebFilterOperation::createBlurFilter(10)); |
| 1189 blurLayer->setFilters(filters); | 1189 blurLayer->setFilters(filters); |
| 1190 | 1190 |
| 1191 filters.clear(); | 1191 filters.clear(); |
| 1192 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); | 1192 filters.append(WebFilterOperation::createGrayscaleFilter(0.5)); |
| 1193 opaqueLayer->setFilters(filters); | 1193 opaqueLayer->setFilters(filters); |
| 1194 | 1194 |
| 1195 filters.clear(); | 1195 filters.clear(); |
| 1196 filters.append(WebFilterOperation::createOpacityFilter(0.5)); | 1196 filters.append(WebFilterOperation::createOpacityFilter(0.5)); |
| 1197 opacityLayer->setFilters(filters); | 1197 opacityLayer->setFilters(filters); |
| 1198 | 1198 |
| 1199 this->calcDrawEtc(parent); | 1199 this->calcDrawEtc(parent); |
| 1200 | 1200 |
| 1201 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1201 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1202 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1202 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1203 | 1203 |
| 1204 // Opacity layer won't contribute to occlusion. | 1204 // Opacity layer won't contribute to occlusion. |
| 1205 this->visitLayer(opacityLayer, occlusion); | 1205 this->visitLayer(opacityLayer, occlusion); |
| 1206 this->enterContributingSurface(opacityLayer, occlusion); | 1206 this->enterContributingSurface(opacityLayer, occlusion); |
| 1207 | 1207 |
| 1208 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1208 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1209 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1209 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1210 | 1210 |
| 1211 // And has nothing to contribute to its parent surface. | 1211 // And has nothing to contribute to its parent surface. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 // But the opaque layer's occlusion is preserved on the parent. | 1243 // But the opaque layer's occlusion is preserved on the parent. |
| 1244 this->leaveContributingSurface(blurLayer, occlusion); | 1244 this->leaveContributingSurface(blurLayer, occlusion); |
| 1245 this->enterLayer(parent, occlusion); | 1245 this->enterLayer(parent, occlusion); |
| 1246 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); | 1246 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInScreenSpace
().bounds()); |
| 1247 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1247 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1248 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1248 EXPECT_RECT_EQ(IntRect(30, 30, 70, 70), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1249 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1249 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1250 } | 1250 } |
| 1251 }; | 1251 }; |
| 1252 | 1252 |
| 1253 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestFilters); | 1253 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestFilters); |
| 1254 | 1254 |
| 1255 template<class Types, bool opaqueLayers> | 1255 template<class Types, bool opaqueLayers> |
| 1256 class CCOcclusionTrackerTestReplicaDoesOcclude : public CCOcclusionTrackerTest<T
ypes, opaqueLayers> { | 1256 class OcclusionTrackerTestReplicaDoesOcclude : public OcclusionTrackerTest<Types
, opaqueLayers> { |
| 1257 protected: | 1257 protected: |
| 1258 void runMyTest() | 1258 void runMyTest() |
| 1259 { | 1259 { |
| 1260 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 1260 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 1261 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1261 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1262 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); | 1262 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); |
| 1263 this->calcDrawEtc(parent); | 1263 this->calcDrawEtc(parent); |
| 1264 | 1264 |
| 1265 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1265 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1266 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1266 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1267 | 1267 |
| 1268 this->visitLayer(surface, occlusion); | 1268 this->visitLayer(surface, occlusion); |
| 1269 | 1269 |
| 1270 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); | 1270 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1271 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1271 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1272 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); | 1272 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1273 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1273 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1274 | 1274 |
| 1275 this->visitContributingSurface(surface, occlusion); | 1275 this->visitContributingSurface(surface, occlusion); |
| 1276 this->enterLayer(parent, occlusion); | 1276 this->enterLayer(parent, occlusion); |
| 1277 | 1277 |
| 1278 // The surface and replica should both be occluding the parent. | 1278 // The surface and replica should both be occluding the parent. |
| 1279 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 1279 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
| 1280 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1280 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1281 } | 1281 } |
| 1282 }; | 1282 }; |
| 1283 | 1283 |
| 1284 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaDoesOcclude); | 1284 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); |
| 1285 | 1285 |
| 1286 template<class Types, bool opaqueLayers> | 1286 template<class Types, bool opaqueLayers> |
| 1287 class CCOcclusionTrackerTestReplicaWithClipping : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 1287 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s, opaqueLayers> { |
| 1288 protected: | 1288 protected: |
| 1289 void runMyTest() | 1289 void runMyTest() |
| 1290 { | 1290 { |
| 1291 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); | 1291 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 170)); |
| 1292 parent->setMasksToBounds(true); | 1292 parent->setMasksToBounds(true); |
| 1293 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1293 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1294 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); | 1294 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(50, 5
0), IntSize()); |
| 1295 this->calcDrawEtc(parent); | 1295 this->calcDrawEtc(parent); |
| 1296 | 1296 |
| 1297 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1297 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1298 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1298 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1299 | 1299 |
| 1300 this->visitLayer(surface, occlusion); | 1300 this->visitLayer(surface, occlusion); |
| 1301 | 1301 |
| 1302 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); | 1302 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1303 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1303 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1304 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); | 1304 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1305 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1305 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1306 | 1306 |
| 1307 this->visitContributingSurface(surface, occlusion); | 1307 this->visitContributingSurface(surface, occlusion); |
| 1308 this->enterLayer(parent, occlusion); | 1308 this->enterLayer(parent, occlusion); |
| 1309 | 1309 |
| 1310 // The surface and replica should both be occluding the parent. | 1310 // The surface and replica should both be occluding the parent. |
| 1311 EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurf
ace().bounds()); | 1311 EXPECT_RECT_EQ(IntRect(0, 100, 100, 70), occlusion.occlusionInTargetSurf
ace().bounds()); |
| 1312 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 1312 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1313 } | 1313 } |
| 1314 }; | 1314 }; |
| 1315 | 1315 |
| 1316 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithClipping); | 1316 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithClipping); |
| 1317 | 1317 |
| 1318 template<class Types, bool opaqueLayers> | 1318 template<class Types, bool opaqueLayers> |
| 1319 class CCOcclusionTrackerTestReplicaWithMask : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 1319 class OcclusionTrackerTestReplicaWithMask : public OcclusionTrackerTest<Types, o
paqueLayers> { |
| 1320 protected: | 1320 protected: |
| 1321 void runMyTest() | 1321 void runMyTest() |
| 1322 { | 1322 { |
| 1323 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 1323 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 1324 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); | 1324 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 100), IntSize(50, 50), true); |
| 1325 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, FloatPoint(50, 50), IntSize()); | 1325 typename Types::LayerType* replica = this->createReplicaLayer(surface, t
his->identityMatrix, FloatPoint(50, 50), IntSize()); |
| 1326 this->createMaskLayer(replica, IntSize(10, 10)); | 1326 this->createMaskLayer(replica, IntSize(10, 10)); |
| 1327 this->calcDrawEtc(parent); | 1327 this->calcDrawEtc(parent); |
| 1328 | 1328 |
| 1329 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1329 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1330 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1330 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1331 | 1331 |
| 1332 this->visitLayer(surface, occlusion); | 1332 this->visitLayer(surface, occlusion); |
| 1333 | 1333 |
| 1334 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); | 1334 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInScreenSpace
().bounds()); |
| 1335 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1335 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1336 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); | 1336 EXPECT_RECT_EQ(IntRect(0, 0, 50, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 1337 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1337 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1338 | 1338 |
| 1339 this->visitContributingSurface(surface, occlusion); | 1339 this->visitContributingSurface(surface, occlusion); |
| 1340 this->enterLayer(parent, occlusion); | 1340 this->enterLayer(parent, occlusion); |
| 1341 | 1341 |
| 1342 // The replica should not be occluding the parent, since it has a mask a
pplied to it. | 1342 // The replica should not be occluding the parent, since it has a mask a
pplied to it. |
| 1343 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1343 EXPECT_RECT_EQ(IntRect(0, 100, 50, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1344 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1344 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1345 } | 1345 } |
| 1346 }; | 1346 }; |
| 1347 | 1347 |
| 1348 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaWithMask); | 1348 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
| 1349 | 1349 |
| 1350 template<class Types, bool opaqueLayers> | 1350 template<class Types, bool opaqueLayers> |
| 1351 class CCOcclusionTrackerTestLayerClipRectOutsideChild : public CCOcclusionTracke
rTest<Types, opaqueLayers> { | 1351 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types, opaqueLayers> { |
| 1352 protected: | 1352 protected: |
| 1353 void runMyTest() | 1353 void runMyTest() |
| 1354 { | 1354 { |
| 1355 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1355 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1356 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1356 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1357 this->calcDrawEtc(parent); | 1357 this->calcDrawEtc(parent); |
| 1358 | 1358 |
| 1359 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1359 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1360 occlusion.setLayerClipRect(IntRect(200, 100, 100, 100)); | 1360 occlusion.setLayerClipRect(IntRect(200, 100, 100, 100)); |
| 1361 | 1361 |
| 1362 this->enterLayer(layer, occlusion); | 1362 this->enterLayer(layer, occlusion); |
| 1363 | 1363 |
| 1364 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1364 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1365 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1365 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1366 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1366 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1367 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1367 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1368 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); | 1368 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); |
| 1369 | 1369 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1382 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1382 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1383 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1383 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1384 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1384 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1385 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1385 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1386 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1386 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1387 | 1387 |
| 1388 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); | 1388 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); |
| 1389 } | 1389 } |
| 1390 }; | 1390 }; |
| 1391 | 1391 |
| 1392 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOutsideChild); | 1392 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOutsideChild); |
| 1393 | 1393 |
| 1394 template<class Types, bool opaqueLayers> | 1394 template<class Types, bool opaqueLayers> |
| 1395 class CCOcclusionTrackerTestViewportRectOutsideChild : public CCOcclusionTracker
Test<Types, opaqueLayers> { | 1395 class OcclusionTrackerTestViewportRectOutsideChild : public OcclusionTrackerTest
<Types, opaqueLayers> { |
| 1396 protected: | 1396 protected: |
| 1397 void runMyTest() | 1397 void runMyTest() |
| 1398 { | 1398 { |
| 1399 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1399 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1400 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1400 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1401 this->calcDrawEtc(parent); | 1401 this->calcDrawEtc(parent); |
| 1402 | 1402 |
| 1403 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100)); | 1403 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(200, 100, 100, 100)); |
| 1404 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1404 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1405 | 1405 |
| 1406 this->enterLayer(layer, occlusion); | 1406 this->enterLayer(layer, occlusion); |
| 1407 | 1407 |
| 1408 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1408 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1409 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1409 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1410 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1410 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1411 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1411 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1412 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); | 1412 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); |
| 1413 | 1413 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1426 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1426 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1427 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1427 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1428 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1428 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1429 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1429 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1430 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1430 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1431 | 1431 |
| 1432 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); | 1432 EXPECT_RECT_EQ(IntRect(200, 100, 100, 100), occlusion.unoccludedContentR
ect(parent, IntRect(0, 0, 300, 300))); |
| 1433 } | 1433 } |
| 1434 }; | 1434 }; |
| 1435 | 1435 |
| 1436 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOutsideChild); | 1436 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); |
| 1437 | 1437 |
| 1438 template<class Types, bool opaqueLayers> | 1438 template<class Types, bool opaqueLayers> |
| 1439 class CCOcclusionTrackerTestLayerClipRectOverChild : public CCOcclusionTrackerTe
st<Types, opaqueLayers> { | 1439 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes, opaqueLayers> { |
| 1440 protected: | 1440 protected: |
| 1441 void runMyTest() | 1441 void runMyTest() |
| 1442 { | 1442 { |
| 1443 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1443 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1444 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1444 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1445 this->calcDrawEtc(parent); | 1445 this->calcDrawEtc(parent); |
| 1446 | 1446 |
| 1447 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1447 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1448 occlusion.setLayerClipRect(IntRect(100, 100, 100, 100)); | 1448 occlusion.setLayerClipRect(IntRect(100, 100, 100, 100)); |
| 1449 | 1449 |
| 1450 this->enterLayer(layer, occlusion); | 1450 this->enterLayer(layer, occlusion); |
| 1451 | 1451 |
| 1452 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1452 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1453 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1453 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1454 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1454 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1455 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1455 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1456 | 1456 |
| 1457 this->leaveLayer(layer, occlusion); | 1457 this->leaveLayer(layer, occlusion); |
| 1458 this->visitContributingSurface(layer, occlusion); | 1458 this->visitContributingSurface(layer, occlusion); |
| 1459 this->enterLayer(parent, occlusion); | 1459 this->enterLayer(parent, occlusion); |
| 1460 | 1460 |
| 1461 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1461 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1462 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1462 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1463 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1463 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1464 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); | 1464 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); |
| 1465 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1465 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1466 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1466 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1467 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1467 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1468 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1468 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1469 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1469 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1470 | 1470 |
| 1471 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); | 1471 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); |
| 1472 } | 1472 } |
| 1473 }; | 1473 }; |
| 1474 | 1474 |
| 1475 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOverChild); | 1475 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverChild); |
| 1476 | 1476 |
| 1477 template<class Types, bool opaqueLayers> | 1477 template<class Types, bool opaqueLayers> |
| 1478 class CCOcclusionTrackerTestViewportRectOverChild : public CCOcclusionTrackerTes
t<Types, opaqueLayers> { | 1478 class OcclusionTrackerTestViewportRectOverChild : public OcclusionTrackerTest<Ty
pes, opaqueLayers> { |
| 1479 protected: | 1479 protected: |
| 1480 void runMyTest() | 1480 void runMyTest() |
| 1481 { | 1481 { |
| 1482 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1482 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1483 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1483 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1484 this->calcDrawEtc(parent); | 1484 this->calcDrawEtc(parent); |
| 1485 | 1485 |
| 1486 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100)); | 1486 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(100, 100, 100, 100)); |
| 1487 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1487 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1488 | 1488 |
| 1489 this->enterLayer(layer, occlusion); | 1489 this->enterLayer(layer, occlusion); |
| 1490 | 1490 |
| 1491 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1491 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1492 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1492 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1493 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1493 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1494 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1494 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1495 | 1495 |
| 1496 this->leaveLayer(layer, occlusion); | 1496 this->leaveLayer(layer, occlusion); |
| 1497 this->visitContributingSurface(layer, occlusion); | 1497 this->visitContributingSurface(layer, occlusion); |
| 1498 this->enterLayer(parent, occlusion); | 1498 this->enterLayer(parent, occlusion); |
| 1499 | 1499 |
| 1500 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); | 1500 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 0, 100, 100))); |
| 1501 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1501 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1502 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); | 1502 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 0, 100, 100))); |
| 1503 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); | 1503 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))); |
| 1504 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); | 1504 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 100, 100, 100))); |
| 1505 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); | 1505 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 0, 100, 100))); |
| 1506 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); | 1506 EXPECT_TRUE(occlusion.occluded(parent, IntRect(0, 200, 100, 100))); |
| 1507 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); | 1507 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 200, 100, 100))); |
| 1508 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1508 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1509 | 1509 |
| 1510 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); | 1510 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); |
| 1511 } | 1511 } |
| 1512 }; | 1512 }; |
| 1513 | 1513 |
| 1514 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOverChild); | 1514 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); |
| 1515 | 1515 |
| 1516 template<class Types, bool opaqueLayers> | 1516 template<class Types, bool opaqueLayers> |
| 1517 class CCOcclusionTrackerTestLayerClipRectPartlyOverChild : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 1517 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types, opaqueLayers> { |
| 1518 protected: | 1518 protected: |
| 1519 void runMyTest() | 1519 void runMyTest() |
| 1520 { | 1520 { |
| 1521 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1521 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1522 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1522 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1523 this->calcDrawEtc(parent); | 1523 this->calcDrawEtc(parent); |
| 1524 | 1524 |
| 1525 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1525 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1526 occlusion.setLayerClipRect(IntRect(50, 50, 200, 200)); | 1526 occlusion.setLayerClipRect(IntRect(50, 50, 200, 200)); |
| 1527 | 1527 |
| 1528 this->enterLayer(layer, occlusion); | 1528 this->enterLayer(layer, occlusion); |
| 1529 | 1529 |
| 1530 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1530 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1531 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1531 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1532 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1532 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1533 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1533 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1534 | 1534 |
| 1535 this->leaveLayer(layer, occlusion); | 1535 this->leaveLayer(layer, occlusion); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1547 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1547 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1548 | 1548 |
| 1549 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); | 1549 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); |
| 1550 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); | 1550 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); |
| 1551 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); | 1551 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); |
| 1552 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); | 1552 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); |
| 1553 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); | 1553 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); |
| 1554 } | 1554 } |
| 1555 }; | 1555 }; |
| 1556 | 1556 |
| 1557 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectPartlyOverChild); | 1557 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectPartlyOverChild); |
| 1558 | 1558 |
| 1559 template<class Types, bool opaqueLayers> | 1559 template<class Types, bool opaqueLayers> |
| 1560 class CCOcclusionTrackerTestViewportRectPartlyOverChild : public CCOcclusionTrac
kerTest<Types, opaqueLayers> { | 1560 class OcclusionTrackerTestViewportRectPartlyOverChild : public OcclusionTrackerT
est<Types, opaqueLayers> { |
| 1561 protected: | 1561 protected: |
| 1562 void runMyTest() | 1562 void runMyTest() |
| 1563 { | 1563 { |
| 1564 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1564 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1565 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1565 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1566 this->calcDrawEtc(parent); | 1566 this->calcDrawEtc(parent); |
| 1567 | 1567 |
| 1568 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200)); | 1568 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(50, 50, 200, 200)); |
| 1569 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1569 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1570 | 1570 |
| 1571 this->enterLayer(layer, occlusion); | 1571 this->enterLayer(layer, occlusion); |
| 1572 | 1572 |
| 1573 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1573 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1574 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1574 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1575 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1575 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1576 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1576 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1577 | 1577 |
| 1578 this->leaveLayer(layer, occlusion); | 1578 this->leaveLayer(layer, occlusion); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1590 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1590 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1591 | 1591 |
| 1592 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); | 1592 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.unoccludedContentRec
t(parent, IntRect(0, 0, 300, 300))); |
| 1593 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); | 1593 EXPECT_RECT_EQ(IntRect(200, 50, 50, 50), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 100))); |
| 1594 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); | 1594 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(0, 100, 300, 100))); |
| 1595 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); | 1595 EXPECT_RECT_EQ(IntRect(200, 100, 50, 100), occlusion.unoccludedContentRe
ct(parent, IntRect(200, 100, 100, 100))); |
| 1596 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); | 1596 EXPECT_RECT_EQ(IntRect(100, 200, 100, 50), occlusion.unoccludedContentRe
ct(parent, IntRect(100, 200, 100, 100))); |
| 1597 } | 1597 } |
| 1598 }; | 1598 }; |
| 1599 | 1599 |
| 1600 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectPartlyOverChild); | 1600 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectPartlyOverChild); |
| 1601 | 1601 |
| 1602 template<class Types, bool opaqueLayers> | 1602 template<class Types, bool opaqueLayers> |
| 1603 class CCOcclusionTrackerTestLayerClipRectOverNothing : public CCOcclusionTracker
Test<Types, opaqueLayers> { | 1603 class OcclusionTrackerTestLayerClipRectOverNothing : public OcclusionTrackerTest
<Types, opaqueLayers> { |
| 1604 protected: | 1604 protected: |
| 1605 void runMyTest() | 1605 void runMyTest() |
| 1606 { | 1606 { |
| 1607 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1607 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1608 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1608 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1609 this->calcDrawEtc(parent); | 1609 this->calcDrawEtc(parent); |
| 1610 | 1610 |
| 1611 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1611 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1612 occlusion.setLayerClipRect(IntRect(500, 500, 100, 100)); | 1612 occlusion.setLayerClipRect(IntRect(500, 500, 100, 100)); |
| 1613 | 1613 |
| 1614 this->enterLayer(layer, occlusion); | 1614 this->enterLayer(layer, occlusion); |
| 1615 | 1615 |
| 1616 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1616 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1617 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1617 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1618 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1618 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1619 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1619 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1620 | 1620 |
| 1621 this->leaveLayer(layer, occlusion); | 1621 this->leaveLayer(layer, occlusion); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1633 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1633 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1634 | 1634 |
| 1635 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); | 1635 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); |
| 1636 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 1
00)).isEmpty()); | 1636 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 1
00)).isEmpty()); |
| 1637 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300,
100)).isEmpty()); | 1637 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300,
100)).isEmpty()); |
| 1638 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 10
0, 100)).isEmpty()); | 1638 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 10
0, 100)).isEmpty()); |
| 1639 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 10
0, 100)).isEmpty()); | 1639 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 10
0, 100)).isEmpty()); |
| 1640 } | 1640 } |
| 1641 }; | 1641 }; |
| 1642 | 1642 |
| 1643 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectOverNothing); | 1643 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectOverNothing); |
| 1644 | 1644 |
| 1645 template<class Types, bool opaqueLayers> | 1645 template<class Types, bool opaqueLayers> |
| 1646 class CCOcclusionTrackerTestViewportRectOverNothing : public CCOcclusionTrackerT
est<Types, opaqueLayers> { | 1646 class OcclusionTrackerTestViewportRectOverNothing : public OcclusionTrackerTest<
Types, opaqueLayers> { |
| 1647 protected: | 1647 protected: |
| 1648 void runMyTest() | 1648 void runMyTest() |
| 1649 { | 1649 { |
| 1650 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1650 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1651 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1651 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1652 this->calcDrawEtc(parent); | 1652 this->calcDrawEtc(parent); |
| 1653 | 1653 |
| 1654 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100)); | 1654 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(500, 500, 100, 100)); |
| 1655 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1655 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1656 | 1656 |
| 1657 this->enterLayer(layer, occlusion); | 1657 this->enterLayer(layer, occlusion); |
| 1658 | 1658 |
| 1659 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1659 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1660 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1660 EXPECT_TRUE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1661 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1661 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1662 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1662 EXPECT_TRUE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1663 | 1663 |
| 1664 this->leaveLayer(layer, occlusion); | 1664 this->leaveLayer(layer, occlusion); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1676 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); | 1676 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))); |
| 1677 | 1677 |
| 1678 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); | 1678 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 3
00)).isEmpty()); |
| 1679 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 1
00)).isEmpty()); | 1679 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 0, 300, 1
00)).isEmpty()); |
| 1680 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300,
100)).isEmpty()); | 1680 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(0, 100, 300,
100)).isEmpty()); |
| 1681 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 10
0, 100)).isEmpty()); | 1681 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(200, 100, 10
0, 100)).isEmpty()); |
| 1682 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 10
0, 100)).isEmpty()); | 1682 EXPECT_TRUE(occlusion.unoccludedContentRect(parent, IntRect(100, 200, 10
0, 100)).isEmpty()); |
| 1683 } | 1683 } |
| 1684 }; | 1684 }; |
| 1685 | 1685 |
| 1686 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestViewportRectOverNothing); | 1686 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverNothing); |
| 1687 | 1687 |
| 1688 template<class Types, bool opaqueLayers> | 1688 template<class Types, bool opaqueLayers> |
| 1689 class CCOcclusionTrackerTestLayerClipRectForLayerOffOrigin : public CCOcclusionT
rackerTest<Types, opaqueLayers> { | 1689 class OcclusionTrackerTestLayerClipRectForLayerOffOrigin : public OcclusionTrack
erTest<Types, opaqueLayers> { |
| 1690 protected: | 1690 protected: |
| 1691 void runMyTest() | 1691 void runMyTest() |
| 1692 { | 1692 { |
| 1693 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1693 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1694 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); | 1694 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), true); |
| 1695 this->calcDrawEtc(parent); | 1695 this->calcDrawEtc(parent); |
| 1696 | 1696 |
| 1697 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1697 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1698 this->enterLayer(layer, occlusion); | 1698 this->enterLayer(layer, occlusion); |
| 1699 | 1699 |
| 1700 // This layer is translated when drawn into its target. So if the clip r
ect given from the target surface | 1700 // This layer is translated when drawn into its target. So if the clip r
ect given from the target surface |
| 1701 // is not in that target space, then after translating these query rects
into the target, they will fall outside | 1701 // is not in that target space, then after translating these query rects
into the target, they will fall outside |
| 1702 // the clip and be considered occluded. | 1702 // the clip and be considered occluded. |
| 1703 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1703 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1704 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1704 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1705 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1705 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1706 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1706 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1707 } | 1707 } |
| 1708 }; | 1708 }; |
| 1709 | 1709 |
| 1710 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestLayerClipRectForLayerOffOrigin
); | 1710 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipRectForLayerOffOrigin); |
| 1711 | 1711 |
| 1712 template<class Types, bool opaqueLayers> | 1712 template<class Types, bool opaqueLayers> |
| 1713 class CCOcclusionTrackerTestOpaqueContentsRegionEmpty : public CCOcclusionTracke
rTest<Types, opaqueLayers> { | 1713 class OcclusionTrackerTestOpaqueContentsRegionEmpty : public OcclusionTrackerTes
t<Types, opaqueLayers> { |
| 1714 protected: | 1714 protected: |
| 1715 void runMyTest() | 1715 void runMyTest() |
| 1716 { | 1716 { |
| 1717 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1717 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1718 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false); | 1718 typename Types::ContentLayerType* layer = this->createDrawingSurface(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 200), false); |
| 1719 this->calcDrawEtc(parent); | 1719 this->calcDrawEtc(parent); |
| 1720 | 1720 |
| 1721 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1721 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1722 this->enterLayer(layer, occlusion); | 1722 this->enterLayer(layer, occlusion); |
| 1723 | 1723 |
| 1724 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); | 1724 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 0, 100, 100))); |
| 1725 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); | 1725 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 0, 100, 100))); |
| 1726 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); | 1726 EXPECT_FALSE(occlusion.occluded(layer, IntRect(0, 100, 100, 100))); |
| 1727 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); | 1727 EXPECT_FALSE(occlusion.occluded(layer, IntRect(100, 100, 100, 100))); |
| 1728 | 1728 |
| 1729 // Occluded since its outside the surface bounds. | 1729 // Occluded since its outside the surface bounds. |
| 1730 EXPECT_TRUE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); | 1730 EXPECT_TRUE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); |
| 1731 | 1731 |
| 1732 // Test without any clip rect. | 1732 // Test without any clip rect. |
| 1733 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 1733 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 1734 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); | 1734 EXPECT_FALSE(occlusion.occluded(layer, IntRect(200, 100, 100, 100))); |
| 1735 occlusion.useDefaultLayerClipRect(); | 1735 occlusion.useDefaultLayerClipRect(); |
| 1736 | 1736 |
| 1737 this->leaveLayer(layer, occlusion); | 1737 this->leaveLayer(layer, occlusion); |
| 1738 this->visitContributingSurface(layer, occlusion); | 1738 this->visitContributingSurface(layer, occlusion); |
| 1739 this->enterLayer(parent, occlusion); | 1739 this->enterLayer(parent, occlusion); |
| 1740 | 1740 |
| 1741 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty()); | 1741 EXPECT_TRUE(occlusion.occlusionInScreenSpace().bounds().isEmpty()); |
| 1742 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 1742 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1743 } | 1743 } |
| 1744 }; | 1744 }; |
| 1745 | 1745 |
| 1746 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionEmpty); | 1746 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionEmpty); |
| 1747 | 1747 |
| 1748 template<class Types, bool opaqueLayers> | 1748 template<class Types, bool opaqueLayers> |
| 1749 class CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 1749 class OcclusionTrackerTestOpaqueContentsRegionNonEmpty : public OcclusionTracker
Test<Types, opaqueLayers> { |
| 1750 protected: | 1750 protected: |
| 1751 void runMyTest() | 1751 void runMyTest() |
| 1752 { | 1752 { |
| 1753 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1753 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1754 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false); | 1754 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(100, 100), IntSize(200, 200), false); |
| 1755 this->calcDrawEtc(parent); | 1755 this->calcDrawEtc(parent); |
| 1756 | 1756 |
| 1757 { | 1757 { |
| 1758 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1758 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1759 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); | 1759 layer->setOpaqueContentsRect(IntRect(0, 0, 100, 100)); |
| 1760 | 1760 |
| 1761 this->resetLayerIterator(); | 1761 this->resetLayerIterator(); |
| 1762 this->visitLayer(layer, occlusion); | 1762 this->visitLayer(layer, occlusion); |
| 1763 this->enterLayer(parent, occlusion); | 1763 this->enterLayer(parent, occlusion); |
| 1764 | 1764 |
| 1765 EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScr
eenSpace().bounds()); | 1765 EXPECT_RECT_EQ(IntRect(100, 100, 100, 100), occlusion.occlusionInScr
eenSpace().bounds()); |
| 1766 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1766 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1767 | 1767 |
| 1768 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1768 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1769 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)))
; | 1769 EXPECT_TRUE(occlusion.occluded(parent, IntRect(100, 100, 100, 100)))
; |
| 1770 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); | 1770 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 { | 1773 { |
| 1774 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1774 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1775 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); | 1775 layer->setOpaqueContentsRect(IntRect(20, 20, 180, 180)); |
| 1776 | 1776 |
| 1777 this->resetLayerIterator(); | 1777 this->resetLayerIterator(); |
| 1778 this->visitLayer(layer, occlusion); | 1778 this->visitLayer(layer, occlusion); |
| 1779 this->enterLayer(parent, occlusion); | 1779 this->enterLayer(parent, occlusion); |
| 1780 | 1780 |
| 1781 EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScr
eenSpace().bounds()); | 1781 EXPECT_RECT_EQ(IntRect(120, 120, 180, 180), occlusion.occlusionInScr
eenSpace().bounds()); |
| 1782 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1782 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1783 | 1783 |
| 1784 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1784 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1785 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); | 1785 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); |
| 1786 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)))
; | 1786 EXPECT_TRUE(occlusion.occluded(parent, IntRect(200, 200, 100, 100)))
; |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 { | 1789 { |
| 1790 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1790 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1791 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); | 1791 layer->setOpaqueContentsRect(IntRect(150, 150, 100, 100)); |
| 1792 | 1792 |
| 1793 this->resetLayerIterator(); | 1793 this->resetLayerIterator(); |
| 1794 this->visitLayer(layer, occlusion); | 1794 this->visitLayer(layer, occlusion); |
| 1795 this->enterLayer(parent, occlusion); | 1795 this->enterLayer(parent, occlusion); |
| 1796 | 1796 |
| 1797 EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScree
nSpace().bounds()); | 1797 EXPECT_RECT_EQ(IntRect(250, 250, 50, 50), occlusion.occlusionInScree
nSpace().bounds()); |
| 1798 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1798 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1799 | 1799 |
| 1800 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); | 1800 EXPECT_FALSE(occlusion.occluded(parent, IntRect(0, 100, 100, 100))); |
| 1801 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); | 1801 EXPECT_FALSE(occlusion.occluded(parent, IntRect(100, 100, 100, 100))
); |
| 1802 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); | 1802 EXPECT_FALSE(occlusion.occluded(parent, IntRect(200, 200, 100, 100))
); |
| 1803 } | 1803 } |
| 1804 } | 1804 } |
| 1805 }; | 1805 }; |
| 1806 | 1806 |
| 1807 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestOpaqueContentsRegionNonEmpty); | 1807 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestOpaqueContentsRegionNonEmpty); |
| 1808 | 1808 |
| 1809 template<class Types, bool opaqueLayers> | 1809 template<class Types, bool opaqueLayers> |
| 1810 class CCOcclusionTrackerTest3dTransform : public CCOcclusionTrackerTest<Types, o
paqueLayers> { | 1810 class OcclusionTrackerTest3dTransform : public OcclusionTrackerTest<Types, opaqu
eLayers> { |
| 1811 protected: | 1811 protected: |
| 1812 void runMyTest() | 1812 void runMyTest() |
| 1813 { | 1813 { |
| 1814 WebTransformationMatrix transform; | 1814 WebTransformationMatrix transform; |
| 1815 transform.rotate3d(0, 30, 0); | 1815 transform.rotate3d(0, 30, 0); |
| 1816 | 1816 |
| 1817 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1817 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1818 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1818 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1819 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); | 1819 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); |
| 1820 this->calcDrawEtc(parent); | 1820 this->calcDrawEtc(parent); |
| 1821 | 1821 |
| 1822 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1822 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1823 this->enterLayer(layer, occlusion); | 1823 this->enterLayer(layer, occlusion); |
| 1824 | 1824 |
| 1825 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. | 1825 // The layer is rotated in 3d but without preserving 3d, so it only gets
resized. |
| 1826 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); | 1826 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); |
| 1827 } | 1827 } |
| 1828 }; | 1828 }; |
| 1829 | 1829 |
| 1830 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTest3dTransform); | 1830 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTest3dTransform); |
| 1831 | 1831 |
| 1832 template<class Types, bool opaqueLayers> | 1832 template<class Types, bool opaqueLayers> |
| 1833 class CCOcclusionTrackerTestUnsorted3dLayers : public CCOcclusionTrackerTest<Typ
es, opaqueLayers> { | 1833 class OcclusionTrackerTestUnsorted3dLayers : public OcclusionTrackerTest<Types,
opaqueLayers> { |
| 1834 protected: | 1834 protected: |
| 1835 void runMyTest() | 1835 void runMyTest() |
| 1836 { | 1836 { |
| 1837 // Currently, the main thread layer iterator does not iterate over 3d it
ems in | 1837 // Currently, the main thread layer iterator does not iterate over 3d it
ems in |
| 1838 // sorted order, because layer sorting is not performed on the main thre
ad. | 1838 // sorted order, because layer sorting is not performed on the main thre
ad. |
| 1839 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes | 1839 // Because of this, the occlusion tracker cannot assume that a 3d layer
occludes |
| 1840 // other layers that have not yet been iterated over. For now, the expec
ted | 1840 // other layers that have not yet been iterated over. For now, the expec
ted |
| 1841 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion | 1841 // behavior is that a 3d layer simply does not add any occlusion to the
occlusion |
| 1842 // tracker. | 1842 // tracker. |
| 1843 | 1843 |
| 1844 WebTransformationMatrix translationToFront; | 1844 WebTransformationMatrix translationToFront; |
| 1845 translationToFront.translate3d(0, 0, -10); | 1845 translationToFront.translate3d(0, 0, -10); |
| 1846 WebTransformationMatrix translationToBack; | 1846 WebTransformationMatrix translationToBack; |
| 1847 translationToFront.translate3d(0, 0, -100); | 1847 translationToFront.translate3d(0, 0, -100); |
| 1848 | 1848 |
| 1849 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1849 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1850 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true); | 1850 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, FloatPoint(0, 0), IntSize(100, 100), true); |
| 1851 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true); | 1851 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, FloatPoint(50, 50), IntSize(100, 100), true); |
| 1852 parent->setPreserves3D(true); | 1852 parent->setPreserves3D(true); |
| 1853 | 1853 |
| 1854 this->calcDrawEtc(parent); | 1854 this->calcDrawEtc(parent); |
| 1855 | 1855 |
| 1856 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1856 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1857 this->visitLayer(child2, occlusion); | 1857 this->visitLayer(child2, occlusion); |
| 1858 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1858 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1859 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1859 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1860 | 1860 |
| 1861 this->visitLayer(child1, occlusion); | 1861 this->visitLayer(child1, occlusion); |
| 1862 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); | 1862 EXPECT_TRUE(occlusion.occlusionInScreenSpace().isEmpty()); |
| 1863 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); | 1863 EXPECT_TRUE(occlusion.occlusionInTargetSurface().isEmpty()); |
| 1864 } | 1864 } |
| 1865 }; | 1865 }; |
| 1866 | 1866 |
| 1867 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. | 1867 // This test will have different layer ordering on the impl thread; the test wil
l only work on the main thread. |
| 1868 MAIN_THREAD_TEST(CCOcclusionTrackerTestUnsorted3dLayers); | 1868 MAIN_THREAD_TEST(OcclusionTrackerTestUnsorted3dLayers); |
| 1869 | 1869 |
| 1870 template<class Types, bool opaqueLayers> | 1870 template<class Types, bool opaqueLayers> |
| 1871 class CCOcclusionTrackerTestPerspectiveTransform : public CCOcclusionTrackerTest
<Types, opaqueLayers> { | 1871 class OcclusionTrackerTestPerspectiveTransform : public OcclusionTrackerTest<Typ
es, opaqueLayers> { |
| 1872 protected: | 1872 protected: |
| 1873 void runMyTest() | 1873 void runMyTest() |
| 1874 { | 1874 { |
| 1875 WebTransformationMatrix transform; | 1875 WebTransformationMatrix transform; |
| 1876 transform.translate(150, 150); | 1876 transform.translate(150, 150); |
| 1877 transform.applyPerspective(400); | 1877 transform.applyPerspective(400); |
| 1878 transform.rotate3d(1, 0, 0, -30); | 1878 transform.rotate3d(1, 0, 0, -30); |
| 1879 transform.translate(-150, -150); | 1879 transform.translate(-150, -150); |
| 1880 | 1880 |
| 1881 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1881 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1882 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 1882 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 1883 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); | 1883 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(100, 100), IntSize(200, 200), true); |
| 1884 container->setPreserves3D(true); | 1884 container->setPreserves3D(true); |
| 1885 layer->setPreserves3D(true); | 1885 layer->setPreserves3D(true); |
| 1886 this->calcDrawEtc(parent); | 1886 this->calcDrawEtc(parent); |
| 1887 | 1887 |
| 1888 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1888 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1889 this->enterLayer(layer, occlusion); | 1889 this->enterLayer(layer, occlusion); |
| 1890 | 1890 |
| 1891 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); | 1891 EXPECT_RECT_EQ(IntRect(0, 0, 200, 200), occlusion.unoccludedContentRect(
layer, IntRect(0, 0, 200, 200))); |
| 1892 } | 1892 } |
| 1893 }; | 1893 }; |
| 1894 | 1894 |
| 1895 // 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. | 1895 // 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. |
| 1896 IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransform); | 1896 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransform); |
| 1897 | 1897 |
| 1898 template<class Types, bool opaqueLayers> | 1898 template<class Types, bool opaqueLayers> |
| 1899 class CCOcclusionTrackerTestPerspectiveTransformBehindCamera : public CCOcclusio
nTrackerTest<Types, opaqueLayers> { | 1899 class OcclusionTrackerTestPerspectiveTransformBehindCamera : public OcclusionTra
ckerTest<Types, opaqueLayers> { |
| 1900 protected: | 1900 protected: |
| 1901 void runMyTest() | 1901 void runMyTest() |
| 1902 { | 1902 { |
| 1903 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. | 1903 // This test is based on the platform/chromium/compositing/3d-corners.ht
ml layout test. |
| 1904 WebTransformationMatrix transform; | 1904 WebTransformationMatrix transform; |
| 1905 transform.translate(250, 50); | 1905 transform.translate(250, 50); |
| 1906 transform.applyPerspective(10); | 1906 transform.applyPerspective(10); |
| 1907 transform.translate(-250, -50); | 1907 transform.translate(-250, -50); |
| 1908 transform.translate(250, 50); | 1908 transform.translate(250, 50); |
| 1909 transform.rotate3d(1, 0, 0, -167); | 1909 transform.rotate3d(1, 0, 0, -167); |
| 1910 transform.translate(-250, -50); | 1910 transform.translate(-250, -50); |
| 1911 | 1911 |
| 1912 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 100)); | 1912 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 100)); |
| 1913 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(500, 500)); | 1913 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, FloatPoint(0, 0), IntSize(500, 500)); |
| 1914 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(0, 0), IntSize(500, 500), true); | 1914 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, FloatPoint(0, 0), IntSize(500, 500), true); |
| 1915 container->setPreserves3D(true); | 1915 container->setPreserves3D(true); |
| 1916 layer->setPreserves3D(true); | 1916 layer->setPreserves3D(true); |
| 1917 this->calcDrawEtc(parent); | 1917 this->calcDrawEtc(parent); |
| 1918 | 1918 |
| 1919 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1919 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1920 this->enterLayer(layer, occlusion); | 1920 this->enterLayer(layer, occlusion); |
| 1921 | 1921 |
| 1922 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, | 1922 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, |
| 1923 // this will include many more pixels but must include at least the bott
om 11 rows. | 1923 // this will include many more pixels but must include at least the bott
om 11 rows. |
| 1924 EXPECT_TRUE(occlusion.unoccludedContentRect(layer, IntRect(0, 0, 500, 50
0)).contains(IntRect(0, 489, 500, 11))); | 1924 EXPECT_TRUE(occlusion.unoccludedContentRect(layer, IntRect(0, 0, 500, 50
0)).contains(IntRect(0, 489, 500, 11))); |
| 1925 } | 1925 } |
| 1926 }; | 1926 }; |
| 1927 | 1927 |
| 1928 // 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. | 1928 // 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. |
| 1929 IMPL_THREAD_TEST(CCOcclusionTrackerTestPerspectiveTransformBehindCamera); | 1929 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); |
| 1930 | 1930 |
| 1931 template<class Types, bool opaqueLayers> | 1931 template<class Types, bool opaqueLayers> |
| 1932 class CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public CCOcclusion
TrackerTest<Types, opaqueLayers> { | 1932 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types, opaqueLayers> { |
| 1933 protected: | 1933 protected: |
| 1934 void runMyTest() | 1934 void runMyTest() |
| 1935 { | 1935 { |
| 1936 WebTransformationMatrix transform; | 1936 WebTransformationMatrix transform; |
| 1937 transform.translate(50, 50); | 1937 transform.translate(50, 50); |
| 1938 transform.applyPerspective(100); | 1938 transform.applyPerspective(100); |
| 1939 transform.translate3d(0, 0, 110); | 1939 transform.translate3d(0, 0, 110); |
| 1940 transform.translate(-50, -50); | 1940 transform.translate(-50, -50); |
| 1941 | 1941 |
| 1942 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 1942 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 1943 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), IntSize(100, 100), true); | 1943 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), IntSize(100, 100), true); |
| 1944 parent->setPreserves3D(true); | 1944 parent->setPreserves3D(true); |
| 1945 layer->setPreserves3D(true); | 1945 layer->setPreserves3D(true); |
| 1946 this->calcDrawEtc(parent); | 1946 this->calcDrawEtc(parent); |
| 1947 | 1947 |
| 1948 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1948 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1949 | 1949 |
| 1950 // The |layer| is entirely behind the camera and should not occlude. | 1950 // The |layer| is entirely behind the camera and should not occlude. |
| 1951 this->visitLayer(layer, occlusion); | 1951 this->visitLayer(layer, occlusion); |
| 1952 this->enterLayer(parent, occlusion); | 1952 this->enterLayer(parent, occlusion); |
| 1953 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 1953 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1954 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 1954 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1955 } | 1955 } |
| 1956 }; | 1956 }; |
| 1957 | 1957 |
| 1958 // 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. | 1958 // 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. |
| 1959 IMPL_THREAD_TEST(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude); | 1959 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); |
| 1960 | 1960 |
| 1961 template<class Types, bool opaqueLayers> | 1961 template<class Types, bool opaqueLayers> |
| 1962 class CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect : public CCOcclusio
nTrackerTest<Types, opaqueLayers> { | 1962 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types, opaqueLayers> { |
| 1963 protected: | 1963 protected: |
| 1964 void runMyTest() | 1964 void runMyTest() |
| 1965 { | 1965 { |
| 1966 WebTransformationMatrix transform; | 1966 WebTransformationMatrix transform; |
| 1967 transform.translate(50, 50); | 1967 transform.translate(50, 50); |
| 1968 transform.applyPerspective(100); | 1968 transform.applyPerspective(100); |
| 1969 transform.translate3d(0, 0, 99); | 1969 transform.translate3d(0, 0, 99); |
| 1970 transform.translate(-50, -50); | 1970 transform.translate(-50, -50); |
| 1971 | 1971 |
| 1972 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); | 1972 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 100)); |
| 1973 parent->setMasksToBounds(true); | 1973 parent->setMasksToBounds(true); |
| 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), IntSize(100, 100), true); | 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, FloatPoint(0, 0), IntSize(100, 100), true); |
| 1975 parent->setPreserves3D(true); | 1975 parent->setPreserves3D(true); |
| 1976 layer->setPreserves3D(true); | 1976 layer->setPreserves3D(true); |
| 1977 this->calcDrawEtc(parent); | 1977 this->calcDrawEtc(parent); |
| 1978 | 1978 |
| 1979 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 1979 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 1980 | 1980 |
| 1981 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. | 1981 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. |
| 1982 // Ensure that those pixels don't occlude things outside the clipRect. | 1982 // Ensure that those pixels don't occlude things outside the clipRect. |
| 1983 this->visitLayer(layer, occlusion); | 1983 this->visitLayer(layer, occlusion); |
| 1984 this->enterLayer(parent, occlusion); | 1984 this->enterLayer(parent, occlusion); |
| 1985 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); | 1985 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 1986 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 1986 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 1987 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace
().bounds()); | 1987 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInScreenSpace
().bounds()); |
| 1988 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 1988 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 1989 } | 1989 } |
| 1990 }; | 1990 }; |
| 1991 | 1991 |
| 1992 // 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. | 1992 // 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. |
| 1993 IMPL_THREAD_TEST(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect); | 1993 IMPL_THREAD_TEST(OcclusionTrackerTestLargePixelsOccludeInsideClipRect); |
| 1994 | 1994 |
| 1995 template<class Types, bool opaqueLayers> | 1995 template<class Types, bool opaqueLayers> |
| 1996 class CCOcclusionTrackerTestAnimationOpacity1OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 1996 class OcclusionTrackerTestAnimationOpacity1OnMainThread : public OcclusionTracke
rTest<Types, opaqueLayers> { |
| 1997 protected: | 1997 protected: |
| 1998 void runMyTest() | 1998 void runMyTest() |
| 1999 { | 1999 { |
| 2000 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2000 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2001 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2001 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2002 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2002 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2003 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); | 2003 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); |
| 2004 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); | 2004 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); |
| 2005 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); | 2005 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2006 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); | 2006 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); |
| 2007 | 2007 |
| 2008 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); | 2008 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); |
| 2009 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); | 2009 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); |
| 2010 this->calcDrawEtc(parent); | 2010 this->calcDrawEtc(parent); |
| 2011 | 2011 |
| 2012 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 2012 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
| 2013 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 2013 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
| 2014 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 2014 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
| 2015 | 2015 |
| 2016 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2016 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2017 | 2017 |
| 2018 this->visitLayer(topmost, occlusion); | 2018 this->visitLayer(topmost, occlusion); |
| 2019 this->enterLayer(parent2, occlusion); | 2019 this->enterLayer(parent2, occlusion); |
| 2020 // This occlusion will affect all surfaces. | 2020 // This occlusion will affect all surfaces. |
| 2021 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent2, IntRect(0, 0, 300, 300))); | 2021 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent2, IntRect(0, 0, 300, 300))); |
| 2022 this->leaveLayer(parent2, occlusion); | 2022 this->leaveLayer(parent2, occlusion); |
| 2023 | 2023 |
| 2024 this->visitLayer(surfaceChild2, occlusion); | 2024 this->visitLayer(surfaceChild2, occlusion); |
| 2025 this->enterLayer(surfaceChild, occlusion); | 2025 this->enterLayer(surfaceChild, occlusion); |
| 2026 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); | 2026 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); |
| 2027 this->leaveLayer(surfaceChild, occlusion); | 2027 this->leaveLayer(surfaceChild, occlusion); |
| 2028 this->enterLayer(surface, occlusion); | 2028 this->enterLayer(surface, occlusion); |
| 2029 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); | 2029 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); |
| 2030 this->leaveLayer(surface, occlusion); | 2030 this->leaveLayer(surface, occlusion); |
| 2031 | 2031 |
| 2032 this->enterContributingSurface(surface, occlusion); | 2032 this->enterContributingSurface(surface, occlusion); |
| 2033 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 2033 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 2034 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); | 2034 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); |
| 2035 this->leaveContributingSurface(surface, occlusion); | 2035 this->leaveContributingSurface(surface, occlusion); |
| 2036 | 2036 |
| 2037 this->visitLayer(layer, occlusion); | 2037 this->visitLayer(layer, occlusion); |
| 2038 this->enterLayer(parent, occlusion); | 2038 this->enterLayer(parent, occlusion); |
| 2039 | 2039 |
| 2040 // Occlusion is not added for the animating |layer|. | 2040 // Occlusion is not added for the animating |layer|. |
| 2041 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); | 2041 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2042 } | 2042 } |
| 2043 }; | 2043 }; |
| 2044 | 2044 |
| 2045 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity1OnMainThread); | 2045 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity1OnMainThread); |
| 2046 | 2046 |
| 2047 template<class Types, bool opaqueLayers> | 2047 template<class Types, bool opaqueLayers> |
| 2048 class CCOcclusionTrackerTestAnimationOpacity0OnMainThread : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 2048 class OcclusionTrackerTestAnimationOpacity0OnMainThread : public OcclusionTracke
rTest<Types, opaqueLayers> { |
| 2049 protected: | 2049 protected: |
| 2050 void runMyTest() | 2050 void runMyTest() |
| 2051 { | 2051 { |
| 2052 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2052 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2053 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2053 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2054 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2054 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2055 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); | 2055 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); |
| 2056 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); | 2056 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); |
| 2057 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); | 2057 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2058 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); | 2058 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, FloatPoint(250, 0), IntSize(50, 300), true); |
| 2059 | 2059 |
| 2060 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
1, 0, false); | 2060 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
1, 0, false); |
| 2061 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 1, 0, false); | 2061 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 1, 0, false); |
| 2062 this->calcDrawEtc(parent); | 2062 this->calcDrawEtc(parent); |
| 2063 | 2063 |
| 2064 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 2064 EXPECT_TRUE(layer->drawOpacityIsAnimating()); |
| 2065 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 2065 EXPECT_FALSE(surface->drawOpacityIsAnimating()); |
| 2066 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); | 2066 EXPECT_TRUE(surface->renderSurface()->drawOpacityIsAnimating()); |
| 2067 | 2067 |
| 2068 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2068 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2069 | 2069 |
| 2070 this->visitLayer(topmost, occlusion); | 2070 this->visitLayer(topmost, occlusion); |
| 2071 this->enterLayer(parent2, occlusion); | 2071 this->enterLayer(parent2, occlusion); |
| 2072 // This occlusion will affect all surfaces. | 2072 // This occlusion will affect all surfaces. |
| 2073 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); | 2073 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2074 this->leaveLayer(parent2, occlusion); | 2074 this->leaveLayer(parent2, occlusion); |
| 2075 | 2075 |
| 2076 this->visitLayer(surfaceChild2, occlusion); | 2076 this->visitLayer(surfaceChild2, occlusion); |
| 2077 this->enterLayer(surfaceChild, occlusion); | 2077 this->enterLayer(surfaceChild, occlusion); |
| 2078 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); | 2078 EXPECT_RECT_EQ(IntRect(100, 0, 100, 300), occlusion.unoccludedContentRec
t(surfaceChild, IntRect(0, 0, 300, 300))); |
| 2079 this->leaveLayer(surfaceChild, occlusion); | 2079 this->leaveLayer(surfaceChild, occlusion); |
| 2080 this->enterLayer(surface, occlusion); | 2080 this->enterLayer(surface, occlusion); |
| 2081 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); | 2081 EXPECT_RECT_EQ(IntRect(200, 0, 50, 300), occlusion.unoccludedContentRect
(surface, IntRect(0, 0, 300, 300))); |
| 2082 this->leaveLayer(surface, occlusion); | 2082 this->leaveLayer(surface, occlusion); |
| 2083 | 2083 |
| 2084 this->enterContributingSurface(surface, occlusion); | 2084 this->enterContributingSurface(surface, occlusion); |
| 2085 // Occlusion within the surface is lost when leaving the animating surfa
ce. | 2085 // Occlusion within the surface is lost when leaving the animating surfa
ce. |
| 2086 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); | 2086 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 300, 300))); |
| 2087 this->leaveContributingSurface(surface, occlusion); | 2087 this->leaveContributingSurface(surface, occlusion); |
| 2088 | 2088 |
| 2089 this->visitLayer(layer, occlusion); | 2089 this->visitLayer(layer, occlusion); |
| 2090 this->enterLayer(parent, occlusion); | 2090 this->enterLayer(parent, occlusion); |
| 2091 | 2091 |
| 2092 // Occlusion is not added for the animating |layer|. | 2092 // Occlusion is not added for the animating |layer|. |
| 2093 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); | 2093 EXPECT_RECT_EQ(IntRect(0, 0, 250, 300), occlusion.unoccludedContentRect(
parent, IntRect(0, 0, 300, 300))); |
| 2094 } | 2094 } |
| 2095 }; | 2095 }; |
| 2096 | 2096 |
| 2097 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationOpacity0OnMainThread); | 2097 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationOpacity0OnMainThread); |
| 2098 | 2098 |
| 2099 template<class Types, bool opaqueLayers> | 2099 template<class Types, bool opaqueLayers> |
| 2100 class CCOcclusionTrackerTestAnimationTranslateOnMainThread : public CCOcclusionT
rackerTest<Types, opaqueLayers> { | 2100 class OcclusionTrackerTestAnimationTranslateOnMainThread : public OcclusionTrack
erTest<Types, opaqueLayers> { |
| 2101 protected: | 2101 protected: |
| 2102 void runMyTest() | 2102 void runMyTest() |
| 2103 { | 2103 { |
| 2104 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2104 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2105 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2105 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2106 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); | 2106 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 300), true); |
| 2107 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); | 2107 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(200, 300), true); |
| 2108 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); | 2108 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); |
| 2109 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true); | 2109 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(0, 0), IntSize(50, 300), true); |
| 2110 | 2110 |
| 2111 addAnimatedTransformToController(*layer->layerAnimationController(), 10,
30, 0); | 2111 addAnimatedTransformToController(*layer->layerAnimationController(), 10,
30, 0); |
| 2112 addAnimatedTransformToController(*surface->layerAnimationController(), 1
0, 30, 0); | 2112 addAnimatedTransformToController(*surface->layerAnimationController(), 1
0, 30, 0); |
| 2113 addAnimatedTransformToController(*surfaceChild->layerAnimationController
(), 10, 30, 0); | 2113 addAnimatedTransformToController(*surfaceChild->layerAnimationController
(), 10, 30, 0); |
| 2114 this->calcDrawEtc(parent); | 2114 this->calcDrawEtc(parent); |
| 2115 | 2115 |
| 2116 EXPECT_TRUE(layer->drawTransformIsAnimating()); | 2116 EXPECT_TRUE(layer->drawTransformIsAnimating()); |
| 2117 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); | 2117 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); |
| 2118 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin
g()); | 2118 EXPECT_TRUE(surface->renderSurface()->targetSurfaceTransformsAreAnimatin
g()); |
| 2119 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating(
)); | 2119 EXPECT_TRUE(surface->renderSurface()->screenSpaceTransformsAreAnimating(
)); |
| 2120 // The surface owning layer doesn't animate against its own surface. | 2120 // The surface owning layer doesn't animate against its own surface. |
| 2121 EXPECT_FALSE(surface->drawTransformIsAnimating()); | 2121 EXPECT_FALSE(surface->drawTransformIsAnimating()); |
| 2122 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); | 2122 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); |
| 2123 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); | 2123 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); |
| 2124 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); | 2124 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); |
| 2125 | 2125 |
| 2126 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2126 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2127 | 2127 |
| 2128 this->visitLayer(surface2, occlusion); | 2128 this->visitLayer(surface2, occlusion); |
| 2129 this->enterContributingSurface(surface2, occlusion); | 2129 this->enterContributingSurface(surface2, occlusion); |
| 2130 | 2130 |
| 2131 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); | 2131 EXPECT_RECT_EQ(IntRect(0, 0, 50, 300), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2132 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2132 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2133 | 2133 |
| 2134 this->leaveContributingSurface(surface2, occlusion); | 2134 this->leaveContributingSurface(surface2, occlusion); |
| 2135 this->enterLayer(surfaceChild2, occlusion); | 2135 this->enterLayer(surfaceChild2, occlusion); |
| 2136 | 2136 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2179 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. | 2179 // The |surface| is moving in the screen and in its target, so all occlu
sion within the surface is lost when leaving it. |
| 2180 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); | 2180 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); |
| 2181 this->leaveLayer(layer, occlusion); | 2181 this->leaveLayer(layer, occlusion); |
| 2182 | 2182 |
| 2183 this->enterLayer(parent, occlusion); | 2183 this->enterLayer(parent, occlusion); |
| 2184 // The |layer| is animating in the screen and in its target, so no occlu
sion is added. | 2184 // The |layer| is animating in the screen and in its target, so no occlu
sion is added. |
| 2185 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); | 2185 EXPECT_RECT_EQ(IntRect(50, 0, 250, 300), occlusion.unoccludedContentRect
(parent, IntRect(0, 0, 300, 300))); |
| 2186 } | 2186 } |
| 2187 }; | 2187 }; |
| 2188 | 2188 |
| 2189 MAIN_THREAD_TEST(CCOcclusionTrackerTestAnimationTranslateOnMainThread); | 2189 MAIN_THREAD_TEST(OcclusionTrackerTestAnimationTranslateOnMainThread); |
| 2190 | 2190 |
| 2191 template<class Types, bool opaqueLayers> | 2191 template<class Types, bool opaqueLayers> |
| 2192 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public CCOcclus
ionTrackerTest<Types, opaqueLayers> { | 2192 class OcclusionTrackerTestSurfaceOcclusionTranslatesToParent : public OcclusionT
rackerTest<Types, opaqueLayers> { |
| 2193 protected: | 2193 protected: |
| 2194 void runMyTest() | 2194 void runMyTest() |
| 2195 { | 2195 { |
| 2196 WebTransformationMatrix surfaceTransform; | 2196 WebTransformationMatrix surfaceTransform; |
| 2197 surfaceTransform.translate(300, 300); | 2197 surfaceTransform.translate(300, 300); |
| 2198 surfaceTransform.scale(2); | 2198 surfaceTransform.scale(2); |
| 2199 surfaceTransform.translate(-150, -150); | 2199 surfaceTransform.translate(-150, -150); |
| 2200 | 2200 |
| 2201 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); | 2201 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(500, 500)); |
| 2202 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); | 2202 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, surfaceTransform, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2203 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); | 2203 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(300, 300), false); |
| 2204 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2204 surface->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); |
| 2205 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); | 2205 surface2->setOpaqueContentsRect(IntRect(0, 0, 200, 200)); |
| 2206 this->calcDrawEtc(parent); | 2206 this->calcDrawEtc(parent); |
| 2207 | 2207 |
| 2208 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2208 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2209 | 2209 |
| 2210 this->visitLayer(surface2, occlusion); | 2210 this->visitLayer(surface2, occlusion); |
| 2211 this->visitContributingSurface(surface2, occlusion); | 2211 this->visitContributingSurface(surface2, occlusion); |
| 2212 | 2212 |
| 2213 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpa
ce().bounds()); | 2213 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInScreenSpa
ce().bounds()); |
| 2214 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2214 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2215 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSur
face().bounds()); | 2215 EXPECT_RECT_EQ(IntRect(50, 50, 200, 200), occlusion.occlusionInTargetSur
face().bounds()); |
| 2216 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2216 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2217 | 2217 |
| 2218 // Clear any stored occlusion. | 2218 // Clear any stored occlusion. |
| 2219 occlusion.setOcclusionInScreenSpace(Region()); | 2219 occlusion.setOcclusionInScreenSpace(Region()); |
| 2220 occlusion.setOcclusionInTargetSurface(Region()); | 2220 occlusion.setOcclusionInTargetSurface(Region()); |
| 2221 | 2221 |
| 2222 this->visitLayer(surface, occlusion); | 2222 this->visitLayer(surface, occlusion); |
| 2223 this->visitContributingSurface(surface, occlusion); | 2223 this->visitContributingSurface(surface, occlusion); |
| 2224 | 2224 |
| 2225 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace
().bounds()); | 2225 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInScreenSpace
().bounds()); |
| 2226 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2226 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2227 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2227 EXPECT_RECT_EQ(IntRect(0, 0, 400, 400), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2228 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2228 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2229 } | 2229 } |
| 2230 }; | 2230 }; |
| 2231 | 2231 |
| 2232 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesToPare
nt); | 2232 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); |
| 2233 | 2233 |
| 2234 template<class Types, bool opaqueLayers> | 2234 template<class Types, bool opaqueLayers> |
| 2235 class CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public CCOc
clusionTrackerTest<Types, opaqueLayers> { | 2235 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types, opaqueLayers> { |
| 2236 protected: | 2236 protected: |
| 2237 void runMyTest() | 2237 void runMyTest() |
| 2238 { | 2238 { |
| 2239 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); | 2239 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 300)); |
| 2240 parent->setMasksToBounds(true); | 2240 parent->setMasksToBounds(true); |
| 2241 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); | 2241 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, FloatPoint(0, 0), IntSize(500, 300), false); |
| 2242 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); | 2242 surface->setOpaqueContentsRect(IntRect(0, 0, 400, 200)); |
| 2243 this->calcDrawEtc(parent); | 2243 this->calcDrawEtc(parent); |
| 2244 | 2244 |
| 2245 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2245 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2246 | 2246 |
| 2247 this->visitLayer(surface, occlusion); | 2247 this->visitLayer(surface, occlusion); |
| 2248 this->visitContributingSurface(surface, occlusion); | 2248 this->visitContributingSurface(surface, occlusion); |
| 2249 | 2249 |
| 2250 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace
().bounds()); | 2250 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2251 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2251 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2252 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2252 EXPECT_RECT_EQ(IntRect(0, 0, 300, 200), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2253 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2253 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2254 } | 2254 } |
| 2255 }; | 2255 }; |
| 2256 | 2256 |
| 2257 MAIN_AND_IMPL_THREAD_TEST(CCOcclusionTrackerTestSurfaceOcclusionTranslatesWithCl
ipping); | 2257 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesWithClip
ping); |
| 2258 | 2258 |
| 2259 template<class Types, bool opaqueLayers> | 2259 template<class Types, bool opaqueLayers> |
| 2260 class CCOcclusionTrackerTestReplicaOccluded : public CCOcclusionTrackerTest<Type
s, opaqueLayers> { | 2260 class OcclusionTrackerTestReplicaOccluded : public OcclusionTrackerTest<Types, o
paqueLayers> { |
| 2261 protected: | 2261 protected: |
| 2262 void runMyTest() | 2262 void runMyTest() |
| 2263 { | 2263 { |
| 2264 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2264 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2265 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2265 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2266 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2266 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2267 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); | 2267 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 100), IntSize(100, 100), true); |
| 2268 this->calcDrawEtc(parent); | 2268 this->calcDrawEtc(parent); |
| 2269 | 2269 |
| 2270 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2270 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2271 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2271 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2272 | 2272 |
| 2273 // |topmost| occludes the replica, but not the surface itself. | 2273 // |topmost| occludes the replica, but not the surface itself. |
| 2274 this->visitLayer(topmost, occlusion); | 2274 this->visitLayer(topmost, occlusion); |
| 2275 | 2275 |
| 2276 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); | 2276 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInScreenSpa
ce().bounds()); |
| 2277 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2277 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2278 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); | 2278 EXPECT_RECT_EQ(IntRect(0, 100, 100, 100), occlusion.occlusionInTargetSur
face().bounds()); |
| 2279 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2279 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2280 | 2280 |
| 2281 this->visitLayer(surface, occlusion); | 2281 this->visitLayer(surface, occlusion); |
| 2282 | 2282 |
| 2283 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); | 2283 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2284 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2284 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2285 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2285 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2286 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2286 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2287 | 2287 |
| 2288 this->enterContributingSurface(surface, occlusion); | 2288 this->enterContributingSurface(surface, occlusion); |
| 2289 | 2289 |
| 2290 // Surface is not occluded so it shouldn't think it is. | 2290 // Surface is not occluded so it shouldn't think it is. |
| 2291 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2291 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2292 } | 2292 } |
| 2293 }; | 2293 }; |
| 2294 | 2294 |
| 2295 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReplicaOccluded); | 2295 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaOccluded); |
| 2296 | 2296 |
| 2297 template<class Types, bool opaqueLayers> | 2297 template<class Types, bool opaqueLayers> |
| 2298 class CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded : public CCOcclusionTra
ckerTest<Types, opaqueLayers> { | 2298 class OcclusionTrackerTestSurfaceWithReplicaUnoccluded : public OcclusionTracker
Test<Types, opaqueLayers> { |
| 2299 protected: | 2299 protected: |
| 2300 void runMyTest() | 2300 void runMyTest() |
| 2301 { | 2301 { |
| 2302 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2302 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2303 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2303 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2304 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2304 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2305 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); | 2305 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 110), true); |
| 2306 this->calcDrawEtc(parent); | 2306 this->calcDrawEtc(parent); |
| 2307 | 2307 |
| 2308 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2308 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2309 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2309 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2310 | 2310 |
| 2311 // |topmost| occludes the surface, but not the entire surface's replica. | 2311 // |topmost| occludes the surface, but not the entire surface's replica. |
| 2312 this->visitLayer(topmost, occlusion); | 2312 this->visitLayer(topmost, occlusion); |
| 2313 | 2313 |
| 2314 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); | 2314 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); |
| 2315 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2315 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2316 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2316 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2317 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2317 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2318 | 2318 |
| 2319 this->visitLayer(surface, occlusion); | 2319 this->visitLayer(surface, occlusion); |
| 2320 | 2320 |
| 2321 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); | 2321 EXPECT_RECT_EQ(IntRect(0, 0, 100, 110), occlusion.occlusionInScreenSpace
().bounds()); |
| 2322 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2322 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2323 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2323 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2324 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2324 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2325 | 2325 |
| 2326 this->enterContributingSurface(surface, occlusion); | 2326 this->enterContributingSurface(surface, occlusion); |
| 2327 | 2327 |
| 2328 // Surface is occluded, but only the top 10px of the replica. | 2328 // Surface is occluded, but only the top 10px of the replica. |
| 2329 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurf
aceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2329 EXPECT_RECT_EQ(IntRect(0, 0, 0, 0), occlusion.unoccludedContributingSurf
aceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2330 EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); | 2330 EXPECT_RECT_EQ(IntRect(0, 10, 100, 90), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); |
| 2331 } | 2331 } |
| 2332 }; | 2332 }; |
| 2333 | 2333 |
| 2334 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceWithReplicaUnoccluded); | 2334 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceWithReplicaUnoccluded); |
| 2335 | 2335 |
| 2336 template<class Types, bool opaqueLayers> | 2336 template<class Types, bool opaqueLayers> |
| 2337 class CCOcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public CCOccl
usionTrackerTest<Types, opaqueLayers> { | 2337 class OcclusionTrackerTestSurfaceAndReplicaOccludedDifferently : public Occlusio
nTrackerTest<Types, opaqueLayers> { |
| 2338 protected: | 2338 protected: |
| 2339 void runMyTest() | 2339 void runMyTest() |
| 2340 { | 2340 { |
| 2341 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2341 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2342 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2342 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2343 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); | 2343 this->createReplicaLayer(surface, this->identityMatrix, FloatPoint(0, 10
0), IntSize(100, 100)); |
| 2344 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); | 2344 typename Types::LayerType* overSurface = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 0), IntSize(40, 100), true); |
| 2345 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); | 2345 typename Types::LayerType* overReplica = this->createDrawingLayer(parent
, this->identityMatrix, FloatPoint(0, 100), IntSize(50, 100), true); |
| 2346 this->calcDrawEtc(parent); | 2346 this->calcDrawEtc(parent); |
| 2347 | 2347 |
| 2348 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2348 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2349 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2349 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2350 | 2350 |
| 2351 // These occlude the surface and replica differently, so we can test eac
h one. | 2351 // These occlude the surface and replica differently, so we can test eac
h one. |
| 2352 this->visitLayer(overReplica, occlusion); | 2352 this->visitLayer(overReplica, occlusion); |
| 2353 this->visitLayer(overSurface, occlusion); | 2353 this->visitLayer(overSurface, occlusion); |
| 2354 | 2354 |
| 2355 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace(
).bounds()); | 2355 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2356 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2356 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2357 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurfac
e().bounds()); | 2357 EXPECT_RECT_EQ(IntRect(0, 0, 50, 200), occlusion.occlusionInTargetSurfac
e().bounds()); |
| 2358 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2358 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2359 | 2359 |
| 2360 this->visitLayer(surface, occlusion); | 2360 this->visitLayer(surface, occlusion); |
| 2361 | 2361 |
| 2362 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); | 2362 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.occlusionInScreenSpace
().bounds()); |
| 2363 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2363 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2364 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2364 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2365 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2365 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2366 | 2366 |
| 2367 this->enterContributingSurface(surface, occlusion); | 2367 this->enterContributingSurface(surface, occlusion); |
| 2368 | 2368 |
| 2369 // Surface and replica are occluded different amounts. | 2369 // Surface and replica are occluded different amounts. |
| 2370 EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2370 EXPECT_RECT_EQ(IntRect(40, 0, 60, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2371 EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); | 2371 EXPECT_RECT_EQ(IntRect(50, 0, 50, 100), occlusion.unoccludedContributing
SurfaceContentRect(surface, true, IntRect(0, 0, 100, 100))); |
| 2372 } | 2372 } |
| 2373 }; | 2373 }; |
| 2374 | 2374 |
| 2375 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceAndReplicaOccludedDiffe
rently); | 2375 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceAndReplicaOccludedDifferent
ly); |
| 2376 | 2376 |
| 2377 template<class Types, bool opaqueLayers> | 2377 template<class Types, bool opaqueLayers> |
| 2378 class CCOcclusionTrackerTestSurfaceChildOfSurface : public CCOcclusionTrackerTes
t<Types, opaqueLayers> { | 2378 class OcclusionTrackerTestSurfaceChildOfSurface : public OcclusionTrackerTest<Ty
pes, opaqueLayers> { |
| 2379 protected: | 2379 protected: |
| 2380 void runMyTest() | 2380 void runMyTest() |
| 2381 { | 2381 { |
| 2382 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2382 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
| 2383 | 2383 |
| 2384 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2384 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2385 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2385 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2386 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); | 2386 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 10), IntSize(100, 50), true); |
| 2387 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); | 2387 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); |
| 2388 this->calcDrawEtc(parent); | 2388 this->calcDrawEtc(parent); |
| 2389 | 2389 |
| 2390 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); | 2390 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(-100, -100, 1000, 1000)); |
| 2391 | 2391 |
| 2392 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2392 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
| 2393 this->visitLayer(topmost, occlusion); | 2393 this->visitLayer(topmost, occlusion); |
| 2394 | 2394 |
| 2395 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace(
).bounds()); | 2395 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInScreenSpace(
).bounds()); |
| 2396 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2396 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2397 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurfac
e().bounds()); | 2397 EXPECT_RECT_EQ(IntRect(0, 0, 100, 50), occlusion.occlusionInTargetSurfac
e().bounds()); |
| 2398 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2398 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2399 | 2399 |
| 2400 this->visitLayer(surfaceChild, occlusion); | 2400 this->visitLayer(surfaceChild, occlusion); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2423 EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); | 2423 EXPECT_RECT_EQ(IntRect(0, 10, 100, 50), occlusion.occlusionInTargetSurfa
ce().bounds()); |
| 2424 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2424 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2425 this->leaveLayer(surface, occlusion); | 2425 this->leaveLayer(surface, occlusion); |
| 2426 | 2426 |
| 2427 this->enterContributingSurface(surface, occlusion); | 2427 this->enterContributingSurface(surface, occlusion); |
| 2428 // The surface's parent does have a clipRect as it is the root layer. | 2428 // The surface's parent does have a clipRect as it is the root layer. |
| 2429 EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2429 EXPECT_RECT_EQ(IntRect(0, 50, 100, 50), occlusion.unoccludedContributing
SurfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2430 } | 2430 } |
| 2431 }; | 2431 }; |
| 2432 | 2432 |
| 2433 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfSurface); | 2433 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfSurface); |
| 2434 | 2434 |
| 2435 template<class Types, bool opaqueLayers> | 2435 template<class Types, bool opaqueLayers> |
| 2436 class CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public CCOcclusi
onTrackerTest<Types, opaqueLayers> { | 2436 class OcclusionTrackerTestTopmostSurfaceIsClippedToViewport : public OcclusionTr
ackerTest<Types, opaqueLayers> { |
| 2437 protected: | 2437 protected: |
| 2438 void runMyTest() | 2438 void runMyTest() |
| 2439 { | 2439 { |
| 2440 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. | 2440 // This test verifies that the top-most surface is considered occluded o
utside of its target's clipRect and outside the viewport rect. |
| 2441 | 2441 |
| 2442 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); | 2442 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(100, 200)); |
| 2443 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); | 2443 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 300), true); |
| 2444 this->calcDrawEtc(parent); | 2444 this->calcDrawEtc(parent); |
| 2445 | 2445 |
| 2446 { | 2446 { |
| 2447 // Make a viewport rect that is larger than the root layer. | 2447 // Make a viewport rect that is larger than the root layer. |
| 2448 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2448 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2449 | 2449 |
| 2450 this->visitLayer(surface, occlusion); | 2450 this->visitLayer(surface, occlusion); |
| 2451 | 2451 |
| 2452 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. | 2452 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. |
| 2453 this->enterContributingSurface(surface, occlusion); | 2453 this->enterContributingSurface(surface, occlusion); |
| 2454 // Make sure the parent's clipRect clips the unoccluded region of th
e child surface. | 2454 // Make sure the parent's clipRect clips the unoccluded region of th
e child surface. |
| 2455 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); | 2455 EXPECT_RECT_EQ(IntRect(0, 0, 100, 200), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); |
| 2456 } | 2456 } |
| 2457 this->resetLayerIterator(); | 2457 this->resetLayerIterator(); |
| 2458 { | 2458 { |
| 2459 // Make a viewport rect that is smaller than the root layer. | 2459 // Make a viewport rect that is smaller than the root layer. |
| 2460 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename T
ypes::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); | 2460 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Typ
es::RenderSurfaceType> occlusion(IntRect(0, 0, 100, 100)); |
| 2461 | 2461 |
| 2462 this->visitLayer(surface, occlusion); | 2462 this->visitLayer(surface, occlusion); |
| 2463 | 2463 |
| 2464 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. | 2464 // The root layer always has a clipRect. So the parent of |surface|
has a clipRect giving the surface itself a clipRect. |
| 2465 this->enterContributingSurface(surface, occlusion); | 2465 this->enterContributingSurface(surface, occlusion); |
| 2466 // Make sure the viewport rect clips the unoccluded region of the ch
ild surface. | 2466 // Make sure the viewport rect clips the unoccluded region of the ch
ild surface. |
| 2467 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); | 2467 EXPECT_RECT_EQ(IntRect(0, 0, 100, 100), occlusion.unoccludedContribu
tingSurfaceContentRect(surface, false, IntRect(0, 0, 100, 300))); |
| 2468 } | 2468 } |
| 2469 } | 2469 } |
| 2470 }; | 2470 }; |
| 2471 | 2471 |
| 2472 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTopmostSurfaceIsClippedToViewp
ort); | 2472 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTopmostSurfaceIsClippedToViewport)
; |
| 2473 | 2473 |
| 2474 template<class Types, bool opaqueLayers> | 2474 template<class Types, bool opaqueLayers> |
| 2475 class CCOcclusionTrackerTestSurfaceChildOfClippingSurface : public CCOcclusionTr
ackerTest<Types, opaqueLayers> { | 2475 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke
rTest<Types, opaqueLayers> { |
| 2476 protected: | 2476 protected: |
| 2477 void runMyTest() | 2477 void runMyTest() |
| 2478 { | 2478 { |
| 2479 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2479 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
| 2480 | 2480 |
| 2481 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); | 2481 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(80, 200)); |
| 2482 parent->setMasksToBounds(true); | 2482 parent->setMasksToBounds(true); |
| 2483 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); | 2483 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), true); |
| 2484 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); | 2484 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, FloatPoint(0, 0), IntSize(100, 100), false); |
| 2485 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); | 2485 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, FloatPoint(0, 0), IntSize(100, 50), true); |
| 2486 this->calcDrawEtc(parent); | 2486 this->calcDrawEtc(parent); |
| 2487 | 2487 |
| 2488 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2488 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2489 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2489 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2490 | 2490 |
| 2491 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2491 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
| 2492 this->visitLayer(topmost, occlusion); | 2492 this->visitLayer(topmost, occlusion); |
| 2493 | 2493 |
| 2494 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace()
.bounds()); | 2494 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInScreenSpace()
.bounds()); |
| 2495 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2495 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2496 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface
().bounds()); | 2496 EXPECT_RECT_EQ(IntRect(0, 0, 80, 50), occlusion.occlusionInTargetSurface
().bounds()); |
| 2497 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2497 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2498 | 2498 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2513 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); | 2513 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surfaceChild, false, IntRect(0, 0, 100, 100))); |
| 2514 this->leaveContributingSurface(surfaceChild, occlusion); | 2514 this->leaveContributingSurface(surfaceChild, occlusion); |
| 2515 | 2515 |
| 2516 this->visitLayer(surface, occlusion); | 2516 this->visitLayer(surface, occlusion); |
| 2517 this->enterContributingSurface(surface, occlusion); | 2517 this->enterContributingSurface(surface, occlusion); |
| 2518 // The surface's parent does have a clipRect as it is the root layer. | 2518 // The surface's parent does have a clipRect as it is the root layer. |
| 2519 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); | 2519 EXPECT_RECT_EQ(IntRect(0, 50, 80, 50), occlusion.unoccludedContributingS
urfaceContentRect(surface, false, IntRect(0, 0, 100, 100))); |
| 2520 } | 2520 } |
| 2521 }; | 2521 }; |
| 2522 | 2522 |
| 2523 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestSurfaceChildOfClippingSurface)
; | 2523 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestSurfaceChildOfClippingSurface); |
| 2524 | 2524 |
| 2525 template<class Types, bool opaqueLayers> | 2525 template<class Types, bool opaqueLayers> |
| 2526 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public
CCOcclusionTrackerTest<Types, opaqueLayers> { | 2526 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilter : public Oc
clusionTrackerTest<Types, opaqueLayers> { |
| 2527 protected: | 2527 protected: |
| 2528 void runMyTest() | 2528 void runMyTest() |
| 2529 { | 2529 { |
| 2530 WebTransformationMatrix scaleByHalf; | 2530 WebTransformationMatrix scaleByHalf; |
| 2531 scaleByHalf.scale(0.5); | 2531 scaleByHalf.scale(0.5); |
| 2532 | 2532 |
| 2533 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2533 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
| 2534 // 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 | 2534 // 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 |
| 2535 // appears at 50, 50 and the replica at 200, 50. | 2535 // appears at 50, 50 and the replica at 200, 50. |
| 2536 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2536 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2537 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); | 2537 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); |
| 2538 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); | 2538 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); |
| 2539 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); | 2539 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); |
| 2540 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); | 2540 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); |
| 2541 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); | 2541 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); |
| 2542 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); | 2542 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); |
| 2543 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); | 2543 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); |
| 2544 | 2544 |
| 2545 // Filters make the layer own a surface. | 2545 // Filters make the layer own a surface. |
| 2546 WebFilterOperations filters; | 2546 WebFilterOperations filters; |
| 2547 filters.append(WebFilterOperation::createBlurFilter(10)); | 2547 filters.append(WebFilterOperation::createBlurFilter(10)); |
| 2548 filteredSurface->setBackgroundFilters(filters); | 2548 filteredSurface->setBackgroundFilters(filters); |
| 2549 | 2549 |
| 2550 // Save the distance of influence for the blur effect. | 2550 // Save the distance of influence for the blur effect. |
| 2551 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2551 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2552 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2552 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2553 | 2553 |
| 2554 this->calcDrawEtc(parent); | 2554 this->calcDrawEtc(parent); |
| 2555 | 2555 |
| 2556 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2556 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2557 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2557 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2558 | 2558 |
| 2559 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2559 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| 2560 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2560 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
| 2561 this->visitLayer(occludingLayer5, occlusion); | 2561 this->visitLayer(occludingLayer5, occlusion); |
| 2562 this->visitLayer(occludingLayer4, occlusion); | 2562 this->visitLayer(occludingLayer4, occlusion); |
| 2563 this->visitLayer(occludingLayer3, occlusion); | 2563 this->visitLayer(occludingLayer3, occlusion); |
| 2564 this->visitLayer(occludingLayer2, occlusion); | 2564 this->visitLayer(occludingLayer2, occlusion); |
| 2565 this->visitLayer(occludingLayer1, occlusion); | 2565 this->visitLayer(occludingLayer1, occlusion); |
| 2566 | 2566 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2638 testRect.move(-1, 0); | 2638 testRect.move(-1, 0); |
| 2639 testRect.expand(1, 0); | 2639 testRect.expand(1, 0); |
| 2640 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); | 2640 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2641 testRect = outsetRect; | 2641 testRect = outsetRect; |
| 2642 testRect.move(0, -1); | 2642 testRect.move(0, -1); |
| 2643 testRect.expand(0, 1); | 2643 testRect.expand(0, 1); |
| 2644 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); | 2644 EXPECT_RECT_EQ(outsetRect, occlusion.unoccludedContentRect(parent, testR
ect)); |
| 2645 } | 2645 } |
| 2646 }; | 2646 }; |
| 2647 | 2647 |
| 2648 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilter); | 2648 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilter); |
| 2649 | 2649 |
| 2650 template<class Types, bool opaqueLayers> | 2650 template<class Types, bool opaqueLayers> |
| 2651 class CCOcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public CC
OcclusionTrackerTest<Types, opaqueLayers> { | 2651 class OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice : public Occl
usionTrackerTest<Types, opaqueLayers> { |
| 2652 protected: | 2652 protected: |
| 2653 void runMyTest() | 2653 void runMyTest() |
| 2654 { | 2654 { |
| 2655 WebTransformationMatrix scaleByHalf; | 2655 WebTransformationMatrix scaleByHalf; |
| 2656 scaleByHalf.scale(0.5); | 2656 scaleByHalf.scale(0.5); |
| 2657 | 2657 |
| 2658 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2658 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
| 2659 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, FloatPoint(0, 0), IntSize(75, 75)); | 2659 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, FloatPoint(0, 0), IntSize(75, 75)); |
| 2660 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, FloatPoint(0, 0), IntSize(150, 150)); | 2660 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, FloatPoint(0, 0), IntSize(150, 150)); |
| 2661 parent->setMasksToBounds(true); | 2661 parent->setMasksToBounds(true); |
| 2662 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); | 2662 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2663 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); | 2663 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, FloatPoint(0, 0), IntSize(300, 300), false); |
| 2664 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true); | 2664 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, FloatPoint(100, 100), IntSize(50, 50), true); |
| 2665 | 2665 |
| 2666 // Filters make the layers own surfaces. | 2666 // Filters make the layers own surfaces. |
| 2667 WebFilterOperations filters; | 2667 WebFilterOperations filters; |
| 2668 filters.append(WebFilterOperation::createBlurFilter(3)); | 2668 filters.append(WebFilterOperation::createBlurFilter(3)); |
| 2669 filteredSurface1->setBackgroundFilters(filters); | 2669 filteredSurface1->setBackgroundFilters(filters); |
| 2670 filteredSurface2->setBackgroundFilters(filters); | 2670 filteredSurface2->setBackgroundFilters(filters); |
| 2671 | 2671 |
| 2672 // Save the distance of influence for the blur effect. | 2672 // Save the distance of influence for the blur effect. |
| 2673 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2673 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2674 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2674 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2675 | 2675 |
| 2676 this->calcDrawEtc(root); | 2676 this->calcDrawEtc(root); |
| 2677 | 2677 |
| 2678 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2678 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2679 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2679 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2680 | 2680 |
| 2681 this->visitLayer(occludingLayerAbove, occlusion); | 2681 this->visitLayer(occludingLayerAbove, occlusion); |
| 2682 EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occl
usionInScreenSpace().bounds()); | 2682 EXPECT_RECT_EQ(IntRect(100 / 2, 100 / 2, 50 / 2, 50 / 2), occlusion.occl
usionInScreenSpace().bounds()); |
| 2683 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 2683 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2684 EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); | 2684 EXPECT_RECT_EQ(IntRect(100, 100, 50, 50), occlusion.occlusionInTargetSur
face().bounds()); |
| 2685 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 2685 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2686 | 2686 |
| 2687 this->visitLayer(filteredSurface2, occlusion); | 2687 this->visitLayer(filteredSurface2, occlusion); |
| 2688 this->visitContributingSurface(filteredSurface2, occlusion); | 2688 this->visitContributingSurface(filteredSurface2, occlusion); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2700 outsetTop = (outsetTop + 1) / 2; | 2700 outsetTop = (outsetTop + 1) / 2; |
| 2701 outsetRight = (outsetRight + 1) / 2; | 2701 outsetRight = (outsetRight + 1) / 2; |
| 2702 outsetBottom = (outsetBottom + 1) / 2; | 2702 outsetBottom = (outsetBottom + 1) / 2; |
| 2703 outsetLeft = (outsetLeft + 1) / 2; | 2703 outsetLeft = (outsetLeft + 1) / 2; |
| 2704 expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetB
ottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetB
ottom) * 2); | 2704 expectedOcclusion = IntRect(100 / 2 + outsetRight * 2, 100 / 2 + outsetB
ottom * 2, 50 / 2 - (outsetLeft + outsetRight) * 2, 50 /2 - (outsetTop + outsetB
ottom) * 2); |
| 2705 | 2705 |
| 2706 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); | 2706 EXPECT_RECT_EQ(expectedOcclusion, occlusion.occlusionInScreenSpace().rec
ts()[0]); |
| 2707 } | 2707 } |
| 2708 }; | 2708 }; |
| 2709 | 2709 |
| 2710 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestTwoBackgroundFiltersReduceOccl
usionTwice); | 2710 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusio
nTwice); |
| 2711 | 2711 |
| 2712 template<class Types, bool opaqueLayers> | 2712 template<class Types, bool opaqueLayers> |
| 2713 class CCOcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip :
public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2713 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types, opaqueLayers> { |
| 2714 protected: | 2714 protected: |
| 2715 void runMyTest() | 2715 void runMyTest() |
| 2716 { | 2716 { |
| 2717 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2717 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
| 2718 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2718 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2719 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for | 2719 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for |
| 2720 // the background filter. | 2720 // the background filter. |
| 2721 typename Types::LayerType* clippingSurface = this->createSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70)); | 2721 typename Types::LayerType* clippingSurface = this->createSurface(parent,
this->identityMatrix, FloatPoint(0, 0), IntSize(300, 70)); |
| 2722 clippingSurface->setMasksToBounds(true); | 2722 clippingSurface->setMasksToBounds(true); |
| 2723 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false)
; | 2723 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), false)
; |
| 2724 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(150, 0), IntSize()); | 2724 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(150, 0), IntSize()); |
| 2725 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); | 2725 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 0), IntSize(300, 50), true); |
| 2726 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); | 2726 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 100), IntSize(300, 50), true); |
| 2727 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); | 2727 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(0, 50), IntSize(50, 50), true); |
| 2728 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); | 2728 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(100, 50), IntSize(100, 50), true); |
| 2729 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); | 2729 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, FloatPoint(250, 50), IntSize(50, 50), true); |
| 2730 | 2730 |
| 2731 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. | 2731 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. |
| 2732 WebFilterOperations filters; | 2732 WebFilterOperations filters; |
| 2733 filters.append(WebFilterOperation::createBlurFilter(12)); | 2733 filters.append(WebFilterOperation::createBlurFilter(12)); |
| 2734 filteredSurface->setBackgroundFilters(filters); | 2734 filteredSurface->setBackgroundFilters(filters); |
| 2735 | 2735 |
| 2736 // Save the distance of influence for the blur effect. | 2736 // Save the distance of influence for the blur effect. |
| 2737 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2737 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2738 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2738 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2739 | 2739 |
| 2740 this->calcDrawEtc(parent); | 2740 this->calcDrawEtc(parent); |
| 2741 | 2741 |
| 2742 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2742 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2743 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2743 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2744 | 2744 |
| 2745 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2745 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| 2746 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. | 2746 // need to see some of the pixels (up to radius far) underneath the occl
udingLayers. |
| 2747 this->visitLayer(occludingLayer5, occlusion); | 2747 this->visitLayer(occludingLayer5, occlusion); |
| 2748 this->visitLayer(occludingLayer4, occlusion); | 2748 this->visitLayer(occludingLayer4, occlusion); |
| 2749 this->visitLayer(occludingLayer3, occlusion); | 2749 this->visitLayer(occludingLayer3, occlusion); |
| 2750 this->visitLayer(occludingLayer2, occlusion); | 2750 this->visitLayer(occludingLayer2, occlusion); |
| 2751 this->visitLayer(occludingLayer1, occlusion); | 2751 this->visitLayer(occludingLayer1, occlusion); |
| 2752 | 2752 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 testRect.move(-1, 0); | 2825 testRect.move(-1, 0); |
| 2826 testRect.expand(1, 0); | 2826 testRect.expand(1, 0); |
| 2827 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); | 2827 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2828 testRect = outsetRect; | 2828 testRect = outsetRect; |
| 2829 testRect.move(0, -1); | 2829 testRect.move(0, -1); |
| 2830 testRect.expand(0, 1); | 2830 testRect.expand(0, 1); |
| 2831 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); | 2831 EXPECT_RECT_EQ(clippedOutsetRect, occlusion.unoccludedContentRect(clippi
ngSurface, testRect)); |
| 2832 } | 2832 } |
| 2833 }; | 2833 }; |
| 2834 | 2834 |
| 2835 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontOccludePixelsNeededForBack
groundFilterWithClip); | 2835 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontOccludePixelsNeededForBackgrou
ndFilterWithClip); |
| 2836 | 2836 |
| 2837 template<class Types, bool opaqueLayers> | 2837 template<class Types, bool opaqueLayers> |
| 2838 class CCOcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public CC
OcclusionTrackerTest<Types, opaqueLayers> { | 2838 class OcclusionTrackerTestDontReduceOcclusionBelowBackgroundFilter : public Occl
usionTrackerTest<Types, opaqueLayers> { |
| 2839 protected: | 2839 protected: |
| 2840 void runMyTest() | 2840 void runMyTest() |
| 2841 { | 2841 { |
| 2842 WebTransformationMatrix scaleByHalf; | 2842 WebTransformationMatrix scaleByHalf; |
| 2843 scaleByHalf.scale(0.5); | 2843 scaleByHalf.scale(0.5); |
| 2844 | 2844 |
| 2845 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. | 2845 // Make a surface and its replica, each 50x50, with a smaller 30x30 laye
r centered below each. |
| 2846 // 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 | 2846 // 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 |
| 2847 // appears at 50, 50 and the replica at 200, 50. | 2847 // appears at 50, 50 and the replica at 200, 50. |
| 2848 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2848 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2849 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true); | 2849 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(60, 60), IntSize(30, 30), true); |
| 2850 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true); | 2850 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(210, 60), IntSize(30, 30), true); |
| 2851 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); | 2851 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); |
| 2852 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); | 2852 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); |
| 2853 | 2853 |
| 2854 // Filters make the layer own a surface. | 2854 // Filters make the layer own a surface. |
| 2855 WebFilterOperations filters; | 2855 WebFilterOperations filters; |
| 2856 filters.append(WebFilterOperation::createBlurFilter(3)); | 2856 filters.append(WebFilterOperation::createBlurFilter(3)); |
| 2857 filteredSurface->setBackgroundFilters(filters); | 2857 filteredSurface->setBackgroundFilters(filters); |
| 2858 | 2858 |
| 2859 this->calcDrawEtc(parent); | 2859 this->calcDrawEtc(parent); |
| 2860 | 2860 |
| 2861 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2861 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2862 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2862 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2863 | 2863 |
| 2864 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2864 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
| 2865 this->visitLayer(filteredSurface, occlusion); | 2865 this->visitLayer(filteredSurface, occlusion); |
| 2866 this->visitContributingSurface(filteredSurface, occlusion); | 2866 this->visitContributingSurface(filteredSurface, occlusion); |
| 2867 | 2867 |
| 2868 this->visitLayer(behindReplicaLayer, occlusion); | 2868 this->visitLayer(behindReplicaLayer, occlusion); |
| 2869 this->visitLayer(behindSurfaceLayer, occlusion); | 2869 this->visitLayer(behindSurfaceLayer, occlusion); |
| 2870 | 2870 |
| 2871 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. | 2871 // The layers behind the surface are not blurred, and their occlusion do
es not change, until we leave the surface. |
| 2872 // So it should not be modified by the filter here. | 2872 // So it should not be modified by the filter here. |
| 2873 IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30); | 2873 IntRect occlusionBehindSurface = IntRect(60, 60, 30, 30); |
| 2874 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); | 2874 IntRect occlusionBehindReplica = IntRect(210, 60, 30, 30); |
| 2875 | 2875 |
| 2876 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); | 2876 IntRect expectedOpaqueBounds = unionRect(occlusionBehindSurface, occlusi
onBehindReplica); |
| 2877 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 2877 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2878 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2878 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2879 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 2879 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2880 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2880 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2881 } | 2881 } |
| 2882 }; | 2882 }; |
| 2883 | 2883 |
| 2884 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionBelowBackgr
oundFilter); | 2884 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionBelowBackground
Filter); |
| 2885 | 2885 |
| 2886 template<class Types, bool opaqueLayers> | 2886 template<class Types, bool opaqueLayers> |
| 2887 class CCOcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : pu
blic CCOcclusionTrackerTest<Types, opaqueLayers> { | 2887 class OcclusionTrackerTestDontReduceOcclusionIfBackgroundFilterIsOccluded : publ
ic OcclusionTrackerTest<Types, opaqueLayers> { |
| 2888 protected: | 2888 protected: |
| 2889 void runMyTest() | 2889 void runMyTest() |
| 2890 { | 2890 { |
| 2891 WebTransformationMatrix scaleByHalf; | 2891 WebTransformationMatrix scaleByHalf; |
| 2892 scaleByHalf.scale(0.5); | 2892 scaleByHalf.scale(0.5); |
| 2893 | 2893 |
| 2894 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. | 2894 // Make a surface and its replica, each 50x50, that are completely occlu
ded by opaque layers which are above them in the z-order. |
| 2895 // 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 | 2895 // 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 |
| 2896 // appears at 50, 50 and the replica at 200, 50. | 2896 // appears at 50, 50 and the replica at 200, 50. |
| 2897 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2897 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2898 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); | 2898 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); |
| 2899 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); | 2899 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); |
| 2900 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true); | 2900 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(50, 50), IntSize(50, 50), true); |
| 2901 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true); | 2901 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), IntSize(50, 50), true); |
| 2902 | 2902 |
| 2903 // Filters make the layer own a surface. | 2903 // Filters make the layer own a surface. |
| 2904 WebFilterOperations filters; | 2904 WebFilterOperations filters; |
| 2905 filters.append(WebFilterOperation::createBlurFilter(3)); | 2905 filters.append(WebFilterOperation::createBlurFilter(3)); |
| 2906 filteredSurface->setBackgroundFilters(filters); | 2906 filteredSurface->setBackgroundFilters(filters); |
| 2907 | 2907 |
| 2908 this->calcDrawEtc(parent); | 2908 this->calcDrawEtc(parent); |
| 2909 | 2909 |
| 2910 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2910 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2911 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2911 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2912 | 2912 |
| 2913 this->visitLayer(aboveReplicaLayer, occlusion); | 2913 this->visitLayer(aboveReplicaLayer, occlusion); |
| 2914 this->visitLayer(aboveSurfaceLayer, occlusion); | 2914 this->visitLayer(aboveSurfaceLayer, occlusion); |
| 2915 | 2915 |
| 2916 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2916 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
| 2917 this->visitLayer(filteredSurface, occlusion); | 2917 this->visitLayer(filteredSurface, occlusion); |
| 2918 this->visitContributingSurface(filteredSurface, occlusion); | 2918 this->visitContributingSurface(filteredSurface, occlusion); |
| 2919 | 2919 |
| 2920 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. | 2920 // The filter is completely occluded, so it should not blur anything and
reduce any occlusion. |
| 2921 IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50); | 2921 IntRect occlusionAboveSurface = IntRect(50, 50, 50, 50); |
| 2922 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); | 2922 IntRect occlusionAboveReplica = IntRect(200, 50, 50, 50); |
| 2923 | 2923 |
| 2924 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); | 2924 IntRect expectedOpaqueBounds = unionRect(occlusionAboveSurface, occlusio
nAboveReplica); |
| 2925 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); | 2925 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInScreenSpace().
bounds()); |
| 2926 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); | 2926 EXPECT_EQ(2u, occlusion.occlusionInScreenSpace().rects().size()); |
| 2927 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); | 2927 EXPECT_RECT_EQ(expectedOpaqueBounds, occlusion.occlusionInTargetSurface(
).bounds()); |
| 2928 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); | 2928 EXPECT_EQ(2u, occlusion.occlusionInTargetSurface().rects().size()); |
| 2929 } | 2929 } |
| 2930 }; | 2930 }; |
| 2931 | 2931 |
| 2932 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestDontReduceOcclusionIfBackgroun
dFilterIsOccluded); | 2932 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestDontReduceOcclusionIfBackgroundFil
terIsOccluded); |
| 2933 | 2933 |
| 2934 template<class Types, bool opaqueLayers> | 2934 template<class Types, bool opaqueLayers> |
| 2935 class CCOcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOcclud
ed : public CCOcclusionTrackerTest<Types, opaqueLayers> { | 2935 class OcclusionTrackerTestReduceOcclusionWhenBackgroundFilterIsPartiallyOccluded
: public OcclusionTrackerTest<Types, opaqueLayers> { |
| 2936 protected: | 2936 protected: |
| 2937 void runMyTest() | 2937 void runMyTest() |
| 2938 { | 2938 { |
| 2939 WebTransformationMatrix scaleByHalf; | 2939 WebTransformationMatrix scaleByHalf; |
| 2940 scaleByHalf.scale(0.5); | 2940 scaleByHalf.scale(0.5); |
| 2941 | 2941 |
| 2942 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. | 2942 // Make a surface and its replica, each 50x50, that are partially occlud
ed by opaque layers which are above them in the z-order. |
| 2943 // 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 | 2943 // 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 |
| 2944 // appears at 50, 50 and the replica at 200, 50. | 2944 // appears at 50, 50 and the replica at 200, 50. |
| 2945 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); | 2945 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(300, 150)); |
| 2946 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); | 2946 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, FloatPoint(50, 50), IntSize(100, 100), false); |
| 2947 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); | 2947 this->createReplicaLayer(filteredSurface, this->identityMatrix, FloatPoi
nt(300, 0), IntSize()); |
| 2948 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true); | 2948 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(70, 50), IntSize(30, 50), true); |
| 2949 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true); | 2949 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, FloatPoint(200, 50), IntSize(30, 50), true); |
| 2950 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true); | 2950 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(90, 40), IntSize(10, 10), true); |
| 2951 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true); | 2951 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, FloatPoint(200, 40), IntSize(10, 10), true); |
| 2952 | 2952 |
| 2953 // Filters make the layer own a surface. | 2953 // Filters make the layer own a surface. |
| 2954 WebFilterOperations filters; | 2954 WebFilterOperations filters; |
| 2955 filters.append(WebFilterOperation::createBlurFilter(3)); | 2955 filters.append(WebFilterOperation::createBlurFilter(3)); |
| 2956 filteredSurface->setBackgroundFilters(filters); | 2956 filteredSurface->setBackgroundFilters(filters); |
| 2957 | 2957 |
| 2958 // Save the distance of influence for the blur effect. | 2958 // Save the distance of influence for the blur effect. |
| 2959 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2959 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2960 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2960 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2961 | 2961 |
| 2962 this->calcDrawEtc(parent); | 2962 this->calcDrawEtc(parent); |
| 2963 | 2963 |
| 2964 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 2964 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 2965 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 2965 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 2966 | 2966 |
| 2967 this->visitLayer(besideReplicaLayer, occlusion); | 2967 this->visitLayer(besideReplicaLayer, occlusion); |
| 2968 this->visitLayer(besideSurfaceLayer, occlusion); | 2968 this->visitLayer(besideSurfaceLayer, occlusion); |
| 2969 this->visitLayer(aboveReplicaLayer, occlusion); | 2969 this->visitLayer(aboveReplicaLayer, occlusion); |
| 2970 this->visitLayer(aboveSurfaceLayer, occlusion); | 2970 this->visitLayer(aboveSurfaceLayer, occlusion); |
| 2971 | 2971 |
| 2972 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2972 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
| 2973 this->visitLayer(filteredSurface, occlusion); | 2973 this->visitLayer(filteredSurface, occlusion); |
| 2974 this->visitContributingSurface(filteredSurface, occlusion); | 2974 this->visitContributingSurface(filteredSurface, occlusion); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2994 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { | 2994 for (size_t i = 0; i < expectedOcclusion.rects().size(); ++i) { |
| 2995 IntRect expectedRect = expectedOcclusion.rects()[i]; | 2995 IntRect expectedRect = expectedOcclusion.rects()[i]; |
| 2996 IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i]; | 2996 IntRect screenRect = occlusion.occlusionInScreenSpace().rects()[i]; |
| 2997 IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i]
; | 2997 IntRect targetRect = occlusion.occlusionInTargetSurface().rects()[i]
; |
| 2998 EXPECT_EQ(expectedRect, screenRect); | 2998 EXPECT_EQ(expectedRect, screenRect); |
| 2999 EXPECT_EQ(expectedRect, targetRect); | 2999 EXPECT_EQ(expectedRect, targetRect); |
| 3000 } | 3000 } |
| 3001 } | 3001 } |
| 3002 }; | 3002 }; |
| 3003 | 3003 |
| 3004 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestReduceOcclusionWhenBackgroundF
ilterIsPartiallyOccluded); | 3004 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReduceOcclusionWhenBackgroundFilte
rIsPartiallyOccluded); |
| 3005 | 3005 |
| 3006 template<class Types, bool opaqueLayers> | 3006 template<class Types, bool opaqueLayers> |
| 3007 class CCOcclusionTrackerTestMinimumTrackingSize : public CCOcclusionTrackerTest<
Types, opaqueLayers> { | 3007 class OcclusionTrackerTestMinimumTrackingSize : public OcclusionTrackerTest<Type
s, opaqueLayers> { |
| 3008 protected: | 3008 protected: |
| 3009 void runMyTest() | 3009 void runMyTest() |
| 3010 { | 3010 { |
| 3011 IntSize trackingSize(100, 100); | 3011 IntSize trackingSize(100, 100); |
| 3012 IntSize belowTrackingSize(99, 99); | 3012 IntSize belowTrackingSize(99, 99); |
| 3013 | 3013 |
| 3014 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); | 3014 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, FloatPoint(0, 0), IntSize(400, 400)); |
| 3015 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), trackingSize, true); | 3015 typename Types::LayerType* large = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), trackingSize, true); |
| 3016 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); | 3016 typename Types::LayerType* small = this->createDrawingLayer(parent, this
->identityMatrix, FloatPoint(0, 0), belowTrackingSize, true); |
| 3017 this->calcDrawEtc(parent); | 3017 this->calcDrawEtc(parent); |
| 3018 | 3018 |
| 3019 TestCCOcclusionTrackerWithClip<typename Types::LayerType, typename Types
::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); | 3019 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); |
| 3020 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); | 3020 occlusion.setLayerClipRect(IntRect(0, 0, 1000, 1000)); |
| 3021 occlusion.setMinimumTrackingSize(trackingSize); | 3021 occlusion.setMinimumTrackingSize(trackingSize); |
| 3022 | 3022 |
| 3023 // The small layer is not tracked because it is too small. | 3023 // The small layer is not tracked because it is too small. |
| 3024 this->visitLayer(small, occlusion); | 3024 this->visitLayer(small, occlusion); |
| 3025 | 3025 |
| 3026 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); | 3026 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInScreenSpace().bounds()); |
| 3027 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); | 3027 EXPECT_EQ(0u, occlusion.occlusionInScreenSpace().rects().size()); |
| 3028 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; | 3028 EXPECT_RECT_EQ(IntRect(), occlusion.occlusionInTargetSurface().bounds())
; |
| 3029 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); | 3029 EXPECT_EQ(0u, occlusion.occlusionInTargetSurface().rects().size()); |
| 3030 | 3030 |
| 3031 // The large layer is tracked as it is large enough. | 3031 // The large layer is tracked as it is large enough. |
| 3032 this->visitLayer(large, occlusion); | 3032 this->visitLayer(large, occlusion); |
| 3033 | 3033 |
| 3034 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInS
creenSpace().bounds()); | 3034 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInS
creenSpace().bounds()); |
| 3035 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); | 3035 EXPECT_EQ(1u, occlusion.occlusionInScreenSpace().rects().size()); |
| 3036 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInT
argetSurface().bounds()); | 3036 EXPECT_RECT_EQ(IntRect(IntPoint(), trackingSize), occlusion.occlusionInT
argetSurface().bounds()); |
| 3037 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); | 3037 EXPECT_EQ(1u, occlusion.occlusionInTargetSurface().rects().size()); |
| 3038 } | 3038 } |
| 3039 }; | 3039 }; |
| 3040 | 3040 |
| 3041 ALL_CCOCCLUSIONTRACKER_TEST(CCOcclusionTrackerTestMinimumTrackingSize); | 3041 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestMinimumTrackingSize); |
| 3042 | 3042 |
| 3043 } // namespace | 3043 } // namespace |
| OLD | NEW |