OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_io_surface.h" | 5 #include "ui/gl/gl_image_io_surface.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/mac/bind_objc_block.h" | 10 #include "base/mac/bind_objc_block.h" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 } | 369 } |
370 | 370 |
371 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() { | 371 base::ScopedCFTypeRef<IOSurfaceRef> GLImageIOSurface::io_surface() { |
372 return io_surface_; | 372 return io_surface_; |
373 } | 373 } |
374 | 374 |
375 base::ScopedCFTypeRef<CVPixelBufferRef> GLImageIOSurface::cv_pixel_buffer() { | 375 base::ScopedCFTypeRef<CVPixelBufferRef> GLImageIOSurface::cv_pixel_buffer() { |
376 return cv_pixel_buffer_; | 376 return cv_pixel_buffer_; |
377 } | 377 } |
378 | 378 |
| 379 GLImage::Type GLImageIOSurface::GetType() const { |
| 380 return Type::IOSURFACE; |
| 381 } |
| 382 |
379 // static | 383 // static |
380 unsigned GLImageIOSurface::GetInternalFormatForTesting( | 384 unsigned GLImageIOSurface::GetInternalFormatForTesting( |
381 gfx::BufferFormat format) { | 385 gfx::BufferFormat format) { |
382 DCHECK(ValidFormat(format)); | 386 DCHECK(ValidFormat(format)); |
383 return TextureFormat(format); | 387 return TextureFormat(format); |
384 } | 388 } |
| 389 |
| 390 // static |
| 391 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { |
| 392 if (!image || image->GetType() != Type::IOSURFACE) |
| 393 return nullptr; |
| 394 return static_cast<GLImageIOSurface*>(image); |
| 395 } |
| 396 |
385 } // namespace gl | 397 } // namespace gl |
OLD | NEW |