| 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/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "ui/gl/android/surface_texture.h" | 8 #include "ui/gl/android/surface_texture.h" |
| 9 #include "ui/gl/android/surface_texture_tracker.h" | |
| 10 | 9 |
| 11 namespace gfx { | 10 namespace gfx { |
| 12 | 11 |
| 13 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size) | 12 GLImageSurfaceTexture::GLImageSurfaceTexture(const gfx::Size& size) |
| 14 : size_(size), texture_id_(0) { | 13 : size_(size), texture_id_(0) { |
| 15 } | 14 } |
| 16 | 15 |
| 17 GLImageSurfaceTexture::~GLImageSurfaceTexture() { | 16 GLImageSurfaceTexture::~GLImageSurfaceTexture() { |
| 18 DCHECK(!surface_texture_); | 17 DCHECK(!surface_texture_); |
| 19 DCHECK_EQ(0, texture_id_); | 18 DCHECK_EQ(0, texture_id_); |
| 20 } | 19 } |
| 21 | 20 |
| 22 bool GLImageSurfaceTexture::Initialize( | 21 bool GLImageSurfaceTexture::Initialize(SurfaceTexture* surface_texture) { |
| 23 const gfx::GpuMemoryBufferHandle& handle) { | |
| 24 DCHECK(!surface_texture_); | 22 DCHECK(!surface_texture_); |
| 25 surface_texture_ = | 23 surface_texture_ = surface_texture; |
| 26 SurfaceTextureTracker::GetInstance()->AcquireSurfaceTexture( | 24 return true; |
| 27 handle.surface_texture_id.primary_id, | |
| 28 handle.surface_texture_id.secondary_id); | |
| 29 return !!surface_texture_; | |
| 30 } | 25 } |
| 31 | 26 |
| 32 void GLImageSurfaceTexture::Destroy(bool have_context) { | 27 void GLImageSurfaceTexture::Destroy(bool have_context) { |
| 33 surface_texture_ = NULL; | 28 surface_texture_ = NULL; |
| 34 texture_id_ = 0; | 29 texture_id_ = 0; |
| 35 } | 30 } |
| 36 | 31 |
| 37 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; } | 32 gfx::Size GLImageSurfaceTexture::GetSize() { return size_; } |
| 38 | 33 |
| 39 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { | 34 bool GLImageSurfaceTexture::BindTexImage(unsigned target) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 78 |
| 84 bool GLImageSurfaceTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 79 bool GLImageSurfaceTexture::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 85 int z_order, | 80 int z_order, |
| 86 OverlayTransform transform, | 81 OverlayTransform transform, |
| 87 const Rect& bounds_rect, | 82 const Rect& bounds_rect, |
| 88 const RectF& crop_rect) { | 83 const RectF& crop_rect) { |
| 89 return false; | 84 return false; |
| 90 } | 85 } |
| 91 | 86 |
| 92 } // namespace gfx | 87 } // namespace gfx |
| OLD | NEW |