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

Unified Diff: ui/gl/gl_implementation_ozone.cc

Issue 13886018: Add a factory and defines for native Linux surfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 7 years, 7 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_implementation.cc ('k') | ui/gl/gl_surface_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_implementation_ozone.cc
diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_ozone.cc
similarity index 67%
copy from ui/gl/gl_implementation_android.cc
copy to ui/gl/gl_implementation_ozone.cc
index d948c5782f86963d0d8151d0a0f8f6c643d1f3b8..b3bdfc93f9a1ed01aa0adb5452144404deb1e262 100644
--- a/ui/gl/gl_implementation_android.cc
+++ b/ui/gl/gl_implementation_ozone.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/native_library.h"
#include "base/path_service.h"
+#include "ui/base/ozone/surface_factory_ozone.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_egl_api_implementation.h"
#include "ui/gl/gl_gl_api_implementation.h"
@@ -27,20 +28,6 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near,
glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far));
}
-base::NativeLibrary LoadLibrary(const base::FilePath& filename) {
- std::string error;
- base::NativeLibrary library = base::LoadNativeLibrary(filename, &error);
- if (!library) {
- DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error;
- return NULL;
- }
- return library;
-}
-
-base::NativeLibrary LoadLibrary(const char* filename) {
- return LoadLibrary(base::FilePath(filename));
-}
-
} // namespace
void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) {
@@ -55,32 +42,10 @@ bool InitializeGLBindings(GLImplementation implementation) {
return true;
switch (implementation) {
- case kGLImplementationEGLGLES2: {
- base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so");
- if (!gles_library)
- return false;
- base::NativeLibrary egl_library = LoadLibrary("libEGL.so");
- if (!egl_library) {
- base::UnloadNativeLibrary(gles_library);
- return false;
- }
-
- GLGetProcAddressProc get_proc_address =
- reinterpret_cast<GLGetProcAddressProc>(
- base::GetFunctionPointerFromNativeLibrary(
- egl_library, "eglGetProcAddress"));
- if (!get_proc_address) {
- LOG(ERROR) << "eglGetProcAddress not found.";
- base::UnloadNativeLibrary(egl_library);
- base::UnloadNativeLibrary(gles_library);
+ case kGLImplementationEGLGLES2:
+ if (!ui::SurfaceFactoryOzone::GetInstance()->LoadEGLGLES2Bindings())
return false;
- }
-
- SetGLGetProcAddressProc(get_proc_address);
- AddGLNativeLibrary(egl_library);
- AddGLNativeLibrary(gles_library);
SetGLImplementation(kGLImplementationEGLGLES2);
-
InitializeGLBindingsGL();
InitializeGLBindingsEGL();
@@ -89,7 +54,6 @@ bool InitializeGLBindings(GLImplementation implementation) {
::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf;
::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef;
break;
- }
case kGLImplementationMockGL: {
SetGLGetProcAddressProc(GetMockGLProcAddress);
SetGLImplementation(kGLImplementationMockGL);
@@ -97,7 +61,8 @@ bool InitializeGLBindings(GLImplementation implementation) {
break;
}
default:
- NOTIMPLEMENTED() << "InitializeGLBindings on Android";
+ NOTIMPLEMENTED()
+ << "Unsupported GL type for NativeSurfaceLinux GL implementation";
return false;
}
@@ -128,7 +93,6 @@ void ClearGLBindings() {
ClearGLBindingsEGL();
ClearGLBindingsGL();
SetGLImplementation(kGLImplementationNone);
-
UnloadGLNativeLibraries();
}
« no previous file with comments | « ui/gl/gl_implementation.cc ('k') | ui/gl/gl_surface_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698