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

Side by Side Diff: ui/gl/gl_context_cgl.cc

Issue 303543004: MacViews: views_examples_with_content_exe working! Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add files Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/mac/point_utils.mm ('k') | ui/gl/gl_surface_cgl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gl/gl_context_cgl.h" 5 #include "ui/gl/gl_context_cgl.h"
6 6
7 #include <OpenGL/CGLRenderers.h> 7 #include <OpenGL/CGLRenderers.h>
8 #include <OpenGL/CGLTypes.h> 8 #include <OpenGL/CGLTypes.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 format, 109 format,
110 share_context ? 110 share_context ?
111 static_cast<CGLContextObj>(share_context->GetHandle()) : NULL, 111 static_cast<CGLContextObj>(share_context->GetHandle()) : NULL,
112 reinterpret_cast<CGLContextObj*>(&context_)); 112 reinterpret_cast<CGLContextObj*>(&context_));
113 if (res != kCGLNoError) { 113 if (res != kCGLNoError) {
114 LOG(ERROR) << "Error creating context."; 114 LOG(ERROR) << "Error creating context.";
115 Destroy(); 115 Destroy();
116 return false; 116 return false;
117 } 117 }
118 118
119 // For transparent windows.
120 GLint opaque = 0;
121 CGLSetParameter(
122 static_cast<CGLContextObj>(context_), kCGLCPSurfaceOpacity, &opaque);
123
119 gpu_preference_ = gpu_preference; 124 gpu_preference_ = gpu_preference;
120 return true; 125 return true;
121 } 126 }
122 127
123 void GLContextCGL::Destroy() { 128 void GLContextCGL::Destroy() {
124 if (discrete_pixelformat_) { 129 if (discrete_pixelformat_) {
125 // Delay releasing the pixel format for 10 seconds to reduce the number of 130 // Delay releasing the pixel format for 10 seconds to reduce the number of
126 // unnecessary GPU switches. 131 // unnecessary GPU switches.
127 base::MessageLoop::current()->PostDelayedTask( 132 base::MessageLoop::current()->PostDelayedTask(
128 FROM_HERE, 133 FROM_HERE,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 301
297 GLContextCGL::~GLContextCGL() { 302 GLContextCGL::~GLContextCGL() {
298 Destroy(); 303 Destroy();
299 } 304 }
300 305
301 GpuPreference GLContextCGL::GetGpuPreference() { 306 GpuPreference GLContextCGL::GetGpuPreference() {
302 return gpu_preference_; 307 return gpu_preference_;
303 } 308 }
304 309
305 } // namespace gfx 310 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/mac/point_utils.mm ('k') | ui/gl/gl_surface_cgl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698