Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 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_GPU_GL_TEXTURE_H_ |
| 6 | #define MOJO_GPU_GL_TEXTURE_H_ |
| 7 | |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 8 | #include "mojo/gpu/gl_context.h" |
Viet-Trung Luu | 84765c4 | 2015-10-10 01:07:51 -0700 | [diff] [blame] | 9 | #include "mojo/services/geometry/interfaces/geometry.mojom.h" |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 10 | |
| 11 | namespace mojo { |
| 12 | |
Jeff Brown | d3074d0 | 2016-04-19 13:58:54 -0700 | [diff] [blame] | 13 | // Manages a GL texture. |
| 14 | // |
| 15 | // Instances of this object are not thread-safe and must be used on the same |
| 16 | // thread as the GL context was created on. |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 17 | class GLTexture { |
| 18 | public: |
Jeff Brown | d3074d0 | 2016-04-19 13:58:54 -0700 | [diff] [blame] | 19 | GLTexture(const GLContext::Scope& gl_scope, const mojo::Size& size); |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 20 | ~GLTexture(); |
| 21 | |
Jeff Brown | d3074d0 | 2016-04-19 13:58:54 -0700 | [diff] [blame] | 22 | const scoped_refptr<GLContext>& gl_context() const { return gl_context_; } |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 23 | const mojo::Size& size() const { return size_; } |
| 24 | uint32_t texture_id() const { return texture_id_; } |
| 25 | |
| 26 | private: |
Jeff Brown | d3074d0 | 2016-04-19 13:58:54 -0700 | [diff] [blame] | 27 | scoped_refptr<GLContext> gl_context_; |
Adam Barth | 932befc | 2014-11-17 13:53:24 -0800 | [diff] [blame] | 28 | mojo::Size size_; |
| 29 | uint32_t texture_id_; |
| 30 | |
| 31 | DISALLOW_COPY_AND_ASSIGN(GLTexture); |
| 32 | }; |
| 33 | |
| 34 | } // namespace mojo |
| 35 | |
| 36 | #endif // MOJO_GPU_GL_TEXTURE_H_ |