Index: ui/gl/gl_image.h |
diff --git a/ui/gl/gl_image.h b/ui/gl/gl_image.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..32ded64427e29fa5e59e5f87e345bff5c8e3f025 |
--- /dev/null |
+++ b/ui/gl/gl_image.h |
@@ -0,0 +1,53 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_GL_GL_IMAGE_H_ |
+#define UI_GL_GL_IMAGE_H_ |
+ |
+#include "base/memory/ref_counted.h" |
+#include "ui/gfx/size.h" |
+#include "ui/gl/gl_bindings.h" |
+#include "ui/gl/gl_export.h" |
+ |
+namespace gfx { |
+ |
+class GLSurface; |
+ |
+// Encapsulates an image that can be bound to a texture, hiding platform |
+// specific management. |
+class GL_EXPORT GLImage : public base::RefCounted<GLImage> { |
+ public: |
+ GLImage(); |
+ |
+ // Initializes the image to be compatible with the given surface. The image |
+ // can be made with other surface's of the same type. The compatible |
+ // surface is only needed for certain platforms like WGL, OSMesa and GLX. It |
+ // should be specific for all platforms though. |
+ virtual bool Initialize(GLSurface* compatible_surface); |
+ |
+ // Destroys the surface. |
+ virtual void Destroy() = 0; |
+ |
+ // Get the size of the image. |
+ virtual gfx::Size GetSize() = 0; |
+ |
+ // Update pixmap for this GL image and bind it to the current texture unit. |
+ virtual bool RebindPixmap(GLuint pixmap); |
+ |
+ // Create a pixmap backed GL image. |
+ static scoped_refptr<GLImage> CreatePixmapGLImage( |
+ GLSurface* compatible_surface); |
+ |
+ protected: |
+ virtual ~GLImage(); |
+ |
+ private: |
+ friend class base::RefCounted<GLImage>; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GLImage); |
+}; |
+ |
+} // namespace gfx |
+ |
+#endif // UI_GL_GL_IMAGE_H_ |