OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |