| OLD | NEW |
| 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 #include "examples/surfaces_app/child_gl_impl.h" | 5 #include "examples/surfaces_app/child_gl_impl.h" |
| 6 | 6 |
| 7 #ifndef GL_GLEXT_PROTOTYPES | 7 #ifndef GL_GLEXT_PROTOTYPES |
| 8 #define GL_GLEXT_PROTOTYPES | 8 #define GL_GLEXT_PROTOTYPES |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 ChildGLImpl::~ChildGLImpl() { | 71 ChildGLImpl::~ChildGLImpl() { |
| 72 MojoGLES2DestroyContext(context_); | 72 MojoGLES2DestroyContext(context_); |
| 73 surface_->DestroySurface(local_id_); | 73 surface_->DestroySurface(local_id_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ChildGLImpl::ProduceFrame(ColorPtr color, | 76 void ChildGLImpl::ProduceFrame(ColorPtr color, |
| 77 SizePtr size, | 77 SizePtr size, |
| 78 const ProduceCallback& callback) { | 78 const ProduceCallback& callback) { |
| 79 color_ = color.To<SkColor>(); | 79 color_ = color.To<SkColor>(); |
| 80 size_ = size.To<gfx::Size>(); | 80 size_ = size.To<gfx::Size>(); |
| 81 cube_.Init(size_.width(), size_.height()); | 81 cube_.Init(); |
| 82 cube_.set_size(size_.width(), size_.height()); |
| 82 cube_.set_color( | 83 cube_.set_color( |
| 83 SkColorGetR(color_), SkColorGetG(color_), SkColorGetB(color_)); | 84 SkColorGetR(color_), SkColorGetG(color_), SkColorGetB(color_)); |
| 84 surface_->CreateSurface(local_id_); | 85 surface_->CreateSurface(local_id_); |
| 85 produce_callback_ = callback; | 86 produce_callback_ = callback; |
| 86 if (id_namespace_ != 0u) | 87 if (id_namespace_ != 0u) |
| 87 RunProduceCallback(); | 88 RunProduceCallback(); |
| 88 Draw(); | 89 Draw(); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void ChildGLImpl::SetIdNamespace(uint32_t id_namespace) { | 92 void ChildGLImpl::SetIdNamespace(uint32_t id_namespace) { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); | 199 surface_->SubmitFrame(local_id_, mojo::Frame::From(*frame), mojo::Closure()); |
| 199 | 200 |
| 200 base::MessageLoop::current()->PostDelayedTask( | 201 base::MessageLoop::current()->PostDelayedTask( |
| 201 FROM_HERE, | 202 FROM_HERE, |
| 202 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), | 203 base::Bind(&ChildGLImpl::Draw, base::Unretained(this)), |
| 203 base::TimeDelta::FromMilliseconds(50)); | 204 base::TimeDelta::FromMilliseconds(50)); |
| 204 } | 205 } |
| 205 | 206 |
| 206 } // namespace examples | 207 } // namespace examples |
| 207 } // namespace mojo | 208 } // namespace mojo |
| OLD | NEW |