Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 UI_GL_GL_IMAGE_H_ | 5 #ifndef UI_GL_GL_IMAGE_H_ |
| 6 #define UI_GL_GL_IMAGE_H_ | 6 #define UI_GL_GL_IMAGE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "ui/gfx/gpu_memory_buffer.h" | 9 #include "ui/gfx/gpu_memory_buffer.h" |
| 10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
| 12 #include "ui/gl/gl_export.h" | 12 #include "ui/gl/gl_export.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 | 15 |
| 16 class GLSurface; | 16 class GLSurface; |
| 17 | 17 |
| 18 #if defined(OS_ANDROID) | |
| 19 class GLImageStream; | |
| 20 #endif | |
| 21 | |
| 18 // Encapsulates an image that can be bound to a texture, hiding platform | 22 // Encapsulates an image that can be bound to a texture, hiding platform |
| 19 // specific management. | 23 // specific management. |
| 20 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { | 24 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { |
| 21 public: | 25 public: |
| 22 GLImage(); | 26 GLImage(); |
| 23 | 27 |
| 24 // Destroys the image. | 28 // Destroys the image. |
| 25 virtual void Destroy() = 0; | 29 virtual void Destroy() = 0; |
| 26 | 30 |
| 27 // Get the size of the image. | 31 // Get the size of the image. |
| 28 virtual gfx::Size GetSize() = 0; | 32 virtual gfx::Size GetSize() = 0; |
| 29 | 33 |
| 30 // Bind image to texture currently bound to GL_TEXTURE_2D target. | 34 // Bind image to texture currently bound to GL_TEXTURE_2D target. |
| 31 virtual bool BindTexImage(); | 35 virtual bool BindTexImage(); |
| 32 | 36 |
| 33 // Release image from texture currently bound to GL_TEXTURE_2D target. | 37 // Release image from texture currently bound to GL_TEXTURE_2D target. |
| 34 virtual void ReleaseTexImage(); | 38 virtual void ReleaseTexImage(); |
| 35 | 39 |
| 36 // Create a GL image for a window. | 40 // Create a GL image for a window. |
| 37 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); | 41 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); |
| 38 | 42 |
| 43 // Called before the texture is used for drawing. | |
| 44 virtual void WillUseTexImage(); | |
|
reveman
2013/08/14 15:22:44
please move this above all static methods.
no sievers
2013/08/14 18:16:48
Done.
| |
| 45 | |
| 39 // Create a GL image for a GPU Memory buffer. | 46 // Create a GL image for a GPU Memory buffer. |
| 40 static scoped_refptr<GLImage> CreateGLImageForGpuMemoryBuffer( | 47 static scoped_refptr<GLImage> CreateGLImageForGpuMemoryBuffer( |
| 41 gfx::GpuMemoryBufferHandle buffer, gfx::Size size); | 48 gfx::GpuMemoryBufferHandle buffer, gfx::Size size); |
| 42 | 49 |
| 50 // Create a GL image for a streaming texture. | |
| 51 static scoped_refptr<GLImage> CreateGLImageForStreamTexture( | |
| 52 unsigned int texture_id); | |
|
reveman
2013/08/14 15:22:44
I prefer if you didn't add this until the usage ma
no sievers
2013/08/14 18:16:48
Done.
| |
| 53 | |
| 54 #if defined(OS_ANDROID) | |
| 55 virtual GLImageStream* AsGLImageStream(); | |
| 56 #endif | |
| 57 | |
| 43 protected: | 58 protected: |
| 44 virtual ~GLImage(); | 59 virtual ~GLImage(); |
| 45 | 60 |
| 46 private: | 61 private: |
| 47 friend class base::RefCounted<GLImage>; | 62 friend class base::RefCounted<GLImage>; |
| 48 | 63 |
| 49 DISALLOW_COPY_AND_ASSIGN(GLImage); | 64 DISALLOW_COPY_AND_ASSIGN(GLImage); |
| 50 }; | 65 }; |
| 51 | 66 |
| 52 } // namespace gfx | 67 } // namespace gfx |
| 53 | 68 |
| 54 #endif // UI_GL_GL_IMAGE_H_ | 69 #endif // UI_GL_GL_IMAGE_H_ |
| OLD | NEW |