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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1999 EXPECT_EQ(1, other_callback_count); | 1999 EXPECT_EQ(1, other_callback_count); |
2000 } | 2000 } |
2001 #endif // OS_ANDROID | 2001 #endif // OS_ANDROID |
2002 | 2002 |
2003 class TestOverlayProcessor : public OverlayProcessor { | 2003 class TestOverlayProcessor : public OverlayProcessor { |
2004 public: | 2004 public: |
2005 class Strategy : public OverlayProcessor::Strategy { | 2005 class Strategy : public OverlayProcessor::Strategy { |
2006 public: | 2006 public: |
2007 Strategy() {} | 2007 Strategy() {} |
2008 ~Strategy() override {} | 2008 ~Strategy() override {} |
2009 MOCK_METHOD3(Attempt, | 2009 MOCK_METHOD4(Attempt, |
2010 bool(ResourceProvider* resource_provider, | 2010 bool(ResourceProvider* resource_provider, |
2011 RenderPassList* render_passes, | 2011 RenderPassList* render_passes, |
2012 OverlayCandidateList* candidates)); | 2012 OverlayCandidateList* candidates, |
| 2013 gfx::Rect* damage_rect)); |
2013 }; | 2014 }; |
2014 | 2015 |
2015 explicit TestOverlayProcessor(OutputSurface* surface) | 2016 explicit TestOverlayProcessor(OutputSurface* surface) |
2016 : OverlayProcessor(surface) {} | 2017 : OverlayProcessor(surface) {} |
2017 ~TestOverlayProcessor() override {} | 2018 ~TestOverlayProcessor() override {} |
2018 void Initialize() override { | 2019 void Initialize() override { |
2019 strategy_ = new Strategy(); | 2020 strategy_ = new Strategy(); |
2020 strategies_.push_back(make_scoped_ptr(strategy_)); | 2021 strategies_.push_back(make_scoped_ptr(strategy_)); |
2021 } | 2022 } |
2022 | 2023 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 viewport_rect, viewport_rect, viewport_rect, resource_id, | 2083 viewport_rect, viewport_rect, viewport_rect, resource_id, |
2083 premultiplied_alpha, gfx::PointF(0, 0), | 2084 premultiplied_alpha, gfx::PointF(0, 0), |
2084 gfx::PointF(1, 1), SK_ColorTRANSPARENT, vertex_opacity, | 2085 gfx::PointF(1, 1), SK_ColorTRANSPARENT, vertex_opacity, |
2085 flipped, nearest_neighbor); | 2086 flipped, nearest_neighbor); |
2086 | 2087 |
2087 // DirectRenderer::DrawFrame calls into OverlayProcessor::ProcessForOverlays. | 2088 // DirectRenderer::DrawFrame calls into OverlayProcessor::ProcessForOverlays. |
2088 // Attempt will be called for each strategy in OverlayProcessor. We have | 2089 // Attempt will be called for each strategy in OverlayProcessor. We have |
2089 // added a fake strategy, so checking for Attempt calls checks if there was | 2090 // added a fake strategy, so checking for Attempt calls checks if there was |
2090 // any attempt to overlay, which there shouldn't be. We can't use the quad | 2091 // any attempt to overlay, which there shouldn't be. We can't use the quad |
2091 // list because the render pass is cleaned up by DrawFrame. | 2092 // list because the render pass is cleaned up by DrawFrame. |
2092 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _)).Times(0); | 2093 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _, _)).Times(0); |
2093 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2094 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2094 viewport_rect, false); | 2095 viewport_rect, false); |
2095 Mock::VerifyAndClearExpectations(processor->strategy_); | 2096 Mock::VerifyAndClearExpectations(processor->strategy_); |
2096 | 2097 |
2097 // Without a copy request Attempt() should be called once. | 2098 // Without a copy request Attempt() should be called once. |
2098 root_pass = AddRenderPass(&render_passes_in_draw_order_, RenderPassId(1, 0), | 2099 root_pass = AddRenderPass(&render_passes_in_draw_order_, RenderPassId(1, 0), |
2099 viewport_rect, gfx::Transform()); | 2100 viewport_rect, gfx::Transform()); |
2100 root_pass->has_transparent_background = false; | 2101 root_pass->has_transparent_background = false; |
2101 | 2102 |
2102 overlay_quad = root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); | 2103 overlay_quad = root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
2103 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), | 2104 overlay_quad->SetNew(root_pass->CreateAndAppendSharedQuadState(), |
2104 viewport_rect, viewport_rect, viewport_rect, resource_id, | 2105 viewport_rect, viewport_rect, viewport_rect, resource_id, |
2105 premultiplied_alpha, gfx::PointF(0, 0), | 2106 premultiplied_alpha, gfx::PointF(0, 0), |
2106 gfx::PointF(1, 1), SK_ColorTRANSPARENT, vertex_opacity, | 2107 gfx::PointF(1, 1), SK_ColorTRANSPARENT, vertex_opacity, |
2107 flipped, nearest_neighbor); | 2108 flipped, nearest_neighbor); |
2108 | 2109 |
2109 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _)).Times(1); | 2110 EXPECT_CALL(*processor->strategy_, Attempt(_, _, _, _)).Times(1); |
2110 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2111 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2111 viewport_rect, false); | 2112 viewport_rect, false); |
2112 } | 2113 } |
2113 | 2114 |
2114 class SingleOverlayOnTopProcessor : public OverlayProcessor { | 2115 class SingleOverlayOnTopProcessor : public OverlayProcessor { |
2115 public: | 2116 public: |
2116 class SingleOverlayValidator : public OverlayCandidateValidator { | 2117 class SingleOverlayValidator : public OverlayCandidateValidator { |
2117 public: | 2118 public: |
2118 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { | 2119 void GetStrategies(OverlayProcessor::StrategyList* strategies) override { |
2119 strategies->push_back( | 2120 strategies->push_back( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2224 EXPECT_CALL(overlay_scheduler, | 2225 EXPECT_CALL(overlay_scheduler, |
2225 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, | 2226 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, |
2226 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); | 2227 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); |
2227 | 2228 |
2228 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2229 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2229 viewport_rect, false); | 2230 viewport_rect, false); |
2230 } | 2231 } |
2231 | 2232 |
2232 } // namespace | 2233 } // namespace |
2233 } // namespace cc | 2234 } // namespace cc |
OLD | NEW |