From 69c4baad91b953afbd0ea9b76b57a7040812bb24 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 28 Mar 2013 21:02:53 +0100 Subject: gl_video: always upload all planes When displaying YUV with alpha plane (an extremely rare special case), we didn't upload the alpha plane, because we don't do anything with it. This actually created some annoying special cases, so upload the alpha planes as well, even if they're unused. --- video/out/gl_video.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'video') diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 8f69c37ccd..6bc78e6b4e 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -103,7 +103,7 @@ struct texplane { }; struct video_image { - struct texplane planes[3]; + struct texplane planes[4]; bool image_flipped; }; @@ -1363,13 +1363,6 @@ struct mp_image *gl_video_download_image(struct gl_video *p) mp_image_t *image = mp_image_alloc(p->image_format, p->texture_w, p->texture_h); - // NOTE about image formats with alpha plane: we don't even have the alpha - // anymore. We never upload it to any texture, as it would be a waste of - // time. On the other hand, we can't find a "similar", non-alpha image - // format easily. So we just leave the alpha plane of the newly allocated - // image as-is, and hope that the alpha is ignored by the receiver of the - // screenshot. (If not, code should be added to make it fully opaque.) - for (int n = 0; n < p->plane_count; n++) { struct texplane *plane = &vimg->planes[n]; gl->ActiveTexture(GL_TEXTURE0 + n); @@ -1651,13 +1644,7 @@ static bool init_format(int fmt, struct gl_video *init) init->is_yuv = desc.flags & MP_IMGFLAG_YUV; init->is_linear_rgb = false; - - // NOTE: we throw away the additional alpha plane, if one exists. - // (2 plane formats with a 2nd alpha plane don't exist) - init->plane_count = FFMIN(desc.num_planes, 3); - assert(desc.num_planes >= init->plane_count); - assert(desc.num_planes <= init->plane_count + 1); - + init->plane_count = desc.num_planes; init->image_desc = desc; return true; -- cgit v1.2.3