: getting_animation_frames_(false) {
context_ = MojoGLES2CreateContext(
pipe.release().value(),
- &DidCreateContextThunk,
&ContextLostThunk,
&DrawAnimationFrameThunk,
this);
+ MojoGLES2MakeCurrent(context_);
}
GLES2ClientImpl::~GLES2ClientImpl() {
MojoGLES2DestroyContext(context_);
}
+void GLES2ClientImpl::SetSize(const Size& size) {
+ size_ = gfx::Size(size.width(), size.height());
+ if (size_.IsEmpty())
+ return;
+ cube_.Init(size_.width(), size_.height());
+ RequestAnimationFrames();
+}
+
void GLES2ClientImpl::HandleInputEvent(const Event& event) {
switch (event.action()) {
case ui::ET_MOUSE_PRESSED:
}
}
-void GLES2ClientImpl::DidCreateContext(uint32_t width,
- uint32_t height) {
- MojoGLES2MakeCurrent(context_);
-
- cube_.Init(width, height);
- RequestAnimationFrames();
-}
-
-void GLES2ClientImpl::DidCreateContextThunk(
- void* closure,
- uint32_t width,
- uint32_t height) {
- static_cast<GLES2ClientImpl*>(closure)->DidCreateContext(width, height);
-}
-
void GLES2ClientImpl::ContextLost() {
CancelAnimationFrames();
}