From 027f5bb47182130ae1edb30de789e42f4305e2ca Mon Sep 17 00:00:00 2001 From: Holger Kaelberer Date: Wed, 14 Mar 2012 17:28:57 +0000 Subject: [PATCH] video: overlay-composition: fix rectangle caching after alpha (un)premultiplying If we are asked to (un)premultiply,we need to create the new rectangle with the right flags, so we can find it properly on subsequent cache lookups (also because it's wrong otherwise). https://bugzilla.gnome.org/show_bug.cgi?id=668483 --- gst-libs/gst/video/video-overlay-composition.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/video-overlay-composition.c b/gst-libs/gst/video/video-overlay-composition.c index 8c6ebb2..73641ea 100644 --- a/gst-libs/gst/video/video-overlay-composition.c +++ b/gst-libs/gst/video/video-overlay-composition.c @@ -908,6 +908,7 @@ gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle * rectangle, guint * stride, GstVideoOverlayFormatFlags flags, gboolean unscaled) { + GstVideoOverlayFormatFlags new_flags; GstVideoOverlayRectangle *scaled_rect = NULL; GstBlendVideoFormatInfo info; GstBuffer *buf; @@ -960,11 +961,14 @@ gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle * info.pixels = g_memdup (info.pixels, info.size); } + new_flags = rectangle->flags; if (!gst_video_overlay_rectangle_is_same_alpha_type (rectangle->flags, flags)) { if (rectangle->flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA) { gst_video_overlay_rectangle_unpremultiply (&info); + new_flags &= ~GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA; } else { gst_video_overlay_rectangle_premultiply (&info); + new_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA; } } @@ -975,7 +979,7 @@ gst_video_overlay_rectangle_get_pixels_argb_internal (GstVideoOverlayRectangle * scaled_rect = gst_video_overlay_rectangle_new_argb (buf, wanted_width, wanted_height, info.stride[0], - 0, 0, wanted_width, wanted_height, rectangle->flags); + 0, 0, wanted_width, wanted_height, new_flags); gst_buffer_unref (buf); -- 2.7.4