| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_FRAMEBUFFER_SURFACE_H_ | 5 #ifndef MOJO_SKIA_GANESH_FRAMEBUFFER_SURFACE_H_ |
| 6 #define MOJO_SKIA_GANESH_FRAMEBUFFER_SURFACE_H_ | 6 #define MOJO_SKIA_GANESH_FRAMEBUFFER_SURFACE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include "base/macros.h" |
| 9 | |
| 10 #include "mojo/gpu/gl_texture.h" | |
| 11 #include "mojo/skia/ganesh_context.h" | |
| 12 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
| 13 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
| 14 | 11 |
| 15 namespace mojo { | 12 namespace mojo { |
| 13 namespace skia { |
| 14 |
| 15 class GaneshContext; |
| 16 | 16 |
| 17 // This class represents an SkSurface backed by a GL framebuffer, which is | 17 // This class represents an SkSurface backed by a GL framebuffer, which is |
| 18 // appropriate for use with Ganesh. This is useful for rendering Skia | 18 // appropriate for use with Ganesh. This is useful for rendering Skia |
| 19 // commands directly to the display framebuffer. | 19 // commands directly to the display framebuffer. |
| 20 class GaneshFramebufferSurface { | 20 class GaneshFramebufferSurface { |
| 21 public: | 21 public: |
| 22 // Creates a surface that wraps the currently bound GL framebuffer. | 22 // Creates a surface that wraps the currently bound GL framebuffer. |
| 23 // The size of the surface is determined by querying the current viewport. | 23 // The size of the surface is determined by querying the current viewport. |
| 24 explicit GaneshFramebufferSurface(GaneshContext* context); | 24 explicit GaneshFramebufferSurface(GaneshContext* context); |
| 25 ~GaneshFramebufferSurface(); | 25 ~GaneshFramebufferSurface(); |
| 26 | 26 |
| 27 SkSurface* surface() const { return surface_.get(); } | 27 SkSurface* surface() const { return surface_.get(); } |
| 28 SkCanvas* canvas() const { return surface_->getCanvas(); } | 28 SkCanvas* canvas() const { return surface_->getCanvas(); } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 skia::RefPtr<SkSurface> surface_; | 31 ::skia::RefPtr<SkSurface> surface_; |
| 32 | 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(GaneshFramebufferSurface); | 33 DISALLOW_COPY_AND_ASSIGN(GaneshFramebufferSurface); |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 } // namespace skia |
| 36 } // namespace mojo | 37 } // namespace mojo |
| 37 | 38 |
| 38 #endif // MOJO_SKIA_GANESH_FRAMEBUFFER_SURFACE_H_ | 39 #endif // MOJO_SKIA_GANESH_FRAMEBUFFER_SURFACE_H_ |
| OLD | NEW |