diff options
author | Markus Pfau <pfau@peak3d.de> | 2019-04-10 08:12:26 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-10 08:12:26 +0200 |
commit | b91695e796cc3e33ef7750719fa2cc9bced3bc6f (patch) | |
tree | b24ca6467a5d83b338b6a1844e4861b97c2bcc31 | |
parent | d1ce7c60508ec66d25ed99149a193b6fd6d7b6c0 (diff) | |
parent | ace7269be3af65ae927c9233e295cc7c45008c18 (diff) |
Merge pull request #15880 from peak3d/pixelstore
[LinuxRendererGLES] Fix pixelstore usage
-rw-r--r-- | xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp index c8a5b6b456..39e3866fac 100644 --- a/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp +++ b/xbmc/cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.cpp @@ -279,23 +279,28 @@ void CLinuxRendererGLES::LoadPlane(CYuvPlane& plane, int type, glBindTexture(m_textureTarget, plane.id); - if (m_pixelStoreKey > 0) + bool pixelStoreChanged = false; + if (stride != static_cast<int>(width * bps)) { - glPixelStorei(m_pixelStoreKey, stride); - } - else if (stride != static_cast<int>(width * bps)) - { - unsigned char *src(static_cast<unsigned char*>(data)), - *dst(m_planeBuffer); + if (m_pixelStoreKey > 0) + { + pixelStoreChanged = true; + glPixelStorei(m_pixelStoreKey, stride); + } + else + { + unsigned char *src(static_cast<unsigned char*>(data)), + *dst(m_planeBuffer); - for (unsigned int y = 0; y < height; ++y, src += stride, dst += width * bpp) - memcpy(dst, src, width * bpp); + for (unsigned int y = 0; y < height; ++y, src += stride, dst += width * bpp) + memcpy(dst, src, width * bpp); - pixelData = m_planeBuffer; + pixelData = m_planeBuffer; + } } glTexSubImage2D(m_textureTarget, 0, 0, 0, width, height, type, GL_UNSIGNED_BYTE, pixelData); - if (m_pixelStoreKey > 0) + if (m_pixelStoreKey > 0 && pixelStoreChanged) glPixelStorei(m_pixelStoreKey, 0); // check if we need to load any border pixels |