mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
A couple small improvements to the CameraManager.
git-svn-id: https://zxing.googlecode.com/svn/trunk@361 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
66ae9f7ed4
commit
5c496574a3
|
@ -60,10 +60,8 @@ final class CameraManager {
|
|||
usePreviewForDecode = true;
|
||||
setUsePreviewForDecode(false);
|
||||
|
||||
camera = CameraDevice.open();
|
||||
camera = null;
|
||||
params = new CameraDevice.CaptureParams();
|
||||
previewMode = false;
|
||||
setPreviewMode(true);
|
||||
}
|
||||
|
||||
public void openDriver() {
|
||||
|
@ -106,8 +104,8 @@ final class CameraManager {
|
|||
screenResolution.y);
|
||||
bitmap = Bitmap.createBitmap(screenResolution.x, screenResolution.y, false);
|
||||
} else {
|
||||
Log.v(TAG, "Creating bitmap at still resolution: " + screenResolution.x + "," +
|
||||
screenResolution.y);
|
||||
Log.v(TAG, "Creating bitmap at still resolution: " + stillResolution.x + "," +
|
||||
stillResolution.y);
|
||||
bitmap = Bitmap.createBitmap(stillResolution.x, stillResolution.y, false);
|
||||
}
|
||||
}
|
||||
|
@ -244,6 +242,7 @@ final class CameraManager {
|
|||
}
|
||||
|
||||
private void calculatePreviewResolution() {
|
||||
if (previewResolution == null) {
|
||||
int previewHeight = (int) (stillResolution.x * stillMultiplier * 1.4f);
|
||||
int previewWidth = previewHeight * screenResolution.x / screenResolution.y;
|
||||
previewWidth = ((previewWidth + 7) >> 3) << 3;
|
||||
|
@ -252,6 +251,7 @@ final class CameraManager {
|
|||
previewResolution = new Point(previewWidth, previewHeight);
|
||||
Log.v(TAG, "previewWidth " + previewWidth + " previewHeight " + previewHeight);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME(dswitkin): These three methods have temporary constants until the new Camera API can
|
||||
// provide the real values for the current device.
|
||||
|
|
Loading…
Reference in a new issue