Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/utils/win/SkWGL_win.cpp

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/utils/win/SkIStream.cpp ('k') | src/views/SkOSMenu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 int coreProfileAttribs[] = { 360 int coreProfileAttribs[] = {
361 SK_WGL_CONTEXT_MAJOR_VERSION, -1, 361 SK_WGL_CONTEXT_MAJOR_VERSION, -1,
362 SK_WGL_CONTEXT_MINOR_VERSION, -1, 362 SK_WGL_CONTEXT_MINOR_VERSION, -1,
363 SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT, 363 SK_WGL_CONTEXT_PROFILE_MASK, SK_WGL_CONTEXT_CORE_PROFILE_BIT,
364 0, 364 0,
365 }; 365 };
366 for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) { 366 for (int v = 0; v < SK_ARRAY_COUNT(kCoreGLVersions) / 2; ++v) {
367 coreProfileAttribs[1] = kCoreGLVersions[2 * v]; 367 coreProfileAttribs[1] = kCoreGLVersions[2 * v];
368 coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1]; 368 coreProfileAttribs[3] = kCoreGLVersions[2 * v + 1];
369 glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttr ibs); 369 glrc = extensions.createContextAttribs(dc, NULL, coreProfileAttr ibs);
370 if (NULL != glrc) { 370 if (glrc) {
371 break; 371 break;
372 } 372 }
373 } 373 }
374 } 374 }
375 } 375 }
376 376
377 if (NULL == glrc) { 377 if (NULL == glrc) {
378 glrc = wglCreateContext(dc); 378 glrc = wglCreateContext(dc);
379 } 379 }
380 SkASSERT(glrc); 380 SkASSERT(glrc);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 // try for single buffer first 423 // try for single buffer first
424 for (int dblBuffer = 0; dblBuffer < 2; ++dblBuffer) { 424 for (int dblBuffer = 0; dblBuffer < 2; ++dblBuffer) {
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 (NULL != dc) { 432 if (dc) {
433 HGLRC glrc = create_gl_context(dc, extensions, contextType); 433 HGLRC glrc = create_gl_context(dc, extensions, contextType);
434 if (NULL != glrc) { 434 if (glrc) {
435 return SkNEW_ARGS(SkWGLPbufferContext, (pbuf, dc, glrc)) ; 435 return SkNEW_ARGS(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 }
OLDNEW
« no previous file with comments | « src/utils/win/SkIStream.cpp ('k') | src/views/SkOSMenu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698