diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-13 03:14:23 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-13 03:14:23 +0000 |
commit | 412ffac715c603e2e25e1d91c81a16bccae3a7b4 (patch) | |
tree | 1f43a1e8929f8d38f004241303c4db2cdec908c7 /mojo/examples/surfaces_app | |
parent | 9b6ec20291d64bc502059226c767e5bd5a3956c5 (diff) | |
download | chromium_src-412ffac715c603e2e25e1d91c81a16bccae3a7b4.zip chromium_src-412ffac715c603e2e25e1d91c81a16bccae3a7b4.tar.gz chromium_src-412ffac715c603e2e25e1d91c81a16bccae3a7b4.tar.bz2 |
Mojo surfaces service and example app
This provides an implementation of the mojo surfaces service and a
sample with two mojo applications composing each other via surfaces. The
viewport / display hookup is a bit of a hack in this patch as is the
complete lack of scheduling logic, but it's enough to get started.
Review URL: https://codereview.chromium.org/361123002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282856 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/surfaces_app')
-rw-r--r-- | mojo/examples/surfaces_app/DEPS | 6 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/child.mojom | 12 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/child_app.cc | 47 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/child_impl.cc | 109 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/child_impl.h | 70 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/embedder.cc | 92 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/embedder.h | 46 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/surfaces_app.cc | 138 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/surfaces_util.cc | 39 | ||||
-rw-r--r-- | mojo/examples/surfaces_app/surfaces_util.h | 27 |
10 files changed, 586 insertions, 0 deletions
diff --git a/mojo/examples/surfaces_app/DEPS b/mojo/examples/surfaces_app/DEPS new file mode 100644 index 0000000..edcc6c6 --- /dev/null +++ b/mojo/examples/surfaces_app/DEPS @@ -0,0 +1,6 @@ +include_rules = [ + "+cc", + "+ui/gfx", + "+gpu/command_buffer/client", + "+third_party/skia/include", +] diff --git a/mojo/examples/surfaces_app/child.mojom b/mojo/examples/surfaces_app/child.mojom new file mode 100644 index 0000000..926cad8 --- /dev/null +++ b/mojo/examples/surfaces_app/child.mojom @@ -0,0 +1,12 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import "mojo/services/public/interfaces/geometry/geometry.mojom" +import "mojo/services/public/interfaces/surfaces/quads.mojom" +import "mojo/services/public/interfaces/surfaces/surface_id.mojom" + +interface Child { + ProduceFrame(mojo.surfaces.Color color, mojo.Size size) => + (mojo.surfaces.SurfaceId id); +}; diff --git a/mojo/examples/surfaces_app/child_app.cc b/mojo/examples/surfaces_app/child_app.cc new file mode 100644 index 0000000..0a5c034 --- /dev/null +++ b/mojo/examples/surfaces_app/child_app.cc @@ -0,0 +1,47 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/examples/surfaces_app/child_impl.h" +#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/public/cpp/application/application_delegate.h" +#include "mojo/public/cpp/application/application_impl.h" +#include "mojo/public/cpp/bindings/string.h" + +namespace mojo { +namespace examples { + +class ChildApp : public ApplicationDelegate, public ChildImpl::Context { + public: + ChildApp() {} + virtual ~ChildApp() {} + + virtual void Initialize(ApplicationImpl* app) OVERRIDE { app_ = app; } + + // ApplicationDelegate implementation. + virtual bool ConfigureIncomingConnection( + ApplicationConnection* connection) OVERRIDE { + connection->AddService<ChildImpl, ChildImpl::Context>(this); + return true; + } + + // ChildImpl::Context implementation. + virtual ApplicationConnection* ShellConnection( + const mojo::String& application_url) OVERRIDE { + return app_->ConnectToApplication(application_url); + } + + private: + ApplicationImpl* app_; + + DISALLOW_COPY_AND_ASSIGN(ChildApp); +}; + +} // namespace examples + +// static +ApplicationDelegate* ApplicationDelegate::Create() { + return new examples::ChildApp(); +} + +} // namespace mojo diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc new file mode 100644 index 0000000..52118f0 --- /dev/null +++ b/mojo/examples/surfaces_app/child_impl.cc @@ -0,0 +1,109 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/examples/surfaces_app/child_impl.h" + +#include "base/bind.h" +#include "cc/output/compositor_frame.h" +#include "cc/output/delegated_frame_data.h" +#include "cc/quads/render_pass.h" +#include "cc/quads/solid_color_draw_quad.h" +#include "mojo/examples/surfaces_app/surfaces_util.h" +#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" +#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/transform.h" + +namespace mojo { +namespace examples { + +using cc::RenderPass; +using cc::DrawQuad; +using cc::SolidColorDrawQuad; +using cc::DelegatedFrameData; +using cc::CompositorFrame; + +class SurfaceClientImpl : public surfaces::SurfaceClient { + public: + explicit SurfaceClientImpl(ChildImpl* impl) : impl_(impl) {} + virtual ~SurfaceClientImpl() {} + + // surfaces::SurfaceClient implementation + virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE { + impl_->SetIdNamespace(id_namespace); + } + + virtual void ReturnResources( + Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE { + DCHECK(!resources.size()); + } + + private: + ChildImpl* impl_; +}; + +ChildImpl::ChildImpl(ApplicationConnection* connection, Context* context) + : surface_client_(new SurfaceClientImpl(this)) { + context->ShellConnection("mojo:mojo_surfaces_service") + ->ConnectToService(&surface_); + surface_.set_client(surface_client_.get()); +} + +ChildImpl::~ChildImpl() { + surface_->DestroySurface(mojo::surfaces::SurfaceId::From(id_)); +} + +void ChildImpl::ProduceFrame( + surfaces::ColorPtr color, + SizePtr size, + const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) { + color_ = color.To<SkColor>(); + size_ = size.To<gfx::Size>(); + produce_callback_ = callback; + if (allocator_) + Draw(); +} + +void ChildImpl::SetIdNamespace(uint32_t id_namespace) { + allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); + if (!produce_callback_.is_null()) + Draw(); +} + +void ChildImpl::Draw() { + id_ = allocator_->GenerateId(); + surface_->CreateSurface(mojo::surfaces::SurfaceId::From(id_), + mojo::Size::From(size_)); + gfx::Rect rect(size_); + RenderPass::Id id(1, 1); + scoped_ptr<RenderPass> pass = RenderPass::Create(); + pass->SetNew(id, rect, rect, gfx::Transform()); + + CreateAndAppendSimpleSharedQuadState(pass.get(), gfx::Transform(), size_); + + scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); + bool force_anti_aliasing_off = false; + color_quad->SetNew(pass->shared_quad_state_list.back(), + rect, + rect, + color_, + force_anti_aliasing_off); + pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); + + scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); + delegated_frame_data->render_pass_list.push_back(pass.Pass()); + + scoped_ptr<CompositorFrame> frame(new CompositorFrame); + frame->delegated_frame_data = delegated_frame_data.Pass(); + + surface_->SubmitFrame(mojo::surfaces::SurfaceId::From(id_), + mojo::surfaces::Frame::From(*frame)); + produce_callback_.Run(surfaces::SurfaceId::From(id_)); +} + +} // namespace examples +} // namespace mojo diff --git a/mojo/examples/surfaces_app/child_impl.h b/mojo/examples/surfaces_app/child_impl.h new file mode 100644 index 0000000..8770f61 --- /dev/null +++ b/mojo/examples/surfaces_app/child_impl.h @@ -0,0 +1,70 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ +#define MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ + +#include "base/memory/scoped_ptr.h" +#include "cc/surfaces/surface_id.h" +#include "cc/surfaces/surface_id_allocator.h" +#include "mojo/examples/surfaces_app/child.mojom.h" +#include "mojo/public/cpp/bindings/string.h" +#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" +#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/size.h" + +namespace cc { +class CompositorFrame; +} + +namespace mojo { + +class ApplicationConnection; + +namespace surfaces { +class Surface; +} + +namespace examples { + +class SurfaceClientImpl; + +// Simple example of a child app using surfaces. +class ChildImpl : public InterfaceImpl<Child> { + public: + class Context { + public: + virtual ApplicationConnection* ShellConnection( + const mojo::String& application_url) = 0; + }; + ChildImpl(ApplicationConnection* connection, Context* context); + virtual ~ChildImpl(); + + void SetIdNamespace(uint32_t id_namespace); + + private: + // Child implementation. + virtual void ProduceFrame( + surfaces::ColorPtr color, + SizePtr size, + const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) OVERRIDE; + + void Draw(); + + SkColor color_; + gfx::Size size_; + scoped_ptr<cc::SurfaceIdAllocator> allocator_; + surfaces::SurfacePtr surface_; + cc::SurfaceId id_; + scoped_ptr<SurfaceClientImpl> surface_client_; + mojo::Callback<void(surfaces::SurfaceIdPtr id)> produce_callback_; + + DISALLOW_COPY_AND_ASSIGN(ChildImpl); +}; + +} // namespace examples +} // namespace mojo + +#endif // MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ diff --git a/mojo/examples/surfaces_app/embedder.cc b/mojo/examples/surfaces_app/embedder.cc new file mode 100644 index 0000000..a525a18 --- /dev/null +++ b/mojo/examples/surfaces_app/embedder.cc @@ -0,0 +1,92 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/examples/surfaces_app/embedder.h" + +#include "cc/output/compositor_frame.h" +#include "cc/output/delegated_frame_data.h" +#include "cc/quads/render_pass.h" +#include "cc/quads/solid_color_draw_quad.h" +#include "cc/quads/surface_draw_quad.h" +#include "mojo/examples/surfaces_app/surfaces_util.h" +#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/size.h" +#include "ui/gfx/transform.h" + +namespace mojo { +namespace examples { + +using cc::RenderPass; +using cc::SurfaceDrawQuad; +using cc::DrawQuad; +using cc::SolidColorDrawQuad; +using cc::DelegatedFrameData; +using cc::CompositorFrame; + +Embedder::Embedder(surfaces::Surface* surface) : surface_(surface) { +} + +Embedder::~Embedder() { +} + +void Embedder::ProduceFrame(cc::SurfaceId child_one, + cc::SurfaceId child_two, + const gfx::Size& child_size, + const gfx::Size& size, + double rotation_degrees) { + gfx::Rect rect(size); + RenderPass::Id pass_id(1, 1); + scoped_ptr<RenderPass> pass = RenderPass::Create(); + pass->SetNew(pass_id, rect, rect, gfx::Transform()); + + gfx::Transform one_transform; + one_transform.Translate(10 + child_size.width() / 2, + 50 + child_size.height() / 2); + one_transform.Rotate(rotation_degrees); + one_transform.Translate(-child_size.width() / 2, -child_size.height() / 2); + CreateAndAppendSimpleSharedQuadState(pass.get(), one_transform, size); + + scoped_ptr<SurfaceDrawQuad> surface_one_quad = SurfaceDrawQuad::Create(); + gfx::Rect one_rect(child_size); + surface_one_quad->SetNew( + pass->shared_quad_state_list.back(), one_rect, one_rect, child_one); + pass->quad_list.push_back(surface_one_quad.PassAs<DrawQuad>()); + + gfx::Transform two_transform; + two_transform.Translate(10 + size.width() / 2 + child_size.width() / 2, + 50 + child_size.height() / 2); + two_transform.Rotate(-rotation_degrees * 0.76); + two_transform.Translate(-child_size.width() / 2, -child_size.height() / 2); + CreateAndAppendSimpleSharedQuadState(pass.get(), two_transform, size); + + scoped_ptr<SurfaceDrawQuad> surface_two_quad = SurfaceDrawQuad::Create(); + gfx::Rect two_rect(child_size); + surface_two_quad->SetNew( + pass->shared_quad_state_list.back(), two_rect, two_rect, child_two); + pass->quad_list.push_back(surface_two_quad.PassAs<DrawQuad>()); + + CreateAndAppendSimpleSharedQuadState(pass.get(), gfx::Transform(), size); + scoped_ptr<SolidColorDrawQuad> color_quad = SolidColorDrawQuad::Create(); + bool force_anti_aliasing_off = false; + color_quad->SetNew(pass->shared_quad_state_list.back(), + rect, + rect, + SK_ColorYELLOW, + force_anti_aliasing_off); + pass->quad_list.push_back(color_quad.PassAs<DrawQuad>()); + + scoped_ptr<DelegatedFrameData> delegated_frame_data(new DelegatedFrameData); + delegated_frame_data->render_pass_list.push_back(pass.Pass()); + + scoped_ptr<CompositorFrame> frame(new CompositorFrame); + frame->delegated_frame_data = delegated_frame_data.Pass(); + + surface_->SubmitFrame(mojo::surfaces::SurfaceId::From(id_), + mojo::surfaces::Frame::From(*frame)); +} + +} // namespace examples +} // namespace mojo diff --git a/mojo/examples/surfaces_app/embedder.h b/mojo/examples/surfaces_app/embedder.h new file mode 100644 index 0000000..4e04dfd --- /dev/null +++ b/mojo/examples/surfaces_app/embedder.h @@ -0,0 +1,46 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_EXAMPLES_SURFACES_APP_EMBEDDER_H_ +#define MOJO_EXAMPLES_SURFACES_APP_EMBEDDER_H_ + +#include "base/memory/scoped_ptr.h" +#include "cc/surfaces/surface_id.h" +#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h" +#include "ui/gfx/size.h" + +namespace cc { +class CompositorFrame; +} + +namespace mojo { + +class ApplicationConnection; + +namespace examples { + +// Simple example of a surface embedder that embeds two other surfaces. +class Embedder { + public: + explicit Embedder(surfaces::Surface* surface); + ~Embedder(); + + void SetSurfaceId(cc::SurfaceId id) { id_ = id; } + void ProduceFrame(cc::SurfaceId child_one, + cc::SurfaceId child_two, + const gfx::Size& child_size, + const gfx::Size& size, + double rotation_degrees); + + private: + cc::SurfaceId id_; + surfaces::Surface* surface_; + + DISALLOW_COPY_AND_ASSIGN(Embedder); +}; + +} // namespace examples +} // namespace mojo + +#endif // MOJO_EXAMPLES_SURFACES_APP_EMBEDDER_H_ diff --git a/mojo/examples/surfaces_app/surfaces_app.cc b/mojo/examples/surfaces_app/surfaces_app.cc new file mode 100644 index 0000000..ca5e36f --- /dev/null +++ b/mojo/examples/surfaces_app/surfaces_app.cc @@ -0,0 +1,138 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "base/bind.h" +#include "base/macros.h" +#include "base/message_loop/message_loop.h" +#include "cc/surfaces/surface_id_allocator.h" +#include "mojo/examples/surfaces_app/child.mojom.h" +#include "mojo/examples/surfaces_app/embedder.h" +#include "mojo/public/cpp/application/application_connection.h" +#include "mojo/public/cpp/application/application_delegate.h" +#include "mojo/public/cpp/system/core.h" +#include "mojo/public/interfaces/service_provider/service_provider.mojom.h" +#include "mojo/services/gles2/command_buffer.mojom.h" +#include "mojo/services/public/cpp/geometry/geometry_type_converters.h" +#include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" +#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h" +#include "ui/gfx/rect.h" + +namespace mojo { +namespace examples { + +class SurfacesApp : public ApplicationDelegate, + public surfaces::SurfaceClient, + public NativeViewportClient { + public: + SurfacesApp() {} + virtual ~SurfacesApp() {} + + // ApplicationDelegate implementation + virtual bool ConfigureIncomingConnection( + ApplicationConnection* connection) OVERRIDE { + connection->ConnectToService("mojo:mojo_native_viewport_service", + &viewport_); + viewport_.set_client(this); + + connection->ConnectToService("mojo:mojo_surfaces_service", &surfaces_); + surfaces_.set_client(this); + + size_ = gfx::Size(800, 600); + + viewport_->Create(Rect::From(gfx::Rect(gfx::Point(10, 10), size_))); + viewport_->Show(); + + 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_); + child_one_->ProduceFrame(surfaces::Color::From(SK_ColorBLUE), + Size::From(child_size_), + base::Bind(&SurfacesApp::ChildOneProducedFrame, + base::Unretained(this))); + child_two_->ProduceFrame(surfaces::Color::From(SK_ColorGREEN), + Size::From(child_size_), + base::Bind(&SurfacesApp::ChildTwoProducedFrame, + base::Unretained(this))); + embedder_.reset(new Embedder(surfaces_.get())); + return true; + } + + void ChildOneProducedFrame(surfaces::SurfaceIdPtr id) { + child_one_id_ = id.To<cc::SurfaceId>(); + Draw(45.0); + } + + void ChildTwoProducedFrame(surfaces::SurfaceIdPtr id) { + child_two_id_ = id.To<cc::SurfaceId>(); + Draw(45.0); + } + + void Draw(double rotation_degrees) { + if (onscreen_id_.is_null()) { + onscreen_id_ = allocator_->GenerateId(); + CommandBufferPtr cb; + viewport_->CreateGLES2Context(Get(&cb)); + surfaces_->CreateGLES2BoundSurface( + cb.Pass(), + surfaces::SurfaceId::From(onscreen_id_), + Size::From(size_)); + embedder_->SetSurfaceId(onscreen_id_); + } + if (child_one_id_.is_null() || child_two_id_.is_null()) + return; + embedder_->ProduceFrame( + child_one_id_, child_two_id_, child_size_, size_, rotation_degrees); + base::MessageLoop::current()->PostDelayedTask( + FROM_HERE, + base::Bind( + &SurfacesApp::Draw, base::Unretained(this), rotation_degrees + 2.0), + base::TimeDelta::FromMilliseconds(17)); + } + + // surfaces::SurfaceClient implementation. + virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE { + allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); + Draw(45.0); + } + virtual void ReturnResources( + Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE { + DCHECK(!resources.size()); + } + + // NativeViewportClient implementation + virtual void OnCreated() OVERRIDE {} + virtual void OnBoundsChanged(mojo::RectPtr bounds) OVERRIDE {} + virtual void OnDestroyed(const mojo::Callback<void()>& callback) OVERRIDE { + callback.Run(); + } + virtual void OnEvent(mojo::EventPtr event, + const mojo::Callback<void()>& callback) OVERRIDE { + callback.Run(); + } + + private: + surfaces::SurfacePtr surfaces_; + cc::SurfaceId onscreen_id_; + scoped_ptr<cc::SurfaceIdAllocator> allocator_; + scoped_ptr<Embedder> embedder_; + ChildPtr child_one_; + cc::SurfaceId child_one_id_; + ChildPtr child_two_; + cc::SurfaceId child_two_id_; + gfx::Size size_; + gfx::Size child_size_; + + NativeViewportPtr viewport_; + + DISALLOW_COPY_AND_ASSIGN(SurfacesApp); +}; + +} // namespace examples + +// static +ApplicationDelegate* ApplicationDelegate::Create() { + return new examples::SurfacesApp(); +} + +} // namespace mojo diff --git a/mojo/examples/surfaces_app/surfaces_util.cc b/mojo/examples/surfaces_app/surfaces_util.cc new file mode 100644 index 0000000..50bfbff --- /dev/null +++ b/mojo/examples/surfaces_app/surfaces_util.cc @@ -0,0 +1,39 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "mojo/examples/surfaces_app/surfaces_util.h" + +#include "cc/quads/render_pass.h" +#include "cc/quads/shared_quad_state.h" +#include "ui/gfx/rect.h" +#include "ui/gfx/size.h" +#include "ui/gfx/transform.h" + +namespace mojo { +namespace examples { + +using cc::SharedQuadState; + +void CreateAndAppendSimpleSharedQuadState(cc::RenderPass* render_pass, + const gfx::Transform& transform, + const gfx::Size& size) { + const gfx::Size content_bounds = size; + const gfx::Rect visible_content_rect = gfx::Rect(size); + const gfx::Rect clip_rect = gfx::Rect(size); + bool is_clipped = false; + float opacity = 1.f; + const SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; + SharedQuadState* shared_state = render_pass->CreateAndAppendSharedQuadState(); + shared_state->SetAll(transform, + content_bounds, + visible_content_rect, + clip_rect, + is_clipped, + opacity, + blend_mode, + 0); +} + +} // namespace mojo +} // namespace examples diff --git a/mojo/examples/surfaces_app/surfaces_util.h b/mojo/examples/surfaces_app/surfaces_util.h new file mode 100644 index 0000000..3109258 --- /dev/null +++ b/mojo/examples/surfaces_app/surfaces_util.h @@ -0,0 +1,27 @@ +// Copyright 2014 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef MOJO_EXAMPLES_SURFACES_APP_SURFACES_UTIL_H_ +#define MOJO_EXAMPLES_SURFACES_APP_SURFACES_UTIL_H_ + +namespace cc { +class RenderPass; +} + +namespace gfx { +class Transform; +class Size; +} + +namespace mojo { +namespace examples { + +void CreateAndAppendSimpleSharedQuadState(cc::RenderPass* render_pass, + const gfx::Transform& transform, + const gfx::Size& size); + +} // namespace mojo +} // namespace examples + +#endif // MOJO_EXAMPLES_SURFACES_APP_SURFACES_UTIL_H_ |