OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ | |
6 #define MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "mojo/gpu/gl_texture.h" | |
11 #include "mojo/skia/ganesh_context.h" | |
12 #include "skia/ext/refptr.h" | |
13 #include "third_party/skia/include/core/SkSurface.h" | |
14 | |
15 namespace mojo { | |
16 | |
17 // This class represents an SkSurface backed by a GL texture, which is | |
18 // appropriate for use with Ganesh. This is useful for rendering Skia | |
19 // commands to a texture. | |
20 class GaneshTextureSurface { | |
21 public: | |
22 // Creates a surface that wraps the specified GL texture. | |
23 GaneshTextureSurface(GaneshContext* context, | |
24 std::unique_ptr<GLTexture>&& texture); | |
abarth-chromium
2015/12/10 22:46:11
No need for && here
jeffbrown
2015/12/12 01:37:01
Done.
| |
25 ~GaneshTextureSurface(); | |
26 | |
27 SkSurface* surface() const { return surface_.get(); } | |
28 SkCanvas* canvas() const { return surface_->getCanvas(); } | |
29 | |
30 // Destroys the surface and returns its underlying texture. | |
31 std::unique_ptr<GLTexture> TakeTexture(); | |
32 | |
33 private: | |
34 std::unique_ptr<GLTexture> texture_; | |
35 skia::RefPtr<SkSurface> surface_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(GaneshTextureSurface); | |
38 }; | |
39 | |
40 } // namespace mojo | |
41 | |
42 #endif // MOJO_SKIA_GANESH_TEXTURE_SURFACE_H_ | |
OLD | NEW |