OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "ui/gl/gl_surface_nsview.h" | |
6 | |
7 #import <AppKit/NSOpenGL.h> | |
8 #import <AppKit/NSView.h> | |
9 | |
10 #include "base/debug/trace_event.h" | |
11 #include "ui/gl/gl_context_nsview.h" | |
12 | |
13 namespace gfx { | |
14 | |
15 GLSurfaceNSView::GLSurfaceNSView(AcceleratedWidget view) | |
16 : view_(view), | |
17 context_(NULL) { | |
18 } | |
19 | |
20 GLSurfaceNSView::~GLSurfaceNSView() { | |
21 } | |
22 | |
23 void GLSurfaceNSView::Destroy() { | |
24 } | |
25 | |
26 bool GLSurfaceNSView::IsOffscreen() { | |
27 return false; | |
28 } | |
29 | |
30 bool GLSurfaceNSView::SwapBuffers() { | |
31 TRACE_EVENT2("gpu", "GLSurfaceNSView:RealSwapBuffers", | |
32 "width", GetSize().width(), | |
33 "height", GetSize().height()); | |
34 context_->FlushBuffer(); | |
35 return true; | |
36 } | |
37 | |
38 gfx::Size GLSurfaceNSView::GetSize() { | |
39 return gfx::Size(NSSizeToCGSize([view_ bounds].size)); | |
40 } | |
41 | |
42 void* GLSurfaceNSView::GetHandle() { | |
43 return view_; | |
44 } | |
45 | |
46 bool GLSurfaceNSView::OnMakeCurrent(GLContext* context) { | |
47 context_ = static_cast<GLContextNSView *>(context); | |
48 return true; | |
49 } | |
50 | |
51 } // namespace gfx | |
OLD | NEW |