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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include <CoreVideo/CoreVideo.h> | 7 #include <CoreVideo/CoreVideo.h> |
8 #include <OpenGL/CGLIOSurface.h> | 8 #include <OpenGL/CGLIOSurface.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 | 10 |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1034 GL_UNSIGNED_SHORT_8_8_APPLE, // type | 1034 GL_UNSIGNED_SHORT_8_8_APPLE, // type |
1035 surface, // io_surface | 1035 surface, // io_surface |
1036 0); // plane | 1036 0); // plane |
1037 glDisable(GL_TEXTURE_RECTANGLE_ARB); | 1037 glDisable(GL_TEXTURE_RECTANGLE_ARB); |
1038 if (status != kCGLNoError) { | 1038 if (status != kCGLNoError) { |
1039 NOTIFY_STATUS("CGLTexImageIOSurface2D()", status, SFT_PLATFORM_ERROR); | 1039 NOTIFY_STATUS("CGLTexImageIOSurface2D()", status, SFT_PLATFORM_ERROR); |
1040 return false; | 1040 return false; |
1041 } | 1041 } |
1042 | 1042 |
1043 bool allow_overlay = false; | 1043 bool allow_overlay = false; |
1044 scoped_refptr<gfx::GLImageIOSurface> gl_image( | 1044 scoped_refptr<gfx::GLImageIOSurface> gl_image(new gfx::GLImageIOSurface( |
1045 new gfx::GLImageIOSurface(frame.coded_size, GL_BGRA_EXT)); | 1045 gfx::GenericSharedMemoryId(), frame.coded_size, GL_BGRA_EXT)); |
1046 if (gl_image->Initialize(surface, gfx::GenericSharedMemoryId(), | 1046 if (gl_image->Initialize(surface, gfx::BufferFormat::BGRA_8888)) { |
1047 gfx::BufferFormat::BGRA_8888)) { | |
1048 allow_overlay = true; | 1047 allow_overlay = true; |
1049 } else { | 1048 } else { |
1050 gl_image = nullptr; | 1049 gl_image = nullptr; |
1051 } | 1050 } |
1052 bind_image_.Run(picture_info->client_texture_id, GL_TEXTURE_RECTANGLE_ARB, | 1051 bind_image_.Run(picture_info->client_texture_id, GL_TEXTURE_RECTANGLE_ARB, |
1053 gl_image); | 1052 gl_image); |
1054 | 1053 |
1055 // Assign the new image(s) to the the picture info. | 1054 // Assign the new image(s) to the the picture info. |
1056 picture_info->gl_image = gl_image; | 1055 picture_info->gl_image = gl_image; |
1057 picture_info->cv_image = frame.image; | 1056 picture_info->cv_image = frame.image; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 SupportedProfile profile; | 1138 SupportedProfile profile; |
1140 profile.profile = supported_profile; | 1139 profile.profile = supported_profile; |
1141 profile.min_resolution.SetSize(16, 16); | 1140 profile.min_resolution.SetSize(16, 16); |
1142 profile.max_resolution.SetSize(4096, 2160); | 1141 profile.max_resolution.SetSize(4096, 2160); |
1143 profiles.push_back(profile); | 1142 profiles.push_back(profile); |
1144 } | 1143 } |
1145 return profiles; | 1144 return profiles; |
1146 } | 1145 } |
1147 | 1146 |
1148 } // namespace content | 1147 } // namespace content |
OLD | NEW |