getWidth/getHeight optimized.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 10 Sep 2012 13:07:21 +0000 (17:07 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 10 Sep 2012 13:08:35 +0000 (17:08 +0400)
modules/androidcamera/src/camera_activity.cpp

index 8ce53a8..fe4b284 100644 (file)
@@ -61,7 +61,7 @@ private:
 
 std::string CameraWrapperConnector::pathLibFolder;
 
-bool CameraWrapperConnector::isConnectedToLib=false;
+bool CameraWrapperConnector::isConnectedToLib = false;
 InitCameraConnectC  CameraWrapperConnector::pInitCameraC = 0;
 CloseCameraConnectC  CameraWrapperConnector::pCloseCameraC = 0;
 GetCameraPropertyC CameraWrapperConnector::pGetPropertyC = 0;
@@ -421,18 +421,24 @@ void CameraActivity::applyProperties()
     frameWidth = -1;
     frameHeight = -1;
     CameraWrapperConnector::applyProperties(&camera);
+    frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
+    frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
 }
 
 int CameraActivity::getFrameWidth()
 {
     LOGD("CameraActivity::getFrameWidth()");
-    return getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
+    if (frameWidth <= 0)
+       frameWidth = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEWIDTH);
+    return frameWidth;
 }
 
 int CameraActivity::getFrameHeight()
 {
     LOGD("CameraActivity::getFrameHeight()");
-    return frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
+    if (frameHeight <= 0)
+       frameHeight = getProperty(ANDROID_CAMERA_PROPERTY_FRAMEHEIGHT);
+    return frameHeight;
 }
 
 void CameraActivity::setPathLibFolder(const char* path)