Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1037)

Side by Side Diff: webrtc/test/mac/video_renderer_mac.mm

Issue 2827223003: Revert of GN: Enable ARC for Mac and iOS in rtc_* templates (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/test/mac/run_test.mm ('k') | webrtc/webrtc.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 - (id)initWithTitle:(NSString *)title width:(int)width height:(int)height { 37 - (id)initWithTitle:(NSString *)title width:(int)width height:(int)height {
38 if (self = [super init]) { 38 if (self = [super init]) {
39 title_ = title; 39 title_ = title;
40 width_ = width; 40 width_ = width;
41 height_ = height; 41 height_ = height;
42 } 42 }
43 return self; 43 return self;
44 } 44 }
45 45
46 - (void)dealloc {
47 [window_ release];
48 [super dealloc];
49 }
50
46 - (void)createWindow:(NSObject *)ignored { 51 - (void)createWindow:(NSObject *)ignored {
47 NSInteger xOrigin = nextXOrigin_; 52 NSInteger xOrigin = nextXOrigin_;
48 NSRect screenFrame = [[NSScreen mainScreen] frame]; 53 NSRect screenFrame = [[NSScreen mainScreen] frame];
49 if (nextXOrigin_ + width_ < screenFrame.size.width) { 54 if (nextXOrigin_ + width_ < screenFrame.size.width) {
50 nextXOrigin_ += width_; 55 nextXOrigin_ += width_;
51 } else { 56 } else {
52 xOrigin = 0; 57 xOrigin = 0;
53 nextXOrigin_ = 0; 58 nextXOrigin_ = 0;
54 nextYOrigin_ += height_; 59 nextYOrigin_ += height_;
55 } 60 }
56 if (nextYOrigin_ + height_ > screenFrame.size.height) { 61 if (nextYOrigin_ + height_ > screenFrame.size.height) {
57 xOrigin = 0; 62 xOrigin = 0;
58 nextXOrigin_ = 0; 63 nextXOrigin_ = 0;
59 nextYOrigin_ = 0; 64 nextYOrigin_ = 0;
60 } 65 }
61 NSInteger yOrigin = nextYOrigin_; 66 NSInteger yOrigin = nextYOrigin_;
62 NSRect windowFrame = NSMakeRect(xOrigin, yOrigin, width_, height_); 67 NSRect windowFrame = NSMakeRect(xOrigin, yOrigin, width_, height_);
63 window_ = [[NSWindow alloc] initWithContentRect:windowFrame 68 window_ = [[NSWindow alloc] initWithContentRect:windowFrame
64 styleMask:NSTitledWindowMask 69 styleMask:NSTitledWindowMask
65 backing:NSBackingStoreBuffered 70 backing:NSBackingStoreBuffered
66 defer:NO]; 71 defer:NO];
67 72
68 NSRect viewFrame = NSMakeRect(0, 0, width_, height_); 73 NSRect viewFrame = NSMakeRect(0, 0, width_, height_);
69 NSOpenGLView *view = [[NSOpenGLView alloc] initWithFrame:viewFrame 74 NSOpenGLView *view = [[[NSOpenGLView alloc] initWithFrame:viewFrame
70 pixelFormat:nil]; 75 pixelFormat:nil] autorelease];
71 context_ = [view openGLContext]; 76 context_ = [view openGLContext];
72 77
73 [[window_ contentView] addSubview:view]; 78 [[window_ contentView] addSubview:view];
74 [window_ setTitle:title_]; 79 [window_ setTitle:title_];
75 [window_ makeKeyAndOrderFront:NSApp]; 80 [window_ makeKeyAndOrderFront:NSApp];
76 } 81 }
77 82
78 - (void)makeCurrentContext { 83 - (void)makeCurrentContext {
79 [context_ makeCurrentContext]; 84 [context_ makeCurrentContext];
80 } 85 }
(...skipping 12 matching lines...) Expand all
93 return NULL; 98 return NULL;
94 } 99 }
95 return renderer; 100 return renderer;
96 } 101 }
97 102
98 MacRenderer::MacRenderer() 103 MacRenderer::MacRenderer()
99 : window_(NULL) {} 104 : window_(NULL) {}
100 105
101 MacRenderer::~MacRenderer() { 106 MacRenderer::~MacRenderer() {
102 GlRenderer::Destroy(); 107 GlRenderer::Destroy();
108 [window_ release];
103 } 109 }
104 110
105 bool MacRenderer::Init(const char* window_title, int width, int height) { 111 bool MacRenderer::Init(const char* window_title, int width, int height) {
106 window_ = [[CocoaWindow alloc] 112 window_ = [[CocoaWindow alloc]
107 initWithTitle:[NSString stringWithUTF8String:window_title] 113 initWithTitle:[NSString stringWithUTF8String:window_title]
108 width:width 114 width:width
109 height:height]; 115 height:height];
110 if (!window_) 116 if (!window_)
111 return false; 117 return false;
112 [window_ performSelectorOnMainThread:@selector(createWindow:) 118 [window_ performSelectorOnMainThread:@selector(createWindow:)
113 withObject:nil 119 withObject:nil
114 waitUntilDone:YES]; 120 waitUntilDone:YES];
115 121
116 [window_ makeCurrentContext]; 122 [window_ makeCurrentContext];
117 GlRenderer::Init(); 123 GlRenderer::Init();
118 GlRenderer::ResizeViewport(width, height); 124 GlRenderer::ResizeViewport(width, height);
119 return true; 125 return true;
120 } 126 }
121 127
122 void MacRenderer::OnFrame(const VideoFrame& frame) { 128 void MacRenderer::OnFrame(const VideoFrame& frame) {
123 [window_ makeCurrentContext]; 129 [window_ makeCurrentContext];
124 GlRenderer::OnFrame(frame); 130 GlRenderer::OnFrame(frame);
125 } 131 }
126 132
127 } // test 133 } // test
128 } // webrtc 134 } // webrtc
OLDNEW
« no previous file with comments | « webrtc/test/mac/run_test.mm ('k') | webrtc/webrtc.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698