Skip to content

Commit

Permalink
Fix clipping issues with the OpenGL painter.
Browse files Browse the repository at this point in the history
This was exposed by
b25ec2e

(This is a different version of the same fix in trunk -
ce0ad7f)
  • Loading branch information
Mark Kendall committed Feb 11, 2011
1 parent b259732 commit 25ffbc3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Expand Up @@ -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();

Expand Down

0 comments on commit 25ffbc3

Please sign in to comment.