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

Unified Diff: examples/ganesh_app/painter.h

Issue 728593003: Add a sample app that draws with Ganesh (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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: examples/ganesh_app/painter.h
diff --git a/examples/surfaces_app/child_gl_impl.h b/examples/ganesh_app/painter.h
similarity index 71%
copy from examples/surfaces_app/child_gl_impl.h
copy to examples/ganesh_app/painter.h
index 48060b8fc4b7d427ae90d5c1f2f5d4506ad405be..93dc001ca8de48879075f02db5b4fe02a7fc6e0a 100644
--- a/examples/surfaces_app/child_gl_impl.h
+++ b/examples/ganesh_app/painter.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
-#define EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+#ifndef EXAMPLES_GANESH_APP_PAINTER_H_
+#define EXAMPLES_GANESH_APP_PAINTER_H_
#include "base/containers/hash_tables.h"
#include "base/macros.h"
@@ -16,10 +16,15 @@
#include "examples/surfaces_app/child.mojom.h"
#include "mojo/public/c/gles2/gles2.h"
#include "mojo/public/cpp/bindings/string.h"
jamesr 2014/11/14 00:36:42 don't need
+#include "mojo/services/public/interfaces/geometry/geometry.mojom.h"
+#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
#include "mojo/services/public/interfaces/surfaces/surface_id.mojom.h"
#include "mojo/services/public/interfaces/surfaces/surfaces.mojom.h"
#include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
+#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkColor.h"
jamesr 2014/11/14 00:36:42 can move to .cc
+#include "third_party/skia/include/core/SkSurface.h"
jamesr 2014/11/14 00:36:42 can move to .cc
+#include "third_party/skia/include/gpu/GrContext.h"
#include "ui/gfx/size.h"
namespace cc {
@@ -32,12 +37,11 @@ class ApplicationConnection;
namespace examples {
-// Simple example of a child app using surfaces + GL.
-class ChildGLImpl : public InterfaceImpl<Child>, public SurfaceClient {
+class Painter : public InterfaceImpl<Child>, public SurfaceClient {
public:
- ChildGLImpl(ApplicationConnection* surfaces_service_connection,
- CommandBufferPtr command_buffer);
- virtual ~ChildGLImpl();
+ Painter(ApplicationConnection* surfaces_service_connection,
+ CommandBufferPtr command_buffer);
+ ~Painter();
// SurfaceClient implementation
virtual void ReturnResources(Array<ReturnedResourcePtr> resources) override;
@@ -53,7 +57,8 @@ class ChildGLImpl : public InterfaceImpl<Child>, public SurfaceClient {
void AllocateSurface();
void Draw();
- SkColor color_;
+ skia::RefPtr<GrContext> gr_context_;
+
gfx::Size size_;
scoped_ptr<cc::SurfaceIdAllocator> allocator_;
SurfacesServicePtr surfaces_service_;
@@ -65,12 +70,13 @@ class ChildGLImpl : public InterfaceImpl<Child>, public SurfaceClient {
base::TimeTicks start_time_;
uint32_t next_resource_id_;
base::hash_map<uint32_t, GLuint> id_to_tex_map_;
- base::WeakPtrFactory<ChildGLImpl> weak_factory_;
- DISALLOW_COPY_AND_ASSIGN(ChildGLImpl);
+ base::WeakPtrFactory<Painter> weak_factory_;
+
+ MOJO_DISALLOW_COPY_AND_ASSIGN(Painter);
};
} // namespace examples
} // namespace mojo
-#endif // EXAMPLES_SURFACES_APP_CHILD_GL_IMPL_H_
+#endif // EXAMPLES_GANESH_APP_PAINTER_H_

Powered by Google App Engine
This is Rietveld 408576698