summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorBogDan Vatra <bogdan@kde.org>2014-02-18 15:31:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-22 14:35:33 +0100
commit26a5727f75c7666e257c930af4cc67081ef1f6d6 (patch)
treed568ab91ef25042d6291cd09d62d4d88aba89d23 /src/android/jar
parent0febd75d5242653be3202ea0e46ed6107e4333bd (diff)
Make full use of QT_ANDROID_RASTER_IMAGE_DEPTH env variable.
If raster only apps set QT_ANDROID_RASTER_IMAGE_DEPTH to 16 (RGB16), we should create also RGB16 native surface. Change-Id: I82692ff34b0e604e627d1d86a437272e3700daf8 Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java4
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtNative.java4
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/QtSurface.java8
3 files changed, 10 insertions, 6 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
index 620ea22dad..aa18dfc2d1 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -987,7 +987,7 @@ public class QtActivityDelegate
m_nativeViews.put(id, view);
}
- public void createSurface(int id, boolean onTop, int x, int y, int w, int h) {
+ public void createSurface(int id, boolean onTop, int x, int y, int w, int h, int imageDepth) {
if (m_surfaces.size() == 0) {
TypedValue attr = new TypedValue();
m_activity.getTheme().resolveAttribute(android.R.attr.windowBackground, attr, true);
@@ -1005,7 +1005,7 @@ public class QtActivityDelegate
if (m_surfaces.containsKey(id))
m_layout.removeView(m_surfaces.remove(id));
- QtSurface surface = new QtSurface(m_activity, id, onTop);
+ QtSurface surface = new QtSurface(m_activity, id, onTop, imageDepth);
if (w < 0 || h < 0) {
surface.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
index 9b716f74e5..02bb1ae485 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java
@@ -511,12 +511,12 @@ public class QtNative
return certificateArray;
}
- private static void createSurface(final int id, final boolean onTop, final int x, final int y, final int w, final int h)
+ private static void createSurface(final int id, final boolean onTop, final int x, final int y, final int w, final int h, final int imageDepth)
{
runAction(new Runnable() {
@Override
public void run() {
- m_activityDelegate.createSurface(id, onTop, x, y, w, h);
+ m_activityDelegate.createSurface(id, onTop, x, y, w, h, imageDepth);
}
});
}
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
index 1454c30638..45a80a3dbb 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java
@@ -59,14 +59,18 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
private GestureDetector m_gestureDetector;
private Object m_accessibilityDelegate = null;
- public QtSurface(Context context, int id, boolean onTop)
+ public QtSurface(Context context, int id, boolean onTop, int imageDepth)
{
super(context);
setFocusable(false);
setFocusableInTouchMode(false);
setZOrderMediaOverlay(onTop);
getHolder().addCallback(this);
- getHolder().setFormat(PixelFormat.RGBA_8888);
+ if (imageDepth == 16)
+ getHolder().setFormat(PixelFormat.RGB_565);
+ else
+ getHolder().setFormat(PixelFormat.RGBA_8888);
+
if (android.os.Build.VERSION.SDK_INT < 11)
getHolder().setType(SurfaceHolder.SURFACE_TYPE_GPU);