Index: src/views/mac/SkNSView.mm |
diff --git a/src/views/mac/SkNSView.mm b/src/views/mac/SkNSView.mm |
index 7ca23f40e523fb98096abb2c3ad502b38239182d..e9e486a2085b5835b2e8610d678c731a295d474b 100644 |
--- a/src/views/mac/SkNSView.mm |
+++ b/src/views/mac/SkNSView.mm |
@@ -329,8 +329,7 @@ static unsigned convertNSModifiersToSk(NSUInteger nsModi) { |
/////////////////////////////////////////////////////////////////////////////// |
#include <OpenGL/OpenGL.h> |
-namespace { |
-CGLContextObj createGLContext(int msaaSampleCount) { |
+static CGLContextObj createGLContext(int msaaSampleCount) { |
GLint major, minor; |
CGLGetVersion(&major, &minor); |
@@ -369,7 +368,6 @@ CGLContextObj createGLContext(int msaaSampleCount) { |
CGLSetCurrentContext(ctx); |
return ctx; |
} |
-} |
- (void)viewDidMoveToWindow { |
[super viewDidMoveToWindow]; |
@@ -420,4 +418,12 @@ CGLContextObj createGLContext(int msaaSampleCount) { |
[fGLContext flushBuffer]; |
} |
} |
+ |
+- (void)setVSync:(bool)enable { |
+ if (fGLContext) { |
+ GLint interval = enable ? 1 : 0; |
+ CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; |
+ CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); |
+ } |
+} |
@end |