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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/UI/RTCNSGLVideoView.m

Issue 2916583005: Ensure the openGLContext is current before trying to reshape the viewport (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | 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 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 [self teardownDisplayLink]; 70 [self teardownDisplayLink];
71 } 71 }
72 72
73 - (void)drawRect:(NSRect)rect { 73 - (void)drawRect:(NSRect)rect {
74 [self drawFrame]; 74 [self drawFrame];
75 } 75 }
76 76
77 - (void)reshape { 77 - (void)reshape {
78 [super reshape]; 78 [super reshape];
79 NSRect frame = [self frame]; 79 NSRect frame = [self frame];
80 [self ensureGLContext];
80 CGLLockContext([[self openGLContext] CGLContextObj]); 81 CGLLockContext([[self openGLContext] CGLContextObj]);
81 glViewport(0, 0, frame.size.width, frame.size.height); 82 glViewport(0, 0, frame.size.width, frame.size.height);
82 CGLUnlockContext([[self openGLContext] CGLContextObj]); 83 CGLUnlockContext([[self openGLContext] CGLContextObj]);
83 } 84 }
84 85
85 - (void)lockFocus { 86 - (void)lockFocus {
86 NSOpenGLContext *context = [self openGLContext]; 87 NSOpenGLContext *context = [self openGLContext];
87 [super lockFocus]; 88 [super lockFocus];
88 if ([context view] != self) { 89 if ([context view] != self) {
89 [context setView:self]; 90 [context setView:self];
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 NSOpenGLContext* context = [self openGLContext]; 185 NSOpenGLContext* context = [self openGLContext];
185 NSAssert(context, @"context shouldn't be nil"); 186 NSAssert(context, @"context shouldn't be nil");
186 if ([NSOpenGLContext currentContext] != context) { 187 if ([NSOpenGLContext currentContext] != context) {
187 [context makeCurrentContext]; 188 [context makeCurrentContext];
188 } 189 }
189 } 190 }
190 191
191 @end 192 @end
192 193
193 #endif // !TARGET_OS_IPHONE 194 #endif // !TARGET_OS_IPHONE
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698