OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/gl/gl_context_nsview.h" | 5 #include "ui/gfx/gl/gl_context_nsview.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #import <AppKit/NSOpenGL.h> | 9 #import <AppKit/NSOpenGL.h> |
10 #import <AppKit/NSView.h> | 10 #import <AppKit/NSView.h> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 return true; | 49 return true; |
50 } | 50 } |
51 | 51 |
52 void GLContextNSView::Destroy() { | 52 void GLContextNSView::Destroy() { |
53 context_.reset(nil); | 53 context_.reset(nil); |
54 } | 54 } |
55 | 55 |
56 bool GLContextNSView::MakeCurrent(GLSurface* surface) { | 56 bool GLContextNSView::MakeCurrent(GLSurface* surface) { |
57 PluginWindowHandle view = | 57 AcceleratedWidget view = |
58 static_cast<PluginWindowHandle>(surface->GetHandle()); | 58 static_cast<AcceleratedWidget>(surface->GetHandle()); |
59 // Only set the context's view if the view is parented. | 59 // Only set the context's view if the view is parented. |
60 // I.e. it is a valid drawable. | 60 // I.e. it is a valid drawable. |
61 if ([view window]) | 61 if ([view window]) |
62 [context_ setView:view]; | 62 [context_ setView:view]; |
63 [context_ makeCurrentContext]; | 63 [context_ makeCurrentContext]; |
64 | 64 |
65 SetCurrent(this, surface); | 65 SetCurrent(this, surface); |
66 | 66 |
67 if (!surface->OnMakeCurrent(this)) { | 67 if (!surface->OnMakeCurrent(this)) { |
68 LOG(ERROR) << "Unable to make gl context current."; | 68 LOG(ERROR) << "Unable to make gl context current."; |
(...skipping 19 matching lines...) Expand all Loading... |
88 DCHECK(interval == 0 || interval == 1); | 88 DCHECK(interval == 0 || interval == 1); |
89 GLint swap = interval; | 89 GLint swap = interval; |
90 [context_ setValues:&swap forParameter:NSOpenGLCPSwapInterval]; | 90 [context_ setValues:&swap forParameter:NSOpenGLCPSwapInterval]; |
91 } | 91 } |
92 | 92 |
93 void GLContextNSView::FlushBuffer() { | 93 void GLContextNSView::FlushBuffer() { |
94 [context_ flushBuffer]; | 94 [context_ flushBuffer]; |
95 } | 95 } |
96 | 96 |
97 } // namespace gfx | 97 } // namespace gfx |
OLD | NEW |