| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/occlusion_tracker.h" | 5 #include "cc/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include "cc/layer.h" | 7 #include "cc/layer.h" |
| 8 #include "cc/layer_animation_controller.h" | 8 #include "cc/layer_animation_controller.h" |
| 9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
| 10 #include "cc/layer_tree_host_common.h" | 10 #include "cc/layer_tree_host_common.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 class TestContentLayer : public Layer { | 28 class TestContentLayer : public Layer { |
| 29 public: | 29 public: |
| 30 TestContentLayer() | 30 TestContentLayer() |
| 31 : Layer() | 31 : Layer() |
| 32 , m_overrideOpaqueContentsRect(false) | 32 , m_overrideOpaqueContentsRect(false) |
| 33 { | 33 { |
| 34 } | 34 } |
| 35 | 35 |
| 36 virtual bool drawsContent() const OVERRIDE { return true; } | 36 virtual bool DrawsContent() const OVERRIDE { return true; } |
| 37 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 37 virtual Region VisibleContentOpaqueRegion() const OVERRIDE |
| 38 { | 38 { |
| 39 if (m_overrideOpaqueContentsRect) | 39 if (m_overrideOpaqueContentsRect) |
| 40 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect(
)); | 40 return gfx::IntersectRects(m_opaqueContentsRect, visible_content_rec
t()); |
| 41 return Layer::visibleContentOpaqueRegion(); | 41 return Layer::VisibleContentOpaqueRegion(); |
| 42 } | 42 } |
| 43 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) | 43 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) |
| 44 { | 44 { |
| 45 m_overrideOpaqueContentsRect = true; | 45 m_overrideOpaqueContentsRect = true; |
| 46 m_opaqueContentsRect = opaqueContentsRect; | 46 m_opaqueContentsRect = opaqueContentsRect; |
| 47 } | 47 } |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 virtual ~TestContentLayer() | 50 virtual ~TestContentLayer() |
| 51 { | 51 { |
| 52 } | 52 } |
| 53 | 53 |
| 54 bool m_overrideOpaqueContentsRect; | 54 bool m_overrideOpaqueContentsRect; |
| 55 gfx::Rect m_opaqueContentsRect; | 55 gfx::Rect m_opaqueContentsRect; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class TestContentLayerImpl : public LayerImpl { | 58 class TestContentLayerImpl : public LayerImpl { |
| 59 public: | 59 public: |
| 60 TestContentLayerImpl(LayerTreeImpl* treeImpl, int id) | 60 TestContentLayerImpl(LayerTreeImpl* treeImpl, int id) |
| 61 : LayerImpl(treeImpl, id) | 61 : LayerImpl(treeImpl, id) |
| 62 , m_overrideOpaqueContentsRect(false) | 62 , m_overrideOpaqueContentsRect(false) |
| 63 { | 63 { |
| 64 setDrawsContent(true); | 64 SetDrawsContent(true); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual Region visibleContentOpaqueRegion() const OVERRIDE | 67 virtual Region VisibleContentOpaqueRegion() const OVERRIDE |
| 68 { | 68 { |
| 69 if (m_overrideOpaqueContentsRect) | 69 if (m_overrideOpaqueContentsRect) |
| 70 return gfx::IntersectRects(m_opaqueContentsRect, visibleContentRect(
)); | 70 return gfx::IntersectRects(m_opaqueContentsRect, visible_content_rec
t()); |
| 71 return LayerImpl::visibleContentOpaqueRegion(); | 71 return LayerImpl::VisibleContentOpaqueRegion(); |
| 72 } | 72 } |
| 73 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) | 73 void setOpaqueContentsRect(const gfx::Rect& opaqueContentsRect) |
| 74 { | 74 { |
| 75 m_overrideOpaqueContentsRect = true; | 75 m_overrideOpaqueContentsRect = true; |
| 76 m_opaqueContentsRect = opaqueContentsRect; | 76 m_opaqueContentsRect = opaqueContentsRect; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 bool m_overrideOpaqueContentsRect; | 80 bool m_overrideOpaqueContentsRect; |
| 81 gfx::Rect m_opaqueContentsRect; | 81 gfx::Rect m_opaqueContentsRect; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return
layer->drawTransformIsAnimating(); } | 84 static inline bool layerImplDrawTransformIsUnknown(const Layer* layer) { return
layer->draw_transform_is_animating(); } |
| 85 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa
lse; } | 85 static inline bool layerImplDrawTransformIsUnknown(const LayerImpl*) { return fa
lse; } |
| 86 | 86 |
| 87 template<typename LayerType, typename RenderSurfaceType> | 87 template<typename LayerType, typename RenderSurfaceType> |
| 88 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
RenderSurfaceType> { | 88 class TestOcclusionTrackerWithClip : public TestOcclusionTrackerBase<LayerType,
RenderSurfaceType> { |
| 89 public: | 89 public: |
| 90 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr
ame = false) | 90 TestOcclusionTrackerWithClip(gfx::Rect viewportRect, bool recordMetricsForFr
ame = false) |
| 91 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r
ecordMetricsForFrame) | 91 : TestOcclusionTrackerBase<LayerType, RenderSurfaceType>(viewportRect, r
ecordMetricsForFrame) |
| 92 { | 92 { |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, boo
l* hasOcclusionFromOutsideTargetSurface = 0) const | 95 bool occludedLayer(const LayerType* layer, const gfx::Rect& contentRect, boo
l* hasOcclusionFromOutsideTargetSurface = 0) const |
| 96 { | 96 { |
| 97 return this->Occluded(layer->renderTarget(), contentRect, layer->drawTra
nsform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(), layer->cli
pRect(), hasOcclusionFromOutsideTargetSurface); | 97 return this->Occluded(layer->render_target(), contentRect, layer->draw_t
ransform(), layerImplDrawTransformIsUnknown(layer), layer->is_clipped(), layer->
clip_rect(), hasOcclusionFromOutsideTargetSurface); |
| 98 } | 98 } |
| 99 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
layer. Simple wrapper around unoccludedContentRect. | 99 // Gives an unoccluded sub-rect of |contentRect| in the content space of the
layer. Simple wrapper around unoccludedContentRect. |
| 100 gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect
& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const | 100 gfx::Rect unoccludedLayerContentRect(const LayerType* layer, const gfx::Rect
& contentRect, bool* hasOcclusionFromOutsideTargetSurface = 0) const |
| 101 { | 101 { |
| 102 return this->UnoccludedContentRect(layer->renderTarget(), contentRect, l
ayer->drawTransform(), layerImplDrawTransformIsUnknown(layer), layer->isClipped(
), layer->clipRect(), hasOcclusionFromOutsideTargetSurface); | 102 return this->UnoccludedContentRect(layer->render_target(), contentRect,
layer->draw_transform(), layerImplDrawTransformIsUnknown(layer), layer->is_clipp
ed(), layer->clip_rect(), hasOcclusionFromOutsideTargetSurface); |
| 103 } | 103 } |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 struct OcclusionTrackerTestMainThreadTypes { | 106 struct OcclusionTrackerTestMainThreadTypes { |
| 107 typedef Layer LayerType; | 107 typedef Layer LayerType; |
| 108 typedef LayerTreeHost HostType; | 108 typedef LayerTreeHost HostType; |
| 109 typedef RenderSurface RenderSurfaceType; | 109 typedef RenderSurface RenderSurfaceType; |
| 110 typedef TestContentLayer ContentLayerType; | 110 typedef TestContentLayer ContentLayerType; |
| 111 typedef scoped_refptr<Layer> LayerPtrType; | 111 typedef scoped_refptr<Layer> LayerPtrType; |
| 112 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; | 112 typedef scoped_refptr<ContentLayerType> ContentLayerPtrType; |
| 113 typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurfa
ce, LayerIteratorActions::FrontToBack> TestLayerIterator; | 113 typedef LayerIterator<Layer, std::vector<scoped_refptr<Layer> >, RenderSurfa
ce, LayerIteratorActions::FrontToBack> TestLayerIterator; |
| 114 typedef OcclusionTracker OcclusionTrackerType; | 114 typedef OcclusionTracker OcclusionTrackerType; |
| 115 | 115 |
| 116 static LayerPtrType createLayer(HostType*) | 116 static LayerPtrType createLayer(HostType*) |
| 117 { | 117 { |
| 118 return Layer::create(); | 118 return Layer::Create(); |
| 119 } | 119 } |
| 120 static ContentLayerPtrType createContentLayer(HostType*) { return make_scope
d_refptr(new ContentLayerType()); } | 120 static ContentLayerPtrType createContentLayer(HostType*) { return make_scope
d_refptr(new ContentLayerType()); } |
| 121 | 121 |
| 122 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) | 122 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) |
| 123 { | 123 { |
| 124 LayerPtrType ref(layer); | 124 LayerPtrType ref(layer); |
| 125 layer = NULL; | 125 layer = NULL; |
| 126 return ref; | 126 return ref; |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 142 struct OcclusionTrackerTestImplThreadTypes { | 142 struct OcclusionTrackerTestImplThreadTypes { |
| 143 typedef LayerImpl LayerType; | 143 typedef LayerImpl LayerType; |
| 144 typedef LayerTreeImpl HostType; | 144 typedef LayerTreeImpl HostType; |
| 145 typedef RenderSurfaceImpl RenderSurfaceType; | 145 typedef RenderSurfaceImpl RenderSurfaceType; |
| 146 typedef TestContentLayerImpl ContentLayerType; | 146 typedef TestContentLayerImpl ContentLayerType; |
| 147 typedef scoped_ptr<LayerImpl> LayerPtrType; | 147 typedef scoped_ptr<LayerImpl> LayerPtrType; |
| 148 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; | 148 typedef scoped_ptr<ContentLayerType> ContentLayerPtrType; |
| 149 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> TestLayerIterator; | 149 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl,
LayerIteratorActions::FrontToBack> TestLayerIterator; |
| 150 typedef OcclusionTrackerImpl OcclusionTrackerType; | 150 typedef OcclusionTrackerImpl OcclusionTrackerType; |
| 151 | 151 |
| 152 static LayerPtrType createLayer(HostType* host) { return LayerImpl::create(h
ost, nextLayerImplId++); } | 152 static LayerPtrType createLayer(HostType* host) { return LayerImpl::Create(h
ost, nextLayerImplId++); } |
| 153 static ContentLayerPtrType createContentLayer(HostType* host) { return make_
scoped_ptr(new ContentLayerType(host, nextLayerImplId++)); } | 153 static ContentLayerPtrType createContentLayer(HostType* host) { return make_
scoped_ptr(new ContentLayerType(host, nextLayerImplId++)); } |
| 154 static int nextLayerImplId; | 154 static int nextLayerImplId; |
| 155 | 155 |
| 156 static LayerPtrType passLayerPtr(LayerPtrType& layer) | 156 static LayerPtrType passLayerPtr(LayerPtrType& layer) |
| 157 { | 157 { |
| 158 return layer.Pass(); | 158 return layer.Pass(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) | 161 static LayerPtrType passLayerPtr(ContentLayerPtrType& layer) |
| 162 { | 162 { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 DCHECK(!m_root); | 202 DCHECK(!m_root); |
| 203 m_root = Types::passLayerPtr(layer); | 203 m_root = Types::passLayerPtr(layer); |
| 204 return layerPtr; | 204 return layerPtr; |
| 205 } | 205 } |
| 206 | 206 |
| 207 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& bou
nds) | 207 typename Types::LayerType* createLayer(typename Types::LayerType* parent, co
nst gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& bou
nds) |
| 208 { | 208 { |
| 209 typename Types::LayerPtrType layer(Types::createLayer(getHost())); | 209 typename Types::LayerPtrType layer(Types::createLayer(getHost())); |
| 210 typename Types::LayerType* layerPtr = layer.get(); | 210 typename Types::LayerType* layerPtr = layer.get(); |
| 211 setProperties(layerPtr, transform, position, bounds); | 211 setProperties(layerPtr, transform, position, bounds); |
| 212 parent->addChild(Types::passLayerPtr(layer)); | 212 parent->AddChild(Types::passLayerPtr(layer)); |
| 213 return layerPtr; | 213 return layerPtr; |
| 214 } | 214 } |
| 215 | 215 |
| 216 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& b
ounds) | 216 typename Types::LayerType* createSurface(typename Types::LayerType* parent,
const gfx::Transform& transform, const gfx::PointF& position, const gfx::Size& b
ounds) |
| 217 { | 217 { |
| 218 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); | 218 typename Types::LayerType* layer = createLayer(parent, transform, positi
on, bounds); |
| 219 WebKit::WebFilterOperations filters; | 219 WebKit::WebFilterOperations filters; |
| 220 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); | 220 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
| 221 layer->setFilters(filters); | 221 layer->SetFilters(filters); |
| 222 return layer; | 222 return layer; |
| 223 } | 223 } |
| 224 | 224 |
| 225 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const gfx::Transform& transform, const gfx::PointF& position, const
gfx::Size& bounds, bool opaque) | 225 typename Types::ContentLayerType* createDrawingLayer(typename Types::LayerTy
pe* parent, const gfx::Transform& transform, const gfx::PointF& position, const
gfx::Size& bounds, bool opaque) |
| 226 { | 226 { |
| 227 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); | 227 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); |
| 228 typename Types::ContentLayerType* layerPtr = layer.get(); | 228 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 229 setProperties(layerPtr, transform, position, bounds); | 229 setProperties(layerPtr, transform, position, bounds); |
| 230 | 230 |
| 231 if (m_opaqueLayers) | 231 if (m_opaqueLayers) |
| 232 layerPtr->setContentsOpaque(opaque); | 232 layerPtr->SetContentsOpaque(opaque); |
| 233 else { | 233 else { |
| 234 layerPtr->setContentsOpaque(false); | 234 layerPtr->SetContentsOpaque(false); |
| 235 if (opaque) | 235 if (opaque) |
| 236 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; | 236 layerPtr->setOpaqueContentsRect(gfx::Rect(gfx::Point(), bounds))
; |
| 237 else | 237 else |
| 238 layerPtr->setOpaqueContentsRect(gfx::Rect()); | 238 layerPtr->setOpaqueContentsRect(gfx::Rect()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 parent->addChild(Types::passLayerPtr(layer)); | 241 parent->AddChild(Types::passLayerPtr(layer)); |
| 242 return layerPtr; | 242 return layerPtr; |
| 243 } | 243 } |
| 244 | 244 |
| 245 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const gfx::Transform& transform, const gfx::PointF& position, const gf
x::Size& bounds) | 245 typename Types::LayerType* createReplicaLayer(typename Types::LayerType* own
ingLayer, const gfx::Transform& transform, const gfx::PointF& position, const gf
x::Size& bounds) |
| 246 { | 246 { |
| 247 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); | 247 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); |
| 248 typename Types::ContentLayerType* layerPtr = layer.get(); | 248 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 249 setProperties(layerPtr, transform, position, bounds); | 249 setProperties(layerPtr, transform, position, bounds); |
| 250 setReplica(owningLayer, Types::passLayerPtr(layer)); | 250 setReplica(owningLayer, Types::passLayerPtr(layer)); |
| 251 return layerPtr; | 251 return layerPtr; |
| 252 } | 252 } |
| 253 | 253 |
| 254 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning
Layer, const gfx::Size& bounds) | 254 typename Types::LayerType* createMaskLayer(typename Types::LayerType* owning
Layer, const gfx::Size& bounds) |
| 255 { | 255 { |
| 256 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); | 256 typename Types::ContentLayerPtrType layer(Types::createContentLayer(getH
ost())); |
| 257 typename Types::ContentLayerType* layerPtr = layer.get(); | 257 typename Types::ContentLayerType* layerPtr = layer.get(); |
| 258 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); | 258 setProperties(layerPtr, identityMatrix, gfx::PointF(), bounds); |
| 259 setMask(owningLayer, Types::passLayerPtr(layer)); | 259 setMask(owningLayer, Types::passLayerPtr(layer)); |
| 260 return layerPtr; | 260 return layerPtr; |
| 261 } | 261 } |
| 262 | 262 |
| 263 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const gfx::Transform& transform, const gfx::PointF& position, cons
t gfx::Size& bounds, bool opaque) | 263 typename Types::ContentLayerType* createDrawingSurface(typename Types::Layer
Type* parent, const gfx::Transform& transform, const gfx::PointF& position, cons
t gfx::Size& bounds, bool opaque) |
| 264 { | 264 { |
| 265 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); | 265 typename Types::ContentLayerType* layer = createDrawingLayer(parent, tra
nsform, position, bounds, opaque); |
| 266 WebKit::WebFilterOperations filters; | 266 WebKit::WebFilterOperations filters; |
| 267 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); | 267 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
| 268 layer->setFilters(filters); | 268 layer->SetFilters(filters); |
| 269 return layer; | 269 return layer; |
| 270 } | 270 } |
| 271 | 271 |
| 272 void calcDrawEtc(TestContentLayerImpl* root) | 272 void calcDrawEtc(TestContentLayerImpl* root) |
| 273 { | 273 { |
| 274 DCHECK(root == m_root.get()); | 274 DCHECK(root == m_root.get()); |
| 275 int dummyMaxTextureSize = 512; | 275 int dummyMaxTextureSize = 512; |
| 276 | 276 |
| 277 DCHECK(!root->renderSurface()); | 277 DCHECK(!root->render_surface()); |
| 278 | 278 |
| 279 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1,
dummyMaxTextureSize, false, m_renderSurfaceLayerListImpl, false); | 279 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1,
dummyMaxTextureSize, false, m_renderSurfaceLayerListImpl, false); |
| 280 | 280 |
| 281 m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin
(&m_renderSurfaceLayerListImpl); | 281 m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin
(&m_renderSurfaceLayerListImpl); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void calcDrawEtc(TestContentLayer* root) | 284 void calcDrawEtc(TestContentLayer* root) |
| 285 { | 285 { |
| 286 DCHECK(root == m_root.get()); | 286 DCHECK(root == m_root.get()); |
| 287 int dummyMaxTextureSize = 512; | 287 int dummyMaxTextureSize = 512; |
| 288 | 288 |
| 289 DCHECK(!root->renderSurface()); | 289 DCHECK(!root->render_surface()); |
| 290 | 290 |
| 291 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1,
dummyMaxTextureSize, false, m_renderSurfaceLayerList); | 291 LayerTreeHostCommon::calculateDrawProperties(root, root->bounds(), 1, 1,
dummyMaxTextureSize, false, m_renderSurfaceLayerList); |
| 292 | 292 |
| 293 m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin
(&m_renderSurfaceLayerList); | 293 m_layerIterator = m_layerIteratorBegin = Types::TestLayerIterator::begin
(&m_renderSurfaceLayerList); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void EnterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) | 296 void EnterLayer(typename Types::LayerType* layer, typename Types::OcclusionT
rackerType& occlusion) |
| 297 { | 297 { |
| 298 ASSERT_EQ(layer, *m_layerIterator); | 298 ASSERT_EQ(layer, *m_layerIterator); |
| 299 ASSERT_TRUE(m_layerIterator.representsItself()); | 299 ASSERT_TRUE(m_layerIterator.representsItself()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 void resetLayerIterator() | 342 void resetLayerIterator() |
| 343 { | 343 { |
| 344 m_layerIterator = m_layerIteratorBegin; | 344 m_layerIterator = m_layerIteratorBegin; |
| 345 } | 345 } |
| 346 | 346 |
| 347 const gfx::Transform identityMatrix; | 347 const gfx::Transform identityMatrix; |
| 348 | 348 |
| 349 private: | 349 private: |
| 350 void setBaseProperties(typename Types::LayerType* layer, const gfx::Transfor
m& transform, const gfx::PointF& position, const gfx::Size& bounds) | 350 void setBaseProperties(typename Types::LayerType* layer, const gfx::Transfor
m& transform, const gfx::PointF& position, const gfx::Size& bounds) |
| 351 { | 351 { |
| 352 layer->setTransform(transform); | 352 layer->SetTransform(transform); |
| 353 layer->setSublayerTransform(gfx::Transform()); | 353 layer->SetSublayerTransform(gfx::Transform()); |
| 354 layer->setAnchorPoint(gfx::PointF(0, 0)); | 354 layer->SetAnchorPoint(gfx::PointF(0, 0)); |
| 355 layer->setPosition(position); | 355 layer->SetPosition(position); |
| 356 layer->setBounds(bounds); | 356 layer->SetBounds(bounds); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void setProperties(Layer* layer, const gfx::Transform& transform, const gfx:
:PointF& position, const gfx::Size& bounds) | 359 void setProperties(Layer* layer, const gfx::Transform& transform, const gfx:
:PointF& position, const gfx::Size& bounds) |
| 360 { | 360 { |
| 361 setBaseProperties(layer, transform, position, bounds); | 361 setBaseProperties(layer, transform, position, bounds); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void setProperties(LayerImpl* layer, const gfx::Transform& transform, const
gfx::PointF& position, const gfx::Size& bounds) | 364 void setProperties(LayerImpl* layer, const gfx::Transform& transform, const
gfx::PointF& position, const gfx::Size& bounds) |
| 365 { | 365 { |
| 366 setBaseProperties(layer, transform, position, bounds); | 366 setBaseProperties(layer, transform, position, bounds); |
| 367 | 367 |
| 368 layer->setContentBounds(layer->bounds()); | 368 layer->SetContentBounds(layer->bounds()); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) | 371 void setReplica(Layer* owningLayer, scoped_refptr<Layer> layer) |
| 372 { | 372 { |
| 373 owningLayer->setReplicaLayer(layer.get()); | 373 owningLayer->SetReplicaLayer(layer.get()); |
| 374 m_replicaLayers.push_back(layer); | 374 m_replicaLayers.push_back(layer); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void setReplica(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) | 377 void setReplica(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) |
| 378 { | 378 { |
| 379 owningLayer->setReplicaLayer(layer.Pass()); | 379 owningLayer->SetReplicaLayer(layer.Pass()); |
| 380 } | 380 } |
| 381 | 381 |
| 382 void setMask(Layer* owningLayer, scoped_refptr<Layer> layer) | 382 void setMask(Layer* owningLayer, scoped_refptr<Layer> layer) |
| 383 { | 383 { |
| 384 owningLayer->setMaskLayer(layer.get()); | 384 owningLayer->SetMaskLayer(layer.get()); |
| 385 m_maskLayers.push_back(layer); | 385 m_maskLayers.push_back(layer); |
| 386 } | 386 } |
| 387 | 387 |
| 388 void setMask(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) | 388 void setMask(LayerImpl* owningLayer, scoped_ptr<LayerImpl> layer) |
| 389 { | 389 { |
| 390 owningLayer->setMaskLayer(layer.Pass()); | 390 owningLayer->SetMaskLayer(layer.Pass()); |
| 391 } | 391 } |
| 392 | 392 |
| 393 FakeImplProxy m_proxy; | 393 FakeImplProxy m_proxy; |
| 394 FakeLayerTreeHostImpl m_hostImpl; | 394 FakeLayerTreeHostImpl m_hostImpl; |
| 395 bool m_opaqueLayers; | 395 bool m_opaqueLayers; |
| 396 // These hold ownership of the layers for the duration of the test. | 396 // These hold ownership of the layers for the duration of the test. |
| 397 typename Types::LayerPtrType m_root; | 397 typename Types::LayerPtrType m_root; |
| 398 std::vector<scoped_refptr<Layer> > m_renderSurfaceLayerList; | 398 std::vector<scoped_refptr<Layer> > m_renderSurfaceLayerList; |
| 399 std::vector<LayerImpl*> m_renderSurfaceLayerListImpl; | 399 std::vector<LayerImpl*> m_renderSurfaceLayerListImpl; |
| 400 typename Types::TestLayerIterator m_layerIteratorBegin; | 400 typename Types::TestLayerIterator m_layerIteratorBegin; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 template<class Types> | 461 template<class Types> |
| 462 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types
> { | 462 class OcclusionTrackerTestIdentityTransforms : public OcclusionTrackerTest<Types
> { |
| 463 protected: | 463 protected: |
| 464 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} | 464 OcclusionTrackerTestIdentityTransforms(bool opaqueLayers) : OcclusionTracker
Test<Types>(opaqueLayers) {} |
| 465 | 465 |
| 466 void runMyTest() | 466 void runMyTest() |
| 467 { | 467 { |
| 468 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 468 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
| 469 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 469 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 470 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 470 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 471 parent->setMasksToBounds(true); | 471 parent->SetMasksToBounds(true); |
| 472 this->calcDrawEtc(root); | 472 this->calcDrawEtc(root); |
| 473 | 473 |
| 474 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 474 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 475 | 475 |
| 476 this->visitLayer(layer, occlusion); | 476 this->visitLayer(layer, occlusion); |
| 477 this->EnterLayer(parent, occlusion); | 477 this->EnterLayer(parent, occlusion); |
| 478 | 478 |
| 479 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 479 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 480 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from
_inside_target().ToString()); | 480 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from
_inside_target().ToString()); |
| 481 | 481 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 void runMyTest() | 546 void runMyTest() |
| 547 { | 547 { |
| 548 gfx::Transform layerTransform; | 548 gfx::Transform layerTransform; |
| 549 layerTransform.Translate(250, 250); | 549 layerTransform.Translate(250, 250); |
| 550 layerTransform.Rotate(90); | 550 layerTransform.Rotate(90); |
| 551 layerTransform.Translate(-250, -250); | 551 layerTransform.Translate(-250, -250); |
| 552 | 552 |
| 553 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::Point(0, 0), gfx::Size(200, 200)); | 553 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::Point(0, 0), gfx::Size(200, 200)); |
| 554 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 554 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 555 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 555 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 556 parent->setMasksToBounds(true); | 556 parent->SetMasksToBounds(true); |
| 557 this->calcDrawEtc(root); | 557 this->calcDrawEtc(root); |
| 558 | 558 |
| 559 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 559 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 560 | 560 |
| 561 this->visitLayer(layer, occlusion); | 561 this->visitLayer(layer, occlusion); |
| 562 this->EnterLayer(parent, occlusion); | 562 this->EnterLayer(parent, occlusion); |
| 563 | 563 |
| 564 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 564 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 565 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from
_inside_target().ToString()); | 565 EXPECT_EQ(gfx::Rect(30, 30, 70, 70).ToString(), occlusion.occlusion_from
_inside_target().ToString()); |
| 566 | 566 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 589 protected: | 589 protected: |
| 590 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} | 590 OcclusionTrackerTestTranslatedChild(bool opaqueLayers) : OcclusionTrackerTes
t<Types>(opaqueLayers) {} |
| 591 void runMyTest() | 591 void runMyTest() |
| 592 { | 592 { |
| 593 gfx::Transform layerTransform; | 593 gfx::Transform layerTransform; |
| 594 layerTransform.Translate(20, 20); | 594 layerTransform.Translate(20, 20); |
| 595 | 595 |
| 596 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 596 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
| 597 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 597 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 598 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 598 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 599 parent->setMasksToBounds(true); | 599 parent->SetMasksToBounds(true); |
| 600 this->calcDrawEtc(root); | 600 this->calcDrawEtc(root); |
| 601 | 601 |
| 602 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 602 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 603 | 603 |
| 604 this->visitLayer(layer, occlusion); | 604 this->visitLayer(layer, occlusion); |
| 605 this->EnterLayer(parent, occlusion); | 605 this->EnterLayer(parent, occlusion); |
| 606 | 606 |
| 607 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 607 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 608 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusion_from
_inside_target().ToString()); | 608 EXPECT_EQ(gfx::Rect(50, 50, 50, 50).ToString(), occlusion.occlusion_from
_inside_target().ToString()); |
| 609 | 609 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 632 protected: | 632 protected: |
| 633 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 633 OcclusionTrackerTestChildInRotatedChild(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 634 void runMyTest() | 634 void runMyTest() |
| 635 { | 635 { |
| 636 gfx::Transform childTransform; | 636 gfx::Transform childTransform; |
| 637 childTransform.Translate(250, 250); | 637 childTransform.Translate(250, 250); |
| 638 childTransform.Rotate(90); | 638 childTransform.Rotate(90); |
| 639 childTransform.Translate(-250, -250); | 639 childTransform.Translate(-250, -250); |
| 640 | 640 |
| 641 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 641 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 642 parent->setMasksToBounds(true); | 642 parent->SetMasksToBounds(true); |
| 643 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 643 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 644 child->setMasksToBounds(true); | 644 child->SetMasksToBounds(true); |
| 645 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 645 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 646 this->calcDrawEtc(parent); | 646 this->calcDrawEtc(parent); |
| 647 | 647 |
| 648 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 648 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 649 | 649 |
| 650 this->visitLayer(layer, occlusion); | 650 this->visitLayer(layer, occlusion); |
| 651 this->enterContributingSurface(child, occlusion); | 651 this->enterContributingSurface(child, occlusion); |
| 652 | 652 |
| 653 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 653 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 654 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); | 654 EXPECT_EQ(gfx::Rect(10, 430, 60, 70).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 protected: | 699 protected: |
| 700 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 700 OcclusionTrackerTestScaledRenderSurface(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 701 | 701 |
| 702 void runMyTest() | 702 void runMyTest() |
| 703 { | 703 { |
| 704 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 704 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
| 705 | 705 |
| 706 gfx::Transform layer1Matrix; | 706 gfx::Transform layer1Matrix; |
| 707 layer1Matrix.Scale(2, 2); | 707 layer1Matrix.Scale(2, 2); |
| 708 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 708 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(pare
nt, layer1Matrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 709 layer1->setForceRenderSurface(true); | 709 layer1->SetForceRenderSurface(true); |
| 710 | 710 |
| 711 gfx::Transform layer2Matrix; | 711 gfx::Transform layer2Matrix; |
| 712 layer2Matrix.Translate(25, 25); | 712 layer2Matrix.Translate(25, 25); |
| 713 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); | 713 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(laye
r1, layer2Matrix, gfx::PointF(0, 0), gfx::Size(50, 50), true); |
| 714 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); | 714 typename Types::ContentLayerType* occluder = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(500, 500), true); |
| 715 this->calcDrawEtc(parent); | 715 this->calcDrawEtc(parent); |
| 716 | 716 |
| 717 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 717 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 718 | 718 |
| 719 this->visitLayer(occluder, occlusion); | 719 this->visitLayer(occluder, occlusion); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 737 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 737 OcclusionTrackerTestVisitTargetTwoTimes(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 738 void runMyTest() | 738 void runMyTest() |
| 739 { | 739 { |
| 740 gfx::Transform childTransform; | 740 gfx::Transform childTransform; |
| 741 childTransform.Translate(250, 250); | 741 childTransform.Translate(250, 250); |
| 742 childTransform.Rotate(90); | 742 childTransform.Rotate(90); |
| 743 childTransform.Translate(-250, -250); | 743 childTransform.Translate(-250, -250); |
| 744 | 744 |
| 745 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); | 745 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(200, 200)); |
| 746 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 746 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 747 parent->setMasksToBounds(true); | 747 parent->SetMasksToBounds(true); |
| 748 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 748 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 749 child->setMasksToBounds(true); | 749 child->SetMasksToBounds(true); |
| 750 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 750 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 751 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in | 751 // |child2| makes |parent|'s surface get considered by OcclusionTracker
first, instead of |child|'s. This exercises different code in |
| 752 // leaveToTargetRenderSurface, as the target surface has already been se
en. | 752 // leaveToTargetRenderSurface, as the target surface has already been se
en. |
| 753 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); | 753 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, this->identityMatrix, gfx::PointF(30, 30), gfx::Size(60, 20), true); |
| 754 this->calcDrawEtc(root); | 754 this->calcDrawEtc(root); |
| 755 | 755 |
| 756 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 756 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 757 | 757 |
| 758 this->visitLayer(child2, occlusion); | 758 this->visitLayer(child2, occlusion); |
| 759 | 759 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 childTransform.Translate(250, 250); | 846 childTransform.Translate(250, 250); |
| 847 childTransform.Rotate(95); | 847 childTransform.Rotate(95); |
| 848 childTransform.Translate(-250, -250); | 848 childTransform.Translate(-250, -250); |
| 849 | 849 |
| 850 gfx::Transform layerTransform; | 850 gfx::Transform layerTransform; |
| 851 layerTransform.Translate(10, 10); | 851 layerTransform.Translate(10, 10); |
| 852 | 852 |
| 853 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); | 853 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); |
| 854 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 854 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 855 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); | 855 typename Types::LayerType* child = this->createLayer(parent, childTransf
orm, gfx::PointF(30, 30), gfx::Size(500, 500)); |
| 856 child->setMasksToBounds(true); | 856 child->SetMasksToBounds(true); |
| 857 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); | 857 typename Types::ContentLayerType* layer = this->createDrawingLayer(child
, layerTransform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
| 858 this->calcDrawEtc(root); | 858 this->calcDrawEtc(root); |
| 859 | 859 |
| 860 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 860 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 861 | 861 |
| 862 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visibleContentRect()); | 862 gfx::Rect clippedLayerInChild = MathUtil::mapClippedRect(layerTransform,
layer->visible_content_rect()); |
| 863 | 863 |
| 864 this->visitLayer(layer, occlusion); | 864 this->visitLayer(layer, occlusion); |
| 865 this->enterContributingSurface(child, occlusion); | 865 this->enterContributingSurface(child, occlusion); |
| 866 | 866 |
| 867 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 867 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 868 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusion_from_insid
e_target().ToString()); | 868 EXPECT_EQ(clippedLayerInChild.ToString(), occlusion.occlusion_from_insid
e_target().ToString()); |
| 869 | 869 |
| 870 this->leaveContributingSurface(child, occlusion); | 870 this->leaveContributingSurface(child, occlusion); |
| 871 this->EnterLayer(parent, occlusion); | 871 this->EnterLayer(parent, occlusion); |
| 872 | 872 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 886 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 886 OcclusionTrackerTestSurfaceWithTwoOpaqueChildren(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
| 887 void runMyTest() | 887 void runMyTest() |
| 888 { | 888 { |
| 889 gfx::Transform childTransform; | 889 gfx::Transform childTransform; |
| 890 childTransform.Translate(250, 250); | 890 childTransform.Translate(250, 250); |
| 891 childTransform.Rotate(90); | 891 childTransform.Rotate(90); |
| 892 childTransform.Translate(-250, -250); | 892 childTransform.Translate(-250, -250); |
| 893 | 893 |
| 894 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); | 894 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(1000, 1000)); |
| 895 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 895 typename Types::ContentLayerType* parent = this->createDrawingLayer(root
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 896 parent->setMasksToBounds(true); | 896 parent->SetMasksToBounds(true); |
| 897 typename Types::ContentLayerType* child = this->createDrawingLayer(paren
t, childTransform, gfx::PointF(30, 30), gfx::Size(500, 500), false); | 897 typename Types::ContentLayerType* child = this->createDrawingLayer(paren
t, childTransform, gfx::PointF(30, 30), gfx::Size(500, 500), false); |
| 898 child->setMasksToBounds(true); | 898 child->SetMasksToBounds(true); |
| 899 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); | 899 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 10), gfx::Size(500, 500), true); |
| 900 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); | 900 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d, this->identityMatrix, gfx::PointF(10, 450), gfx::Size(500, 60), true); |
| 901 this->calcDrawEtc(root); | 901 this->calcDrawEtc(root); |
| 902 | 902 |
| 903 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 903 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 904 | 904 |
| 905 this->visitLayer(layer2, occlusion); | 905 this->visitLayer(layer2, occlusion); |
| 906 this->visitLayer(layer1, occlusion); | 906 this->visitLayer(layer1, occlusion); |
| 907 this->visitLayer(child, occlusion); | 907 this->visitLayer(child, occlusion); |
| 908 this->enterContributingSurface(child, occlusion); | 908 this->enterContributingSurface(child, occlusion); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 protected: | 974 protected: |
| 975 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} | 975 OcclusionTrackerTestOverlappingSurfaceSiblings(bool opaqueLayers) : Occlusio
nTrackerTest<Types>(opaqueLayers) {} |
| 976 void runMyTest() | 976 void runMyTest() |
| 977 { | 977 { |
| 978 gfx::Transform childTransform; | 978 gfx::Transform childTransform; |
| 979 childTransform.Translate(250, 250); | 979 childTransform.Translate(250, 250); |
| 980 childTransform.Rotate(90); | 980 childTransform.Rotate(90); |
| 981 childTransform.Translate(-250, -250); | 981 childTransform.Translate(-250, -250); |
| 982 | 982 |
| 983 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 983 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 984 parent->setMasksToBounds(true); | 984 parent->SetMasksToBounds(true); |
| 985 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, gfx::PointF(30, 30), gfx::Size(10, 10)); | 985 typename Types::LayerType* child1 = this->createSurface(parent, childTra
nsform, gfx::PointF(30, 30), gfx::Size(10, 10)); |
| 986 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, gfx::PointF(20, 40), gfx::Size(10, 10)); | 986 typename Types::LayerType* child2 = this->createSurface(parent, childTra
nsform, gfx::PointF(20, 40), gfx::Size(10, 10)); |
| 987 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 987 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 988 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 988 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 989 this->calcDrawEtc(parent); | 989 this->calcDrawEtc(parent); |
| 990 | 990 |
| 991 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 991 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 992 | 992 |
| 993 this->visitLayer(layer2, occlusion); | 993 this->visitLayer(layer2, occlusion); |
| 994 this->enterContributingSurface(child2, occlusion); | 994 this->enterContributingSurface(child2, occlusion); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 gfx::Transform child2Transform; | 1073 gfx::Transform 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, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1078 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1079 parent->setMasksToBounds(true); | 1079 parent->SetMasksToBounds(true); |
| 1080 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); | 1080 typename Types::LayerType* child1 = this->createSurface(parent, child1Tr
ansform, gfx::PointF(30, 20), gfx::Size(10, 10)); |
| 1081 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); | 1081 typename Types::LayerType* child2 = this->createDrawingSurface(parent, c
hild2Transform, gfx::PointF(20, 40), gfx::Size(10, 10), false); |
| 1082 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); | 1082 typename Types::ContentLayerType* layer1 = this->createDrawingLayer(chil
d1, this->identityMatrix, gfx::PointF(-10, -20), gfx::Size(510, 510), true); |
| 1083 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); | 1083 typename Types::ContentLayerType* layer2 = this->createDrawingLayer(chil
d2, this->identityMatrix, gfx::PointF(-10, -10), gfx::Size(510, 510), true); |
| 1084 this->calcDrawEtc(parent); | 1084 this->calcDrawEtc(parent); |
| 1085 | 1085 |
| 1086 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1086 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1087 | 1087 |
| 1088 this->visitLayer(layer2, occlusion); | 1088 this->visitLayer(layer2, occlusion); |
| 1089 this->EnterLayer(child2, occlusion); | 1089 this->EnterLayer(child2, occlusion); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 protected: | 1148 protected: |
| 1149 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} | 1149 OcclusionTrackerTestFilters(bool opaqueLayers) : OcclusionTrackerTest<Types>
(opaqueLayers) {} |
| 1150 void runMyTest() | 1150 void runMyTest() |
| 1151 { | 1151 { |
| 1152 gfx::Transform layerTransform; | 1152 gfx::Transform layerTransform; |
| 1153 layerTransform.Translate(250, 250); | 1153 layerTransform.Translate(250, 250); |
| 1154 layerTransform.Rotate(90); | 1154 layerTransform.Rotate(90); |
| 1155 layerTransform.Translate(-250, -250); | 1155 layerTransform.Translate(-250, -250); |
| 1156 | 1156 |
| 1157 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1157 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1158 parent->setMasksToBounds(true); | 1158 parent->SetMasksToBounds(true); |
| 1159 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1159 typename Types::ContentLayerType* blurLayer = this->createDrawingLayer(p
arent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1160 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1160 typename Types::ContentLayerType* opaqueLayer = this->createDrawingLayer
(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1161 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); | 1161 typename Types::ContentLayerType* opacityLayer = this->createDrawingLaye
r(parent, layerTransform, gfx::PointF(30, 30), gfx::Size(500, 500), true); |
| 1162 | 1162 |
| 1163 WebKit::WebFilterOperations filters; | 1163 WebKit::WebFilterOperations filters; |
| 1164 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); | 1164 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); |
| 1165 blurLayer->setFilters(filters); | 1165 blurLayer->SetFilters(filters); |
| 1166 | 1166 |
| 1167 filters.clear(); | 1167 filters.clear(); |
| 1168 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); | 1168 filters.append(WebKit::WebFilterOperation::createGrayscaleFilter(0.5)); |
| 1169 opaqueLayer->setFilters(filters); | 1169 opaqueLayer->SetFilters(filters); |
| 1170 | 1170 |
| 1171 filters.clear(); | 1171 filters.clear(); |
| 1172 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)); | 1172 filters.append(WebKit::WebFilterOperation::createOpacityFilter(0.5)); |
| 1173 opacityLayer->setFilters(filters); | 1173 opacityLayer->SetFilters(filters); |
| 1174 | 1174 |
| 1175 this->calcDrawEtc(parent); | 1175 this->calcDrawEtc(parent); |
| 1176 | 1176 |
| 1177 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1177 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1178 | 1178 |
| 1179 // Opacity layer won't contribute to occlusion. | 1179 // Opacity layer won't contribute to occlusion. |
| 1180 this->visitLayer(opacityLayer, occlusion); | 1180 this->visitLayer(opacityLayer, occlusion); |
| 1181 this->enterContributingSurface(opacityLayer, occlusion); | 1181 this->enterContributingSurface(opacityLayer, occlusion); |
| 1182 | 1182 |
| 1183 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1183 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 | 1248 |
| 1249 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); | 1249 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaDoesOcclude); |
| 1250 | 1250 |
| 1251 template<class Types> | 1251 template<class Types> |
| 1252 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { | 1252 class OcclusionTrackerTestReplicaWithClipping : public OcclusionTrackerTest<Type
s> { |
| 1253 protected: | 1253 protected: |
| 1254 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} | 1254 OcclusionTrackerTestReplicaWithClipping(bool opaqueLayers) : OcclusionTracke
rTest<Types>(opaqueLayers) {} |
| 1255 void runMyTest() | 1255 void runMyTest() |
| 1256 { | 1256 { |
| 1257 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); | 1257 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 170)); |
| 1258 parent->setMasksToBounds(true); | 1258 parent->SetMasksToBounds(true); |
| 1259 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); | 1259 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 100), gfx::Size(50, 50), true); |
| 1260 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); | 1260 this->createReplicaLayer(surface, this->identityMatrix, gfx::PointF(50,
50), gfx::Size()); |
| 1261 this->calcDrawEtc(parent); | 1261 this->calcDrawEtc(parent); |
| 1262 | 1262 |
| 1263 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1263 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1264 | 1264 |
| 1265 this->visitLayer(surface, occlusion); | 1265 this->visitLayer(surface, occlusion); |
| 1266 | 1266 |
| 1267 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusion_from_i
nside_target().ToString()); | 1267 EXPECT_EQ(gfx::Rect(0, 0, 50, 50).ToString(), occlusion.occlusion_from_i
nside_target().ToString()); |
| 1268 | 1268 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); | 1305 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestReplicaWithMask); |
| 1306 | 1306 |
| 1307 template<class Types> | 1307 template<class Types> |
| 1308 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { | 1308 class OcclusionTrackerTestLayerClipRectOutsideChild : public OcclusionTrackerTes
t<Types> { |
| 1309 protected: | 1309 protected: |
| 1310 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} | 1310 OcclusionTrackerTestLayerClipRectOutsideChild(bool opaqueLayers) : Occlusion
TrackerTest<Types>(opaqueLayers) {} |
| 1311 void runMyTest() | 1311 void runMyTest() |
| 1312 { | 1312 { |
| 1313 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1313 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1314 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(200, 100), gfx::Size(100, 100), false); | 1314 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(200, 100), gfx::Size(100, 100), false); |
| 1315 clip->setMasksToBounds(true); | 1315 clip->SetMasksToBounds(true); |
| 1316 typename Types::ContentLayerType* layer = this->createDrawingLayer(clip,
this->identityMatrix, gfx::PointF(-200, -100), gfx::Size(200, 200), false); | 1316 typename Types::ContentLayerType* layer = this->createDrawingLayer(clip,
this->identityMatrix, gfx::PointF(-200, -100), gfx::Size(200, 200), false); |
| 1317 this->calcDrawEtc(parent); | 1317 this->calcDrawEtc(parent); |
| 1318 | 1318 |
| 1319 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1319 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1320 | 1320 |
| 1321 this->EnterLayer(layer, occlusion); | 1321 this->EnterLayer(layer, occlusion); |
| 1322 | 1322 |
| 1323 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1323 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
| 1324 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1324 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
| 1325 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1325 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); | 1382 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOutsideChild); |
| 1383 | 1383 |
| 1384 template<class Types> | 1384 template<class Types> |
| 1385 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { | 1385 class OcclusionTrackerTestLayerClipRectOverChild : public OcclusionTrackerTest<T
ypes> { |
| 1386 protected: | 1386 protected: |
| 1387 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} | 1387 OcclusionTrackerTestLayerClipRectOverChild(bool opaqueLayers) : OcclusionTra
ckerTest<Types>(opaqueLayers) {} |
| 1388 void runMyTest() | 1388 void runMyTest() |
| 1389 { | 1389 { |
| 1390 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1390 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1391 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(100, 100), false); | 1391 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(100, 100), false); |
| 1392 clip->setMasksToBounds(true); | 1392 clip->SetMasksToBounds(true); |
| 1393 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-100, -100), gfx::Size(200, 200), true); | 1393 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-100, -100), gfx::Size(200, 200), true); |
| 1394 this->calcDrawEtc(parent); | 1394 this->calcDrawEtc(parent); |
| 1395 | 1395 |
| 1396 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1396 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1397 | 1397 |
| 1398 this->EnterLayer(layer, occlusion); | 1398 this->EnterLayer(layer, occlusion); |
| 1399 | 1399 |
| 1400 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1400 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
| 1401 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; | 1401 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100)))
; |
| 1402 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; | 1402 EXPECT_TRUE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100)))
; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); | 1465 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestViewportRectOverChild); |
| 1466 | 1466 |
| 1467 template<class Types> | 1467 template<class Types> |
| 1468 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { | 1468 class OcclusionTrackerTestLayerClipRectPartlyOverChild : public OcclusionTracker
Test<Types> { |
| 1469 protected: | 1469 protected: |
| 1470 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 1470 OcclusionTrackerTestLayerClipRectPartlyOverChild(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
| 1471 void runMyTest() | 1471 void runMyTest() |
| 1472 { | 1472 { |
| 1473 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1473 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1474 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(200, 200), false); | 1474 typename Types::ContentLayerType* clip = this->createDrawingLayer(parent
, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(200, 200), false); |
| 1475 clip->setMasksToBounds(true); | 1475 clip->SetMasksToBounds(true); |
| 1476 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-50, -50), gfx::Size(200, 200), true); | 1476 typename Types::ContentLayerType* layer = this->createDrawingSurface(cli
p, this->identityMatrix, gfx::PointF(-50, -50), gfx::Size(200, 200), true); |
| 1477 this->calcDrawEtc(parent); | 1477 this->calcDrawEtc(parent); |
| 1478 | 1478 |
| 1479 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1479 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1480 | 1480 |
| 1481 this->EnterLayer(layer, occlusion); | 1481 this->EnterLayer(layer, occlusion); |
| 1482 | 1482 |
| 1483 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); | 1483 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 0, 100, 100))); |
| 1484 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); | 1484 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(0, 100, 100, 100))
); |
| 1485 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); | 1485 EXPECT_FALSE(occlusion.occludedLayer(layer, gfx::Rect(100, 0, 100, 100))
); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1739 // tracker. | 1739 // tracker. |
| 1740 | 1740 |
| 1741 gfx::Transform translationToFront; | 1741 gfx::Transform translationToFront; |
| 1742 translationToFront.Translate3d(0, 0, -10); | 1742 translationToFront.Translate3d(0, 0, -10); |
| 1743 gfx::Transform translationToBack; | 1743 gfx::Transform translationToBack; |
| 1744 translationToFront.Translate3d(0, 0, -100); | 1744 translationToFront.Translate3d(0, 0, -100); |
| 1745 | 1745 |
| 1746 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1746 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1747 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 1747 typename Types::ContentLayerType* child1 = this->createDrawingLayer(pare
nt, translationToBack, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 1748 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); | 1748 typename Types::ContentLayerType* child2 = this->createDrawingLayer(pare
nt, translationToFront, gfx::PointF(50, 50), gfx::Size(100, 100), true); |
| 1749 parent->setPreserves3D(true); | 1749 parent->SetPreserves3d(true); |
| 1750 | 1750 |
| 1751 this->calcDrawEtc(parent); | 1751 this->calcDrawEtc(parent); |
| 1752 | 1752 |
| 1753 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1753 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1754 this->visitLayer(child2, occlusion); | 1754 this->visitLayer(child2, occlusion); |
| 1755 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1755 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 1756 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 1756 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 1757 | 1757 |
| 1758 this->visitLayer(child1, occlusion); | 1758 this->visitLayer(child1, occlusion); |
| 1759 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1759 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1772 { | 1772 { |
| 1773 gfx::Transform transform; | 1773 gfx::Transform transform; |
| 1774 transform.Translate(150, 150); | 1774 transform.Translate(150, 150); |
| 1775 transform.ApplyPerspectiveDepth(400); | 1775 transform.ApplyPerspectiveDepth(400); |
| 1776 transform.RotateAboutXAxis(-30); | 1776 transform.RotateAboutXAxis(-30); |
| 1777 transform.Translate(-150, -150); | 1777 transform.Translate(-150, -150); |
| 1778 | 1778 |
| 1779 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1779 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1780 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1780 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1781 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); | 1781 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(100, 100), gfx::Size(200, 200), true); |
| 1782 container->setPreserves3D(true); | 1782 container->SetPreserves3d(true); |
| 1783 layer->setPreserves3D(true); | 1783 layer->SetPreserves3d(true); |
| 1784 this->calcDrawEtc(parent); | 1784 this->calcDrawEtc(parent); |
| 1785 | 1785 |
| 1786 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1786 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1787 this->EnterLayer(layer, occlusion); | 1787 this->EnterLayer(layer, occlusion); |
| 1788 | 1788 |
| 1789 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); | 1789 EXPECT_RECT_EQ(gfx::Rect(0, 0, 200, 200), occlusion.unoccludedLayerConte
ntRect(layer, gfx::Rect(0, 0, 200, 200))); |
| 1790 } | 1790 } |
| 1791 }; | 1791 }; |
| 1792 | 1792 |
| 1793 // 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. | 1793 // 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. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1804 transform.Translate(250, 50); | 1804 transform.Translate(250, 50); |
| 1805 transform.ApplyPerspectiveDepth(10); | 1805 transform.ApplyPerspectiveDepth(10); |
| 1806 transform.Translate(-250, -50); | 1806 transform.Translate(-250, -50); |
| 1807 transform.Translate(250, 50); | 1807 transform.Translate(250, 50); |
| 1808 transform.RotateAboutXAxis(-167); | 1808 transform.RotateAboutXAxis(-167); |
| 1809 transform.Translate(-250, -50); | 1809 transform.Translate(-250, -50); |
| 1810 | 1810 |
| 1811 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 100)); | 1811 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(500, 100)); |
| 1812 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); | 1812 typename Types::LayerType* container = this->createLayer(parent, this->i
dentityMatrix, gfx::PointF(0, 0), gfx::Size(500, 500)); |
| 1813 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(0, 0), gfx::Size(500, 500), true); | 1813 typename Types::ContentLayerType* layer = this->createDrawingLayer(conta
iner, transform, gfx::PointF(0, 0), gfx::Size(500, 500), true); |
| 1814 container->setPreserves3D(true); | 1814 container->SetPreserves3d(true); |
| 1815 layer->setPreserves3D(true); | 1815 layer->SetPreserves3d(true); |
| 1816 this->calcDrawEtc(parent); | 1816 this->calcDrawEtc(parent); |
| 1817 | 1817 |
| 1818 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1818 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1819 this->EnterLayer(layer, occlusion); | 1819 this->EnterLayer(layer, occlusion); |
| 1820 | 1820 |
| 1821 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, | 1821 // The bottom 11 pixel rows of this layer remain visible inside the cont
ainer, after translation to the target surface. When translated back, |
| 1822 // this will include many more pixels but must include at least the bott
om 11 rows. | 1822 // this will include many more pixels but must include at least the bott
om 11 rows. |
| 1823 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); | 1823 EXPECT_TRUE(occlusion.unoccludedLayerContentRect(layer, gfx::Rect(0, 0,
500, 500)).Contains(gfx::Rect(0, 489, 500, 11))); |
| 1824 } | 1824 } |
| 1825 }; | 1825 }; |
| 1826 | 1826 |
| 1827 // 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. | 1827 // 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. |
| 1828 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); | 1828 IMPL_THREAD_TEST(OcclusionTrackerTestPerspectiveTransformBehindCamera); |
| 1829 | 1829 |
| 1830 template<class Types> | 1830 template<class Types> |
| 1831 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { | 1831 class OcclusionTrackerTestLayerBehindCameraDoesNotOcclude : public OcclusionTrac
kerTest<Types> { |
| 1832 protected: | 1832 protected: |
| 1833 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} | 1833 OcclusionTrackerTestLayerBehindCameraDoesNotOcclude(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} |
| 1834 void runMyTest() | 1834 void runMyTest() |
| 1835 { | 1835 { |
| 1836 gfx::Transform transform; | 1836 gfx::Transform transform; |
| 1837 transform.Translate(50, 50); | 1837 transform.Translate(50, 50); |
| 1838 transform.ApplyPerspectiveDepth(100); | 1838 transform.ApplyPerspectiveDepth(100); |
| 1839 transform.Translate3d(0, 0, 110); | 1839 transform.Translate3d(0, 0, 110); |
| 1840 transform.Translate(-50, -50); | 1840 transform.Translate(-50, -50); |
| 1841 | 1841 |
| 1842 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1842 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1843 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 1843 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 1844 parent->setPreserves3D(true); | 1844 parent->SetPreserves3d(true); |
| 1845 layer->setPreserves3D(true); | 1845 layer->SetPreserves3d(true); |
| 1846 this->calcDrawEtc(parent); | 1846 this->calcDrawEtc(parent); |
| 1847 | 1847 |
| 1848 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1848 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1849 | 1849 |
| 1850 // The |layer| is entirely behind the camera and should not occlude. | 1850 // The |layer| is entirely behind the camera and should not occlude. |
| 1851 this->visitLayer(layer, occlusion); | 1851 this->visitLayer(layer, occlusion); |
| 1852 this->EnterLayer(parent, occlusion); | 1852 this->EnterLayer(parent, occlusion); |
| 1853 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); | 1853 EXPECT_TRUE(occlusion.occlusion_from_inside_target().IsEmpty()); |
| 1854 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); | 1854 EXPECT_TRUE(occlusion.occlusion_from_outside_target().IsEmpty()); |
| 1855 } | 1855 } |
| 1856 }; | 1856 }; |
| 1857 | 1857 |
| 1858 // 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. | 1858 // 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. |
| 1859 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); | 1859 IMPL_THREAD_TEST(OcclusionTrackerTestLayerBehindCameraDoesNotOcclude); |
| 1860 | 1860 |
| 1861 template<class Types> | 1861 template<class Types> |
| 1862 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { | 1862 class OcclusionTrackerTestLargePixelsOccludeInsideClipRect : public OcclusionTra
ckerTest<Types> { |
| 1863 protected: | 1863 protected: |
| 1864 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} | 1864 OcclusionTrackerTestLargePixelsOccludeInsideClipRect(bool opaqueLayers) : Oc
clusionTrackerTest<Types>(opaqueLayers) {} |
| 1865 void runMyTest() | 1865 void runMyTest() |
| 1866 { | 1866 { |
| 1867 gfx::Transform transform; | 1867 gfx::Transform transform; |
| 1868 transform.Translate(50, 50); | 1868 transform.Translate(50, 50); |
| 1869 transform.ApplyPerspectiveDepth(100); | 1869 transform.ApplyPerspectiveDepth(100); |
| 1870 transform.Translate3d(0, 0, 99); | 1870 transform.Translate3d(0, 0, 99); |
| 1871 transform.Translate(-50, -50); | 1871 transform.Translate(-50, -50); |
| 1872 | 1872 |
| 1873 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); | 1873 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(100, 100)); |
| 1874 parent->setMasksToBounds(true); | 1874 parent->SetMasksToBounds(true); |
| 1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 1875 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, transform, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 1876 parent->setPreserves3D(true); | 1876 parent->SetPreserves3d(true); |
| 1877 layer->setPreserves3D(true); | 1877 layer->SetPreserves3d(true); |
| 1878 this->calcDrawEtc(parent); | 1878 this->calcDrawEtc(parent); |
| 1879 | 1879 |
| 1880 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1880 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1881 | 1881 |
| 1882 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. | 1882 // This is very close to the camera, so pixels in its visibleContentRect
will actually go outside of the layer's clipRect. |
| 1883 // Ensure that those pixels don't occlude things outside the clipRect. | 1883 // Ensure that those pixels don't occlude things outside the clipRect. |
| 1884 this->visitLayer(layer, occlusion); | 1884 this->visitLayer(layer, occlusion); |
| 1885 this->EnterLayer(parent, occlusion); | 1885 this->EnterLayer(parent, occlusion); |
| 1886 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from
_inside_target().ToString()); | 1886 EXPECT_EQ(gfx::Rect(0, 0, 100, 100).ToString(), occlusion.occlusion_from
_inside_target().ToString()); |
| 1887 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 1887 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1906 // +--topmost | 1906 // +--topmost |
| 1907 | 1907 |
| 1908 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1908 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1909 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1909 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1910 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1910 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1911 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 1911 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 1912 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 1912 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 1913 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 1913 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 1914 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); | 1914 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
| 1915 | 1915 |
| 1916 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
0, 1, false); | 1916 addOpacityTransitionToController(*layer->layer_animation_controller(), 1
0, 0, 1, false); |
| 1917 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 0, 1, false); | 1917 addOpacityTransitionToController(*surface->layer_animation_controller(),
10, 0, 1, false); |
| 1918 this->calcDrawEtc(parent); | 1918 this->calcDrawEtc(parent); |
| 1919 | 1919 |
| 1920 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 1920 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 1921 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 1921 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 1922 EXPECT_TRUE(surface->renderSurface()->draw_opacity_is_animating()); | 1922 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 1923 | 1923 |
| 1924 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1924 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1925 | 1925 |
| 1926 this->visitLayer(topmost, occlusion); | 1926 this->visitLayer(topmost, occlusion); |
| 1927 this->EnterLayer(parent2, occlusion); | 1927 this->EnterLayer(parent2, occlusion); |
| 1928 // This occlusion will affect all surfaces. | 1928 // This occlusion will affect all surfaces. |
| 1929 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); | 1929 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); |
| 1930 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 1930 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 1931 EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), occlusion.unoccludedLaye
rContentRect(parent2, gfx::Rect(0, 0, 300, 300)).ToString()); | 1931 EXPECT_EQ(gfx::Rect(0, 0, 250, 300).ToString(), occlusion.unoccludedLaye
rContentRect(parent2, gfx::Rect(0, 0, 300, 300)).ToString()); |
| 1932 this->LeaveLayer(parent2, occlusion); | 1932 this->LeaveLayer(parent2, occlusion); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 void runMyTest() | 1971 void runMyTest() |
| 1972 { | 1972 { |
| 1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 1973 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1974 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1975 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 1975 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 1976 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 1976 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 1977 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 1977 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 1978 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 1978 typename Types::ContentLayerType* parent2 = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 1979 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); | 1979 typename Types::ContentLayerType* topmost = this->createDrawingLayer(par
ent, this->identityMatrix, gfx::PointF(250, 0), gfx::Size(50, 300), true); |
| 1980 | 1980 |
| 1981 addOpacityTransitionToController(*layer->layerAnimationController(), 10,
1, 0, false); | 1981 addOpacityTransitionToController(*layer->layer_animation_controller(), 1
0, 1, 0, false); |
| 1982 addOpacityTransitionToController(*surface->layerAnimationController(), 1
0, 1, 0, false); | 1982 addOpacityTransitionToController(*surface->layer_animation_controller(),
10, 1, 0, false); |
| 1983 this->calcDrawEtc(parent); | 1983 this->calcDrawEtc(parent); |
| 1984 | 1984 |
| 1985 EXPECT_TRUE(layer->drawOpacityIsAnimating()); | 1985 EXPECT_TRUE(layer->draw_opacity_is_animating()); |
| 1986 EXPECT_FALSE(surface->drawOpacityIsAnimating()); | 1986 EXPECT_FALSE(surface->draw_opacity_is_animating()); |
| 1987 EXPECT_TRUE(surface->renderSurface()->draw_opacity_is_animating()); | 1987 EXPECT_TRUE(surface->render_surface()->draw_opacity_is_animating()); |
| 1988 | 1988 |
| 1989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1989 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 1990 | 1990 |
| 1991 this->visitLayer(topmost, occlusion); | 1991 this->visitLayer(topmost, occlusion); |
| 1992 this->EnterLayer(parent2, occlusion); | 1992 this->EnterLayer(parent2, occlusion); |
| 1993 // This occlusion will affect all surfaces. | 1993 // This occlusion will affect all surfaces. |
| 1994 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); | 1994 EXPECT_EQ(gfx::Rect(250, 0, 50, 300).ToString(), occlusion.occlusion_fro
m_inside_target().ToString()); |
| 1995 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 1995 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| 1996 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); | 1996 EXPECT_RECT_EQ(gfx::Rect(0, 0, 250, 300), occlusion.unoccludedLayerConte
ntRect(parent, gfx::Rect(0, 0, 300, 300))); |
| 1997 this->LeaveLayer(parent2, occlusion); | 1997 this->LeaveLayer(parent2, occlusion); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2035 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} | 2035 OcclusionTrackerTestAnimationTranslateOnMainThread(bool opaqueLayers) : Occl
usionTrackerTest<Types>(opaqueLayers) {} |
| 2036 void runMyTest() | 2036 void runMyTest() |
| 2037 { | 2037 { |
| 2038 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 2038 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 2039 typename Types::ContentLayerType* layer = this->createDrawingLayer(paren
t, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 2040 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); | 2040 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 300), true); |
| 2041 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); | 2041 typename Types::ContentLayerType* surfaceChild = this->createDrawingLaye
r(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 300), true); |
| 2042 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); | 2042 typename Types::ContentLayerType* surfaceChild2 = this->createDrawingLay
er(surface, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 300), true); |
| 2043 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 300), true); | 2043 typename Types::ContentLayerType* surface2 = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 300), true); |
| 2044 | 2044 |
| 2045 addAnimatedTransformToController(*layer->layerAnimationController(), 10,
30, 0); | 2045 addAnimatedTransformToController(*layer->layer_animation_controller(), 1
0, 30, 0); |
| 2046 addAnimatedTransformToController(*surface->layerAnimationController(), 1
0, 30, 0); | 2046 addAnimatedTransformToController(*surface->layer_animation_controller(),
10, 30, 0); |
| 2047 addAnimatedTransformToController(*surfaceChild->layerAnimationController
(), 10, 30, 0); | 2047 addAnimatedTransformToController(*surfaceChild->layer_animation_controll
er(), 10, 30, 0); |
| 2048 this->calcDrawEtc(parent); | 2048 this->calcDrawEtc(parent); |
| 2049 | 2049 |
| 2050 EXPECT_TRUE(layer->drawTransformIsAnimating()); | 2050 EXPECT_TRUE(layer->draw_transform_is_animating()); |
| 2051 EXPECT_TRUE(layer->screenSpaceTransformIsAnimating()); | 2051 EXPECT_TRUE(layer->screen_space_transform_is_animating()); |
| 2052 EXPECT_TRUE(surface->renderSurface()->target_surface_transforms_are_anim
ating()); | 2052 EXPECT_TRUE(surface->render_surface()->target_surface_transforms_are_ani
mating()); |
| 2053 EXPECT_TRUE(surface->renderSurface()->screen_space_transforms_are_animat
ing()); | 2053 EXPECT_TRUE(surface->render_surface()->screen_space_transforms_are_anima
ting()); |
| 2054 // The surface owning layer doesn't animate against its own surface. | 2054 // The surface owning layer doesn't animate against its own surface. |
| 2055 EXPECT_FALSE(surface->drawTransformIsAnimating()); | 2055 EXPECT_FALSE(surface->draw_transform_is_animating()); |
| 2056 EXPECT_TRUE(surface->screenSpaceTransformIsAnimating()); | 2056 EXPECT_TRUE(surface->screen_space_transform_is_animating()); |
| 2057 EXPECT_TRUE(surfaceChild->drawTransformIsAnimating()); | 2057 EXPECT_TRUE(surfaceChild->draw_transform_is_animating()); |
| 2058 EXPECT_TRUE(surfaceChild->screenSpaceTransformIsAnimating()); | 2058 EXPECT_TRUE(surfaceChild->screen_space_transform_is_animating()); |
| 2059 | 2059 |
| 2060 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2060 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2061 | 2061 |
| 2062 this->visitLayer(surface2, occlusion); | 2062 this->visitLayer(surface2, occlusion); |
| 2063 this->enterContributingSurface(surface2, occlusion); | 2063 this->enterContributingSurface(surface2, occlusion); |
| 2064 | 2064 |
| 2065 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusion_from_
inside_target().ToString()); | 2065 EXPECT_EQ(gfx::Rect(0, 0, 50, 300).ToString(), occlusion.occlusion_from_
inside_target().ToString()); |
| 2066 | 2066 |
| 2067 this->leaveContributingSurface(surface2, occlusion); | 2067 this->leaveContributingSurface(surface2, occlusion); |
| 2068 this->EnterLayer(surfaceChild2, occlusion); | 2068 this->EnterLayer(surfaceChild2, occlusion); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2156 | 2156 |
| 2157 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); | 2157 MAIN_AND_IMPL_THREAD_TEST(OcclusionTrackerTestSurfaceOcclusionTranslatesToParent
); |
| 2158 | 2158 |
| 2159 template<class Types> | 2159 template<class Types> |
| 2160 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { | 2160 class OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping : public Occlus
ionTrackerTest<Types> { |
| 2161 protected: | 2161 protected: |
| 2162 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2162 OcclusionTrackerTestSurfaceOcclusionTranslatesWithClipping(bool opaqueLayers
) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2163 void runMyTest() | 2163 void runMyTest() |
| 2164 { | 2164 { |
| 2165 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); | 2165 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 300)); |
| 2166 parent->setMasksToBounds(true); | 2166 parent->SetMasksToBounds(true); |
| 2167 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); | 2167 typename Types::ContentLayerType* surface = this->createDrawingSurface(p
arent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(500, 300), false); |
| 2168 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); | 2168 surface->setOpaqueContentsRect(gfx::Rect(0, 0, 400, 200)); |
| 2169 this->calcDrawEtc(parent); | 2169 this->calcDrawEtc(parent); |
| 2170 | 2170 |
| 2171 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2171 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2172 | 2172 |
| 2173 this->visitLayer(surface, occlusion); | 2173 this->visitLayer(surface, occlusion); |
| 2174 this->visitContributingSurface(surface, occlusion); | 2174 this->visitContributingSurface(surface, occlusion); |
| 2175 | 2175 |
| 2176 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); | 2176 EXPECT_EQ(gfx::Rect().ToString(), occlusion.occlusion_from_outside_targe
t().ToString()); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2381 | 2381 |
| 2382 template<class Types> | 2382 template<class Types> |
| 2383 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke
rTest<Types> { | 2383 class OcclusionTrackerTestSurfaceChildOfClippingSurface : public OcclusionTracke
rTest<Types> { |
| 2384 protected: | 2384 protected: |
| 2385 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} | 2385 OcclusionTrackerTestSurfaceChildOfClippingSurface(bool opaqueLayers) : Occlu
sionTrackerTest<Types>(opaqueLayers) {} |
| 2386 void runMyTest() | 2386 void runMyTest() |
| 2387 { | 2387 { |
| 2388 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. | 2388 // This test verifies that the surface cliprect does not end up empty an
d clip away the entire unoccluded rect. |
| 2389 | 2389 |
| 2390 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(80, 200)); | 2390 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(80, 200)); |
| 2391 parent->setMasksToBounds(true); | 2391 parent->SetMasksToBounds(true); |
| 2392 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); | 2392 typename Types::LayerType* surface = this->createDrawingSurface(parent,
this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), true); |
| 2393 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 2393 typename Types::LayerType* surfaceChild = this->createDrawingSurface(sur
face, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 2394 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); | 2394 typename Types::LayerType* topmost = this->createDrawingLayer(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 50), true); |
| 2395 this->calcDrawEtc(parent); | 2395 this->calcDrawEtc(parent); |
| 2396 | 2396 |
| 2397 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2397 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2398 | 2398 |
| 2399 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. | 2399 // |topmost| occludes everything partially so we know occlusion is happe
ning at all. |
| 2400 this->visitLayer(topmost, occlusion); | 2400 this->visitLayer(topmost, occlusion); |
| 2401 | 2401 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2443 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2444 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); | 2444 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
| 2445 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); | 2445 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
| 2446 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); | 2446 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
| 2447 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); | 2447 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
| 2448 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); | 2448 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
| 2449 | 2449 |
| 2450 // Filters make the layer own a surface. | 2450 // Filters make the layer own a surface. |
| 2451 WebKit::WebFilterOperations filters; | 2451 WebKit::WebFilterOperations filters; |
| 2452 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); | 2452 filters.append(WebKit::WebFilterOperation::createBlurFilter(10)); |
| 2453 filteredSurface->setBackgroundFilters(filters); | 2453 filteredSurface->SetBackgroundFilters(filters); |
| 2454 | 2454 |
| 2455 // Save the distance of influence for the blur effect. | 2455 // Save the distance of influence for the blur effect. |
| 2456 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2456 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2457 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2457 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2458 | 2458 |
| 2459 this->calcDrawEtc(parent); | 2459 this->calcDrawEtc(parent); |
| 2460 | 2460 |
| 2461 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2461 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2462 | 2462 |
| 2463 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2463 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2557 protected: | 2557 protected: |
| 2558 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2558 OcclusionTrackerTestTwoBackgroundFiltersReduceOcclusionTwice(bool opaqueLaye
rs) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2559 void runMyTest() | 2559 void runMyTest() |
| 2560 { | 2560 { |
| 2561 gfx::Transform scaleByHalf; | 2561 gfx::Transform scaleByHalf; |
| 2562 scaleByHalf.Scale(0.5, 0.5); | 2562 scaleByHalf.Scale(0.5, 0.5); |
| 2563 | 2563 |
| 2564 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. | 2564 // Makes two surfaces that completely cover |parent|. The occlusion both
above and below the filters will be reduced by each of them. |
| 2565 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); | 2565 typename Types::ContentLayerType* root = this->createRoot(this->identity
Matrix, gfx::PointF(0, 0), gfx::Size(75, 75)); |
| 2566 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); | 2566 typename Types::LayerType* parent = this->createSurface(root, scaleByHal
f, gfx::PointF(0, 0), gfx::Size(150, 150)); |
| 2567 parent->setMasksToBounds(true); | 2567 parent->SetMasksToBounds(true); |
| 2568 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2568 typename Types::LayerType* filteredSurface1 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 2569 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); | 2569 typename Types::LayerType* filteredSurface2 = this->createDrawingLayer(p
arent, scaleByHalf, gfx::PointF(0, 0), gfx::Size(300, 300), false); |
| 2570 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); | 2570 typename Types::LayerType* occludingLayerAbove = this->createDrawingLaye
r(parent, this->identityMatrix, gfx::PointF(100, 100), gfx::Size(50, 50), true); |
| 2571 | 2571 |
| 2572 // Filters make the layers own surfaces. | 2572 // Filters make the layers own surfaces. |
| 2573 WebKit::WebFilterOperations filters; | 2573 WebKit::WebFilterOperations filters; |
| 2574 filters.append(WebKit::WebFilterOperation::createBlurFilter(1)); | 2574 filters.append(WebKit::WebFilterOperation::createBlurFilter(1)); |
| 2575 filteredSurface1->setBackgroundFilters(filters); | 2575 filteredSurface1->SetBackgroundFilters(filters); |
| 2576 filteredSurface2->setBackgroundFilters(filters); | 2576 filteredSurface2->SetBackgroundFilters(filters); |
| 2577 | 2577 |
| 2578 // Save the distance of influence for the blur effect. | 2578 // Save the distance of influence for the blur effect. |
| 2579 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2579 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2580 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2580 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2581 | 2581 |
| 2582 this->calcDrawEtc(root); | 2582 this->calcDrawEtc(root); |
| 2583 | 2583 |
| 2584 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2584 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2585 | 2585 |
| 2586 this->visitLayer(occludingLayerAbove, occlusion); | 2586 this->visitLayer(occludingLayerAbove, occlusion); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2607 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { | 2607 class OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip : p
ublic OcclusionTrackerTest<Types> { |
| 2608 protected: | 2608 protected: |
| 2609 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} | 2609 OcclusionTrackerTestDontOccludePixelsNeededForBackgroundFilterWithClip(bool
opaqueLayers) : OcclusionTrackerTest<Types>(opaqueLayers) {} |
| 2610 void runMyTest() | 2610 void runMyTest() |
| 2611 { | 2611 { |
| 2612 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. | 2612 // Make a surface and its replica, each 50x50, that are completely surro
unded by opaque layers which are above them in the z-order. |
| 2613 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2613 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2614 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for | 2614 // We stick the filtered surface inside a clipping surface so that we ca
n make sure the clip is honored when exposing pixels for |
| 2615 // the background filter. | 2615 // the background filter. |
| 2616 typename Types::LayerType* clippingSurface = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 70), false); | 2616 typename Types::LayerType* clippingSurface = this->createDrawingSurface(
parent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 70), false); |
| 2617 clippingSurface->setMasksToBounds(true); | 2617 clippingSurface->SetMasksToBounds(true); |
| 2618 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), fal
se); | 2618 typename Types::LayerType* filteredSurface = this->createDrawingLayer(cl
ippingSurface, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), fal
se); |
| 2619 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(150, 0), gfx::Size()); | 2619 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(150, 0), gfx::Size()); |
| 2620 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); | 2620 typename Types::LayerType* occludingLayer1 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(300, 50), true); |
| 2621 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); | 2621 typename Types::LayerType* occludingLayer2 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 100), gfx::Size(300, 50), true); |
| 2622 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); | 2622 typename Types::LayerType* occludingLayer3 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(0, 50), gfx::Size(50, 50), true); |
| 2623 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); | 2623 typename Types::LayerType* occludingLayer4 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(100, 50), gfx::Size(100, 50), true); |
| 2624 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); | 2624 typename Types::LayerType* occludingLayer5 = this->createDrawingLayer(pa
rent, this->identityMatrix, gfx::PointF(250, 50), gfx::Size(50, 50), true); |
| 2625 | 2625 |
| 2626 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. | 2626 // Filters make the layer own a surface. This filter is large enough tha
t it goes outside the bottom of the clippingSurface. |
| 2627 WebKit::WebFilterOperations filters; | 2627 WebKit::WebFilterOperations filters; |
| 2628 filters.append(WebKit::WebFilterOperation::createBlurFilter(12)); | 2628 filters.append(WebKit::WebFilterOperation::createBlurFilter(12)); |
| 2629 filteredSurface->setBackgroundFilters(filters); | 2629 filteredSurface->SetBackgroundFilters(filters); |
| 2630 | 2630 |
| 2631 // Save the distance of influence for the blur effect. | 2631 // Save the distance of influence for the blur effect. |
| 2632 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2632 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2633 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2633 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2634 | 2634 |
| 2635 this->calcDrawEtc(parent); | 2635 this->calcDrawEtc(parent); |
| 2636 | 2636 |
| 2637 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2637 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2638 | 2638 |
| 2639 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will | 2639 // These layers occlude pixels directly beside the filteredSurface. Beca
use filtered surface blends pixels in a radius, it will |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2751 // appears at 50, 50 and the replica at 200, 50. | 2751 // appears at 50, 50 and the replica at 200, 50. |
| 2752 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2752 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2753 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); | 2753 typename Types::LayerType* behindSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(60, 60), gfx::Size(30, 30), true); |
| 2754 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); | 2754 typename Types::LayerType* behindReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(210, 60), gfx::Size(30, 30), true); |
| 2755 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2755 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2756 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2756 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2757 | 2757 |
| 2758 // Filters make the layer own a surface. | 2758 // Filters make the layer own a surface. |
| 2759 WebKit::WebFilterOperations filters; | 2759 WebKit::WebFilterOperations filters; |
| 2760 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2760 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
| 2761 filteredSurface->setBackgroundFilters(filters); | 2761 filteredSurface->SetBackgroundFilters(filters); |
| 2762 | 2762 |
| 2763 this->calcDrawEtc(parent); | 2763 this->calcDrawEtc(parent); |
| 2764 | 2764 |
| 2765 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2765 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2766 | 2766 |
| 2767 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. | 2767 // The surface has a background blur, so it blurs non-opaque pixels belo
w it. |
| 2768 this->visitLayer(filteredSurface, occlusion); | 2768 this->visitLayer(filteredSurface, occlusion); |
| 2769 this->visitContributingSurface(filteredSurface, occlusion); | 2769 this->visitContributingSurface(filteredSurface, occlusion); |
| 2770 | 2770 |
| 2771 this->visitLayer(behindReplicaLayer, occlusion); | 2771 this->visitLayer(behindReplicaLayer, occlusion); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2799 // appears at 50, 50 and the replica at 200, 50. | 2799 // appears at 50, 50 and the replica at 200, 50. |
| 2800 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); | 2800 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(300, 150)); |
| 2801 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2801 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2802 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2802 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2803 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); | 2803 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(50, 50), gfx::Size(50, 50), true); |
| 2804 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); | 2804 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(50, 50), true); |
| 2805 | 2805 |
| 2806 // Filters make the layer own a surface. | 2806 // Filters make the layer own a surface. |
| 2807 WebKit::WebFilterOperations filters; | 2807 WebKit::WebFilterOperations filters; |
| 2808 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2808 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
| 2809 filteredSurface->setBackgroundFilters(filters); | 2809 filteredSurface->SetBackgroundFilters(filters); |
| 2810 | 2810 |
| 2811 this->calcDrawEtc(parent); | 2811 this->calcDrawEtc(parent); |
| 2812 | 2812 |
| 2813 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2813 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2814 | 2814 |
| 2815 this->visitLayer(aboveReplicaLayer, occlusion); | 2815 this->visitLayer(aboveReplicaLayer, occlusion); |
| 2816 this->visitLayer(aboveSurfaceLayer, occlusion); | 2816 this->visitLayer(aboveSurfaceLayer, occlusion); |
| 2817 | 2817 |
| 2818 this->visitLayer(filteredSurface, occlusion); | 2818 this->visitLayer(filteredSurface, occlusion); |
| 2819 | 2819 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2860 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); | 2860 typename Types::LayerType* filteredSurface = this->createDrawingLayer(pa
rent, scaleByHalf, gfx::PointF(50, 50), gfx::Size(100, 100), false); |
| 2861 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); | 2861 this->createReplicaLayer(filteredSurface, this->identityMatrix, gfx::Poi
ntF(300, 0), gfx::Size()); |
| 2862 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); | 2862 typename Types::LayerType* aboveSurfaceLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(70, 50), gfx::Size(30, 50), true); |
| 2863 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); | 2863 typename Types::LayerType* aboveReplicaLayer = this->createDrawingLayer(
parent, this->identityMatrix, gfx::PointF(200, 50), gfx::Size(30, 50), true); |
| 2864 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); | 2864 typename Types::LayerType* besideSurfaceLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(90, 40), gfx::Size(10, 10), true); |
| 2865 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(200, 40), gfx::Size(10, 10), true); | 2865 typename Types::LayerType* besideReplicaLayer = this->createDrawingLayer
(parent, this->identityMatrix, gfx::PointF(200, 40), gfx::Size(10, 10), true); |
| 2866 | 2866 |
| 2867 // Filters make the layer own a surface. | 2867 // Filters make the layer own a surface. |
| 2868 WebKit::WebFilterOperations filters; | 2868 WebKit::WebFilterOperations filters; |
| 2869 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); | 2869 filters.append(WebKit::WebFilterOperation::createBlurFilter(3)); |
| 2870 filteredSurface->setBackgroundFilters(filters); | 2870 filteredSurface->SetBackgroundFilters(filters); |
| 2871 | 2871 |
| 2872 // Save the distance of influence for the blur effect. | 2872 // Save the distance of influence for the blur effect. |
| 2873 int outsetTop, outsetRight, outsetBottom, outsetLeft; | 2873 int outsetTop, outsetRight, outsetBottom, outsetLeft; |
| 2874 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); | 2874 filters.getOutsets(outsetTop, outsetRight, outsetBottom, outsetLeft); |
| 2875 | 2875 |
| 2876 this->calcDrawEtc(parent); | 2876 this->calcDrawEtc(parent); |
| 2877 | 2877 |
| 2878 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 2878 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 2879 | 2879 |
| 2880 this->visitLayer(besideReplicaLayer, occlusion); | 2880 this->visitLayer(besideReplicaLayer, occlusion); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2950 | 2950 |
| 2951 template<class Types> | 2951 template<class Types> |
| 2952 class OcclusionTrackerTestViewportClipIsExternalOcclusion : public OcclusionTrac
kerTest<Types> { | 2952 class OcclusionTrackerTestViewportClipIsExternalOcclusion : public OcclusionTrac
kerTest<Types> { |
| 2953 protected: | 2953 protected: |
| 2954 OcclusionTrackerTestViewportClipIsExternalOcclusion(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} | 2954 OcclusionTrackerTestViewportClipIsExternalOcclusion(bool opaqueLayers) : Occ
lusionTrackerTest<Types>(opaqueLayers) {} |
| 2955 void runMyTest() | 2955 void runMyTest() |
| 2956 { | 2956 { |
| 2957 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); | 2957 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); |
| 2958 typename Types::LayerType* small = this->createDrawingSurface(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), false); | 2958 typename Types::LayerType* small = this->createDrawingSurface(parent, th
is->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), false); |
| 2959 typename Types::LayerType* large = this->createDrawingLayer(small, this-
>identityMatrix, gfx::PointF(0, 0), gfx::Size(400, 400), false); | 2959 typename Types::LayerType* large = this->createDrawingLayer(small, this-
>identityMatrix, gfx::PointF(0, 0), gfx::Size(400, 400), false); |
| 2960 small->setMasksToBounds(true); | 2960 small->SetMasksToBounds(true); |
| 2961 this->calcDrawEtc(parent); | 2961 this->calcDrawEtc(parent); |
| 2962 | 2962 |
| 2963 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 100, 100)); | 2963 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 100, 100)); |
| 2964 | 2964 |
| 2965 this->EnterLayer(large, occlusion); | 2965 this->EnterLayer(large, occlusion); |
| 2966 | 2966 |
| 2967 bool hasOcclusionFromOutsideTargetSurface = false; | 2967 bool hasOcclusionFromOutsideTargetSurface = false; |
| 2968 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerConte
ntRect(large, gfx::Rect(0, 0, 400, 400), &hasOcclusionFromOutsideTargetSurface))
; | 2968 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerConte
ntRect(large, gfx::Rect(0, 0, 400, 400), &hasOcclusionFromOutsideTargetSurface))
; |
| 2969 EXPECT_TRUE(hasOcclusionFromOutsideTargetSurface); | 2969 EXPECT_TRUE(hasOcclusionFromOutsideTargetSurface); |
| 2970 | 2970 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2997 class OcclusionTrackerTestLayerClipIsExternalOcclusion : public OcclusionTracker
Test<Types> { | 2997 class OcclusionTrackerTestLayerClipIsExternalOcclusion : public OcclusionTracker
Test<Types> { |
| 2998 protected: | 2998 protected: |
| 2999 OcclusionTrackerTestLayerClipIsExternalOcclusion(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} | 2999 OcclusionTrackerTestLayerClipIsExternalOcclusion(bool opaqueLayers) : Occlus
ionTrackerTest<Types>(opaqueLayers) {} |
| 3000 void runMyTest() | 3000 void runMyTest() |
| 3001 { | 3001 { |
| 3002 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); | 3002 typename Types::ContentLayerType* parent = this->createRoot(this->identi
tyMatrix, gfx::PointF(0, 0), gfx::Size(400, 400)); |
| 3003 typename Types::LayerType* smallest = this->createDrawingLayer(parent, t
his->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 50), false); | 3003 typename Types::LayerType* smallest = this->createDrawingLayer(parent, t
his->identityMatrix, gfx::PointF(0, 0), gfx::Size(50, 50), false); |
| 3004 typename Types::LayerType* smaller = this->createDrawingSurface(smallest
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); | 3004 typename Types::LayerType* smaller = this->createDrawingSurface(smallest
, this->identityMatrix, gfx::PointF(0, 0), gfx::Size(100, 100), false); |
| 3005 typename Types::LayerType* small = this->createDrawingSurface(smaller, t
his->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), false); | 3005 typename Types::LayerType* small = this->createDrawingSurface(smaller, t
his->identityMatrix, gfx::PointF(0, 0), gfx::Size(200, 200), false); |
| 3006 typename Types::LayerType* large = this->createDrawingLayer(small, this-
>identityMatrix, gfx::PointF(0, 0), gfx::Size(400, 400), false); | 3006 typename Types::LayerType* large = this->createDrawingLayer(small, this-
>identityMatrix, gfx::PointF(0, 0), gfx::Size(400, 400), false); |
| 3007 smallest->setMasksToBounds(true); | 3007 smallest->SetMasksToBounds(true); |
| 3008 smaller->setMasksToBounds(true); | 3008 smaller->SetMasksToBounds(true); |
| 3009 small->setMasksToBounds(true); | 3009 small->SetMasksToBounds(true); |
| 3010 this->calcDrawEtc(parent); | 3010 this->calcDrawEtc(parent); |
| 3011 | 3011 |
| 3012 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); | 3012 TestOcclusionTrackerWithClip<typename Types::LayerType, typename Types::
RenderSurfaceType> occlusion(gfx::Rect(0, 0, 1000, 1000)); |
| 3013 | 3013 |
| 3014 this->EnterLayer(large, occlusion); | 3014 this->EnterLayer(large, occlusion); |
| 3015 | 3015 |
| 3016 // Clipping from the smaller layer is from outside the target surface. | 3016 // Clipping from the smaller layer is from outside the target surface. |
| 3017 bool hasOcclusionFromOutsideTargetSurface = false; | 3017 bool hasOcclusionFromOutsideTargetSurface = false; |
| 3018 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerConte
ntRect(large, gfx::Rect(0, 0, 400, 400), &hasOcclusionFromOutsideTargetSurface))
; | 3018 EXPECT_RECT_EQ(gfx::Rect(0, 0, 100, 100), occlusion.unoccludedLayerConte
ntRect(large, gfx::Rect(0, 0, 400, 400), &hasOcclusionFromOutsideTargetSurface))
; |
| 3019 EXPECT_TRUE(hasOcclusionFromOutsideTargetSurface); | 3019 EXPECT_TRUE(hasOcclusionFromOutsideTargetSurface); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3049 hasOcclusionFromOutsideTargetSurface = false; | 3049 hasOcclusionFromOutsideTargetSurface = false; |
| 3050 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.UnoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); | 3050 EXPECT_RECT_EQ(gfx::Rect(0, 0, 50, 50), occlusion.UnoccludedContributing
SurfaceContentRect(smaller, false, gfx::Rect(0, 0, 100, 100), &hasOcclusionFromO
utsideTargetSurface)); |
| 3051 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); | 3051 EXPECT_FALSE(hasOcclusionFromOutsideTargetSurface); |
| 3052 } | 3052 } |
| 3053 }; | 3053 }; |
| 3054 | 3054 |
| 3055 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) | 3055 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestLayerClipIsExternalOcclusion) |
| 3056 | 3056 |
| 3057 } // namespace | 3057 } // namespace |
| 3058 } // namespace cc | 3058 } // namespace cc |
| OLD | NEW |