| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "cc/debug/lap_timer.h" | 9 #include "cc/debug/lap_timer.h" |
| 10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
| 11 #include "cc/quads/render_pass.h" | 11 #include "cc/quads/render_pass.h" |
| 12 #include "cc/quads/texture_draw_quad.h" | 12 #include "cc/quads/texture_draw_quad.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/perf/perf_test.h" | 14 #include "testing/perf/perf_test.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 static const int kTimeLimitMillis = 2000; | 19 static const int kTimeLimitMillis = 2000; |
| 20 static const int kWarmupRuns = 5; | 20 static const int kWarmupRuns = 5; |
| 21 static const int kTimeCheckInterval = 10; | 21 static const int kTimeCheckInterval = 10; |
| 22 | 22 |
| 23 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { | 23 SharedQuadState* CreateSharedQuadState(RenderPass* render_pass) { |
| 24 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); | 24 gfx::Transform quad_transform = gfx::Transform(1.0, 0.0, 0.5, 1.0, 0.5, 0.0); |
| 25 gfx::Size content_bounds(26, 28); | 25 gfx::Size content_bounds(26, 28); |
| 26 gfx::Rect visible_content_rect(10, 12, 14, 16); | 26 gfx::Rect visible_layer_rect(10, 12, 14, 16); |
| 27 gfx::Rect clip_rect(19, 21, 23, 25); | 27 gfx::Rect clip_rect(19, 21, 23, 25); |
| 28 bool is_clipped = false; | 28 bool is_clipped = false; |
| 29 float opacity = 1.f; | 29 float opacity = 1.f; |
| 30 int sorting_context_id = 65536; | 30 int sorting_context_id = 65536; |
| 31 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; | 31 SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; |
| 32 | 32 |
| 33 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); | 33 SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); |
| 34 state->SetAll(quad_transform, content_bounds, visible_content_rect, clip_rect, | 34 state->SetAll(quad_transform, content_bounds, visible_layer_rect, clip_rect, |
| 35 is_clipped, opacity, blend_mode, sorting_context_id); | 35 is_clipped, opacity, blend_mode, sorting_context_id); |
| 36 return state; | 36 return state; |
| 37 } | 37 } |
| 38 | 38 |
| 39 class DrawQuadPerfTest : public testing::Test { | 39 class DrawQuadPerfTest : public testing::Test { |
| 40 public: | 40 public: |
| 41 DrawQuadPerfTest() | 41 DrawQuadPerfTest() |
| 42 : timer_(kWarmupRuns, | 42 : timer_(kWarmupRuns, |
| 43 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), | 43 base::TimeDelta::FromMilliseconds(kTimeLimitMillis), |
| 44 kTimeCheckInterval) {} | 44 kTimeCheckInterval) {} |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 TEST_F(DrawQuadPerfTest, IterateResources) { | 106 TEST_F(DrawQuadPerfTest, IterateResources) { |
| 107 RunIterateResourceTest("10_quads", 10); | 107 RunIterateResourceTest("10_quads", 10); |
| 108 RunIterateResourceTest("100_quads", 100); | 108 RunIterateResourceTest("100_quads", 100); |
| 109 RunIterateResourceTest("500_quads", 500); | 109 RunIterateResourceTest("500_quads", 500); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace | 112 } // namespace |
| 113 } // namespace cc | 113 } // namespace cc |
| OLD | NEW |