Loading graphics/java/android/graphics/BitmapRegionDecoder.java +24 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import java.io.InputStream; public final class BitmapRegionDecoder { private int mNativeBitmapRegionDecoder; private boolean mRecycled; // ensures that the native decoder object exists and that only one decode can // occur at a time. private final Object mNativeLock = new Object(); /** * Create a BitmapRegionDecoder from the specified byte array. Loading Loading @@ -179,6 +182,7 @@ public final class BitmapRegionDecoder { * decoded. */ public Bitmap decodeRegion(Rect rect, BitmapFactory.Options options) { synchronized (mNativeLock) { checkRecycled("decodeRegion called on recycled region decoder"); if (rect.right <= 0 || rect.bottom <= 0 || rect.left >= getWidth() || rect.top >= getHeight()) Loading @@ -186,18 +190,23 @@ public final class BitmapRegionDecoder { return nativeDecodeRegion(mNativeBitmapRegionDecoder, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, options); } } /** Returns the original image's width */ public int getWidth() { synchronized (mNativeLock) { checkRecycled("getWidth called on recycled region decoder"); return nativeGetWidth(mNativeBitmapRegionDecoder); } } /** Returns the original image's height */ public int getHeight() { synchronized (mNativeLock) { checkRecycled("getHeight called on recycled region decoder"); return nativeGetHeight(mNativeBitmapRegionDecoder); } } /** * Frees up the memory associated with this region decoder, and mark the Loading @@ -210,11 +219,13 @@ public final class BitmapRegionDecoder { * memory when there are no more references to this region decoder. */ public void recycle() { synchronized (mNativeLock) { if (!mRecycled) { nativeClean(mNativeBitmapRegionDecoder); mRecycled = true; } } } /** * Returns true if this region decoder has been recycled. Loading Loading
graphics/java/android/graphics/BitmapRegionDecoder.java +24 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import java.io.InputStream; public final class BitmapRegionDecoder { private int mNativeBitmapRegionDecoder; private boolean mRecycled; // ensures that the native decoder object exists and that only one decode can // occur at a time. private final Object mNativeLock = new Object(); /** * Create a BitmapRegionDecoder from the specified byte array. Loading Loading @@ -179,6 +182,7 @@ public final class BitmapRegionDecoder { * decoded. */ public Bitmap decodeRegion(Rect rect, BitmapFactory.Options options) { synchronized (mNativeLock) { checkRecycled("decodeRegion called on recycled region decoder"); if (rect.right <= 0 || rect.bottom <= 0 || rect.left >= getWidth() || rect.top >= getHeight()) Loading @@ -186,18 +190,23 @@ public final class BitmapRegionDecoder { return nativeDecodeRegion(mNativeBitmapRegionDecoder, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, options); } } /** Returns the original image's width */ public int getWidth() { synchronized (mNativeLock) { checkRecycled("getWidth called on recycled region decoder"); return nativeGetWidth(mNativeBitmapRegionDecoder); } } /** Returns the original image's height */ public int getHeight() { synchronized (mNativeLock) { checkRecycled("getHeight called on recycled region decoder"); return nativeGetHeight(mNativeBitmapRegionDecoder); } } /** * Frees up the memory associated with this region decoder, and mark the Loading @@ -210,11 +219,13 @@ public final class BitmapRegionDecoder { * memory when there are no more references to this region decoder. */ public void recycle() { synchronized (mNativeLock) { if (!mRecycled) { nativeClean(mNativeBitmapRegionDecoder); mRecycled = true; } } } /** * Returns true if this region decoder has been recycled. Loading