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 #ifndef MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 6 #define MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 7 8 #include "mojo/examples/sample_app/spinning_cube.h" 9 #include "mojo/public/c/gles2/gles2.h" 10 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" 11 #include "ui/gfx/point_f.h" 12 #include "ui/gfx/size.h" 13 14 namespace mojo { 15 namespace examples { 16 17 class GLES2ClientImpl { 18 public: 19 explicit GLES2ClientImpl(CommandBufferPtr command_buffer); 20 virtual ~GLES2ClientImpl(); 21 22 void SetSize(const Size& size); 23 void HandleInputEvent(const Event& event); 24 25 private: 26 void ContextLost(); 27 static void ContextLostThunk(void* closure); 28 void DrawAnimationFrame(); 29 static void DrawAnimationFrameThunk(void* closure); 30 31 void RequestAnimationFrames(); 32 void CancelAnimationFrames(); 33 34 MojoTimeTicks last_time_; 35 gfx::Size size_; 36 SpinningCube cube_; 37 gfx::PointF capture_point_; 38 gfx::PointF last_drag_point_; 39 MojoTimeTicks drag_start_time_; 40 bool getting_animation_frames_; 41 42 MojoGLES2Context context_; 43 44 MOJO_DISALLOW_COPY_AND_ASSIGN(GLES2ClientImpl); 45 }; 46 47 } // namespace examples 48 } // namespace mojo 49 50 #endif // MOJO_EXAMPLES_SAMPLE_APP_GLES2_CLIENT_IMPL_H_ 51