Permalink
Browse files

[droid] add nasty EGL changes. This needs to be redone.

  • Loading branch information...
Cory Fields
Cory Fields committed Jul 12, 2012
1 parent 9f0558d commit f6ecaea0a4b653acf7d50512f7d8f7919c803c87
@@ -33,7 +33,8 @@ typedef enum _WindowSystemType
WINDOW_SYSTEM_IOS,
WINDOW_SYSTEM_X11,
WINDOW_SYSTEM_SDL,
- WINDOW_SYSTEM_EGL
+ WINDOW_SYSTEM_EGL,
+ WINDOW_SYSTEM_ANDROID
} WindowSystemType;
struct RESOLUTION_WHR
@@ -36,7 +36,7 @@
#elif defined(TARGET_LINUX) && defined(HAS_GLES) && defined(HAVE_X11)
#include "X11/WinSystemX11GLES.h"
-#elif defined(TARGET_LINUX) && defined(HAS_GLES) && defined(HAS_EGL)
+#elif defined(TARGET_LINUX) && defined(HAS_GLES) && defined(HAS_EGL)
#include "egl/WinSystemGLES.h"
#elif defined(TARGET_FREEBSD) && defined(HAS_GL) && defined(HAVE_X11)
@@ -1,9 +1,10 @@
-INCLUDES=-I. -I../.. -I../../linux
+INCLUDES=-I.
-SRCS=WinBindingEGL.cpp \
- WinSystemGLES.cpp \
+SRCS = WinSystemGLES.cpp
+SRCS+= WinEGLPlatformGeneric.cpp
+SRCS+= WinEGLPlatformAndroid.cpp
-LIB=windowing_egl.a
+LIB = windowing_egl.a
include ../../../Makefile.include
-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))
@@ -0,0 +1,39 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#ifdef HAS_EGL
+
+#include "system.h"
+
+#if defined(TARGET_ANDROID)
+ #include "xbmc/windowing/egl/WinEGLPlatformAndroid.h"
+ class CWinEGLPlatformAndroid;
+ #define CWinEGLPlatform CWinEGLPlatformAndroid
+
+#else
+ #include "xbmc/windowing/egl/WinEGLPlatformGeneric.h"
+ class CWinEGLPlatformGeneric;
+ #define CWinEGLPlatform CWinEGLPlatformGeneric
+
+#endif
+
+#endif
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include <unistd.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <linux/fb.h>
+#include <sys/ioctl.h>
+
+#include "WinEGLPlatformAndroid.h"
+#include "android/activity/XBMCApp.h"
+////////////////////////////////////////////////////////////////////////////////////////////
+EGLNativeWindowType CWinEGLPlatformAndroid::InitWindowSystem(EGLNativeDisplayType nativeDisplay, int width, int height, int bpp)
+{
+ if (CXBMCApp::GetNativeWindow() == NULL)
+ return 0;
+
+ CWinEGLPlatformGeneric::InitWindowSystem(nativeDisplay, width, height, bpp);
+
+ return getNativeWindow();
+}
+
+void CWinEGLPlatformAndroid::DestroyWindowSystem(EGLNativeWindowType native_window)
+{
+ CWinEGLPlatformGeneric::DestroyWindowSystem(native_window);
+}
+
+bool CWinEGLPlatformAndroid::ClampToGUIDisplayLimits(int &width, int &height)
+{
+ return false;
+}
+
+bool CWinEGLPlatformAndroid::CreateWindow()
+{
+ EGLint format;
+ // EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is
+ // guaranteed to be accepted by ANativeWindow_setBuffersGeometry().
+ // As soon as we picked a EGLConfig, we can safely reconfigure the
+ // ANativeWindow buffers to match, using EGL_NATIVE_VISUAL_ID.
+ eglGetConfigAttrib(m_display, m_config, EGL_NATIVE_VISUAL_ID, &format);
+
+ CXBMCApp::SetBuffersGeometry(0, 0, format);
+
+ CWinEGLPlatformGeneric::CreateWindow();
+ return true;
+}
+
+EGLNativeWindowType CWinEGLPlatformAndroid::getNativeWindow()
+{
+ return (EGLNativeWindowType)CXBMCApp::GetNativeWindow();
+}
@@ -0,0 +1,40 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#if defined(TARGET_ANDROID)
+
+#include "WinEGLPlatformGeneric.h"
+
+class CWinEGLPlatformAndroid : public CWinEGLPlatformGeneric
+{
+public:
+ virtual EGLNativeWindowType InitWindowSystem(EGLNativeDisplayType nativeDisplay, int width, int height, int bpp);
+ virtual void DestroyWindowSystem(EGLNativeWindowType native_window);
+ virtual bool ClampToGUIDisplayLimits(int &width, int &height);
+
+ virtual bool CreateWindow();
+
+protected:
+ virtual EGLNativeWindowType getNativeWindow();
+};
+
+#endif
Oops, something went wrong.

0 comments on commit f6ecaea

Please sign in to comment.