コード サンプル 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);
質問 : メモリや速度などの点で、どのコード セグメントが優れていますか?