Skip to content

Commit

Permalink
fix crash bug on black rectangle.
Browse files Browse the repository at this point in the history
  • Loading branch information
azki committed Mar 5, 2014
1 parent db04224 commit 365584c
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -15,6 +15,7 @@
import android.graphics.BitmapFactory;
import android.graphics.BitmapRegionDecoder;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
Expand Down Expand Up @@ -448,7 +449,14 @@ public void run() {
synchronized(mDecoder) {
bitmap = mDecoder.decodeRegion(tile.mTileRect, options);
}


if (bitmap == null) { // this case is black rectangle.
bitmap = Bitmap.createBitmap(tile.mTileRect.right - tile.mTileRect.left, tile.mTileRect.bottom
- tile.mTileRect.top, Config.ARGB_8888);
Canvas c = new Canvas(bitmap);
c.drawColor(Color.BLACK);
}

synchronized(sBitmapCacheLock) {
sBitmapCache.put(tile.getKey(), bitmap);
}
Expand Down

0 comments on commit 365584c

Please sign in to comment.