| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 kCGLPFAStencilSize, (CGLPixelFormatAttribute) 8, | 337 kCGLPFAStencilSize, (CGLPixelFormatAttribute) 8, |
| 338 kCGLPFAAccelerated, | 338 kCGLPFAAccelerated, |
| 339 kCGLPFADoubleBuffer, | 339 kCGLPFADoubleBuffer, |
| 340 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, | 340 kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core
, |
| 341 (CGLPixelFormatAttribute)0 | 341 (CGLPixelFormatAttribute)0 |
| 342 }; | 342 }; |
| 343 | 343 |
| 344 CGLPixelFormatObj format; | 344 CGLPixelFormatObj format; |
| 345 GLint npix = 0; | 345 GLint npix = 0; |
| 346 if (msaaSampleCount > 0) { | 346 if (msaaSampleCount > 0) { |
| 347 static int kAttributeCount = SK_ARRAY_COUNT(attributes); | 347 static const int kAttributeCount = SK_ARRAY_COUNT(attributes); |
| 348 CGLPixelFormatAttribute msaaAttributes[kAttributeCount + 5]; | 348 CGLPixelFormatAttribute msaaAttributes[kAttributeCount + 5]; |
| 349 memcpy(msaaAttributes, attributes, sizeof(attributes)); | 349 memcpy(msaaAttributes, attributes, sizeof(attributes)); |
| 350 SkASSERT(0 == msaaAttributes[kAttributeCount - 1]); | 350 SkASSERT(0 == msaaAttributes[kAttributeCount - 1]); |
| 351 msaaAttributes[kAttributeCount - 1] = kCGLPFASampleBuffers; | 351 msaaAttributes[kAttributeCount - 1] = kCGLPFASampleBuffers; |
| 352 msaaAttributes[kAttributeCount + 0] = (CGLPixelFormatAttribute)1; | 352 msaaAttributes[kAttributeCount + 0] = (CGLPixelFormatAttribute)1; |
| 353 msaaAttributes[kAttributeCount + 1] = kCGLPFAMultisample; | 353 msaaAttributes[kAttributeCount + 1] = kCGLPFAMultisample; |
| 354 msaaAttributes[kAttributeCount + 2] = kCGLPFASamples; | 354 msaaAttributes[kAttributeCount + 2] = kCGLPFASamples; |
| 355 msaaAttributes[kAttributeCount + 3] = | 355 msaaAttributes[kAttributeCount + 3] = |
| 356 (CGLPixelFormatAttribute)msaaSampleCount; | 356 (CGLPixelFormatAttribute)msaaSampleCount; |
| 357 msaaAttributes[kAttributeCount + 4] = (CGLPixelFormatAttribute)0; | 357 msaaAttributes[kAttributeCount + 4] = (CGLPixelFormatAttribute)0; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 } | 421 } |
| 422 | 422 |
| 423 - (void)setVSync:(bool)enable { | 423 - (void)setVSync:(bool)enable { |
| 424 if (fGLContext) { | 424 if (fGLContext) { |
| 425 GLint interval = enable ? 1 : 0; | 425 GLint interval = enable ? 1 : 0; |
| 426 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; | 426 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; |
| 427 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); | 427 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 @end | 430 @end |
| OLD | NEW |