Fix for bug 3434228
Change-Id: I57973faf782b487e7913a096f0ab6012dc1c9415
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1b10c5c..b51279a 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -83,17 +83,17 @@
int alphaMin, int alphaPref,
int depthMin, int depthPref,
int stencilMin, int stencilPref,
- int samplesMin, int samplesPref, float samplesQ);
+ int samplesMin, int samplesPref, float samplesQ, int dpi);
synchronized int nContextCreateGL(int dev, int ver,
int colorMin, int colorPref,
int alphaMin, int alphaPref,
int depthMin, int depthPref,
int stencilMin, int stencilPref,
- int samplesMin, int samplesPref, float samplesQ) {
+ int samplesMin, int samplesPref, float samplesQ, int dpi) {
return rsnContextCreateGL(dev, ver, colorMin, colorPref,
alphaMin, alphaPref, depthMin, depthPref,
stencilMin, stencilPref,
- samplesMin, samplesPref, samplesQ);
+ samplesMin, samplesPref, samplesQ, dpi);
}
native int rsnContextCreate(int dev, int ver);
synchronized int nContextCreate(int dev, int ver) {
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index 4359795..d4b5434 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -165,13 +165,14 @@
mWidth = 0;
mHeight = 0;
mDev = nDeviceCreate();
+ int dpi = ctx.getResources().getDisplayMetrics().densityDpi;
mContext = nContextCreateGL(mDev, 0,
mSurfaceConfig.mColorMin, mSurfaceConfig.mColorPref,
mSurfaceConfig.mAlphaMin, mSurfaceConfig.mAlphaPref,
mSurfaceConfig.mDepthMin, mSurfaceConfig.mDepthPref,
mSurfaceConfig.mStencilMin, mSurfaceConfig.mStencilPref,
mSurfaceConfig.mSamplesMin, mSurfaceConfig.mSamplesPref,
- mSurfaceConfig.mSamplesQ);
+ mSurfaceConfig.mSamplesQ, dpi);
if (mContext == 0) {
throw new RSDriverException("Failed to create RS context.");
}