Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Side by Side Diff: ui/gl/gl_image_memory.h

Issue 634083002: gpu: Compositor management of GpuMemoryBuffer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-pre-chromium-image-refactor
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_image_glx.cc ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/gpu_memory_buffer.h"
17
16 namespace gfx { 18 namespace gfx {
17 19
18 class GL_EXPORT GLImageMemory : public GLImage { 20 class GL_EXPORT GLImageMemory : public GLImage {
19 public: 21 public:
20 GLImageMemory(const gfx::Size& size, unsigned internalformat); 22 GLImageMemory(const gfx::Size& size, unsigned internalformat);
21 23
22 bool Initialize(const unsigned char* memory); 24 static size_t BytesPerPixel(gfx::GpuMemoryBuffer::Format format);
25
26 bool Initialize(const unsigned char* memory,
27 gfx::GpuMemoryBuffer::Format format);
23 28
24 // Overridden from GLImage: 29 // Overridden from GLImage:
25 virtual void Destroy(bool have_context) override; 30 virtual void Destroy(bool have_context) override;
26 virtual gfx::Size GetSize() override; 31 virtual gfx::Size GetSize() override;
27 virtual bool BindTexImage(unsigned target) override; 32 virtual bool BindTexImage(unsigned target) override;
28 virtual void ReleaseTexImage(unsigned target) override {} 33 virtual void ReleaseTexImage(unsigned target) override {}
29 virtual bool CopyTexImage(unsigned target) override; 34 virtual bool CopyTexImage(unsigned target) override;
30 virtual void WillUseTexImage() override; 35 virtual void WillUseTexImage() override;
31 virtual void DidUseTexImage() override; 36 virtual void DidUseTexImage() override;
32 virtual void WillModifyTexImage() override {} 37 virtual void WillModifyTexImage() override {}
33 virtual void DidModifyTexImage() override {} 38 virtual void DidModifyTexImage() override {}
34 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, 39 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
35 int z_order, 40 int z_order,
36 OverlayTransform transform, 41 OverlayTransform transform,
37 const Rect& bounds_rect, 42 const Rect& bounds_rect,
38 const RectF& crop_rect) override; 43 const RectF& crop_rect) override;
39 44
40 protected: 45 protected:
41 virtual ~GLImageMemory(); 46 virtual ~GLImageMemory();
42 47
43 bool HasValidFormat() const;
44 size_t Bytes() const;
45
46 private: 48 private:
47 void DoBindTexImage(unsigned target); 49 void DoBindTexImage(unsigned target);
48 50
49 const unsigned char* memory_;
50 const gfx::Size size_; 51 const gfx::Size size_;
51 const unsigned internalformat_; 52 const unsigned internalformat_;
53 const unsigned char* memory_;
54 gfx::GpuMemoryBuffer::Format format_;
52 bool in_use_; 55 bool in_use_;
53 unsigned target_; 56 unsigned target_;
54 bool need_do_bind_tex_image_; 57 bool need_do_bind_tex_image_;
55 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ 58 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \
56 defined(USE_OZONE) 59 defined(USE_OZONE)
57 unsigned egl_texture_id_; 60 unsigned egl_texture_id_;
58 EGLImageKHR egl_image_; 61 EGLImageKHR egl_image_;
59 #endif 62 #endif
60 63
61 DISALLOW_COPY_AND_ASSIGN(GLImageMemory); 64 DISALLOW_COPY_AND_ASSIGN(GLImageMemory);
62 }; 65 };
63 66
64 } // namespace gfx 67 } // namespace gfx
65 68
66 #endif // UI_GL_GL_IMAGE_MEMORY_H_ 69 #endif // UI_GL_GL_IMAGE_MEMORY_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_image_glx.cc ('k') | ui/gl/gl_image_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698