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

Unified Diff: tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp

Issue 1850543003: Revert of rename sk_gpu_test::GLContext to sk_gpu_test::GLTestContext (Closed) Base URL: https://chromium.googlesource.com/skia.git@move
Patch Set: Created 4 years, 9 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 | « tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp ('k') | tools/gpu/gl/mesa/GLContext_mesa.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
diff --git a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp b/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
deleted file mode 100644
index b2cdaacd8ad1afcdc8397f05002df4874bb67591..0000000000000000000000000000000000000000
--- a/tools/gpu/gl/mac/CreatePlatformGLTestContext_mac.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkTypes.h"
-
-#include "gl/GLTestContext.h"
-#include "AvailabilityMacros.h"
-
-#include <OpenGL/OpenGL.h>
-#include <dlfcn.h>
-
-namespace {
-class MacGLTestContext : public sk_gpu_test::GLTestContext {
-public:
- MacGLTestContext();
- ~MacGLTestContext() override;
-
-private:
- void destroyGLContext();
-
- void onPlatformMakeCurrent() const override;
- void onPlatformSwapBuffers() const override;
- GrGLFuncPtr onPlatformGetProcAddress(const char*) const override;
-
- CGLContextObj fContext;
- void* fGLLibrary;
-};
-
-MacGLTestContext::MacGLTestContext()
- : fContext(nullptr)
- , fGLLibrary(RTLD_DEFAULT) {
- CGLPixelFormatAttribute attributes[] = {
-#if MAC_OS_X_VERSION_10_7
- kCGLPFAOpenGLProfile, (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core,
-#endif
- kCGLPFADoubleBuffer,
- (CGLPixelFormatAttribute)0
- };
- CGLPixelFormatObj pixFormat;
- GLint npix;
-
- CGLChoosePixelFormat(attributes, &pixFormat, &npix);
-
- if (nullptr == pixFormat) {
- SkDebugf("CGLChoosePixelFormat failed.");
- return;
- }
-
- CGLCreateContext(pixFormat, nullptr, &fContext);
- CGLReleasePixelFormat(pixFormat);
-
- if (nullptr == fContext) {
- SkDebugf("CGLCreateContext failed.");
- return;
- }
-
- CGLSetCurrentContext(fContext);
-
- SkAutoTUnref<const GrGLInterface> gl(GrGLCreateNativeInterface());
- if (nullptr == gl.get()) {
- SkDebugf("Context could not create GL interface.\n");
- this->destroyGLContext();
- return;
- }
- if (!gl->validate()) {
- SkDebugf("Context could not validate GL interface.\n");
- this->destroyGLContext();
- return;
- }
-
- fGLLibrary = dlopen(
- "/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib",
- RTLD_LAZY);
-
- this->init(gl.release());
-}
-
-MacGLTestContext::~MacGLTestContext() {
- this->teardown();
- this->destroyGLContext();
-}
-
-void MacGLTestContext::destroyGLContext() {
- if (fContext) {
- CGLReleaseContext(fContext);
- fContext = nullptr;
- }
- if (RTLD_DEFAULT != fGLLibrary) {
- dlclose(fGLLibrary);
- }
-}
-
-void MacGLTestContext::onPlatformMakeCurrent() const {
- CGLSetCurrentContext(fContext);
-}
-
-void MacGLTestContext::onPlatformSwapBuffers() const {
- CGLFlushDrawable(fContext);
-}
-
-GrGLFuncPtr MacGLTestContext::onPlatformGetProcAddress(const char* procName) const {
- return reinterpret_cast<GrGLFuncPtr>(dlsym(fGLLibrary, procName));
-}
-
-} // anonymous namespace
-
-namespace sk_gpu_test {
-GLTestContext* CreatePlatformGLTestContext(GrGLStandard forcedGpuAPI,
- GLTestContext* shareContext) {
- SkASSERT(!shareContext);
- if (shareContext) {
- return nullptr;
- }
-
- if (kGLES_GrGLStandard == forcedGpuAPI) {
- return nullptr;
- }
- MacGLTestContext* ctx = new MacGLTestContext;
- if (!ctx->isValid()) {
- delete ctx;
- return nullptr;
- }
- return ctx;
-}
-} // namespace sk_gpu_test
« no previous file with comments | « tools/gpu/gl/mac/CreatePlatformGLContext_mac.cpp ('k') | tools/gpu/gl/mesa/GLContext_mesa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698