• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/wallpapers/Basic


Commit MetaInfo

Revisionff41eed2db72b18e5ef8972379228f3bdcf34fca (tree)
Time2009-08-25 05:55:57
AuthorRomain Guy <romainguy@andr...>
CommiterRomain Guy

Log Message

Fix GC issues with native objects.

Change-Id: I670457555e60927f16ae383bebc6840c5d850db1

Change Summary

Incremental Difference

--- a/src/com/android/wallpaper/galaxy/GalaxyRS.java
+++ b/src/com/android/wallpaper/galaxy/GalaxyRS.java
@@ -87,6 +87,12 @@ class GalaxyRS {
8787 private ProgramStore mPfsLights;
8888 @SuppressWarnings({"FieldCanBeLocal"})
8989 private ProgramVertex mPvBackground;
90+ @SuppressWarnings({"FieldCanBeLocal"})
91+ private Sampler mSampler;
92+ @SuppressWarnings({"FieldCanBeLocal"})
93+ private Sampler mLightSampler;
94+ @SuppressWarnings({"FieldCanBeLocal"})
95+ private ProgramVertex.MatrixAllocation mPvOrthoAlloc;
9096
9197 @SuppressWarnings({"FieldCanBeLocal"})
9298 private Allocation[] mTextures;
@@ -272,8 +278,7 @@ class GalaxyRS {
272278
273279 final int count = textures.length;
274280 for (int i = 0; i < count; i++) {
275- final Allocation texture = textures[i];
276- texture.uploadToTexture(0);
281+ textures[i].uploadToTexture(0);
277282 }
278283 }
279284
@@ -297,28 +302,28 @@ class GalaxyRS {
297302 sampleBuilder.setMag(LINEAR);
298303 sampleBuilder.setWrapS(WRAP);
299304 sampleBuilder.setWrapT(WRAP);
300- Sampler sampler = sampleBuilder.create();
305+ mSampler = sampleBuilder.create();
301306
302307 ProgramFragment.Builder builder = new ProgramFragment.Builder(mRS, null, null);
303308 builder.setTexEnable(true, 0);
304309 builder.setTexEnvMode(REPLACE, 0);
305310 mPfBackground = builder.create();
306311 mPfBackground.setName("PFBackground");
307- mPfBackground.bindSampler(sampler, 0);
312+ mPfBackground.bindSampler(mSampler, 0);
308313
309314 sampleBuilder = new Sampler.Builder(mRS);
310315 sampleBuilder.setMin(NEAREST);
311316 sampleBuilder.setMag(NEAREST);
312317 sampleBuilder.setWrapS(WRAP);
313318 sampleBuilder.setWrapT(WRAP);
314- Sampler lightSampler = sampleBuilder.create();
319+ mLightSampler = sampleBuilder.create();
315320
316321 builder = new ProgramFragment.Builder(mRS, null, null);
317322 builder.setTexEnable(true, 0);
318323 builder.setTexEnvMode(MODULATE, 0);
319324 mPfLighting = builder.create();
320325 mPfLighting.setName("PFLighting");
321- mPfLighting.bindSampler(lightSampler, 0);
326+ mPfLighting.bindSampler(mLightSampler, 0);
322327 }
323328
324329 private void createProgramFragmentStore() {
@@ -338,13 +343,13 @@ class GalaxyRS {
338343 }
339344
340345 private void createProgramVertex() {
341- ProgramVertex.MatrixAllocation pvOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
346+ mPvOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
342347 //mPvOrthoAlloc.setupProjectionNormalized(mWidth, mHeight);
343- pvOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
348+ mPvOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
344349
345350 ProgramVertex.Builder builder = new ProgramVertex.Builder(mRS, null, null);
346351 mPvBackground = builder.create();
347- mPvBackground.bindAllocation(pvOrthoAlloc);
352+ mPvBackground.bindAllocation(mPvOrthoAlloc);
348353 mPvBackground.setName("PVBackground");
349354 }
350355 }
\ No newline at end of file
--- a/src/com/android/wallpaper/grass/GrassRS.java
+++ b/src/com/android/wallpaper/grass/GrassRS.java
@@ -80,6 +80,10 @@ class GrassRS {
8080 private ProgramStore mPfsBackground;
8181 @SuppressWarnings({ "FieldCanBeLocal" })
8282 private ProgramVertex mPvBackground;
83+ @SuppressWarnings({"FieldCanBeLocal"})
84+ private Sampler mSampler;
85+ @SuppressWarnings({"FieldCanBeLocal"})
86+ private ProgramVertex.MatrixAllocation mPvOrthoAlloc;
8387
8488 @SuppressWarnings({ "FieldCanBeLocal" })
8589 private Allocation[] mTextures;
@@ -89,10 +93,11 @@ class GrassRS {
8993
9094 private Allocation mBlades;
9195 private Allocation mBladesBuffer;
96+ @SuppressWarnings({"FieldCanBeLocal"})
97+ private SimpleMesh mBladesMesh;
9298
9399 private int mTriangles;
94100 private final float[] mFloatData5 = new float[5];
95- private SimpleMesh mBladesMesh;
96101
97102 public GrassRS(int width, int height) {
98103 mWidth = width;
@@ -288,14 +293,14 @@ class GrassRS {
288293 samplerBuilder.setMag(LINEAR);
289294 samplerBuilder.setWrapS(WRAP);
290295 samplerBuilder.setWrapT(WRAP);
291- Sampler sampler = samplerBuilder.create();
296+ mSampler = samplerBuilder.create();
292297
293298 ProgramFragment.Builder builder = new ProgramFragment.Builder(mRS, null, null);
294299 builder.setTexEnable(true, 0);
295300 builder.setTexEnvMode(REPLACE, 0);
296301 mPfBackground = builder.create();
297302 mPfBackground.setName("PFBackground");
298- mPfBackground.bindSampler(sampler, 0);
303+ mPfBackground.bindSampler(mSampler, 0);
299304 }
300305
301306 private void createProgramFragmentStore() {
@@ -309,13 +314,13 @@ class GrassRS {
309314 }
310315
311316 private void createProgramVertex() {
312- ProgramVertex.MatrixAllocation pvOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
313- pvOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
317+ mPvOrthoAlloc = new ProgramVertex.MatrixAllocation(mRS);
318+ mPvOrthoAlloc.setupOrthoWindow(mWidth, mHeight);
314319
315320 ProgramVertex.Builder pvb = new ProgramVertex.Builder(mRS, null, null);
316321 pvb.setTextureMatrixEnable(true);
317322 mPvBackground = pvb.create();
318- mPvBackground.bindAllocation(pvOrthoAlloc);
323+ mPvBackground.bindAllocation(mPvOrthoAlloc);
319324 mPvBackground.setName("PVBackground");
320325 }
321326 }