| 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 void Destroy(bool have_context) override; |
| 34 virtual gfx::Size GetSize() override; | 34 gfx::Size GetSize() override; |
| 35 virtual bool BindTexImage(unsigned target) override; | 35 bool BindTexImage(unsigned target) override; |
| 36 virtual void ReleaseTexImage(unsigned target) override; | 36 void ReleaseTexImage(unsigned target) override; |
| 37 virtual bool CopyTexImage(unsigned target) override; | 37 bool CopyTexImage(unsigned target) override; |
| 38 virtual void WillUseTexImage() override; | 38 void WillUseTexImage() override; |
| 39 virtual void WillModifyTexImage() override; | 39 void WillModifyTexImage() override; |
| 40 virtual void DidModifyTexImage() override; | 40 void DidModifyTexImage() override; |
| 41 virtual void DidUseTexImage() override; | 41 void DidUseTexImage() override; |
| 42 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 42 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 ~GLImageSync() override; |
| 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 }; |
| 57 | 57 |
| 58 GLImageSync::GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer, | 58 GLImageSync::GLImageSync(const scoped_refptr<NativeImageBuffer>& buffer, |
| 59 const gfx::Size& size) | 59 const gfx::Size& size) |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 299 } |
| 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 ~NativeImageBufferStub() override {} |
| 310 virtual void AddClient(gfx::GLImage* client) override {} | 310 void AddClient(gfx::GLImage* client) override {} |
| 311 virtual void RemoveClient(gfx::GLImage* client) override {} | 311 void RemoveClient(gfx::GLImage* client) override {} |
| 312 virtual bool IsClient(gfx::GLImage* client) override { return true; } | 312 bool IsClient(gfx::GLImage* client) override { return true; } |
| 313 virtual void BindToTexture(GLenum target) override {} | 313 void BindToTexture(GLenum target) override {} |
| 314 virtual void WillRead(gfx::GLImage* client) override {} | 314 void WillRead(gfx::GLImage* client) override {} |
| 315 virtual void WillWrite(gfx::GLImage* client) override {} | 315 void WillWrite(gfx::GLImage* client) override {} |
| 316 virtual void DidRead(gfx::GLImage* client) override {} | 316 void DidRead(gfx::GLImage* client) override {} |
| 317 virtual void DidWrite(gfx::GLImage* client) override {} | 317 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 // All structural changes should have orphaned the texture. | 489 // All structural changes should have orphaned the texture. |
| 490 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) | 490 if (image_buffer_.get() && !texture->GetLevelImage(texture->target(), 0)) |
| 491 return false; | 491 return false; |
| 492 | 492 |
| 493 return true; | 493 return true; |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace gles2 | 496 } // namespace gles2 |
| 497 } // namespace gpu | 497 } // namespace gpu |
| OLD | NEW |