summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-02-11 02:40:17 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-02-11 02:40:17 (GMT)
commit25ffbc31b429044f382932238d6d81e5259805ae (patch)
treeff4669273da2636e8b0e86782056d3f0d720dc08
parentb2597320082b67da3e7bb71ebbae40f6440fa41b (diff)
Fix clipping issues with the OpenGL painter.
This was exposed by https://github.com/MythTV/mythtv/commit/b25ec2ebee9bfebf7d148b03c70c6912635d91e4 (This is a different version of the same fix in trunk - ce0ad7fa2546356454a5)
-rw-r--r--mythtv/libs/libmythui/mythrender_opengl.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/mythtv/libs/libmythui/mythrender_opengl.cpp b/mythtv/libs/libmythui/mythrender_opengl.cpp
index 2d3e00a..a1718f1 100644
--- a/mythtv/libs/libmythui/mythrender_opengl.cpp
+++ b/mythtv/libs/libmythui/mythrender_opengl.cpp
@@ -893,24 +893,27 @@ void MythRenderOpenGL::DrawBitmap(uint tex, uint target, const QRect *src,
prog = 0;
double srcx1, srcx2, srcy1, srcy2;
+ QSize size = m_textures[tex].m_size;
+ int width = std::min(src->width(), size.width());
+ int height = std::min(src->height(), size.height());
if (tex && !IsRectTexture(m_textures[tex].m_type))
{
- srcx1 = src->x() / (double)m_textures[tex].m_size.width();
- srcx2 = srcx1 + src->width() / (double)m_textures[tex].m_size.width();
- srcy1 = src->y() / (double)m_textures[tex].m_size.height();
- srcy2 = srcy1 + src->height() / (double)m_textures[tex].m_size.height();
+ srcx1 = src->x() / (double)size.width();
+ srcx2 = srcx1 + width / (double)size.width();
+ srcy1 = src->y() / (double)size.height();
+ srcy2 = srcy1 + height / (double)size.height();
}
else
{
srcx1 = src->x();
- srcx2 = srcx1 + src->width();
+ srcx2 = srcx1 + width;
srcy1 = src->y();
- srcy2 = srcy1 + src->height();
+ srcy2 = srcy1 + height;
}
- int width = std::min(src->width(), dst->width());
- int height = std::min(src->height(), dst->height());
+ width = std::min(width, dst->width());
+ height = std::min(height, dst->height());
makeCurrent();