OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #import "SkNSView.h" | 8 #import "SkNSView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 #include <OpenGL/OpenGL.h> | 330 #include <OpenGL/OpenGL.h> |
331 | 331 |
332 static CGLContextObj createGLContext(int msaaSampleCount) { | 332 static CGLContextObj createGLContext(int msaaSampleCount) { |
333 GLint major, minor; | 333 GLint major, minor; |
334 CGLGetVersion(&major, &minor); | 334 CGLGetVersion(&major, &minor); |
335 | 335 |
336 static const CGLPixelFormatAttribute attributes[] = { | 336 static const CGLPixelFormatAttribute attributes[] = { |
337 kCGLPFAStencilSize, (CGLPixelFormatAttribute) 8, | 337 kCGLPFAStencilSize, (CGLPixelFormatAttribute) 8, |
338 kCGLPFAAccelerated, | 338 kCGLPFAAccelerated, |
339 kCGLPFADoubleBuffer, | 339 kCGLPFADoubleBuffer, |
| 340 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, |
340 (CGLPixelFormatAttribute)0 | 341 (CGLPixelFormatAttribute)0 |
341 }; | 342 }; |
342 | 343 |
343 CGLPixelFormatObj format; | 344 CGLPixelFormatObj format; |
344 GLint npix = 0; | 345 GLint npix = 0; |
345 if (msaaSampleCount > 0) { | 346 if (msaaSampleCount > 0) { |
346 static int kAttributeCount = SK_ARRAY_COUNT(attributes); | 347 static int kAttributeCount = SK_ARRAY_COUNT(attributes); |
347 CGLPixelFormatAttribute msaaAttributes[kAttributeCount + 5]; | 348 CGLPixelFormatAttribute msaaAttributes[kAttributeCount + 5]; |
348 memcpy(msaaAttributes, attributes, sizeof(attributes)); | 349 memcpy(msaaAttributes, attributes, sizeof(attributes)); |
349 SkASSERT(0 == msaaAttributes[kAttributeCount - 1]); | 350 SkASSERT(0 == msaaAttributes[kAttributeCount - 1]); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 } | 421 } |
421 | 422 |
422 - (void)setVSync:(bool)enable { | 423 - (void)setVSync:(bool)enable { |
423 if (fGLContext) { | 424 if (fGLContext) { |
424 GLint interval = enable ? 1 : 0; | 425 GLint interval = enable ? 1 : 0; |
425 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; | 426 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; |
426 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); | 427 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); |
427 } | 428 } |
428 } | 429 } |
429 @end | 430 @end |
OLD | NEW |