Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: cc/test/render_pass_test_utils.cc

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/render_pass_test_utils.h ('k') | cc/test/skia_common.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/test/render_pass_test_utils.h" 5 #include "cc/test/render_pass_test_utils.h"
6 6
7 #include "cc/layers/append_quads_data.h" 7 #include "cc/layers/append_quads_data.h"
8 #include "cc/layers/quad_sink.h" 8 #include "cc/layers/quad_sink.h"
9 #include "cc/quads/render_pass_draw_quad.h" 9 #include "cc/quads/render_pass_draw_quad.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
11 #include "cc/quads/solid_color_draw_quad.h" 11 #include "cc/quads/solid_color_draw_quad.h"
12 #include "cc/resources/resource_provider.h" 12 #include "cc/resources/resource_provider.h"
13 #include "cc/test/mock_quad_culler.h" 13 #include "cc/test/mock_quad_culler.h"
14 #include "cc/test/render_pass_test_common.h" 14 #include "cc/test/render_pass_test_common.h"
15 #include "third_party/skia/include/core/SkColor.h" 15 #include "third_party/skia/include/core/SkColor.h"
16 #include "third_party/skia/include/core/SkImageFilter.h" 16 #include "third_party/skia/include/core/SkImageFilter.h"
17 #include "ui/gfx/rect.h" 17 #include "ui/gfx/rect.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 TestRenderPass* AddRenderPass(RenderPassList* pass_list, 21 TestRenderPass* AddRenderPass(RenderPassList* pass_list,
22 RenderPass::Id id, 22 RenderPass::Id id,
23 gfx::Rect output_rect, 23 const gfx::Rect& output_rect,
24 const gfx::Transform& root_transform) { 24 const gfx::Transform& root_transform) {
25 scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); 25 scoped_ptr<TestRenderPass> pass(TestRenderPass::Create());
26 pass->SetNew(id, output_rect, output_rect, root_transform); 26 pass->SetNew(id, output_rect, output_rect, root_transform);
27 TestRenderPass* saved = pass.get(); 27 TestRenderPass* saved = pass.get();
28 pass_list->push_back(pass.PassAs<RenderPass>()); 28 pass_list->push_back(pass.PassAs<RenderPass>());
29 return saved; 29 return saved;
30 } 30 }
31 31
32 SolidColorDrawQuad* AddQuad(TestRenderPass* pass, 32 SolidColorDrawQuad* AddQuad(TestRenderPass* pass,
33 gfx::Rect rect, 33 const gfx::Rect& rect,
34 SkColor color) { 34 SkColor color) {
35 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); 35 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
36 AppendQuadsData data(pass->id); 36 AppendQuadsData data(pass->id);
37 SharedQuadState* shared_state = 37 SharedQuadState* shared_state =
38 quad_sink.UseSharedQuadState(SharedQuadState::Create()); 38 quad_sink.UseSharedQuadState(SharedQuadState::Create());
39 shared_state->SetAll(gfx::Transform(), 39 shared_state->SetAll(gfx::Transform(),
40 rect.size(), 40 rect.size(),
41 rect, 41 rect,
42 rect, 42 rect,
43 false, 43 false,
44 1, 44 1,
45 SkXfermode::kSrcOver_Mode); 45 SkXfermode::kSrcOver_Mode);
46 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 46 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
47 quad->SetNew(shared_state, rect, color, false); 47 quad->SetNew(shared_state, rect, color, false);
48 SolidColorDrawQuad* quad_ptr = quad.get(); 48 SolidColorDrawQuad* quad_ptr = quad.get();
49 quad_sink.Append(quad.PassAs<DrawQuad>(), &data); 49 quad_sink.Append(quad.PassAs<DrawQuad>(), &data);
50 return quad_ptr; 50 return quad_ptr;
51 } 51 }
52 52
53 SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass, 53 SolidColorDrawQuad* AddClippedQuad(TestRenderPass* pass,
54 gfx::Rect rect, 54 const gfx::Rect& rect,
55 SkColor color) { 55 SkColor color) {
56 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); 56 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
57 AppendQuadsData data(pass->id); 57 AppendQuadsData data(pass->id);
58 SharedQuadState* shared_state = 58 SharedQuadState* shared_state =
59 quad_sink.UseSharedQuadState(SharedQuadState::Create()); 59 quad_sink.UseSharedQuadState(SharedQuadState::Create());
60 shared_state->SetAll(gfx::Transform(), 60 shared_state->SetAll(gfx::Transform(),
61 rect.size(), 61 rect.size(),
62 rect, 62 rect,
63 rect, 63 rect,
64 true, 64 true,
65 1, 65 1,
66 SkXfermode::kSrcOver_Mode); 66 SkXfermode::kSrcOver_Mode);
67 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 67 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
68 quad->SetNew(shared_state, rect, color, false); 68 quad->SetNew(shared_state, rect, color, false);
69 SolidColorDrawQuad* quad_ptr = quad.get(); 69 SolidColorDrawQuad* quad_ptr = quad.get();
70 quad_sink.Append(quad.PassAs<DrawQuad>(), &data); 70 quad_sink.Append(quad.PassAs<DrawQuad>(), &data);
71 return quad_ptr; 71 return quad_ptr;
72 } 72 }
73 73
74 SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass, 74 SolidColorDrawQuad* AddTransformedQuad(TestRenderPass* pass,
75 gfx::Rect rect, 75 const gfx::Rect& rect,
76 SkColor color, 76 SkColor color,
77 const gfx::Transform& transform) { 77 const gfx::Transform& transform) {
78 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list); 78 MockQuadCuller quad_sink(&pass->quad_list, &pass->shared_quad_state_list);
79 AppendQuadsData data(pass->id); 79 AppendQuadsData data(pass->id);
80 SharedQuadState* shared_state = 80 SharedQuadState* shared_state =
81 quad_sink.UseSharedQuadState(SharedQuadState::Create()); 81 quad_sink.UseSharedQuadState(SharedQuadState::Create());
82 shared_state->SetAll( 82 shared_state->SetAll(
83 transform, rect.size(), rect, rect, false, 1, SkXfermode::kSrcOver_Mode); 83 transform, rect.size(), rect, rect, false, 1, SkXfermode::kSrcOver_Mode);
84 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); 84 scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create();
85 quad->SetNew(shared_state, rect, color, false); 85 quad->SetNew(shared_state, rect, color, false);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 1, 129 1,
130 SkXfermode::kSrcOver_Mode); 130 SkXfermode::kSrcOver_Mode);
131 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); 131 scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
132 quad->SetNew(shared_state, output_rect, contributing_pass->id, false, 132 quad->SetNew(shared_state, output_rect, contributing_pass->id, false,
133 mask_resource_id, output_rect, gfx::RectF(), filters, 133 mask_resource_id, output_rect, gfx::RectF(), filters,
134 FilterOperations()); 134 FilterOperations());
135 quad_sink.Append(quad.PassAs<DrawQuad>(), &data); 135 quad_sink.Append(quad.PassAs<DrawQuad>(), &data);
136 } 136 }
137 137
138 } // namespace cc 138 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/render_pass_test_utils.h ('k') | cc/test/skia_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698