代码示例 1:下面的代码段处理大尺寸位图..
// Here reusing same variable "bitmap"
// Decode the JPEG file into a Bitmap
Bitmap bitmap = BitmapFactory.decodeFile(photoDir.getAbsolutePath(), bmOptions);
//Re-sizing
Matrix mtx = new Matrix();
bitmap =Bitmap.createScaledBitmap(bitmap, targetW, targetH,true);
mtx.postRotate(90);
// Rotating Bitmap
bitmap = Bitmap.createBitmap(bitmap, 0, 0, targetW, targetH, mtx, true);
imgPhoto.setImageBitmap(bitmap );
代码示例 2:
//Here i used different variables
// Decode the JPEG file into a Bitmap
Bitmap orginalBitmap = BitmapFactory.decodeFile(photoDir.getAbsolutePath(), bmOptions);
//Re-sizing
Matrix mtx = new Matrix();
Bitmap resizedBitmap =Bitmap.createScaledBitmap(orginalBitmap , targetW, targetH,true);
mtx.postRotate(90);
// Rotating Bitmap
Bitmap rotatedBitmap= Bitmap.createBitmap(resizedBitmap , 0, 0, targetW, targetH, mtx, true);
imgPhoto.setImageBitmap(rotatedBitmap);
问题:哪个代码段在内存和速度等方面更好?