summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJagadish <jagadishkamathk@gmail.com>2016-10-26 12:46:28 +0530
committerSebastian Dröge <sebastian@centricular.com>2016-11-01 20:09:32 +0200
commitd94287c0474a3dd6430108c1aa5a603ce2128e5c (patch)
tree310cd557136919733422bbe1b8e4015ec6b150c9
parent893f8674dfd25aa803810f4fc97c0fa593d636d9 (diff)
gdkpixbufoverlay: Fixing x and y offset computation
While computing the x and y offsets, it's the video resolution and resized overlay resolution to be used instead of actual overlay image resoltuion. Due to this, the overlay image used to get wrongly overlayed in undesired location https://bugzilla.gnome.org/show_bug.cgi?id=757292
-rw-r--r--ext/gdk_pixbuf/gstgdkpixbufoverlay.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/ext/gdk_pixbuf/gstgdkpixbufoverlay.c b/ext/gdk_pixbuf/gstgdkpixbufoverlay.c
index 85421dbcb..b76509189 100644
--- a/ext/gdk_pixbuf/gstgdkpixbufoverlay.c
+++ b/ext/gdk_pixbuf/gstgdkpixbufoverlay.c
@@ -557,20 +557,6 @@ gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
positioning_mode = overlay->positioning_mode;
- if (positioning_mode == GST_GDK_PIXBUF_POSITIONING_PIXELS_ABSOLUTE) {
- x = overlay->offset_x + (overlay->relative_x * overlay_meta->width);
- y = overlay->offset_y + (overlay->relative_y * overlay_meta->height);
- } else {
- x = overlay->offset_x < 0 ?
- video_width + overlay->offset_x - overlay_meta->width +
- (overlay->relative_x * overlay_meta->width) :
- overlay->offset_x + (overlay->relative_x * overlay_meta->width);
- y = overlay->offset_y < 0 ?
- video_height + overlay->offset_y - overlay_meta->height +
- (overlay->relative_y * overlay_meta->height) :
- overlay->offset_y + (overlay->relative_y * overlay_meta->height);
- }
-
width = overlay->overlay_width;
if (width == 0)
width = overlay_meta->width;
@@ -579,6 +565,20 @@ gst_gdk_pixbuf_overlay_update_composition (GstGdkPixbufOverlay * overlay)
if (height == 0)
height = overlay_meta->height;
+ if (positioning_mode == GST_GDK_PIXBUF_POSITIONING_PIXELS_ABSOLUTE) {
+ x = overlay->offset_x + (overlay->relative_x * width);
+ y = overlay->offset_y + (overlay->relative_y * height);
+ } else {
+ x = overlay->offset_x < 0 ?
+ video_width + overlay->offset_x - width +
+ (overlay->relative_x * video_width) :
+ overlay->offset_x + (overlay->relative_x * video_width);
+ y = overlay->offset_y < 0 ?
+ video_height + overlay->offset_y - height +
+ (overlay->relative_y * video_height) :
+ overlay->offset_y + (overlay->relative_y * video_height);
+ }
+
GST_DEBUG_OBJECT (overlay, "overlay image dimensions: %d x %d, alpha=%.2f",
overlay_meta->width, overlay_meta->height, overlay->alpha);
GST_DEBUG_OBJECT (overlay, "properties: x,y: %d,%d (%g%%,%g%%) - WxH: %dx%d",