diff options
author | Jason Sams <jsams@google.com> | 2015-01-06 02:21:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-01-06 02:21:01 +0000 |
commit | 6dc44cd732df4c201fb08fdfd9a126b73078b2c4 (patch) | |
tree | b11cdbe2e97dd787aea5b2973596e7cfba0da5ff /java/tests | |
parent | 9cc5708a0bf7a81551ccad8ab5c5abe23ec1b853 (diff) | |
parent | ebfc261ad12c1062929a0274a7000d2775cdcf00 (diff) | |
download | rs-6dc44cd732df4c201fb08fdfd9a126b73078b2c4.tar.gz |
Merge "Avoid RsBall distorting by disable bitmap scaling."
Diffstat (limited to 'java/tests')
-rw-r--r-- | java/tests/Balls/src/com/example/android/rs/balls/BallsRS.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/java/tests/Balls/src/com/example/android/rs/balls/BallsRS.java b/java/tests/Balls/src/com/example/android/rs/balls/BallsRS.java index d9d182c8..86048d50 100644 --- a/java/tests/Balls/src/com/example/android/rs/balls/BallsRS.java +++ b/java/tests/Balls/src/com/example/android/rs/balls/BallsRS.java @@ -16,9 +16,12 @@ package com.example.android.rs.balls; + import android.content.res.Resources; import android.renderscript.*; import android.util.Log; +import android.graphics.BitmapFactory; +import android.graphics.Bitmap; public class BallsRS { @@ -70,9 +73,12 @@ public class BallsRS { } private Allocation loadTexture(int id) { + BitmapFactory.Options options = new BitmapFactory.Options(); + options.inScaled = false; + Bitmap bp = BitmapFactory.decodeResource(mRes, id, options); final Allocation allocation = - Allocation.createFromBitmapResource(mRS, mRes, - id, Allocation.MipmapControl.MIPMAP_NONE, + Allocation.createFromBitmap(mRS, bp, + Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_GRAPHICS_TEXTURE); return allocation; } |