Avoid destroying Device separately

Bug: 27983025

Device should be destroyed inside the destructor of the associated
Context.

Change-Id: I921a89974e1174f837349a89aef9b03efa4882f5
(cherry picked from commit 4a70df58a3)
This commit is contained in:
Yang Ni
2016-04-04 10:23:57 -07:00
parent 01e307d461
commit cb939dc4fc
2 changed files with 4 additions and 8 deletions

View File

@@ -1031,7 +1031,6 @@ public class RenderScript {
long mDev;
long mContext;
private boolean mDestroyed = false;
@@ -1426,8 +1425,8 @@ public class RenderScript {
RenderScript rs = new RenderScript(ctx);
rs.mDev = rs.nDeviceCreate();
rs.mContext = rs.nContextCreate(rs.mDev, flags, sdkVersion, ct.mID);
long device = rs.nDeviceCreate();
rs.mContext = rs.nContextCreate(device, flags, sdkVersion, ct.mID);
rs.mContextType = ct;
rs.mContextFlags = flags;
rs.mContextSdkVersion = sdkVersion;
@@ -1635,9 +1634,6 @@ public class RenderScript {
}
nContextDestroy();
nDeviceDestroy(mDev);
mDev = 0;
}
}

View File

@@ -177,9 +177,9 @@ public class RenderScriptGL extends RenderScript {
mWidth = 0;
mHeight = 0;
mDev = nDeviceCreate();
long device = nDeviceCreate();
int dpi = ctx.getResources().getDisplayMetrics().densityDpi;
mContext = nContextCreateGL(mDev, 0, sdkVersion,
mContext = nContextCreateGL(device, 0, sdkVersion,
mSurfaceConfig.mColorMin, mSurfaceConfig.mColorPref,
mSurfaceConfig.mAlphaMin, mSurfaceConfig.mAlphaPref,
mSurfaceConfig.mDepthMin, mSurfaceConfig.mDepthPref,