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

Unified Diff: mojo/examples/surfaces_app/surfaces_app.cc

Issue 451753003: Mojo multiple command buffer support and sample (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/examples/surfaces_app/surfaces_app.cc
diff --git a/mojo/examples/surfaces_app/surfaces_app.cc b/mojo/examples/surfaces_app/surfaces_app.cc
index 6b7a9e94194a6675d672f2343c67698a8e6c3a92..b5d83cf0852272b994a7f23582e99edbcb133fdb 100644
--- a/mojo/examples/surfaces_app/surfaces_app.cc
+++ b/mojo/examples/surfaces_app/surfaces_app.cc
@@ -44,7 +44,8 @@ class SurfacesApp : public ApplicationDelegate,
child_size_ = gfx::Size(size_.width() / 3, size_.height() / 2);
connection->ConnectToService("mojo:mojo_surfaces_child_app", &child_one_);
- connection->ConnectToService("mojo:mojo_surfaces_child_app", &child_two_);
+ connection->ConnectToService("mojo:mojo_surfaces_child_gl_app",
+ &child_two_);
child_one_->ProduceFrame(Color::From(SK_ColorBLUE),
Size::From(child_size_),
base::Bind(&SurfacesApp::ChildOneProducedFrame,
@@ -59,15 +60,15 @@ class SurfacesApp : public ApplicationDelegate,
void ChildOneProducedFrame(SurfaceIdPtr id) {
child_one_id_ = id.To<cc::SurfaceId>();
- Draw(45.0);
+ Draw(10);
}
void ChildTwoProducedFrame(SurfaceIdPtr id) {
child_two_id_ = id.To<cc::SurfaceId>();
- Draw(45.0);
+ Draw(10);
}
- void Draw(double rotation_degrees) {
+ void Draw(int offset) {
if (onscreen_id_.is_null()) {
onscreen_id_ = allocator_->GenerateId();
CommandBufferPtr cb;
@@ -80,19 +81,22 @@ class SurfacesApp : public ApplicationDelegate,
}
if (child_one_id_.is_null() || child_two_id_.is_null())
return;
+ int bounced_offset = offset;
+ if (offset > 200)
+ bounced_offset = 400 - offset;
embedder_->ProduceFrame(
- child_one_id_, child_two_id_, child_size_, size_, rotation_degrees);
+ child_one_id_, child_two_id_, child_size_, size_, bounced_offset);
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(
- &SurfacesApp::Draw, base::Unretained(this), rotation_degrees + 2.0),
- base::TimeDelta::FromMilliseconds(17));
+ &SurfacesApp::Draw, base::Unretained(this), (offset + 2) % 400),
+ base::TimeDelta::FromMilliseconds(50));
}
// SurfaceClient implementation.
virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE {
allocator_.reset(new cc::SurfaceIdAllocator(id_namespace));
- Draw(45.0);
+ Draw(10);
}
virtual void ReturnResources(
Array<ReturnedResourcePtr> resources) OVERRIDE {

Powered by Google App Engine
This is Rietveld 408576698