Upstream version 11.39.266.0
[platform/framework/web/crosswalk.git] / src / mojo / examples / surfaces_app / surfaces_util.cc
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 "mojo/examples/surfaces_app/surfaces_util.h"
6
7 #include "cc/quads/render_pass.h"
8 #include "cc/quads/shared_quad_state.h"
9 #include "ui/gfx/rect.h"
10 #include "ui/gfx/size.h"
11 #include "ui/gfx/transform.h"
12
13 namespace mojo {
14 namespace examples {
15
16 using cc::SharedQuadState;
17
18 void CreateAndAppendSimpleSharedQuadState(cc::RenderPass* render_pass,
19                                           const gfx::Transform& transform,
20                                           const gfx::Size& size) {
21   const gfx::Size content_bounds = size;
22   const gfx::Rect visible_content_rect = gfx::Rect(size);
23   const gfx::Rect clip_rect = gfx::Rect(size);
24   bool is_clipped = false;
25   float opacity = 1.f;
26   const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode;
27   SharedQuadState* shared_state = render_pass->CreateAndAppendSharedQuadState();
28   shared_state->SetAll(transform,
29                        content_bounds,
30                        visible_content_rect,
31                        clip_rect,
32                        is_clipped,
33                        opacity,
34                        blend_mode,
35                        0);
36 }
37
38 }  // namespace mojo
39 }  // namespace examples