From f60324e71bc0a894d91d83387533b2c274c1b908 Mon Sep 17 00:00:00 2001 From: Murat Sutunc Date: Mon, 3 Aug 2015 12:57:58 -0700 Subject: [PATCH 1/3] CB-9443 Pick correct maxResolution --- src/windows/CameraProxy.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js index e0abd7471..43e6922de 100644 --- a/src/windows/CameraProxy.js +++ b/src/windows/CameraProxy.js @@ -696,21 +696,22 @@ 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): + cameraCaptureUI.photoSettings.maxResolution = 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 : maxRes = UIMaxRes.highestAvailable; From c7ce09d3d3d8b362315aa328f3ff7e8700c72c6b Mon Sep 17 00:00:00 2001 From: Murat Sutunc Date: Mon, 3 Aug 2015 13:58:04 -0700 Subject: [PATCH 2/3] CR --- src/windows/CameraProxy.js | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js index 43e6922de..ad104e374 100644 --- a/src/windows/CameraProxy.js +++ b/src/windows/CameraProxy.js @@ -697,24 +697,19 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) { var maxRes = null; var UIMaxRes = WMCapture.CameraCaptureUIMaxPhotoResolution; var totalPixels = targetWidth * targetHeight; - switch (true) { - case (totalPixels <= 320 * 240): - cameraCaptureUI.photoSettings.maxResolution = UIMaxRes.verySmallQvga; - break; - case (totalPixels <= 640 * 480): - maxRes = UIMaxRes.smallVga; - break; - case (totalPixels <= 1024 * 768): - maxRes = UIMaxRes.mediumXga; - break; - case (totalPixels <= 3 * 1000 * 1000): - maxRes = UIMaxRes.large3M; - break; - case (totalPixels <= 5 * 1000 * 1000): - maxRes = UIMaxRes.veryLarge5M; - break; - default : - maxRes = UIMaxRes.highestAvailable; + + if (totalPixels <= 320 * 240) { + maxRes = UIMaxRes.verySmallQvga; + } else if (totalPixels <= 640 * 480) { + maxRes = UIMaxRes.smallVga; + } else if (totalPixels <= 1024 * 768) { + maxRes = UIMaxRes.mediumXga; + } else if (totalPixels <= 3 * 1000 * 1000) { + maxRes = UIMaxRes.large3M; + } else if (totalPixels <= 5 * 1000 * 1000) { + maxRes = UIMaxRes.veryLarge5M; + } else { + maxRes = UIMaxRes.highestAvailable; } cameraCaptureUI.photoSettings.maxResolution = maxRes; From 4b72932b9c5479c46051455609a21b19c144a7e3 Mon Sep 17 00:00:00 2001 From: Murat Sutunc Date: Mon, 3 Aug 2015 14:29:18 -0700 Subject: [PATCH 3/3] CR --- src/windows/CameraProxy.js | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js index ad104e374..5ad9475cd 100644 --- a/src/windows/CameraProxy.js +++ b/src/windows/CameraProxy.js @@ -698,18 +698,25 @@ function takePictureFromCameraWindows(successCallback, errorCallback, args) { var UIMaxRes = WMCapture.CameraCaptureUIMaxPhotoResolution; var totalPixels = targetWidth * targetHeight; - if (totalPixels <= 320 * 240) { - maxRes = UIMaxRes.verySmallQvga; - } else if (totalPixels <= 640 * 480) { - maxRes = UIMaxRes.smallVga; - } else if (totalPixels <= 1024 * 768) { - maxRes = UIMaxRes.mediumXga; - } else if (totalPixels <= 3 * 1000 * 1000) { - maxRes = UIMaxRes.large3M; - } else if (totalPixels <= 5 * 1000 * 1000) { - maxRes = UIMaxRes.veryLarge5M; - } else { - maxRes = UIMaxRes.highestAvailable; + switch (true) { + case (totalPixels <= 320 * 240): + maxRes = UIMaxRes.verySmallQvga; + break; + case (totalPixels <= 640 * 480): + maxRes = UIMaxRes.smallVga; + break; + case (totalPixels <= 1024 * 768): + maxRes = UIMaxRes.mediumXga; + break; + case (totalPixels <= 3 * 1000 * 1000): + maxRes = UIMaxRes.large3M; + break; + case (totalPixels <= 5 * 1000 * 1000): + maxRes = UIMaxRes.veryLarge5M; + break; + default: + maxRes = UIMaxRes.highestAvailable; + break; } cameraCaptureUI.photoSettings.maxResolution = maxRes;