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

Unified Diff: ui/gl/gl_surface_mac.cc

Issue 2047283003: Move GLSurface creation from //ui/gl to //ui/gl/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gl_context
Patch Set: Fix Ozone CreateViewGLSurface logic. Created 4 years, 6 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_surface_android.cc ('k') | ui/gl/gl_surface_osmesa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_mac.cc
diff --git a/ui/gl/gl_surface_mac.cc b/ui/gl/gl_surface_mac.cc
deleted file mode 100644
index f38f6dc64538d7e7ec3f84751d1516f778a56e97..0000000000000000000000000000000000000000
--- a/ui/gl/gl_surface_mac.cc
+++ /dev/null
@@ -1,107 +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_surface.h"
-
-#include <memory>
-
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/trace_event/trace_event.h"
-#include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_export.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_surface_osmesa.h"
-#include "ui/gl/gl_surface_stub.h"
-
-namespace gl {
-namespace {
-
-// A "no-op" surface. It is not required that a CGLContextObj have an
-// associated drawable (pbuffer or fullscreen context) in order to be
-// made current. Everywhere this surface type is used, we allocate an
-// FBO at the user level as the drawable of the associated context.
-class GL_EXPORT NoOpGLSurface : public GLSurface {
- public:
- explicit NoOpGLSurface(const gfx::Size& size) : size_(size) {}
-
- // Implement GLSurface.
- bool Initialize(GLSurface::Format format) override { return true; }
- void Destroy() override {}
- bool IsOffscreen() override { return true; }
- gfx::SwapResult SwapBuffers() override {
- NOTREACHED() << "Cannot call SwapBuffers on a NoOpGLSurface.";
- return gfx::SwapResult::SWAP_FAILED;
- }
- gfx::Size GetSize() override { return size_; }
- void* GetHandle() override { return NULL; }
- void* GetDisplay() override { return NULL; }
- bool IsSurfaceless() const override { return true; }
-
- protected:
- ~NoOpGLSurface() override {}
-
- private:
- gfx::Size size_;
-
- DISALLOW_COPY_AND_ASSIGN(NoOpGLSurface);
-};
-
-} // namespace
-
-scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
- gfx::AcceleratedWidget window) {
- TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface");
- switch (GetGLImplementation()) {
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile:
- case kGLImplementationAppleGL: {
- NOTIMPLEMENTED() << "No onscreen support on Mac.";
- return NULL;
- }
- case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless());
- if (!surface->Initialize())
- return NULL;
- return surface;
- }
- case kGLImplementationMockGL:
- return new GLSurfaceStub;
- default:
- NOTREACHED();
- return NULL;
- }
-}
-
-scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
- const gfx::Size& size) {
- TRACE_EVENT0("gpu", "GLSurface::CreateOffscreenGLSurface");
- switch (GetGLImplementation()) {
- case kGLImplementationOSMesaGL: {
- scoped_refptr<GLSurface> surface(
- new GLSurfaceOSMesa(SURFACE_OSMESA_RGBA, size));
- if (!surface->Initialize())
- return NULL;
-
- return surface;
- }
- case kGLImplementationDesktopGL:
- case kGLImplementationDesktopGLCoreProfile:
- case kGLImplementationAppleGL: {
- scoped_refptr<GLSurface> surface(new NoOpGLSurface(size));
- if (!surface->Initialize())
- return NULL;
-
- return surface;
- }
- case kGLImplementationMockGL:
- return new GLSurfaceStub;
- default:
- NOTREACHED();
- return NULL;
- }
-}
-
-} // namespace gl
« no previous file with comments | « ui/gl/gl_surface_android.cc ('k') | ui/gl/gl_surface_osmesa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698