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

Side by Side Diff: mojo/skia/ganesh_texture_surface.h

Issue 1534033002: Improve Ganesh helpers. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-8
Patch Set: rebase Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « mojo/skia/ganesh_image_factory.cc ('k') | mojo/skia/ganesh_texture_surface.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ 5 #ifndef MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_
6 #define MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ 6 #define MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "mojo/gpu/gl_texture.h" 10 #include "base/macros.h"
11 #include "mojo/skia/ganesh_context.h" 11 #include "mojo/skia/ganesh_context.h"
12 #include "skia/ext/refptr.h" 12 #include "skia/ext/refptr.h"
13 #include "third_party/skia/include/core/SkSurface.h" 13 #include "third_party/skia/include/core/SkSurface.h"
14 14
15 namespace mojo { 15 namespace mojo {
16 class GLTexture;
17
18 namespace skia {
16 19
17 // This class represents an SkSurface backed by a GL texture, which is 20 // This class represents an SkSurface backed by a GL texture, which is
18 // appropriate for use with Ganesh. This is useful for rendering Skia 21 // appropriate for use with Ganesh. This is useful for rendering Skia
19 // commands to a texture. 22 // commands to a texture.
20 class GaneshTextureSurface { 23 class GaneshTextureSurface {
21 public: 24 public:
22 // Creates a surface that wraps the specified GL texture. 25 // Creates a surface that wraps the specified GL texture.
23 GaneshTextureSurface(GaneshContext* context, 26 GaneshTextureSurface(const GaneshContext::Scope& scope,
24 std::unique_ptr<GLTexture> texture); 27 std::unique_ptr<GLTexture> texture);
25 ~GaneshTextureSurface(); 28 ~GaneshTextureSurface();
26 29
27 SkSurface* surface() const { return surface_.get(); } 30 SkSurface* surface() const { return surface_.get(); }
28 SkCanvas* canvas() const { return surface_->getCanvas(); } 31 SkCanvas* canvas() const { return surface_->getCanvas(); }
29 32
30 // Destroys the surface and returns its underlying texture. 33 // Destroys the surface and returns its underlying texture.
31 std::unique_ptr<GLTexture> TakeTexture(); 34 std::unique_ptr<GLTexture> TakeTexture();
32 35
33 private: 36 private:
34 std::unique_ptr<GLTexture> texture_; 37 std::unique_ptr<GLTexture> texture_;
35 skia::RefPtr<SkSurface> surface_; 38 ::skia::RefPtr<SkSurface> surface_;
36 39
37 DISALLOW_COPY_AND_ASSIGN(GaneshTextureSurface); 40 DISALLOW_COPY_AND_ASSIGN(GaneshTextureSurface);
38 }; 41 };
39 42
43 } // namespace skia
40 } // namespace mojo 44 } // namespace mojo
41 45
42 #endif // MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ 46 #endif // MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_
OLDNEW
« no previous file with comments | « mojo/skia/ganesh_image_factory.cc ('k') | mojo/skia/ganesh_texture_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698