1 /* 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #import <Cocoa/Cocoa.h> 12 #import <AppKit/AppKit.h> 13 14 #include "webrtc/modules/video_render/mac/cocoa_render_view.h" 15 #include "webrtc/system_wrappers/include/trace.h" 16 17 using namespace webrtc; 18 19 @implementation CocoaRenderView 20 21 -(void)initCocoaRenderView:(NSOpenGLPixelFormat*)fmt{ 22 23 self = [super initWithFrame:[self frame] pixelFormat:fmt]; 24 if (self == nil){ 25 26 WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, 0, "%s:%d Could not create instance", __FUNCTION__, __LINE__); 27 } 28 29 30 _nsOpenGLContext = [self openGLContext]; 31 32 } 33 34 -(NSOpenGLContext*)nsOpenGLContext { 35 return _nsOpenGLContext; 36 } 37 38 -(void)initCocoaRenderViewFullScreen:(NSOpenGLPixelFormat*)fmt{ 39 40 NSRect screenRect = [[NSScreen mainScreen]frame]; 41 // [_windowRef setFrame:screenRect]; 42 // [_windowRef setBounds:screenRect]; 43 self = [super initWithFrame:screenRect pixelFormat:fmt]; 44 if (self == nil){ 45 46 WEBRTC_TRACE(kTraceError, kTraceVideoRenderer, 0, "%s:%d Could not create instance", __FUNCTION__, __LINE__); 47 } 48 49 _nsOpenGLContext = [self openGLContext]; 50 51 } 52 53 @end 54 55 56