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

Side by Side Diff: ui/accelerated_widget_mac/io_surface_layer.mm

Issue 1164363005: Mac: Only allow NSOpenGLContext displaying on the main display (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add GPU switch Created 5 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/accelerated_widget_mac/io_surface_layer.h" 5 #include "ui/accelerated_widget_mac/io_surface_layer.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 #include <OpenGL/CGLIOSurface.h> 8 #include <OpenGL/CGLIOSurface.h>
9 #include <OpenGL/CGLRenderers.h> 9 #include <OpenGL/CGLRenderers.h>
10 #include <OpenGL/gl.h> 10 #include <OpenGL/gl.h>
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // IOSurfaceLayer 167 // IOSurfaceLayer
168 168
169 @implementation IOSurfaceLayer 169 @implementation IOSurfaceLayer
170 170
171 - (id)initWithClient:(ui::IOSurfaceLayerClient*)client 171 - (id)initWithClient:(ui::IOSurfaceLayerClient*)client
172 withScaleFactor:(float)scale_factor 172 withScaleFactor:(float)scale_factor
173 needsGLFinishWorkaround:(bool)needs_gl_finish_workaround { 173 needsGLFinishWorkaround:(bool)needs_gl_finish_workaround {
174 if (self = [super init]) { 174 if (self = [super init]) {
175 helper_.reset(new ui::IOSurfaceLayerHelper(client, self)); 175 helper_.reset(new ui::IOSurfaceLayerHelper(client, self));
176 176
177 iosurface_ = ui::IOSurfaceTexture::Create(needs_gl_finish_workaround); 177 iosurface_ = ui::IOSurfaceTexture::Create(
178 needs_gl_finish_workaround, false);
178 context_ = ui::IOSurfaceContext::Get( 179 context_ = ui::IOSurfaceContext::Get(
179 ui::IOSurfaceContext::kCALayerContext); 180 ui::IOSurfaceContext::kCALayerContext);
180 if (!iosurface_.get() || !context_.get()) { 181 if (!iosurface_.get() || !context_.get()) {
181 LOG(ERROR) << "Failed create CompositingIOSurface or context"; 182 LOG(ERROR) << "Failed create CompositingIOSurface or context";
182 [self resetClient]; 183 [self resetClient];
183 [self release]; 184 [self release];
184 return nil; 185 return nil;
185 } 186 }
186 187
187 [self setAnchorPoint:CGPointMake(0, 0)]; 188 [self setAnchorPoint:CGPointMake(0, 0)];
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (helper_) 294 if (helper_)
294 helper_->DidDraw(draw_succeeded); 295 helper_->DidDraw(draw_succeeded);
295 296
296 [super drawInCGLContext:glContext 297 [super drawInCGLContext:glContext
297 pixelFormat:pixelFormat 298 pixelFormat:pixelFormat
298 forLayerTime:timeInterval 299 forLayerTime:timeInterval
299 displayTime:timeStamp]; 300 displayTime:timeStamp];
300 } 301 }
301 302
302 @end 303 @end
OLDNEW
« no previous file with comments | « ui/accelerated_widget_mac/accelerated_widget_mac.mm ('k') | ui/accelerated_widget_mac/io_surface_ns_gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698