| 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/quad_culler.h" | 5 #include "cc/quad_culler.h" |
| 6 | 6 |
| 7 #include "cc/append_quads_data.h" | 7 #include "cc/append_quads_data.h" |
| 8 #include "cc/layer_tiling_data.h" | 8 #include "cc/layer_tiling_data.h" |
| 9 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
| 10 #include "cc/occlusion_tracker.h" | 10 #include "cc/occlusion_tracker.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 gfx::Rect m_scissorRectInScreen; | 36 gfx::Rect m_scissorRectInScreen; |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, Lay
erIteratorActions::FrontToBack> LayerIteratorType; | 39 typedef LayerIterator<LayerImpl, std::vector<LayerImpl*>, RenderSurfaceImpl, Lay
erIteratorActions::FrontToBack> LayerIteratorType; |
| 40 | 40 |
| 41 class QuadCullerTest : public testing::Test | 41 class QuadCullerTest : public testing::Test |
| 42 { | 42 { |
| 43 public: | 43 public: |
| 44 QuadCullerTest() | 44 QuadCullerTest() |
| 45 : m_hostImpl(&m_proxy) | 45 : m_hostImpl(&m_proxy) |
| 46 , m_layerId(1) |
| 46 { | 47 { |
| 47 } | 48 } |
| 48 | 49 |
| 49 scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const gfx::Tran
sform& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, co
nst gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList) | 50 scoped_ptr<TiledLayerImpl> makeLayer(TiledLayerImpl* parent, const gfx::Tran
sform& drawTransform, const gfx::Rect& layerRect, float opacity, bool opaque, co
nst gfx::Rect& layerOpaqueRect, std::vector<LayerImpl*>& surfaceLayerList) |
| 50 { | 51 { |
| 51 scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(m_hostImpl.act
iveTree(), 1); | 52 scoped_ptr<TiledLayerImpl> layer = TiledLayerImpl::create(m_hostImpl.act
iveTree(), m_layerId++); |
| 52 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10
0, 100), LayerTilingData::NoBorderTexels); | 53 scoped_ptr<LayerTilingData> tiler = LayerTilingData::create(gfx::Size(10
0, 100), LayerTilingData::NoBorderTexels); |
| 53 tiler->setBounds(layerRect.size()); | 54 tiler->setBounds(layerRect.size()); |
| 54 layer->setTilingData(*tiler); | 55 layer->setTilingData(*tiler); |
| 55 layer->setSkipsDraw(false); | 56 layer->setSkipsDraw(false); |
| 56 layer->drawProperties().target_space_transform = drawTransform; | 57 layer->drawProperties().target_space_transform = drawTransform; |
| 57 layer->drawProperties().screen_space_transform = drawTransform; | 58 layer->drawProperties().screen_space_transform = drawTransform; |
| 58 layer->drawProperties().visible_content_rect = layerRect; | 59 layer->drawProperties().visible_content_rect = layerRect; |
| 59 layer->drawProperties().opacity = opacity; | 60 layer->drawProperties().opacity = opacity; |
| 60 layer->setContentsOpaque(opaque); | 61 layer->setContentsOpaque(opaque); |
| 61 layer->setBounds(layerRect.size()); | 62 layer->setBounds(layerRect.size()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 89 QuadCuller quadCuller(quadList, sharedStateList, layer, occlusionTracker
, false, false); | 90 QuadCuller quadCuller(quadList, sharedStateList, layer, occlusionTracker
, false, false); |
| 90 AppendQuadsData data; | 91 AppendQuadsData data; |
| 91 layer->appendQuads(quadCuller, data); | 92 layer->appendQuads(quadCuller, data); |
| 92 occlusionTracker.leaveLayer(it); | 93 occlusionTracker.leaveLayer(it); |
| 93 ++it; | 94 ++it; |
| 94 } | 95 } |
| 95 | 96 |
| 96 protected: | 97 protected: |
| 97 FakeImplProxy m_proxy; | 98 FakeImplProxy m_proxy; |
| 98 FakeLayerTreeHostImpl m_hostImpl; | 99 FakeLayerTreeHostImpl m_hostImpl; |
| 100 int m_layerId; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 #define DECLARE_AND_INITIALIZE_TEST_QUADS \ | 103 #define DECLARE_AND_INITIALIZE_TEST_QUADS \ |
| 102 QuadList quadList; \ | 104 QuadList quadList; \ |
| 103 SharedQuadStateList sharedStateList; \ | 105 SharedQuadStateList sharedStateList; \ |
| 104 std::vector<LayerImpl*> renderSurfaceLayerList; \ | 106 std::vector<LayerImpl*> renderSurfaceLayerList; \ |
| 105 gfx::Transform childTransform; \ | 107 gfx::Transform childTransform; \ |
| 106 gfx::Size rootSize = gfx::Size(300, 300); \ | 108 gfx::Size rootSize = gfx::Size(300, 300); \ |
| 107 gfx::Rect rootRect = gfx::Rect(rootSize); \ | 109 gfx::Rect rootRect = gfx::Rect(rootSize); \ |
| 108 gfx::Size childSize = gfx::Size(200, 200); \ | 110 gfx::Size childSize = gfx::Size(200, 200); \ |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke
r); | 474 appendQuads(quadList, sharedStateList, childLayer.get(), it, occlusionTracke
r); |
| 473 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker
); | 475 appendQuads(quadList, sharedStateList, rootLayer.get(), it, occlusionTracker
); |
| 474 EXPECT_EQ(quadList.size(), 9u); | 476 EXPECT_EQ(quadList.size(), 9u); |
| 475 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1); | 477 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnOpaque(), 0, 1); |
| 476 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0,
1); | 478 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsDrawnTranslucent(), 0,
1); |
| 477 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0,
1); | 479 EXPECT_NEAR(occlusionTracker.overdrawMetrics().pixelsCulledForDrawing(), 0,
1); |
| 478 } | 480 } |
| 479 | 481 |
| 480 } // namespace | 482 } // namespace |
| 481 } // namespace cc | 483 } // namespace cc |
| OLD | NEW |