[gstreamer-bugs] [Bug 345713] ximagesrc uses XFixesCursorImage incorrectly and will segfault
GStreamer (bugzilla.gnome.org)
bugzilla-daemon at bugzilla.gnome.org
Fri Jun 23 10:42:25 PDT 2006
Do not reply to this via email (we are currently unable to handle email
responses and they get discarded). You can add comments to this bug at
http://bugzilla.gnome.org/show_bug.cgi?id=345713
GStreamer | gst-plugins-good | Ver: HEAD CVS
------- Comment #2 from Todd Goyen 2006-06-23 17:42 UTC -------
Also 10 years from now, let it be known that I used very similar code in a
closed source program and don't want it coming back to haunt me..... This code
here though is all yours, License/rewrite it as you wish, because without the
megring code it really doesn't do anything.....
/* xi = XImage x index
* yi = XImage y index
* xci = XFixesCursorImage x index
* yci = XFixesCursorImage y index
* xd = difference in x offsets from (0,0)
* yd = difference in y offsets from (0,0)
* img_location = offset for capture background image to (0,0)
* img = XImage
* ximg = XFixesCursorImage
*/
xd = cimg->x - img_location->x;
yd = cimg->y - img_location->y;
/* The function below is kind of complicated, just remember that we have
two rectangles
* which each have different offsets from 0 and we only merge them where
they overlap
* Oh yeah and one uses longs while the other uses chars
*/
for (yi = yd, yci = 0; yci < cimg->height && yi < img->height; yi++, yci++)
{
if (yi < 0) { continue; } /* Only use valid indexes */
for (xi = xd, xci = 0; xci < cimg->width && xi < img->width; xi++,
xci++) {
if (xi < 0 ) { continue; } /* Only use valid indexes */
off = (yi * img->width + xi) * 4;
/* Merge each pixel in here */
/* Also note that the cimg has already been multiplied by the alpha
channel by XFixes*/
}
}
--
Configure bugmail: http://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the Gstreamer-bugs
mailing list