diff options
author | Fabian Bumberger <fbumberger@rim.com> | 2014-03-27 16:18:11 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-02 16:31:53 +0200 |
commit | 3a18ec30f030d52026880c67d928654822eede8f (patch) | |
tree | e4e1bd152354cd28d2617cc0b15b21352e213893 /src/plugins/qnx/camera/bbcamerasession.cpp | |
parent | 244c63f72a8ec6aededda40723bf61b7f32bf277 (diff) |
BlackBerry: Fix the rotation of the viewfinder
This fixes the rotation of the viewfinder. We have to adjust the orientation
depending on the primary screen orientation. On a keyboard device, the viewfinder
would not rotate at all (same if auto orientation is turned off).
Task-number: QTBUG-37894
Change-Id: I2bf955fb3303ed236d3234154ded94fe78607455
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins/qnx/camera/bbcamerasession.cpp')
-rw-r--r-- | src/plugins/qnx/camera/bbcamerasession.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/qnx/camera/bbcamerasession.cpp b/src/plugins/qnx/camera/bbcamerasession.cpp index 618aca533..c5309b045 100644 --- a/src/plugins/qnx/camera/bbcamerasession.cpp +++ b/src/plugins/qnx/camera/bbcamerasession.cpp @@ -772,11 +772,16 @@ void BbCameraSession::viewfinderFrameGrabbed(const QImage &image) { QTransform transform; + // subtract out the native rotation transform.rotate(m_nativeCameraOrientation); + // subtract out the current device orientation + if (m_device == cameraIdentifierRear()) + transform.rotate(360 - m_orientationHandler->viewfinderOrientation()); + else + transform.rotate(m_orientationHandler->viewfinderOrientation()); + QImage frame = image.copy().transformed(transform); - if (m_device == cameraIdentifierFront()) - frame = frame.mirrored(true, false); QMutexLocker locker(&m_surfaceMutex); if (m_surface) { @@ -896,7 +901,7 @@ bool BbCameraSession::startViewFinder() return false; } - const int angle = m_orientationHandler->orientation(); + const int angle = m_orientationHandler->viewfinderOrientation(); const QSize rotatedSize = ((angle == 0 || angle == 180) ? viewfinderResolution : viewfinderResolution.transposed()); |