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

Unified Diff: mojo/skia/ganesh_texture_surface.h

Issue 1518793004: Improve GL bindings for Ganesh surfaces. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: address review comments Created 5 years 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 | « mojo/skia/ganesh_surface.cc ('k') | mojo/skia/ganesh_texture_surface.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/skia/ganesh_texture_surface.h
diff --git a/mojo/skia/ganesh_texture_surface.h b/mojo/skia/ganesh_texture_surface.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd3b05dc74f5458efa910f0cb84e73eb4cb5b872
--- /dev/null
+++ b/mojo/skia/ganesh_texture_surface.h
@@ -0,0 +1,42 @@
+// 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_SKIA_GANESH_TEXTURE_SURFACE_H_
+#define MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_
+
+#include <memory>
+
+#include "mojo/gpu/gl_texture.h"
+#include "mojo/skia/ganesh_context.h"
+#include "skia/ext/refptr.h"
+#include "third_party/skia/include/core/SkSurface.h"
+
+namespace mojo {
+
+// This class represents an SkSurface backed by a GL texture, which is
+// appropriate for use with Ganesh. This is useful for rendering Skia
+// commands to a texture.
+class GaneshTextureSurface {
+ public:
+ // Creates a surface that wraps the specified GL texture.
+ GaneshTextureSurface(GaneshContext* context,
+ std::unique_ptr<GLTexture> texture);
+ ~GaneshTextureSurface();
+
+ SkSurface* surface() const { return surface_.get(); }
+ SkCanvas* canvas() const { return surface_->getCanvas(); }
+
+ // Destroys the surface and returns its underlying texture.
+ std::unique_ptr<GLTexture> TakeTexture();
+
+ private:
+ std::unique_ptr<GLTexture> texture_;
+ skia::RefPtr<SkSurface> surface_;
+
+ DISALLOW_COPY_AND_ASSIGN(GaneshTextureSurface);
+};
+
+} // namespace mojo
+
+#endif // MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_
« no previous file with comments | « mojo/skia/ganesh_surface.cc ('k') | mojo/skia/ganesh_texture_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698