OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/mus/public/cpp/surfaces/surfaces_utils.h" | 5 #include "components/mus/public/cpp/surfaces/surfaces_utils.h" |
6 | 6 |
7 #include "ui/gfx/geometry/mojo/geometry_type_converters.h" | |
8 #include "ui/gfx/geometry/rect.h" | 7 #include "ui/gfx/geometry/rect.h" |
9 #include "ui/gfx/geometry/size.h" | 8 #include "ui/gfx/geometry/size.h" |
10 #include "ui/gfx/mojo/transform_type_converters.h" | 9 #include "ui/gfx/mojo/transform_type_converters.h" |
11 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
12 | 11 |
13 using mus::mojom::Pass; | 12 using mus::mojom::Pass; |
14 using mus::mojom::PassPtr; | 13 using mus::mojom::PassPtr; |
15 using mus::mojom::SharedQuadState; | 14 using mus::mojom::SharedQuadState; |
16 using mus::mojom::SharedQuadStatePtr; | 15 using mus::mojom::SharedQuadStatePtr; |
17 | 16 |
18 namespace mojo { | 17 namespace mojo { |
19 | 18 |
20 SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { | 19 SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) { |
21 SharedQuadStatePtr sqs = SharedQuadState::New(); | 20 SharedQuadStatePtr sqs = SharedQuadState::New(); |
22 sqs->quad_to_target_transform = Transform::From(gfx::Transform()); | 21 sqs->quad_to_target_transform = Transform::From(gfx::Transform()); |
23 sqs->quad_layer_bounds = Size::From(size); | 22 sqs->quad_layer_bounds = size; |
24 sqs->visible_quad_layer_rect = Rect::From(gfx::Rect(size)); | 23 sqs->visible_quad_layer_rect = gfx::Rect(size); |
25 sqs->clip_rect = Rect::From(gfx::Rect(size)); | 24 sqs->clip_rect = gfx::Rect(size); |
26 sqs->is_clipped = false; | 25 sqs->is_clipped = false; |
27 sqs->opacity = 1.f; | 26 sqs->opacity = 1.f; |
28 sqs->blend_mode = mus::mojom::SkXfermode::kSrc_Mode; | 27 sqs->blend_mode = mus::mojom::SkXfermode::kSrc_Mode; |
29 sqs->sorting_context_id = 0; | 28 sqs->sorting_context_id = 0; |
30 return sqs; | 29 return sqs; |
31 } | 30 } |
32 | 31 |
33 PassPtr CreateDefaultPass(int id, const gfx::Rect& rect) { | 32 PassPtr CreateDefaultPass(int id, const gfx::Rect& rect) { |
34 PassPtr pass = Pass::New(); | 33 PassPtr pass = Pass::New(); |
35 cc::RenderPassId render_pass_id; | 34 cc::RenderPassId render_pass_id; |
36 render_pass_id.layer_id = 1; | 35 render_pass_id.layer_id = 1; |
37 render_pass_id.index = id; | 36 render_pass_id.index = id; |
38 pass->id = render_pass_id; | 37 pass->id = render_pass_id; |
39 pass->output_rect = Rect::From(rect); | 38 pass->output_rect = rect; |
40 pass->damage_rect = Rect::From(rect); | 39 pass->damage_rect = rect; |
41 pass->transform_to_root_target = Transform::From(gfx::Transform()); | 40 pass->transform_to_root_target = Transform::From(gfx::Transform()); |
42 pass->has_transparent_background = false; | 41 pass->has_transparent_background = false; |
43 return pass; | 42 return pass; |
44 } | 43 } |
45 | 44 |
46 } // namespace mojo | 45 } // namespace mojo |
OLD | NEW |