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

Side by Side Diff: mojo/examples/sample_app/gles2_client_impl.cc

Issue 272323003: Mojo: Implement support for |Foo&| mojom syntax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « mojo/examples/sample_app/gles2_client_impl.h ('k') | mojo/examples/sample_app/sample_app.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sample_app/gles2_client_impl.h" 5 #include "mojo/examples/sample_app/gles2_client_impl.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <math.h> 9 #include <math.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
11 11
12 #include "mojo/public/c/gles2/gles2.h" 12 #include "mojo/public/c/gles2/gles2.h"
13 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 namespace examples { 16 namespace examples {
17 namespace { 17 namespace {
18 18
19 float CalculateDragDistance(const gfx::PointF& start, const Point& end) { 19 float CalculateDragDistance(const gfx::PointF& start, const Point& end) {
20 return hypot(start.x() - end.x, start.y() - end.y); 20 return hypot(start.x() - end.x, start.y() - end.y);
21 } 21 }
22 22
23 float GetRandomColor() { 23 float GetRandomColor() {
24 return static_cast<float>(rand()) / static_cast<float>(RAND_MAX); 24 return static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
25 } 25 }
26 26
27 } 27 }
28 28
29 GLES2ClientImpl::GLES2ClientImpl(ScopedMessagePipeHandle pipe) 29 GLES2ClientImpl::GLES2ClientImpl(CommandBufferPtr command_buffer)
30 : getting_animation_frames_(false) { 30 : getting_animation_frames_(false) {
31 context_ = MojoGLES2CreateContext( 31 context_ = MojoGLES2CreateContext(
32 pipe.release().value(), 32 command_buffer.PassMessagePipe().release().value(),
33 &ContextLostThunk, 33 &ContextLostThunk,
34 &DrawAnimationFrameThunk, 34 &DrawAnimationFrameThunk,
35 this); 35 this);
36 MojoGLES2MakeCurrent(context_); 36 MojoGLES2MakeCurrent(context_);
37 } 37 }
38 38
39 GLES2ClientImpl::~GLES2ClientImpl() { 39 GLES2ClientImpl::~GLES2ClientImpl() {
40 MojoGLES2DestroyContext(context_); 40 MojoGLES2DestroyContext(context_);
41 } 41 }
42 42
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 last_time_ = GetTimeTicksNow(); 119 last_time_ = GetTimeTicksNow();
120 } 120 }
121 121
122 void GLES2ClientImpl::CancelAnimationFrames() { 122 void GLES2ClientImpl::CancelAnimationFrames() {
123 getting_animation_frames_ = false; 123 getting_animation_frames_ = false;
124 MojoGLES2CancelAnimationFrames(context_); 124 MojoGLES2CancelAnimationFrames(context_);
125 } 125 }
126 126
127 } // namespace examples 127 } // namespace examples
128 } // namespace mojo 128 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/gles2_client_impl.h ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698