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

Unified Diff: ui/gl/gl_context_nsview.mm

Issue 227473009: Mac: Remove NSView support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_context_nsview.h ('k') | ui/gl/gl_surface_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_context_nsview.mm
diff --git a/ui/gl/gl_context_nsview.mm b/ui/gl/gl_context_nsview.mm
deleted file mode 100644
index bc4a87b910bcb277c3429cf1de309106d5e21c53..0000000000000000000000000000000000000000
--- a/ui/gl/gl_context_nsview.mm
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/gl/gl_context_nsview.h"
-
-#include <vector>
-
-#import <AppKit/NSOpenGL.h>
-#import <AppKit/NSView.h>
-
-#include "base/debug/trace_event.h"
-#include "base/logging.h"
-#include "ui/gl/gl_surface_nsview.h"
-
-namespace gfx {
-
-GLContextNSView::GLContextNSView(GLShareGroup* group)
- : GLContextReal(group) {
-}
-
-GLContextNSView::~GLContextNSView() {
-}
-
-bool GLContextNSView::Initialize(GLSurface* surface,
- GpuPreference gpu_preference) {
- DCHECK(!context_) << "NSGLContext was previously initialized.";
- gpu_preference_ = gpu_preference;
-
- std::vector<NSOpenGLPixelFormatAttribute> attributes;
- attributes.push_back(NSOpenGLPFAAccelerated);
- attributes.push_back(NSOpenGLPFADoubleBuffer);
- attributes.push_back(0);
-
- base::scoped_nsobject<NSOpenGLPixelFormat> pixel_format;
- pixel_format.reset([[NSOpenGLPixelFormat alloc]
- initWithAttributes:&attributes.front()]);
- if (!pixel_format) {
- LOG(ERROR) << "NSOpenGLPixelFormat initWithAttributes failed.";
- return false;
- }
-
- context_.reset([[NSOpenGLContext alloc] initWithFormat:pixel_format
- shareContext:nil]);
- if (!context_) {
- LOG(ERROR) << "NSOpenGLContext initWithFormat failed";
- return false;
- }
-
- return true;
-}
-
-void GLContextNSView::Destroy() {
- context_.reset(nil);
-}
-
-bool GLContextNSView::MakeCurrent(GLSurface* surface) {
- ScopedReleaseCurrent release_current;
- TRACE_EVENT0("gpu", "GLContextNSView::MakeCurrent");
- AcceleratedWidget view =
- static_cast<AcceleratedWidget>(surface->GetHandle());
- // Only set the context's view if the view is parented.
- // I.e. it is a valid drawable.
- if ([view window])
- [context_ setView:view];
- [context_ makeCurrentContext];
-
- SetRealGLApi();
- SetCurrent(surface);
- if (!InitializeDynamicBindings()) {
- return false;
- }
-
- if (!surface->OnMakeCurrent(this)) {
- LOG(ERROR) << "Unable to make gl context current.";
- return false;
- }
-
- release_current.Cancel();
- return true;
-}
-
-void GLContextNSView::ReleaseCurrent(GLSurface* surface) {
- [NSOpenGLContext clearCurrentContext];
-}
-
-bool GLContextNSView::IsCurrent(GLSurface* surface) {
- return context_ == [NSOpenGLContext currentContext];
-}
-
-void* GLContextNSView::GetHandle() {
- return context_;
-}
-
-void GLContextNSView::SetSwapInterval(int interval) {
- DCHECK(interval == 0 || interval == 1);
- GLint swap = interval;
- [context_ setValues:&swap forParameter:NSOpenGLCPSwapInterval];
-}
-
-void GLContextNSView::FlushBuffer() {
- [context_ flushBuffer];
-}
-
-} // namespace gfx
« no previous file with comments | « ui/gl/gl_context_nsview.h ('k') | ui/gl/gl_surface_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698