OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 UI_GL_GL_IMAGE_H_ |
| 6 #define UI_GL_GL_IMAGE_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/gfx/size.h" |
| 10 #include "ui/gl/gl_bindings.h" |
| 11 #include "ui/gl/gl_export.h" |
| 12 |
| 13 namespace gfx { |
| 14 |
| 15 class GLSurface; |
| 16 |
| 17 // Encapsulates an image that can be bound to a texture, hiding platform |
| 18 // specific management. |
| 19 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { |
| 20 public: |
| 21 GLImage(); |
| 22 |
| 23 // Initializes the image to be compatible with the given surface. The image |
| 24 // can be made with other surface's of the same type. The compatible |
| 25 // surface is only needed for certain platforms like WGL, OSMesa and GLX. It |
| 26 // should be specific for all platforms though. |
| 27 virtual bool Initialize(GLSurface* compatible_surface); |
| 28 |
| 29 // Destroys the surface. |
| 30 virtual void Destroy() = 0; |
| 31 |
| 32 // Get the size of the image. |
| 33 virtual gfx::Size GetSize() = 0; |
| 34 |
| 35 // Update pixmap for this GL image and bind it to the current texture unit. |
| 36 virtual bool RebindPixmap(GLuint pixmap); |
| 37 |
| 38 // Create a pixmap backed GL image. |
| 39 static scoped_refptr<GLImage> CreatePixmapGLImage( |
| 40 GLSurface* compatible_surface); |
| 41 |
| 42 protected: |
| 43 virtual ~GLImage(); |
| 44 |
| 45 private: |
| 46 friend class base::RefCounted<GLImage>; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(GLImage); |
| 49 }; |
| 50 |
| 51 } // namespace gfx |
| 52 |
| 53 #endif // UI_GL_GL_IMAGE_H_ |
OLD | NEW |