cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mura...@apache.org
Subject cordova-plugin-camera git commit: CB-9443 Pick correct maxResolution This closes #111, closes #56
Date Mon, 03 Aug 2015 22:48:35 GMT
Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master 813d14366 -> ee5cfe89a


CB-9443 Pick correct maxResolution
This closes #111, closes #56


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/commit/ee5cfe89
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/tree/ee5cfe89
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/diff/ee5cfe89

Branch: refs/heads/master
Commit: ee5cfe89a594ba8a86ca36fe67e7a040cc3d5e17
Parents: 813d143
Author: Murat Sutunc <sutunc@gmail.com>
Authored: Mon Aug 3 12:57:58 2015 -0700
Committer: Murat Sutunc <sutunc@gmail.com>
Committed: Mon Aug 3 15:45:55 2015 -0700

----------------------------------------------------------------------
 src/windows/CameraProxy.js | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/ee5cfe89/src/windows/CameraProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/CameraProxy.js b/src/windows/CameraProxy.js
index e0abd74..5ad9475 100644
--- a/src/windows/CameraProxy.js
+++ b/src/windows/CameraProxy.js
@@ -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;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message