OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SHM_H_ | 5 #ifndef UI_GL_GL_IMAGE_SHM_H_ |
6 #define UI_GL_GL_IMAGE_SHM_H_ | 6 #define UI_GL_GL_IMAGE_SHM_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/gl/gl_bindings.h" |
9 #include "ui/gl/gl_image.h" | 10 #include "ui/gl/gl_image.h" |
10 | 11 |
11 namespace gfx { | 12 namespace gfx { |
12 | 13 |
13 class GL_EXPORT GLImageShm : public GLImage { | 14 class GL_EXPORT GLImageShm : public GLImage { |
14 public: | 15 public: |
15 GLImageShm(gfx::Size size, unsigned internalformat); | 16 GLImageShm(gfx::Size size, unsigned internalformat); |
16 | 17 |
17 bool Initialize(gfx::GpuMemoryBufferHandle buffer); | 18 bool Initialize(gfx::GpuMemoryBufferHandle buffer); |
| 19 void CreateTexture2D(); |
| 20 bool CreateEGLImage(); |
| 21 void ReleaseEGLImageandTexture(); |
18 | 22 |
19 // Overridden from GLImage: | 23 // Overridden from GLImage: |
20 virtual void Destroy() OVERRIDE; | 24 virtual void Destroy() OVERRIDE; |
21 virtual gfx::Size GetSize() OVERRIDE; | 25 virtual gfx::Size GetSize() OVERRIDE; |
22 virtual bool BindTexImage(unsigned target) OVERRIDE; | 26 virtual bool BindTexImage(unsigned target) OVERRIDE; |
23 virtual void ReleaseTexImage(unsigned target) OVERRIDE; | 27 virtual void ReleaseTexImage(unsigned target) OVERRIDE; |
24 virtual void WillUseTexImage() OVERRIDE; | 28 virtual void WillUseTexImage() OVERRIDE; |
25 virtual void DidUseTexImage() OVERRIDE; | 29 virtual void DidUseTexImage() OVERRIDE; |
26 | 30 |
27 protected: | 31 protected: |
28 virtual ~GLImageShm(); | 32 virtual ~GLImageShm(); |
29 | 33 |
30 private: | 34 private: |
31 scoped_ptr<base::SharedMemory> shared_memory_; | 35 scoped_ptr<base::SharedMemory> shared_memory_; |
32 gfx::Size size_; | 36 gfx::Size size_; |
33 unsigned internalformat_; | 37 unsigned internalformat_; |
| 38 GLuint external_texture_id_; |
| 39 EGLImageKHR egl_image_; |
34 | 40 |
35 DISALLOW_COPY_AND_ASSIGN(GLImageShm); | 41 DISALLOW_COPY_AND_ASSIGN(GLImageShm); |
36 }; | 42 }; |
37 | 43 |
38 } // namespace gfx | 44 } // namespace gfx |
39 | 45 |
40 #endif // UI_GL_GL_IMAGE_SHM_H_ | 46 #endif // UI_GL_GL_IMAGE_SHM_H_ |
OLD | NEW |