aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCory Fields <theuni-nospam-@xbmc.org>2013-08-08 20:32:06 -0400
committerCory Fields <theuni-nospam-@xbmc.org>2013-08-08 20:32:06 -0400
commit2d6913cf27d620b9b52990ef0889a61155479b0d (patch)
tree4c9a1329f68d4834d00be41806a3c81cacefa55a
parent6bbe0ba7c50746dfd29b4b78f6c7e0463cc4735c (diff)
jni: fill in Surface class
-rw-r--r--xbmc/android/jni/Context.cpp2
-rw-r--r--xbmc/android/jni/Surface.cpp59
-rw-r--r--xbmc/android/jni/Surface.h24
3 files changed, 73 insertions, 12 deletions
diff --git a/xbmc/android/jni/Context.cpp b/xbmc/android/jni/Context.cpp
index b0de7cc994..3a41b0c380 100644
--- a/xbmc/android/jni/Context.cpp
+++ b/xbmc/android/jni/Context.cpp
@@ -36,6 +36,7 @@
#include "Cursor.h"
#include "ConnectivityManager.h"
#include "AudioManager.h"
+#include "Surface.h"
#include <android/native_activity.h>
@@ -70,6 +71,7 @@ void CJNIContext::PopulateStaticFields()
CJNIContentResolver::PopulateStaticFields();
CJNIConnectivityManager::PopulateStaticFields();
CJNIAudioManager::PopulateStaticFields();
+ CJNISurface::PopulateStaticFields();
}
CJNIPackageManager CJNIContext::GetPackageManager()
diff --git a/xbmc/android/jni/Surface.cpp b/xbmc/android/jni/Surface.cpp
index 07fef75a72..5e49e629ce 100644
--- a/xbmc/android/jni/Surface.cpp
+++ b/xbmc/android/jni/Surface.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * 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
@@ -18,27 +18,70 @@
*
*/
+#include "JNIBase.h"
#include "Surface.h"
#include "SurfaceTexture.h"
+
#include "jutils/jutils-details.hpp"
using namespace jni;
-CJNISurface::CJNISurface(CJNISurfaceTexture *surf_texture) : CJNIBase("android/view/Surface")
+int CJNISurface::ROTATION_0;
+int CJNISurface::ROTATION_90;
+int CJNISurface::ROTATION_180;
+int CJNISurface::ROTATION_270;
+const char* CJNISurface::m_classname = "android/view/Surface";
+
+void CJNISurface::PopulateStaticFields()
+{
+ jhclass clazz = find_class(m_classname);
+ ROTATION_0 = get_static_field<int>(clazz, "ROTATION_0");
+ ROTATION_90 = get_static_field<int>(clazz, "ROTATION_90");
+ ROTATION_180= get_static_field<int>(clazz, "ROTATION_180");
+ ROTATION_270= get_static_field<int>(clazz, "ROTATION_270");
+}
+
+
+CJNISurface::CJNISurface(const CJNISurfaceTexture &surfaceTexture) : CJNIBase(m_classname)
{
- m_object = new_object(GetClassName(),
- "<init>", "(Landroid/graphics/SurfaceTexture;)V",
- surf_texture->get_raw());
+ m_object = new_object(m_classname, "<init>", "(Landroid/graphics/SurfaceTexture;)V", surfaceTexture.get_raw());
m_object.setGlobal();
}
-CJNISurface::~CJNISurface()
+bool CJNISurface::isValid()
{
- release();
+ return call_method<jboolean>(m_object,
+ "isValid", "()Z");
}
void CJNISurface::release()
{
- call_method<jhobject>(m_object,
+ call_method<jboolean>(m_object,
"release", "()V");
}
+
+/*
+CJNICanvas CJNISurface::lockCanvas(const CJNIRect &rect)
+{
+}
+
+void CJNISurface::unlockCanvasAndPost(const CJNICanvas &canvas)
+{
+}
+
+void CJNISurface::unlockCanvas(const CJNICanvas &canvas)
+{
+}
+*/
+
+std::string CJNISurface::toString()
+{
+ return jcast<std::string>(call_method<jhstring>(m_object,
+ "toString", "()Ljava/lang/String;"));
+}
+
+int CJNISurface::describeContents()
+{
+ return call_method<int>(m_object,
+ "describeContents", "()I");
+}
diff --git a/xbmc/android/jni/Surface.h b/xbmc/android/jni/Surface.h
index af514c91f2..bddd57afe0 100644
--- a/xbmc/android/jni/Surface.h
+++ b/xbmc/android/jni/Surface.h
@@ -1,7 +1,7 @@
#pragma once
/*
* Copyright (C) 2013 Team XBMC
- * http://xbmc.org
+ * 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
@@ -25,8 +25,24 @@ class CJNISurfaceTexture;
class CJNISurface : public CJNIBase
{
public:
- CJNISurface(CJNISurfaceTexture *surf_texture);
- ~CJNISurface();
+ CJNISurface(const CJNISurfaceTexture &surfaceTexture);
+ CJNISurface(const jni::jhobject &object) : CJNIBase(object) {};
+ ~CJNISurface() {};
- void release();
+ bool isValid();
+ void release();
+//CJNICanvas lockCanvas(CJNIRect);
+//void unlockCanvasAndPost(const CJNICanvas &canvas);
+//void unlockCanvas(const CJNICanvas &canvas);
+ std::string toString();
+
+ int describeContents();
+ static void PopulateStaticFields();
+ static int ROTATION_0;
+ static int ROTATION_90;
+ static int ROTATION_180;
+ static int ROTATION_270;
+
+private:
+ static const char *m_classname;
};