| 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 "ui/gl/gl_image_surface_texture.h" | 5 #include "ui/gl/gl_image_surface_texture.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "ui/gl/android/surface_texture.h" | 8 #include "ui/gl/android/surface_texture.h" |
| 9 | 9 |
| 10 namespace gfx { | 10 namespace gl { |
| 11 | 11 |
| 12 GLImageSurfaceTexture::GLImageSurfaceTexture(const Size& size) | 12 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size) |
| 13 : size_(size), texture_id_(0) {} | 13 : size_(size), texture_id_(0) {} |
| 14 | 14 |
| 15 GLImageSurfaceTexture::~GLImageSurfaceTexture() { | 15 GLImageSurfaceTexture::~GLImageSurfaceTexture() { |
| 16 DCHECK(thread_checker_.CalledOnValidThread()); | 16 DCHECK(thread_checker_.CalledOnValidThread()); |
| 17 DCHECK(!surface_texture_.get()); | 17 DCHECK(!surface_texture_.get()); |
| 18 DCHECK_EQ(0, texture_id_); | 18 DCHECK_EQ(0, texture_id_); |
| 19 } | 19 } |
| 20 | 20 |
| 21 bool GLImageSurfaceTexture::Initialize(SurfaceTexture* surface_texture) { | 21 bool GLImageSurfaceTexture::Initialize(gfx::SurfaceTexture* surface_texture) { |
| 22 DCHECK(thread_checker_.CalledOnValidThread()); | 22 DCHECK(thread_checker_.CalledOnValidThread()); |
| 23 DCHECK(!surface_texture_.get()); | 23 DCHECK(!surface_texture_.get()); |
| 24 surface_texture_ = surface_texture; | 24 surface_texture_ = surface_texture; |
| 25 return true; | 25 return true; |
| 26 } | 26 } |
| 27 | 27 |
| 28 void GLImageSurfaceTexture::Destroy(bool have_context) { | 28 void GLImageSurfaceTexture::Destroy(bool have_context) { |
| 29 DCHECK(thread_checker_.CalledOnValidThread()); | 29 DCHECK(thread_checker_.CalledOnValidThread()); |
| 30 surface_texture_ = NULL; | 30 surface_texture_ = NULL; |
| 31 texture_id_ = 0; | 31 texture_id_ = 0; |
| 32 } | 32 } |
| 33 | 33 |
| 34 Size GLImageSurfaceTexture::GetSize() { | 34 gfx::Size GLImageSurfaceTexture::GetSize() { |
| 35 return size_; | 35 return size_; |
| 36 } | 36 } |
| 37 | 37 |
| 38 unsigned GLImageSurfaceTexture::GetInternalFormat() { return GL_RGBA; } | 38 unsigned GLImageSurfaceTexture::GetInternalFormat() { return GL_RGBA; } |
| 39 | 39 |
| 40 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { | 40 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { |
| 41 TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage"); | 41 TRACE_EVENT0("gpu", "GLImageSurfaceTexture::BindTexImage"); |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); | 42 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 | 43 |
| 44 if (target != GL_TEXTURE_EXTERNAL_OES) { | 44 if (target != GL_TEXTURE_EXTERNAL_OES) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 surface_texture_->UpdateTexImage(); | 78 surface_texture_->UpdateTexImage(); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool GLImageSurfaceTexture::CopyTexImage(unsigned target) { | 82 bool GLImageSurfaceTexture::CopyTexImage(unsigned target) { |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool GLImageSurfaceTexture::CopyTexSubImage(unsigned target, | 86 bool GLImageSurfaceTexture::CopyTexSubImage(unsigned target, |
| 87 const Point& offset, | 87 const gfx::Point& offset, |
| 88 const Rect& rect) { | 88 const gfx::Rect& rect) { |
| 89 return false; | 89 return false; |
| 90 } | 90 } |
| 91 | 91 |
| 92 bool GLImageSurfaceTexture::ScheduleOverlayPlane(AcceleratedWidget widget, | 92 bool GLImageSurfaceTexture::ScheduleOverlayPlane( |
| 93 int z_order, | 93 gfx::AcceleratedWidget widget, |
| 94 OverlayTransform transform, | 94 int z_order, |
| 95 const Rect& bounds_rect, | 95 gfx::OverlayTransform transform, |
| 96 const RectF& crop_rect) { | 96 const gfx::Rect& bounds_rect, |
| 97 const gfx::RectF& crop_rect) { |
| 97 return false; | 98 return false; |
| 98 } | 99 } |
| 99 | 100 |
| 100 void GLImageSurfaceTexture::OnMemoryDump( | 101 void GLImageSurfaceTexture::OnMemoryDump( |
| 101 base::trace_event::ProcessMemoryDump* pmd, | 102 base::trace_event::ProcessMemoryDump* pmd, |
| 102 uint64_t process_tracing_id, | 103 uint64_t process_tracing_id, |
| 103 const std::string& dump_name) { | 104 const std::string& dump_name) { |
| 104 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914 | 105 // TODO(ericrk): Add OnMemoryDump for GLImages. crbug.com/514914 |
| 105 } | 106 } |
| 106 | 107 |
| 107 } // namespace gfx | 108 } // namespace gl |
| OLD | NEW |