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

Side by Side Diff: mojo/examples/sample_app/gles2_client_impl.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
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/gles2_client_impl.h"
6
7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h>
9
10 #include "mojo/public/gles2/gles2.h"
11
12 namespace mojo {
13 namespace examples {
14
15 GLES2ClientImpl::GLES2ClientImpl(ScopedMessagePipeHandle pipe)
16 : service_(pipe.Pass()) {
17 service_.SetPeer(this);
18 }
19
20 GLES2ClientImpl::~GLES2ClientImpl() {
21 service_->Destroy();
22 }
23
24 void GLES2ClientImpl::DidCreateContext(uint64_t encoded,
25 uint32_t width,
26 uint32_t height) {
27 MojoGLES2MakeCurrent(encoded);
28
29 cube_.Init(width, height);
30 last_time_ = base::Time::Now();
31 timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(16),
32 this, &GLES2ClientImpl::Draw);
33 }
34
35 void GLES2ClientImpl::Draw() {
36 base::Time now = base::Time::Now();
37 base::TimeDelta offset = now - last_time_;
38 last_time_ = now;
39 cube_.Update(offset.InSecondsF());
40 cube_.Draw();
41
42 MojoGLES2SwapBuffers();
43 }
44
45 void GLES2ClientImpl::ContextLost() {
46 timer_.Stop();
47 }
48
49 } // namespace examples
50 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/gles2_client_impl.h ('k') | mojo/examples/sample_app/native_viewport_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698