| 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" |
| 11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
| 12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/trace_event/memory_allocator_dump.h" | 13 #include "base/trace_event/memory_allocator_dump.h" |
| 14 #include "base/trace_event/memory_dump_manager.h" | 14 #include "base/trace_event/memory_dump_manager.h" |
| 15 #include "base/trace_event/process_memory_dump.h" | 15 #include "base/trace_event/process_memory_dump.h" |
| 16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 17 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 18 #include "ui/gl/gl_context.h" | 18 #include "ui/gl/gl_context.h" |
| 19 #include "ui/gl/scoped_api.h" | |
| 20 #include "ui/gl/scoped_binders.h" | 19 #include "ui/gl/scoped_binders.h" |
| 21 #include "ui/gl/yuv_to_rgb_converter.h" | 20 #include "ui/gl/yuv_to_rgb_converter.h" |
| 22 | 21 |
| 23 // Note that this must be included after gl_bindings.h to avoid conflicts. | 22 // Note that this must be included after gl_bindings.h to avoid conflicts. |
| 24 #include <OpenGL/CGLIOSurface.h> | 23 #include <OpenGL/CGLIOSurface.h> |
| 25 #include <Quartz/Quartz.h> | 24 #include <Quartz/Quartz.h> |
| 26 #include <stddef.h> | 25 #include <stddef.h> |
| 27 | 26 |
| 28 using gfx::BufferFormat; | 27 using gfx::BufferFormat; |
| 29 | 28 |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 272 |
| 274 if (format_ != gfx::BufferFormat::YUV_420_BIPLANAR) | 273 if (format_ != gfx::BufferFormat::YUV_420_BIPLANAR) |
| 275 return false; | 274 return false; |
| 276 | 275 |
| 277 GLContext* gl_context = GLContext::GetCurrent(); | 276 GLContext* gl_context = GLContext::GetCurrent(); |
| 278 DCHECK(gl_context); | 277 DCHECK(gl_context); |
| 279 | 278 |
| 280 YUVToRGBConverter* yuv_to_rgb_converter = gl_context->GetYUVToRGBConverter(); | 279 YUVToRGBConverter* yuv_to_rgb_converter = gl_context->GetYUVToRGBConverter(); |
| 281 DCHECK(yuv_to_rgb_converter); | 280 DCHECK(yuv_to_rgb_converter); |
| 282 | 281 |
| 283 ScopedSetGLToRealGLApi scoped_set_gl_api; | |
| 284 | |
| 285 // Note that state restoration is done explicitly instead of scoped binders to | 282 // Note that state restoration is done explicitly instead of scoped binders to |
| 286 // avoid https://crbug.com/601729. | 283 // avoid https://crbug.com/601729. |
| 287 GLint rgb_texture = 0; | 284 GLint rgb_texture = 0; |
| 288 GLenum target_getter = 0; | 285 GLenum target_getter = 0; |
| 289 switch (target) { | 286 switch (target) { |
| 290 case GL_TEXTURE_2D: | 287 case GL_TEXTURE_2D: |
| 291 target_getter = GL_TEXTURE_BINDING_2D; | 288 target_getter = GL_TEXTURE_BINDING_2D; |
| 292 break; | 289 break; |
| 293 case GL_TEXTURE_CUBE_MAP: | 290 case GL_TEXTURE_CUBE_MAP: |
| 294 target_getter = GL_TEXTURE_BINDING_CUBE_MAP; | 291 target_getter = GL_TEXTURE_BINDING_CUBE_MAP; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 395 } |
| 399 | 396 |
| 400 // static | 397 // static |
| 401 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { | 398 GLImageIOSurface* GLImageIOSurface::FromGLImage(GLImage* image) { |
| 402 if (!image || image->GetType() != Type::IOSURFACE) | 399 if (!image || image->GetType() != Type::IOSURFACE) |
| 403 return nullptr; | 400 return nullptr; |
| 404 return static_cast<GLImageIOSurface*>(image); | 401 return static_cast<GLImageIOSurface*>(image); |
| 405 } | 402 } |
| 406 | 403 |
| 407 } // namespace gl | 404 } // namespace gl |
| OLD | NEW |