| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/common/gpu/media/rendering_helper.h" | 5 #include "content/common/gpu/media/rendering_helper.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #import <OpenGL/gl.h> | 8 #import <OpenGL/gl.h> |
| 9 #import <OpenGL/CGLMacro.h> | 9 #import <OpenGL/CGLMacro.h> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 virtual ~RenderingHelperMac(); | 83 virtual ~RenderingHelperMac(); |
| 84 | 84 |
| 85 // Implement RenderingHelper. | 85 // Implement RenderingHelper. |
| 86 virtual void Initialize(bool suppress_swap_to_display, | 86 virtual void Initialize(bool suppress_swap_to_display, |
| 87 int num_windows, | 87 int num_windows, |
| 88 int width, | 88 int width, |
| 89 int height, | 89 int height, |
| 90 base::WaitableEvent* done) OVERRIDE; | 90 base::WaitableEvent* done) OVERRIDE; |
| 91 virtual void UnInitialize(base::WaitableEvent* done) OVERRIDE; | 91 virtual void UnInitialize(base::WaitableEvent* done) OVERRIDE; |
| 92 virtual void CreateTexture(int window_id, | 92 virtual void CreateTexture(int window_id, |
| 93 int texture_target, |
| 93 GLuint* texture_id, | 94 GLuint* texture_id, |
| 94 base::WaitableEvent* done) OVERRIDE; | 95 base::WaitableEvent* done) OVERRIDE; |
| 95 virtual void RenderTexture(GLuint texture_id) OVERRIDE; | 96 virtual void RenderTexture(GLuint texture_id) OVERRIDE; |
| 96 virtual void DeleteTexture(GLuint texture_id) OVERRIDE; | 97 virtual void DeleteTexture(GLuint texture_id) OVERRIDE; |
| 97 virtual void* GetGLContext() OVERRIDE; | 98 virtual void* GetGLContext() OVERRIDE; |
| 98 virtual void* GetGLDisplay() OVERRIDE; | 99 virtual void* GetGLDisplay() OVERRIDE; |
| 99 | 100 |
| 100 private: | 101 private: |
| 101 MessageLoop* message_loop_; | 102 MessageLoop* message_loop_; |
| 102 int width_; | 103 int width_; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 width_ = 0; | 179 width_ = 0; |
| 179 height_ = 0; | 180 height_ = 0; |
| 180 message_loop_ = NULL; | 181 message_loop_ = NULL; |
| 181 [window_ close]; | 182 [window_ close]; |
| 182 window_.reset(); | 183 window_.reset(); |
| 183 gl_view_.reset(); | 184 gl_view_.reset(); |
| 184 done->Signal(); | 185 done->Signal(); |
| 185 } | 186 } |
| 186 | 187 |
| 187 void RenderingHelperMac::CreateTexture(int window_id, | 188 void RenderingHelperMac::CreateTexture(int window_id, |
| 189 int texture_target, |
| 188 GLuint* texture_id, | 190 GLuint* texture_id, |
| 189 base::WaitableEvent* done) { | 191 base::WaitableEvent* done) { |
| 190 CHECK_EQ(MessageLoop::current(), message_loop_); | 192 CHECK_EQ(MessageLoop::current(), message_loop_); |
| 193 CHECK_EQ(GL_TEXTURE_RECTANGLE_ARB, texture_target); |
| 191 CGLContextObj cgl_ctx = GetCGLContext(gl_view_); | 194 CGLContextObj cgl_ctx = GetCGLContext(gl_view_); |
| 192 glGenTextures(1, texture_id); | 195 glGenTextures(1, texture_id); |
| 193 CHECK_EQ(GL_NO_ERROR, static_cast<int>(glGetError())); | 196 CHECK_EQ(GL_NO_ERROR, static_cast<int>(glGetError())); |
| 194 done->Signal(); | 197 done->Signal(); |
| 195 } | 198 } |
| 196 | 199 |
| 197 void RenderingHelperMac::RenderTexture(GLuint texture_id) { | 200 void RenderingHelperMac::RenderTexture(GLuint texture_id) { |
| 198 CHECK_EQ(MessageLoop::current(), message_loop_); | 201 CHECK_EQ(MessageLoop::current(), message_loop_); |
| 199 DrawTexture(gl_view_, texture_id); | 202 DrawTexture(gl_view_, texture_id); |
| 200 } | 203 } |
| 201 | 204 |
| 202 void RenderingHelperMac::DeleteTexture(GLuint texture_id) { | 205 void RenderingHelperMac::DeleteTexture(GLuint texture_id) { |
| 203 CHECK_EQ(MessageLoop::current(), message_loop_); | 206 CHECK_EQ(MessageLoop::current(), message_loop_); |
| 204 CGLContextObj cgl_ctx = GetCGLContext(gl_view_); | 207 CGLContextObj cgl_ctx = GetCGLContext(gl_view_); |
| 205 glDeleteTextures(1, &texture_id); | 208 glDeleteTextures(1, &texture_id); |
| 206 CHECK_EQ(GL_NO_ERROR, static_cast<int>(glGetError())); | 209 CHECK_EQ(GL_NO_ERROR, static_cast<int>(glGetError())); |
| 207 } | 210 } |
| 208 | 211 |
| 209 void* RenderingHelperMac::GetGLContext() { | 212 void* RenderingHelperMac::GetGLContext() { |
| 210 return GetCGLContext(gl_view_); | 213 return GetCGLContext(gl_view_); |
| 211 } | 214 } |
| 212 | 215 |
| 213 void* RenderingHelperMac::GetGLDisplay() { | 216 void* RenderingHelperMac::GetGLDisplay() { |
| 214 return NULL; | 217 return NULL; |
| 215 } | 218 } |
| 216 | 219 |
| 217 } // namespace video_test_util | 220 } // namespace video_test_util |
| OLD | NEW |