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

Side by Side Diff: src/views/mac/SkNSView.mm

Issue 692803003: tell our grcontext to abandon its backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: call unref Created 6 years, 1 month 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 | « samplecode/SampleApp.cpp ('k') | no next file » | 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 * 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 //it must NOT be deferred or should have been on screen at least once) 379 //it must NOT be deferred or should have been on screen at least once)
380 if ([fGLContext view] != self && nil != self.window) { 380 if ([fGLContext view] != self && nil != self.window) {
381 [fGLContext setView:self]; 381 [fGLContext setView:self];
382 } 382 }
383 } 383 }
384 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType 384 - (bool)attach:(SkOSWindow::SkBackEndTypes)attachType
385 withMSAASampleCount:(int) sampleCount 385 withMSAASampleCount:(int) sampleCount
386 andGetInfo:(SkOSWindow::AttachmentInfo*) info { 386 andGetInfo:(SkOSWindow::AttachmentInfo*) info {
387 if (nil == fGLContext) { 387 if (nil == fGLContext) {
388 CGLContextObj ctx = createGLContext(sampleCount); 388 CGLContextObj ctx = createGLContext(sampleCount);
389 SkASSERT(ctx);
389 fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx]; 390 fGLContext = [[NSOpenGLContext alloc] initWithCGLContextObj:ctx];
390 CGLReleaseContext(ctx); 391 CGLReleaseContext(ctx);
391 if (NULL == fGLContext) { 392 if (NULL == fGLContext) {
392 return false; 393 return false;
393 } 394 }
394 [fGLContext setView:self]; 395 [fGLContext setView:self];
395 } 396 }
396 397
397 [fGLContext makeCurrentContext]; 398 [fGLContext makeCurrentContext];
398 CGLPixelFormatObj format = CGLGetPixelFormat((CGLContextObj)[fGLContext CGLC ontextObj]); 399 CGLPixelFormatObj format = CGLGetPixelFormat((CGLContextObj)[fGLContext CGLC ontextObj]);
(...skipping 14 matching lines...) Expand all
413 [fGLContext release]; 414 [fGLContext release];
414 fGLContext = nil; 415 fGLContext = nil;
415 } 416 }
416 417
417 - (void)present { 418 - (void)present {
418 if (nil != fGLContext) { 419 if (nil != fGLContext) {
419 [fGLContext flushBuffer]; 420 [fGLContext flushBuffer];
420 } 421 }
421 } 422 }
422 @end 423 @end
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698