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

Side by Side Diff: examples/spinning_cube/gles2_client_impl.cc

Issue 2236083002: Move mojo/public/c/gpu/* to mojo/public/c/include. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: foo Created 4 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
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.h ('k') | examples/ui/jank/BUILD.gn » ('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 #ifndef GL_GLEXT_PROTOTYPES 5 #ifndef GL_GLEXT_PROTOTYPES
6 #define GL_GLEXT_PROTOTYPES 6 #define GL_GLEXT_PROTOTYPES
7 #endif 7 #endif
8 8
9 #include "examples/spinning_cube/gles2_client_impl.h" 9 #include "examples/spinning_cube/gles2_client_impl.h"
10 10
11 #include <math.h> 11 #include <MGL/mgl.h>
12 #include <MGL/mgl_onscreen.h>
12 #include <stdlib.h> 13 #include <stdlib.h>
14
13 #include <cmath> 15 #include <cmath>
14 #include <utility> 16 #include <utility>
15 17
16 #include "mojo/public/c/gpu/MGL/mgl.h"
17 #include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
18 #include "mojo/public/cpp/environment/environment.h" 18 #include "mojo/public/cpp/environment/environment.h"
19 #include "mojo/public/cpp/system/time.h" 19 #include "mojo/public/cpp/system/time.h"
20 #include "mojo/public/cpp/utility/run_loop.h" 20 #include "mojo/public/cpp/utility/run_loop.h"
21 21
22 namespace examples { 22 namespace examples {
23 namespace { 23 namespace {
24 24
25 // TODO(johngro) : investigate extending mojom with a formal flags type which it 25 // TODO(johngro) : investigate extending mojom with a formal flags type which it
26 // generates good bindings for, so we don't need to resort to this. 26 // generates good bindings for, so we don't need to resort to this.
27 static inline constexpr bool operator &(const mojo::EventFlags& f1, 27 static inline constexpr bool operator &(const mojo::EventFlags& f1,
28 const mojo::EventFlags& f2) { 28 const mojo::EventFlags& f2) {
29 return ((static_cast<uint32_t>(f1) & static_cast<uint32_t>(f2)) != 0); 29 return ((static_cast<uint32_t>(f1) & static_cast<uint32_t>(f2)) != 0);
30 } 30 }
31 31
32 float CalculateDragDistance(const mojo::PointF& start, 32 float CalculateDragDistance(const mojo::PointF& start,
33 const mojo::PointF& end) { 33 const mojo::PointF& end) {
34 return hypot(start.x - end.x, start.y - end.y); 34 return std::hypot(start.x - end.x, start.y - end.y);
35 } 35 }
36 36
37 float GetRandomColor() { 37 float GetRandomColor() {
38 return static_cast<float>(rand()) / static_cast<float>(RAND_MAX); 38 return static_cast<float>(rand()) / static_cast<float>(RAND_MAX);
39 } 39 }
40 40
41 // Return a direction multiplier to apply to drag distances: 41 // Return a direction multiplier to apply to drag distances:
42 // 1 for natural (positive) motion, -1 for reverse (negative) motion 42 // 1 for natural (positive) motion, -1 for reverse (negative) motion
43 int GetEventDirection(const mojo::PointF& current, 43 int GetEventDirection(const mojo::PointF& current,
44 const mojo::PointF& initial, 44 const mojo::PointF& initial,
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 float delta = static_cast<float>(offset) / 1000000.; 178 float delta = static_cast<float>(offset) / 1000000.;
179 last_time_ = now; 179 last_time_ = now;
180 cube_.UpdateForTimeDelta(delta); 180 cube_.UpdateForTimeDelta(delta);
181 cube_.Draw(); 181 cube_.Draw();
182 182
183 MGLSwapBuffers(); 183 MGLSwapBuffers();
184 WantToDraw(); 184 WantToDraw();
185 } 185 }
186 186
187 } // namespace examples 187 } // namespace examples
OLDNEW
« no previous file with comments | « examples/spinning_cube/gles2_client_impl.h ('k') | examples/ui/jank/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698