Skip to content

Commit

Permalink
CB-9443 Pick correct maxResolution
Browse files Browse the repository at this point in the history
This closes apache#111, closes apache#56
  • Loading branch information
muratsu committed Aug 3, 2015
1 parent 813d143 commit ee5cfe8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/windows/CameraProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,24 +696,27 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) {
// decide which max pixels should be supported by targetWidth or targetHeight.
var maxRes = null;
var UIMaxRes = WMCapture.CameraCaptureUIMaxPhotoResolution;
var totalPixels = targetWidth * targetHeight;

switch (true) {
case (targetWidth >= 1280 || targetHeight >= 960) :
cameraCaptureUI.photoSettings.maxResolution = UIMaxRes.large3M;
case (totalPixels <= 320 * 240):
maxRes = UIMaxRes.verySmallQvga;
break;
case (targetWidth >= 1024 || targetHeight >= 768) :
maxRes = UIMaxRes.mediumXga;
case (totalPixels <= 640 * 480):
maxRes = UIMaxRes.smallVga;
break;
case (targetWidth >= 800 || targetHeight >= 600) :
case (totalPixels <= 1024 * 768):
maxRes = UIMaxRes.mediumXga;
break;
case (targetWidth >= 640 || targetHeight >= 480) :
maxRes = UIMaxRes.smallVga;
case (totalPixels <= 3 * 1000 * 1000):
maxRes = UIMaxRes.large3M;
break;
case (targetWidth >= 320 || targetHeight >= 240) :
maxRes = UIMaxRes.verySmallQvga;
case (totalPixels <= 5 * 1000 * 1000):
maxRes = UIMaxRes.veryLarge5M;
break;
default :
default:
maxRes = UIMaxRes.highestAvailable;
break;
}

cameraCaptureUI.photoSettings.maxResolution = maxRes;
Expand Down

0 comments on commit ee5cfe8

Please sign in to comment.