1
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 07:33:46 +01:00

gl_common: fix invalid alignment

0 is invalid. The intention of the code turning off any additional
alignment, so we need 1.

Change a comment: obviously we don't try to set alignment parameters
etc.to handle stride correctly, and instead do everything by row.
This commit is contained in:
wm4 2013-05-30 15:41:01 +02:00
parent bbc865a4da
commit 59892dd4cc

View File

@ -830,10 +830,10 @@ mp_image_t *glGetWindowScreenshot(GL *gl)
gl->GetIntegerv(GL_VIEWPORT, vp);
mp_image_t *image = mp_image_alloc(IMGFMT_RGB24, vp[2], vp[3]);
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
gl->PixelStorei(GL_PACK_ALIGNMENT, 0);
gl->PixelStorei(GL_PACK_ALIGNMENT, 1);
gl->PixelStorei(GL_PACK_ROW_LENGTH, 0);
gl->ReadBuffer(GL_FRONT);
//flip image while reading
//flip image while reading (and also avoid stride-related trouble)
for (int y = 0; y < vp[3]; y++) {
gl->ReadPixels(vp[0], vp[1] + vp[3] - y - 1, vp[2], 1,
GL_RGB, GL_UNSIGNED_BYTE,