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

Side by Side Diff: mojo/examples/surfaces_app/embedder.cc

Issue 404563005: Make RenderPass::Id an isolated class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more case in mojo Created 6 years, 4 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
OLDNEW
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 "mojo/examples/surfaces_app/embedder.h" 5 #include "mojo/examples/surfaces_app/embedder.h"
6 6
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/delegated_frame_data.h" 8 #include "cc/output/delegated_frame_data.h"
9 #include "cc/quads/render_pass.h" 9 #include "cc/quads/render_pass.h"
10 #include "cc/quads/solid_color_draw_quad.h" 10 #include "cc/quads/solid_color_draw_quad.h"
11 #include "cc/quads/surface_draw_quad.h" 11 #include "cc/quads/surface_draw_quad.h"
12 #include "mojo/examples/surfaces_app/surfaces_util.h" 12 #include "mojo/examples/surfaces_app/surfaces_util.h"
13 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" 13 #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h"
14 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" 14 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h"
15 #include "ui/gfx/rect.h" 15 #include "ui/gfx/rect.h"
16 #include "ui/gfx/size.h" 16 #include "ui/gfx/size.h"
17 #include "ui/gfx/transform.h" 17 #include "ui/gfx/transform.h"
18 18
19 namespace mojo { 19 namespace mojo {
20 namespace examples { 20 namespace examples {
21 21
22 using cc::RenderPass; 22 using cc::RenderPass;
23 using cc::RenderPassId;
23 using cc::SurfaceDrawQuad; 24 using cc::SurfaceDrawQuad;
24 using cc::DrawQuad; 25 using cc::DrawQuad;
25 using cc::SolidColorDrawQuad; 26 using cc::SolidColorDrawQuad;
26 using cc::DelegatedFrameData; 27 using cc::DelegatedFrameData;
27 using cc::CompositorFrame; 28 using cc::CompositorFrame;
28 29
29 Embedder::Embedder(Surface* surface) : surface_(surface) { 30 Embedder::Embedder(Surface* surface) : surface_(surface) {
30 } 31 }
31 32
32 Embedder::~Embedder() { 33 Embedder::~Embedder() {
33 } 34 }
34 35
35 void Embedder::ProduceFrame(cc::SurfaceId child_one, 36 void Embedder::ProduceFrame(cc::SurfaceId child_one,
36 cc::SurfaceId child_two, 37 cc::SurfaceId child_two,
37 const gfx::Size& child_size, 38 const gfx::Size& child_size,
38 const gfx::Size& size, 39 const gfx::Size& size,
39 int offset) { 40 int offset) {
40 gfx::Rect rect(size); 41 gfx::Rect rect(size);
41 RenderPass::Id pass_id(1, 1); 42 RenderPassId pass_id(1, 1);
42 scoped_ptr<RenderPass> pass = RenderPass::Create(); 43 scoped_ptr<RenderPass> pass = RenderPass::Create();
43 pass->SetNew(pass_id, rect, rect, gfx::Transform()); 44 pass->SetNew(pass_id, rect, rect, gfx::Transform());
44 45
45 gfx::Transform one_transform; 46 gfx::Transform one_transform;
46 one_transform.Translate(10 + child_size.width() / 2, 47 one_transform.Translate(10 + child_size.width() / 2,
47 50 + child_size.height() / 2); 48 50 + child_size.height() / 2);
48 one_transform.Translate(0, offset); 49 one_transform.Translate(0, offset);
49 one_transform.Translate(-child_size.width() / 2, -child_size.height() / 2); 50 one_transform.Translate(-child_size.width() / 2, -child_size.height() / 2);
50 CreateAndAppendSimpleSharedQuadState(pass.get(), one_transform, size); 51 CreateAndAppendSimpleSharedQuadState(pass.get(), one_transform, size);
51 52
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 scoped_ptr<CompositorFrame> frame(new CompositorFrame); 85 scoped_ptr<CompositorFrame> frame(new CompositorFrame);
85 frame->delegated_frame_data = delegated_frame_data.Pass(); 86 frame->delegated_frame_data = delegated_frame_data.Pass();
86 87
87 surface_->SubmitFrame(mojo::SurfaceId::From(id_), 88 surface_->SubmitFrame(mojo::SurfaceId::From(id_),
88 mojo::Frame::From(*frame)); 89 mojo::Frame::From(*frame));
89 } 90 }
90 91
91 } // namespace examples 92 } // namespace examples
92 } // namespace mojo 93 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/surfaces_app/child_impl.cc ('k') | mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698