Skip to content

Commit

Permalink
[nemo-qtmultimedia-plugins] take into account null crop rects. Fixes …
Browse files Browse the repository at this point in the history
…JB#30057
  • Loading branch information
foolab committed Jun 18, 2015
1 parent a6d00c5 commit 3ee1e77
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/videotexturebackend/videotexturebackend.cpp
Expand Up @@ -216,14 +216,16 @@ bool GStreamerVideoTexture::updateTexture()

// This value is taken from Android GLConsumer
qreal shrinkAmount = 1.0;
if (right - left < m_textureSize.width()) {
qreal croppedWidth = right - left;
qreal croppedHeight = bottom - top;
if (croppedWidth > 0 && croppedWidth < m_textureSize.width()) {
x = (left + shrinkAmount) / m_textureSize.width();
width = ((right - left) - (2.0f * shrinkAmount)) / m_textureSize.width();
width = ((croppedWidth) - (2.0f * shrinkAmount)) / m_textureSize.width();
}

if (bottom - top < m_textureSize.height()) {
if (croppedHeight > 0 && croppedHeight < m_textureSize.height()) {
y = (top + shrinkAmount) / m_textureSize.height();
height = (bottom - top - (2.0 * shrinkAmount)) / m_textureSize.height();
height = (croppedHeight - (2.0f * shrinkAmount)) / m_textureSize.height();
}

m_subRect = QRectF(x, y, width, height);
Expand Down

0 comments on commit 3ee1e77

Please sign in to comment.