Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / mojo / converters / surfaces / surfaces_utils.cc
blobd62fc081556d380348d6314819f03893e805cc9d
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.
5 #include "mojo/converters/surfaces/surfaces_utils.h"
7 #include "mojo/converters/geometry/geometry_type_converters.h"
8 #include "mojo/converters/transform/transform_type_converters.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/transform.h"
13 namespace mojo {
15 SharedQuadStatePtr CreateDefaultSQS(const gfx::Size& size) {
16 SharedQuadStatePtr sqs = SharedQuadState::New();
17 sqs->quad_to_target_transform = Transform::From(gfx::Transform());
18 sqs->quad_layer_bounds = Size::From(size);
19 sqs->visible_quad_layer_rect = Rect::From(gfx::Rect(size));
20 sqs->clip_rect = Rect::From(gfx::Rect(size));
21 sqs->is_clipped = false;
22 sqs->opacity = 1.f;
23 sqs->blend_mode = mojo::SK_XFERMODE_kSrc_Mode;
24 sqs->sorting_context_id = 0;
25 return sqs.Pass();
28 PassPtr CreateDefaultPass(int id, const gfx::Rect& rect) {
29 PassPtr pass = Pass::New();
30 RenderPassId render_pass_id;
31 render_pass_id.layer_id = 1;
32 render_pass_id.index = id;
33 pass->id = render_pass_id.Clone();
34 pass->output_rect = Rect::From(rect);
35 pass->damage_rect = Rect::From(rect);
36 pass->transform_to_root_target = Transform::From(gfx::Transform());
37 pass->has_transparent_background = false;
38 return pass.Pass();
41 } // namespace mojo