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

Side by Side Diff: examples/surfaces_app/child_gl_impl.cc

Issue 940293003: Add a Display and ContextProvider concept to mojom, use to recreate (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months 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/surfaces_app/child_gl_impl.h ('k') | examples/surfaces_app/embedder.h » ('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 #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
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
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
OLDNEW
« no previous file with comments | « examples/surfaces_app/child_gl_impl.h ('k') | examples/surfaces_app/embedder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698