OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkWGL.h" | 9 #include "SkWGL.h" |
10 | 10 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 int pixelFormatsToTry[] = { -1, -1 }; | 425 int pixelFormatsToTry[] = { -1, -1 }; |
426 get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSam
pleCount, | 426 get_pixel_formats_to_try(parentDC, extensions, (0 != dblBuffer), msaaSam
pleCount, |
427 pixelFormatsToTry); | 427 pixelFormatsToTry); |
428 for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFo
rmatsToTry); ++f) { | 428 for (int f = 0; -1 != pixelFormatsToTry[f] && f < SK_ARRAY_COUNT(pixelFo
rmatsToTry); ++f) { |
429 HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry
[f], 1, 1, NULL); | 429 HPBUFFER pbuf = extensions.createPbuffer(parentDC, pixelFormatsToTry
[f], 1, 1, NULL); |
430 if (0 != pbuf) { | 430 if (0 != pbuf) { |
431 HDC dc = extensions.getPbufferDC(pbuf); | 431 HDC dc = extensions.getPbufferDC(pbuf); |
432 if (dc) { | 432 if (dc) { |
433 HGLRC glrc = create_gl_context(dc, extensions, contextType); | 433 HGLRC glrc = create_gl_context(dc, extensions, contextType); |
434 if (glrc) { | 434 if (glrc) { |
435 return SkNEW_ARGS(SkWGLPbufferContext, (pbuf, dc, glrc))
; | 435 return new SkWGLPbufferContext(pbuf, dc, glrc); |
436 } | 436 } |
437 extensions.releasePbufferDC(pbuf, dc); | 437 extensions.releasePbufferDC(pbuf, dc); |
438 } | 438 } |
439 extensions.destroyPbuffer(pbuf); | 439 extensions.destroyPbuffer(pbuf); |
440 } | 440 } |
441 } | 441 } |
442 } | 442 } |
443 return NULL; | 443 return NULL; |
444 } | 444 } |
445 | 445 |
446 SkWGLPbufferContext::~SkWGLPbufferContext() { | 446 SkWGLPbufferContext::~SkWGLPbufferContext() { |
447 SkASSERT(fExtensions.hasExtension(fDC, "WGL_ARB_pbuffer")); | 447 SkASSERT(fExtensions.hasExtension(fDC, "WGL_ARB_pbuffer")); |
448 wglDeleteContext(fGLRC); | 448 wglDeleteContext(fGLRC); |
449 fExtensions.releasePbufferDC(fPbuffer, fDC); | 449 fExtensions.releasePbufferDC(fPbuffer, fDC); |
450 fExtensions.destroyPbuffer(fPbuffer); | 450 fExtensions.destroyPbuffer(fPbuffer); |
451 } | 451 } |
452 | 452 |
453 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc) | 453 SkWGLPbufferContext::SkWGLPbufferContext(HPBUFFER pbuffer, HDC dc, HGLRC glrc) |
454 : fPbuffer(pbuffer) | 454 : fPbuffer(pbuffer) |
455 , fDC(dc) | 455 , fDC(dc) |
456 , fGLRC(glrc) { | 456 , fGLRC(glrc) { |
457 } | 457 } |
OLD | NEW |