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

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: Review comments 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
« no previous file with comments | « examples/ganesh_app/ganesh_app.cc ('k') | examples/ganesh_app/painter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/ganesh_app/painter.h
diff --git a/examples/surfaces_app/child_gl_impl.h b/examples/ganesh_app/painter.h
similarity index 67%
copy from examples/surfaces_app/child_gl_impl.h
copy to examples/ganesh_app/painter.h
index 48060b8fc4b7d427ae90d5c1f2f5d4506ad405be..78580ee2fe0fc912fbcb1a2da84ed9b45f069139 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"
@@ -12,32 +12,26 @@
#include "base/time/time.h"
#include "cc/surfaces/surface_id.h"
#include "cc/surfaces/surface_id_allocator.h"
-#include "examples/sample_app/spinning_cube.h"
#include "examples/surfaces_app/child.mojom.h"
#include "mojo/public/c/gles2/gles2.h"
-#include "mojo/public/cpp/bindings/string.h"
+#include "mojo/services/public/interfaces/geometry/geometry.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 "third_party/skia/include/core/SkColor.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/gpu/GrContext.h"
#include "ui/gfx/size.h"
-namespace cc {
-class CompositorFrame;
-}
-
namespace mojo {
-
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,24 +47,24 @@ 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_;
SurfacePtr surface_;
MojoGLES2Context context_;
cc::SurfaceId id_;
- ::examples::SpinningCube cube_;
Callback<void(SurfaceIdPtr id)> produce_callback_;
- 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_
« no previous file with comments | « examples/ganesh_app/ganesh_app.cc ('k') | examples/ganesh_app/painter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698