| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEMORY_H_ | 5 #ifndef UI_GL_GL_IMAGE_MEMORY_H_ |
| 6 #define UI_GL_GL_IMAGE_MEMORY_H_ | 6 #define UI_GL_GL_IMAGE_MEMORY_H_ |
| 7 | 7 |
| 8 #include "ui/gl/gl_image.h" | 8 #include "ui/gl/gl_image.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ | 10 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| 11 defined(USE_OZONE) | 11 defined(USE_OZONE) |
| 12 #include <EGL/egl.h> | 12 #include <EGL/egl.h> |
| 13 #include <EGL/eglext.h> | 13 #include <EGL/eglext.h> |
| 14 #endif | 14 #endif |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 | 17 |
| 18 class GL_EXPORT GLImageMemory : public GLImage { | 18 class GL_EXPORT GLImageMemory : public GLImage { |
| 19 public: | 19 public: |
| 20 GLImageMemory(const gfx::Size& size, unsigned internalformat); | 20 GLImageMemory(const gfx::Size& size, unsigned internalformat); |
| 21 | 21 |
| 22 bool Initialize(const unsigned char* memory); | 22 bool Initialize(const unsigned char* memory); |
| 23 | 23 |
| 24 // Overridden from GLImage: | 24 // Overridden from GLImage: |
| 25 virtual void Destroy(bool have_context) OVERRIDE; | 25 virtual void Destroy(bool have_context) override; |
| 26 virtual gfx::Size GetSize() OVERRIDE; | 26 virtual gfx::Size GetSize() override; |
| 27 virtual bool BindTexImage(unsigned target) OVERRIDE; | 27 virtual bool BindTexImage(unsigned target) override; |
| 28 virtual void ReleaseTexImage(unsigned target) OVERRIDE {} | 28 virtual void ReleaseTexImage(unsigned target) override {} |
| 29 virtual bool CopyTexImage(unsigned target) OVERRIDE; | 29 virtual bool CopyTexImage(unsigned target) override; |
| 30 virtual void WillUseTexImage() OVERRIDE; | 30 virtual void WillUseTexImage() override; |
| 31 virtual void DidUseTexImage() OVERRIDE; | 31 virtual void DidUseTexImage() override; |
| 32 virtual void WillModifyTexImage() OVERRIDE {} | 32 virtual void WillModifyTexImage() override {} |
| 33 virtual void DidModifyTexImage() OVERRIDE {} | 33 virtual void DidModifyTexImage() override {} |
| 34 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 34 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 35 int z_order, | 35 int z_order, |
| 36 OverlayTransform transform, | 36 OverlayTransform transform, |
| 37 const Rect& bounds_rect, | 37 const Rect& bounds_rect, |
| 38 const RectF& crop_rect) OVERRIDE; | 38 const RectF& crop_rect) override; |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 virtual ~GLImageMemory(); | 41 virtual ~GLImageMemory(); |
| 42 | 42 |
| 43 bool HasValidFormat() const; | 43 bool HasValidFormat() const; |
| 44 size_t Bytes() const; | 44 size_t Bytes() const; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void DoBindTexImage(unsigned target); | 47 void DoBindTexImage(unsigned target); |
| 48 | 48 |
| 49 const unsigned char* memory_; | 49 const unsigned char* memory_; |
| 50 const gfx::Size size_; | 50 const gfx::Size size_; |
| 51 const unsigned internalformat_; | 51 const unsigned internalformat_; |
| 52 bool in_use_; | 52 bool in_use_; |
| 53 unsigned target_; | 53 unsigned target_; |
| 54 bool need_do_bind_tex_image_; | 54 bool need_do_bind_tex_image_; |
| 55 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ | 55 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
| 56 defined(USE_OZONE) | 56 defined(USE_OZONE) |
| 57 unsigned egl_texture_id_; | 57 unsigned egl_texture_id_; |
| 58 EGLImageKHR egl_image_; | 58 EGLImageKHR egl_image_; |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(GLImageMemory); | 61 DISALLOW_COPY_AND_ASSIGN(GLImageMemory); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace gfx | 64 } // namespace gfx |
| 65 | 65 |
| 66 #endif // UI_GL_GL_IMAGE_MEMORY_H_ | 66 #endif // UI_GL_GL_IMAGE_MEMORY_H_ |
| OLD | NEW |