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

Side by Side Diff: examples/ganesh_app/ganesh_view.h

Issue 731893002: Add a simple scheduler for animation frames (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Fix math Created 6 years, 1 month 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/ganesh_app/DEPS ('k') | examples/ganesh_app/ganesh_view.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXAMPLES_GANESH_APP_GANESH_VIEW_H_ 5 #ifndef EXAMPLES_GANESH_APP_GANESH_VIEW_H_
6 #define EXAMPLES_GANESH_APP_GANESH_VIEW_H_ 6 #define EXAMPLES_GANESH_APP_GANESH_VIEW_H_
7 7
8 #include "examples/ganesh_app/ganesh_context.h" 8 #include "examples/ganesh_app/ganesh_context.h"
9 #include "examples/ganesh_app/mojo_gl_context.h" 9 #include "examples/ganesh_app/mojo_gl_context.h"
10 #include "examples/ganesh_app/texture_uploader.h" 10 #include "examples/ganesh_app/texture_uploader.h"
11 #include "mc/scheduler/scheduler.h"
11 #include "mojo/services/public/cpp/view_manager/view_observer.h" 12 #include "mojo/services/public/cpp/view_manager/view_observer.h"
12 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" 13 #include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 class Shell; 16 class Shell;
16 } 17 }
17 18
18 namespace examples { 19 namespace examples {
19 20
20 class GaneshView : public TextureUploader::Client, public mojo::ViewObserver { 21 class GaneshView : public TextureUploader::Client,
22 public mc::Scheduler::Client,
23 public mojo::ViewObserver {
21 public: 24 public:
22 GaneshView(mojo::Shell* shell, mojo::View* view); 25 GaneshView(mojo::Shell* shell, mojo::View* view);
23 ~GaneshView(); 26 ~GaneshView();
24 27
25 private: 28 private:
29 // From ViewObserver
26 void OnViewDestroyed(mojo::View* view) override; 30 void OnViewDestroyed(mojo::View* view) override;
27 void OnViewBoundsChanged(mojo::View* view, 31 void OnViewBoundsChanged(mojo::View* view,
28 const mojo::Rect& old_bounds, 32 const mojo::Rect& old_bounds,
29 const mojo::Rect& new_bounds) override; 33 const mojo::Rect& new_bounds) override;
30 34
35 // From TextureUploader::Client
31 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override; 36 void OnSurfaceIdAvailable(mojo::SurfaceIdPtr surface_id) override;
32 37
33 void Draw(const mojo::Size& size); 38 // From mc::Scheduler::Client
39 void BeginFrame(base::TimeTicks frame_time,
40 base::TimeTicks deadline) override;
41
42 base::TimeDelta Draw(base::TimeTicks frame_time);
34 43
35 mojo::View* view_; 44 mojo::View* view_;
36 MojoGLContext gl_context_; 45 MojoGLContext gl_context_;
37 GaneshContext gr_context_; 46 GaneshContext gr_context_;
38 TextureUploader texture_uploader_; 47 TextureUploader texture_uploader_;
48 base::TimeTicks base_time_;
49 mc::Scheduler scheduler_;
39 50
40 DISALLOW_COPY_AND_ASSIGN(GaneshView); 51 DISALLOW_COPY_AND_ASSIGN(GaneshView);
41 }; 52 };
42 53
43 } // namespace examples 54 } // namespace examples
44 55
45 #endif // EXAMPLES_GANESH_APP_GANESH_VIEW_H_ 56 #endif // EXAMPLES_GANESH_APP_GANESH_VIEW_H_
OLDNEW
« no previous file with comments | « examples/ganesh_app/DEPS ('k') | examples/ganesh_app/ganesh_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698