Android: correctly update camera focus zones.
When setting a null custom focus point, we were correctly resetting the focus zones but we were not emitting the focusZonesChanged signal, causing the QML Camera to not update its focus zones. Change-Id: I59940c4cd2979fa08dc26566dc0f6d19e503f64f Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
@@ -234,25 +234,24 @@ void QAndroidCameraFocusControl::updateFocusZones(QCameraFocusZone::FocusZoneSta
|
|||||||
// create a focus zone (50x50 pixel) around the focus point
|
// create a focus zone (50x50 pixel) around the focus point
|
||||||
m_focusZones.clear();
|
m_focusZones.clear();
|
||||||
|
|
||||||
if (m_actualFocusPoint.isNull())
|
if (!m_actualFocusPoint.isNull()) {
|
||||||
return;
|
QSize viewportSize = m_session->camera()->previewSize();
|
||||||
|
|
||||||
QSize viewportSize = m_session->camera()->previewSize();
|
if (!viewportSize.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!viewportSize.isValid())
|
QSizeF focusSize(50.f / viewportSize.width(), 50.f / viewportSize.height());
|
||||||
return;
|
float x = qBound(qreal(0),
|
||||||
|
m_actualFocusPoint.x() - (focusSize.width() / 2),
|
||||||
|
1.f - focusSize.width());
|
||||||
|
float y = qBound(qreal(0),
|
||||||
|
m_actualFocusPoint.y() - (focusSize.height() / 2),
|
||||||
|
1.f - focusSize.height());
|
||||||
|
|
||||||
QSizeF focusSize(50.f / viewportSize.width(), 50.f / viewportSize.height());
|
QRectF area(QPointF(x, y), focusSize);
|
||||||
float x = qBound(qreal(0),
|
|
||||||
m_actualFocusPoint.x() - (focusSize.width() / 2),
|
|
||||||
1.f - focusSize.width());
|
|
||||||
float y = qBound(qreal(0),
|
|
||||||
m_actualFocusPoint.y() - (focusSize.height() / 2),
|
|
||||||
1.f - focusSize.height());
|
|
||||||
|
|
||||||
QRectF area(QPointF(x, y), focusSize);
|
m_focusZones.append(QCameraFocusZone(area, status));
|
||||||
|
}
|
||||||
m_focusZones.append(QCameraFocusZone(area, status));
|
|
||||||
|
|
||||||
emit focusZonesChanged();
|
emit focusZonesChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user