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 #include "gpu/command_buffer/service/texture_definition.h" | 5 #include "gpu/command_buffer/service/texture_definition.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace gles2 { | 23 namespace gles2 { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 class GLImageSync : public gfx::GLImage { | 27 class GLImageSync : public gfx::GLImage { |
28 public: | 28 public: |
29 explicit GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer, | 29 explicit GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer, |
30 const gfx::Size& size); | 30 const gfx::Size& size); |
31 | 31 |
32 // Implement GLImage. | 32 // Implement GLImage. |
33 virtual void Destroy(bool have_context) OVERRIDE; | 33 virtual void Destroy(bool have_context) override; |
34 virtual gfx::Size GetSize() OVERRIDE; | 34 virtual gfx::Size GetSize() override; |
35 virtual bool BindTexImage(unsigned target) OVERRIDE; | 35 virtual bool BindTexImage(unsigned target) override; |
36 virtual void ReleaseTexImage(unsigned target) OVERRIDE; | 36 virtual void ReleaseTexImage(unsigned target) override; |
37 virtual bool CopyTexImage(unsigned target) OVERRIDE; | 37 virtual bool CopyTexImage(unsigned target) override; |
38 virtual void WillUseTexImage() OVERRIDE; | 38 virtual void WillUseTexImage() override; |
39 virtual void WillModifyTexImage() OVERRIDE; | 39 virtual void WillModifyTexImage() override; |
40 virtual void DidModifyTexImage() OVERRIDE; | 40 virtual void DidModifyTexImage() override; |
41 virtual void DidUseTexImage() OVERRIDE; | 41 virtual void DidUseTexImage() override; |
42 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 42 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
43 int z_order, | 43 int z_order, |
44 gfx::OverlayTransform transform, | 44 gfx::OverlayTransform transform, |
45 const gfx::Rect& bounds_rect, | 45 const gfx::Rect& bounds_rect, |
46 const gfx::RectF& crop_rect) OVERRIDE; | 46 const gfx::RectF& crop_rect) override; |
47 | 47 |
48 protected: | 48 protected: |
49 virtual ~GLImageSync(); | 49 virtual ~GLImageSync(); |
50 | 50 |
51 private: | 51 private: |
52 scoped_refptr<NativeImageBuffer> buffer_; | 52 scoped_refptr<NativeImageBuffer> buffer_; |
53 gfx::Size size_; | 53 gfx::Size size_; |
54 | 54 |
55 DISALLOW_COPY_AND_ASSIGN(GLImageSync); | 55 DISALLOW_COPY_AND_ASSIGN(GLImageSync); |
56 }; | 56 }; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 } | 117 } |
118 | 118 |
119 #if !defined(OS_MACOSX) | 119 #if !defined(OS_MACOSX) |
120 class NativeImageBufferEGL : public NativeImageBuffer { | 120 class NativeImageBufferEGL : public NativeImageBuffer { |
121 public: | 121 public: |
122 static scoped_refptr<NativeImageBufferEGL> Create(GLuint texture_id); | 122 static scoped_refptr<NativeImageBufferEGL> Create(GLuint texture_id); |
123 | 123 |
124 private: | 124 private: |
125 NativeImageBufferEGL(EGLDisplay display, EGLImageKHR image); | 125 NativeImageBufferEGL(EGLDisplay display, EGLImageKHR image); |
126 virtual ~NativeImageBufferEGL(); | 126 virtual ~NativeImageBufferEGL(); |
127 virtual void AddClient(gfx::GLImage* client) OVERRIDE; | 127 virtual void AddClient(gfx::GLImage* client) override; |
128 virtual void RemoveClient(gfx::GLImage* client) OVERRIDE; | 128 virtual void RemoveClient(gfx::GLImage* client) override; |
129 virtual bool IsClient(gfx::GLImage* client) OVERRIDE; | 129 virtual bool IsClient(gfx::GLImage* client) override; |
130 virtual void BindToTexture(GLenum target) OVERRIDE; | 130 virtual void BindToTexture(GLenum target) override; |
131 virtual void WillRead(gfx::GLImage* client) OVERRIDE; | 131 virtual void WillRead(gfx::GLImage* client) override; |
132 virtual void WillWrite(gfx::GLImage* client) OVERRIDE; | 132 virtual void WillWrite(gfx::GLImage* client) override; |
133 virtual void DidRead(gfx::GLImage* client) OVERRIDE; | 133 virtual void DidRead(gfx::GLImage* client) override; |
134 virtual void DidWrite(gfx::GLImage* client) OVERRIDE; | 134 virtual void DidWrite(gfx::GLImage* client) override; |
135 | 135 |
136 EGLDisplay egl_display_; | 136 EGLDisplay egl_display_; |
137 EGLImageKHR egl_image_; | 137 EGLImageKHR egl_image_; |
138 | 138 |
139 base::Lock lock_; | 139 base::Lock lock_; |
140 | 140 |
141 struct ClientInfo { | 141 struct ClientInfo { |
142 ClientInfo(gfx::GLImage* client); | 142 ClientInfo(gfx::GLImage* client); |
143 ~ClientInfo(); | 143 ~ClientInfo(); |
144 | 144 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 #endif | 302 #endif |
303 | 303 |
304 class NativeImageBufferStub : public NativeImageBuffer { | 304 class NativeImageBufferStub : public NativeImageBuffer { |
305 public: | 305 public: |
306 NativeImageBufferStub() : NativeImageBuffer() {} | 306 NativeImageBufferStub() : NativeImageBuffer() {} |
307 | 307 |
308 private: | 308 private: |
309 virtual ~NativeImageBufferStub() {} | 309 virtual ~NativeImageBufferStub() {} |
310 virtual void AddClient(gfx::GLImage* client) OVERRIDE {} | 310 virtual void AddClient(gfx::GLImage* client) override {} |
311 virtual void RemoveClient(gfx::GLImage* client) OVERRIDE {} | 311 virtual void RemoveClient(gfx::GLImage* client) override {} |
312 virtual bool IsClient(gfx::GLImage* client) OVERRIDE { return true; } | 312 virtual bool IsClient(gfx::GLImage* client) override { return true; } |
313 virtual void BindToTexture(GLenum target) OVERRIDE {} | 313 virtual void BindToTexture(GLenum target) override {} |
314 virtual void WillRead(gfx::GLImage* client) OVERRIDE {} | 314 virtual void WillRead(gfx::GLImage* client) override {} |
315 virtual void WillWrite(gfx::GLImage* client) OVERRIDE {} | 315 virtual void WillWrite(gfx::GLImage* client) override {} |
316 virtual void DidRead(gfx::GLImage* client) OVERRIDE {} | 316 virtual void DidRead(gfx::GLImage* client) override {} |
317 virtual void DidWrite(gfx::GLImage* client) OVERRIDE {} | 317 virtual void DidWrite(gfx::GLImage* client) override {} |
318 | 318 |
319 DISALLOW_COPY_AND_ASSIGN(NativeImageBufferStub); | 319 DISALLOW_COPY_AND_ASSIGN(NativeImageBufferStub); |
320 }; | 320 }; |
321 | 321 |
322 } // anonymous namespace | 322 } // anonymous namespace |
323 | 323 |
324 // static | 324 // static |
325 scoped_refptr<NativeImageBuffer> NativeImageBuffer::Create(GLuint texture_id) { | 325 scoped_refptr<NativeImageBuffer> NativeImageBuffer::Create(GLuint texture_id) { |
326 switch (gfx::GetGLImplementation()) { | 326 switch (gfx::GetGLImplementation()) { |
327 #if !defined(OS_MACOSX) | 327 #if !defined(OS_MACOSX) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 487 |
488 // All structural changes should have orphaned the texture. | 488 // All structural changes should have orphaned the texture. |
489 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) | 489 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) |
490 return false; | 490 return false; |
491 | 491 |
492 return true; | 492 return true; |
493 } | 493 } |
494 | 494 |
495 } // namespace gles2 | 495 } // namespace gles2 |
496 } // namespace gpu | 496 } // namespace gpu |
OLD | NEW |