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

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

Issue 101413002: [Mojo] Remove dependency between mojo/public and gpu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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/sample_gles2_delegate.h ('k') | mojo/gles2/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/examples/sample_app/sample_gles2_delegate.h"
6
7 #include <stdio.h>
8 #include <GLES2/gl2.h>
9 #include <GLES2/gl2ext.h>
10
11 namespace mojo {
12 namespace examples {
13
14 SampleGLES2Delegate::SampleGLES2Delegate()
15 : gl_(NULL) {
16 }
17
18 SampleGLES2Delegate::~SampleGLES2Delegate() {
19 }
20
21 void SampleGLES2Delegate::DidCreateContext(
22 GLES2ClientImpl* gl, uint32_t width, uint32_t height) {
23 gl_ = gl;
24 cube_.Init(width, height);
25 last_time_ = base::Time::Now();
26 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(16),
27 this, &SampleGLES2Delegate::Draw);
28 }
29
30 void SampleGLES2Delegate::Draw() {
31 base::Time now = base::Time::Now();
32 base::TimeDelta offset = now - last_time_;
33 last_time_ = now;
34 cube_.Update(offset.InSecondsF());
35 cube_.Draw();
36 gl_->SwapBuffers();
37 }
38
39 void SampleGLES2Delegate::ContextLost(GLES2ClientImpl* gl) {
40 gl_ = NULL;
41 timer_.Stop();
42 }
43
44 } // namespace examples
45 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/sample_gles2_delegate.h ('k') | mojo/gles2/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698