| 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 #include "base/numerics/safe_math.h" |
| 16 #include "ui/gfx/gpu_memory_buffer.h" | 17 #include "ui/gfx/gpu_memory_buffer.h" |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| 19 | 20 |
| 20 class GL_EXPORT GLImageMemory : public GLImage { | 21 class GL_EXPORT GLImageMemory : public GLImage { |
| 21 public: | 22 public: |
| 22 GLImageMemory(const gfx::Size& size, unsigned internalformat); | 23 GLImageMemory(const gfx::Size& size, unsigned internalformat); |
| 23 | 24 |
| 24 static size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format); | 25 static bool StrideInBytes(size_t width, |
| 26 gfx::GpuMemoryBuffer::Format format, |
| 27 size_t* stride_in_bytes); |
| 25 | 28 |
| 26 bool Initialize(const unsigned char* memory, | 29 bool Initialize(const unsigned char* memory, |
| 27 gfx::GpuMemoryBuffer::Format format); | 30 gfx::GpuMemoryBuffer::Format format); |
| 28 | 31 |
| 29 // Overridden from GLImage: | 32 // Overridden from GLImage: |
| 30 void Destroy(bool have_context) override; | 33 void Destroy(bool have_context) override; |
| 31 gfx::Size GetSize() override; | 34 gfx::Size GetSize() override; |
| 32 bool BindTexImage(unsigned target) override; | 35 bool BindTexImage(unsigned target) override; |
| 33 void ReleaseTexImage(unsigned target) override {} | 36 void ReleaseTexImage(unsigned target) override {} |
| 34 bool CopyTexImage(unsigned target) override; | 37 bool CopyTexImage(unsigned target) override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 60 unsigned egl_texture_id_; | 63 unsigned egl_texture_id_; |
| 61 EGLImageKHR egl_image_; | 64 EGLImageKHR egl_image_; |
| 62 #endif | 65 #endif |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(GLImageMemory); | 67 DISALLOW_COPY_AND_ASSIGN(GLImageMemory); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 } // namespace gfx | 70 } // namespace gfx |
| 68 | 71 |
| 69 #endif // UI_GL_GL_IMAGE_MEMORY_H_ | 72 #endif // UI_GL_GL_IMAGE_MEMORY_H_ |
| OLD | NEW |