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

Side by Side Diff: apps/moterm/gl_helper_test_app.cc

Issue 1375313006: For c++, Generate enum classes instead of enum from mojom. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « apps/moterm/gl_helper.cc ('k') | apps/moterm/key_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This is a test application for gl_helper.*, which draws directly to a native 5 // This is a test application for gl_helper.*, which draws directly to a native
6 // viewport (without using the view manager). 6 // viewport (without using the view manager).
7 7
8 #include <GLES2/gl2.h> 8 #include <GLES2/gl2.h>
9 #include <math.h> 9 #include <math.h>
10 10
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 mojo::Transform identity_transform; 172 mojo::Transform identity_transform;
173 identity_transform.matrix = mojo::Array<float>::New(16); 173 identity_transform.matrix = mojo::Array<float>::New(16);
174 for (size_t i = 0; i < 4; i++) { 174 for (size_t i = 0; i < 4; i++) {
175 for (size_t j = 0; j < 4; j++) 175 for (size_t j = 0; j < 4; j++)
176 identity_transform.matrix[4 * i + j] = (i == j); 176 identity_transform.matrix[4 * i + j] = (i == j);
177 } 177 }
178 pass->transform_to_root_target = identity_transform.Clone(); 178 pass->transform_to_root_target = identity_transform.Clone();
179 pass->has_transparent_background = false; 179 pass->has_transparent_background = false;
180 pass->quads = mojo::Array<mojo::QuadPtr>::New(1); 180 pass->quads = mojo::Array<mojo::QuadPtr>::New(1);
181 mojo::QuadPtr quad = mojo::Quad::New(); 181 mojo::QuadPtr quad = mojo::Quad::New();
182 quad->material = mojo::MATERIAL_SURFACE_CONTENT; 182 quad->material = mojo::Material::SURFACE_CONTENT;
183 quad->rect = viewport_rect.Clone(); 183 quad->rect = viewport_rect.Clone();
184 quad->opaque_rect = viewport_rect.Clone(); 184 quad->opaque_rect = viewport_rect.Clone();
185 quad->visible_rect = viewport_rect.Clone(); 185 quad->visible_rect = viewport_rect.Clone();
186 quad->needs_blending = false; 186 quad->needs_blending = false;
187 quad->shared_quad_state_index = 0; 187 quad->shared_quad_state_index = 0;
188 mojo::SurfaceQuadStatePtr surface_quad_state = 188 mojo::SurfaceQuadStatePtr surface_quad_state =
189 mojo::SurfaceQuadState::New(); 189 mojo::SurfaceQuadState::New();
190 surface_quad_state->surface = surface_id_.Clone(); 190 surface_quad_state->surface = surface_id_.Clone();
191 quad->surface_quad_state = surface_quad_state.Pass(); 191 quad->surface_quad_state = surface_quad_state.Pass();
192 192
193 pass->quads[0] = quad.Pass(); 193 pass->quads[0] = quad.Pass();
194 pass->shared_quad_states = mojo::Array<mojo::SharedQuadStatePtr>::New(1); 194 pass->shared_quad_states = mojo::Array<mojo::SharedQuadStatePtr>::New(1);
195 mojo::SharedQuadStatePtr shared_quad_state = mojo::SharedQuadState::New(); 195 mojo::SharedQuadStatePtr shared_quad_state = mojo::SharedQuadState::New();
196 shared_quad_state->content_to_target_transform = identity_transform.Clone(); 196 shared_quad_state->content_to_target_transform = identity_transform.Clone();
197 shared_quad_state->content_bounds = viewport_size_.Clone(); 197 shared_quad_state->content_bounds = viewport_size_.Clone();
198 shared_quad_state->visible_content_rect = viewport_rect.Clone(); 198 shared_quad_state->visible_content_rect = viewport_rect.Clone();
199 shared_quad_state->clip_rect = viewport_rect.Clone(); 199 shared_quad_state->clip_rect = viewport_rect.Clone();
200 shared_quad_state->is_clipped = false; 200 shared_quad_state->is_clipped = false;
201 shared_quad_state->opacity = 1; 201 shared_quad_state->opacity = 1;
202 shared_quad_state->blend_mode = mojo::SK_XFERMODE_kSrc_Mode; 202 shared_quad_state->blend_mode = mojo::SkXfermode::kSrc_Mode;
203 shared_quad_state->sorting_context_id = 0; 203 shared_quad_state->sorting_context_id = 0;
204 pass->shared_quad_states[0] = shared_quad_state.Pass(); 204 pass->shared_quad_states[0] = shared_quad_state.Pass();
205 frame->passes[0] = pass.Pass(); 205 frame->passes[0] = pass.Pass();
206 206
207 DCHECK(display_); 207 DCHECK(display_);
208 display_->SubmitFrame(frame.Pass(), mojo::Display::SubmitFrameCallback()); 208 display_->SubmitFrame(frame.Pass(), mojo::Display::SubmitFrameCallback());
209 } 209 }
210 210
211 // |mojo::ApplicationDelegate|: 211 // |mojo::ApplicationDelegate|:
212 void Initialize(mojo::ApplicationImpl* application_impl) override { 212 void Initialize(mojo::ApplicationImpl* application_impl) override {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 }; 270 };
271 271
272 const GLuint GlHelperExampleApp::kPositionLocation; 272 const GLuint GlHelperExampleApp::kPositionLocation;
273 273
274 } // namespace 274 } // namespace
275 275
276 MojoResult MojoMain(MojoHandle application_request) { 276 MojoResult MojoMain(MojoHandle application_request) {
277 mojo::ApplicationRunnerChromium runner(new GlHelperExampleApp()); 277 mojo::ApplicationRunnerChromium runner(new GlHelperExampleApp());
278 return runner.Run(application_request); 278 return runner.Run(application_request);
279 } 279 }
OLDNEW
« no previous file with comments | « apps/moterm/gl_helper.cc ('k') | apps/moterm/key_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698