OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gfx/gl/gl_surface_nsview.h" | |
6 | |
7 #import <AppKit/NSView.h> | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/logging.h" | |
11 #include "base/mac/mac_util.h" | |
12 #include "ui/gfx/gl/gl_bindings.h" | |
13 #include "ui/gfx/gl/gl_context.h" | |
14 | |
15 namespace gfx { | |
16 | |
17 GLSurfaceNSView::GLSurfaceNSView(PluginWindowHandle view) | |
18 : view_(view) { | |
19 } | |
20 | |
21 GLSurfaceNSView::~GLSurfaceNSView() { | |
22 } | |
23 | |
24 void GLSurfaceNSView::Destroy() { | |
25 } | |
26 | |
27 bool GLSurfaceNSView::IsOffscreen() { | |
28 return false; | |
29 } | |
30 | |
31 bool GLSurfaceNSView::SwapBuffers() { | |
32 CGLContextObj cgl_context = CGLGetCurrentContext(); | |
Nico
2011/11/16 19:11:13
Is there some way to DCHECK that the right context
dhollowa
2011/11/16 19:59:18
Not really, no. The view doesn't expose accessors
| |
33 CGLFlushDrawable(cgl_context); | |
34 return true; | |
35 } | |
36 | |
37 gfx::Size GLSurfaceNSView::GetSize() { | |
38 NSRect bounds = [view_ bounds]; | |
39 return gfx::Size(bounds.size.width, bounds.size.height); | |
Nico
2011/11/16 19:11:13
Doesn't gfx::Size() have a constructor that takes
dhollowa
2011/11/16 19:59:18
Done.
| |
40 } | |
41 | |
42 void* GLSurfaceNSView::GetHandle() { | |
43 return view_; | |
44 } | |
45 | |
46 } // namespace gfx | |
OLD | NEW |