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