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 the relevant 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 it is currently bound to. |
34 virtual void ReleaseTexImage(); | 38 virtual void ReleaseTexImage(); |
35 | 39 |
| 40 // Called before the texture is used for drawing. |
| 41 virtual void WillUseTexImage(); |
| 42 |
36 // Create a GL image for a window. | 43 // Create a GL image for a window. |
37 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); | 44 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); |
38 | 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 |
| 53 #if defined(OS_ANDROID) |
| 54 virtual GLImageStream* AsGLImageStream(); |
| 55 #endif |
| 56 |
43 protected: | 57 protected: |
44 virtual ~GLImage(); | 58 virtual ~GLImage(); |
45 | 59 |
46 private: | 60 private: |
47 friend class base::RefCounted<GLImage>; | 61 friend class base::RefCounted<GLImage>; |
48 | 62 |
49 DISALLOW_COPY_AND_ASSIGN(GLImage); | 63 DISALLOW_COPY_AND_ASSIGN(GLImage); |
50 }; | 64 }; |
51 | 65 |
52 } // namespace gfx | 66 } // namespace gfx |
53 | 67 |
54 #endif // UI_GL_GL_IMAGE_H_ | 68 #endif // UI_GL_GL_IMAGE_H_ |
OLD | NEW |