OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "surfaces/public/cpp/surfaces_utils.h" | |
6 | |
7 #include "geometry/public/interfaces/geometry.mojom.h" | |
8 | |
9 namespace mojo { | |
10 | |
11 namespace { | |
12 TransformPtr GetIdentityTransform() { | |
13 TransformPtr transform(Transform::New()); | |
14 transform->matrix.resize(16); | |
15 transform->matrix[0] = 1.f; | |
16 transform->matrix[5] = 1.f; | |
17 transform->matrix[10] = 1.f; | |
18 transform->matrix[15] = 1.f; | |
19 return transform.Pass(); | |
20 } | |
21 } | |
22 | |
23 SharedQuadStatePtr CreateDefaultSQS(const Size& size) { | |
24 SharedQuadStatePtr sqs = SharedQuadState::New(); | |
25 sqs->content_to_target_transform = GetIdentityTransform(); | |
26 sqs->content_bounds = size.Clone(); | |
27 Rect rect; | |
28 rect.width = size.width; | |
29 rect.height = size.height; | |
30 sqs->visible_content_rect = rect.Clone(); | |
31 sqs->clip_rect = rect.Clone(); | |
32 sqs->is_clipped = false; | |
33 sqs->opacity = 1.f; | |
34 sqs->blend_mode = mojo::SK_XFERMODE_kSrc_Mode; | |
35 sqs->sorting_context_id = 0; | |
36 return sqs.Pass(); | |
37 } | |
38 | |
39 PassPtr CreateDefaultPass(int id, const Rect& rect) { | |
40 PassPtr pass = Pass::New(); | |
41 pass->id = id; | |
42 pass->output_rect = rect.Clone(); | |
43 pass->damage_rect = rect.Clone(); | |
44 pass->transform_to_root_target = GetIdentityTransform(); | |
45 pass->has_transparent_background = false; | |
46 return pass.Pass(); | |
47 } | |
48 | |
49 } // namespace mojo | |
OLD | NEW |