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" | |
10 #include "ui/gfx/native_widget_types.h" | |
11 #include "ui/gfx/size.h" | 9 #include "ui/gfx/size.h" |
12 #include "ui/gl/gl_export.h" | 10 #include "ui/gl/gl_export.h" |
13 | 11 |
14 namespace gfx { | 12 namespace gfx { |
15 | 13 |
16 class GLSurface; | |
17 | |
18 // Encapsulates an image that can be bound to a texture, hiding platform | 14 // Encapsulates an image that can be bound to a texture, hiding platform |
19 // specific management. | 15 // specific management. |
20 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { | 16 class GL_EXPORT GLImage : public base::RefCounted<GLImage> { |
21 public: | 17 public: |
22 GLImage(); | 18 GLImage(); |
23 | 19 |
24 // Destroys the image. | 20 // Destroys the image. |
25 virtual void Destroy() = 0; | 21 virtual void Destroy() = 0; |
26 | 22 |
27 // Get the size of the image. | 23 // Get the size of the image. |
(...skipping 14 matching lines...) Expand all Loading... |
42 // Called before the texture image data will be modified. | 38 // Called before the texture image data will be modified. |
43 virtual void WillModifyTexImage() = 0; | 39 virtual void WillModifyTexImage() = 0; |
44 | 40 |
45 // Called after the texture image data has been modified. | 41 // Called after the texture image data has been modified. |
46 virtual void DidModifyTexImage() = 0; | 42 virtual void DidModifyTexImage() = 0; |
47 | 43 |
48 // Indicate that image should be released after use. | 44 // Indicate that image should be released after use. |
49 // (For an Android work-around only). | 45 // (For an Android work-around only). |
50 virtual void SetReleaseAfterUse(); | 46 virtual void SetReleaseAfterUse(); |
51 | 47 |
52 // Create a GL image for a window. | |
53 static scoped_refptr<GLImage> CreateGLImage(gfx::PluginWindowHandle window); | |
54 | |
55 // Create a GL image for a GPU Memory buffer. | |
56 static scoped_refptr<GLImage> CreateGLImageForGpuMemoryBuffer( | |
57 gfx::GpuMemoryBufferHandle buffer, | |
58 gfx::Size size, | |
59 unsigned internalformat); | |
60 | |
61 protected: | 48 protected: |
62 virtual ~GLImage(); | 49 virtual ~GLImage(); |
63 | 50 |
64 private: | 51 private: |
65 friend class base::RefCounted<GLImage>; | 52 friend class base::RefCounted<GLImage>; |
66 | 53 |
67 DISALLOW_COPY_AND_ASSIGN(GLImage); | 54 DISALLOW_COPY_AND_ASSIGN(GLImage); |
68 }; | 55 }; |
69 | 56 |
70 } // namespace gfx | 57 } // namespace gfx |
71 | 58 |
72 #endif // UI_GL_GL_IMAGE_H_ | 59 #endif // UI_GL_GL_IMAGE_H_ |
OLD | NEW |