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 2106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2117 SingleOverlayValidator validator_; | 2117 SingleOverlayValidator validator_; |
2118 }; | 2118 }; |
2119 | 2119 |
2120 class WaitSyncTokenCountingContext : public TestWebGraphicsContext3D { | 2120 class WaitSyncTokenCountingContext : public TestWebGraphicsContext3D { |
2121 public: | 2121 public: |
2122 MOCK_METHOD1(waitSyncToken, void(const GLbyte* sync_token)); | 2122 MOCK_METHOD1(waitSyncToken, void(const GLbyte* sync_token)); |
2123 }; | 2123 }; |
2124 | 2124 |
2125 class MockOverlayScheduler { | 2125 class MockOverlayScheduler { |
2126 public: | 2126 public: |
2127 MOCK_METHOD5(Schedule, | 2127 MOCK_METHOD7(Schedule, |
2128 void(int plane_z_order, | 2128 void(int plane_z_order, |
2129 gfx::OverlayTransform plane_transform, | 2129 gfx::OverlayTransform plane_transform, |
| 2130 gfx::BufferFormat storage_format, |
2130 unsigned overlay_texture_id, | 2131 unsigned overlay_texture_id, |
2131 const gfx::Rect& display_bounds, | 2132 const gfx::Rect& display_bounds, |
2132 const gfx::RectF& uv_rect)); | 2133 const gfx::RectF& uv_rect, |
| 2134 bool handle_scaling)); |
2133 }; | 2135 }; |
2134 | 2136 |
2135 TEST_F(GLRendererTest, OverlaySyncTokensAreProcessed) { | 2137 TEST_F(GLRendererTest, OverlaySyncTokensAreProcessed) { |
2136 scoped_ptr<WaitSyncTokenCountingContext> context_owned( | 2138 scoped_ptr<WaitSyncTokenCountingContext> context_owned( |
2137 new WaitSyncTokenCountingContext); | 2139 new WaitSyncTokenCountingContext); |
2138 WaitSyncTokenCountingContext* context = context_owned.get(); | 2140 WaitSyncTokenCountingContext* context = context_owned.get(); |
2139 | 2141 |
2140 MockOverlayScheduler overlay_scheduler; | 2142 MockOverlayScheduler overlay_scheduler; |
2141 scoped_refptr<TestContextProvider> context_provider = | 2143 scoped_refptr<TestContextProvider> context_provider = |
2142 TestContextProvider::Create(std::move(context_owned)); | 2144 TestContextProvider::Create(std::move(context_owned)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 shared_state->SetAll(gfx::Transform(), viewport_rect.size(), viewport_rect, | 2194 shared_state->SetAll(gfx::Transform(), viewport_rect.size(), viewport_rect, |
2193 viewport_rect, false, 1, SkXfermode::kSrcOver_Mode, 0); | 2195 viewport_rect, false, 1, SkXfermode::kSrcOver_Mode, 0); |
2194 overlay_quad->SetNew(shared_state, viewport_rect, viewport_rect, | 2196 overlay_quad->SetNew(shared_state, viewport_rect, viewport_rect, |
2195 viewport_rect, resource_id, premultiplied_alpha, | 2197 viewport_rect, resource_id, premultiplied_alpha, |
2196 uv_top_left, uv_bottom_right, SK_ColorTRANSPARENT, | 2198 uv_top_left, uv_bottom_right, SK_ColorTRANSPARENT, |
2197 vertex_opacity, flipped, nearest_neighbor); | 2199 vertex_opacity, flipped, nearest_neighbor); |
2198 | 2200 |
2199 // Verify that overlay_quad actually gets turned into an overlay, and even | 2201 // Verify that overlay_quad actually gets turned into an overlay, and even |
2200 // though it's not drawn, that its sync point is waited on. | 2202 // though it's not drawn, that its sync point is waited on. |
2201 EXPECT_CALL(*context, waitSyncToken(MatchesSyncToken(sync_token))).Times(1); | 2203 EXPECT_CALL(*context, waitSyncToken(MatchesSyncToken(sync_token))).Times(1); |
2202 EXPECT_CALL(overlay_scheduler, | 2204 EXPECT_CALL( |
2203 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, viewport_rect, | 2205 overlay_scheduler, |
2204 BoundingRect(uv_top_left, uv_bottom_right))).Times(1); | 2206 Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, gfx::BufferFormat::BGRX_8888, _, |
| 2207 viewport_rect, BoundingRect(uv_top_left, uv_bottom_right), true)) |
| 2208 .Times(1); |
2205 | 2209 |
2206 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, | 2210 renderer.DrawFrame(&render_passes_in_draw_order_, 1.f, viewport_rect, |
2207 viewport_rect, false); | 2211 viewport_rect, false); |
2208 } | 2212 } |
2209 | 2213 |
2210 } // namespace | 2214 } // namespace |
2211 } // namespace cc | 2215 } // namespace cc |
OLD | NEW |