Re: Turning a XImage * into a Drawable for use with XRenderCreatePicture

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 04, 2024 at 06:27:01PM +0100, Florian Weimer wrote:
> The pcb-rnd package contains a call:
> 
> XRenderCreatePicture(display, lpm->img_scaled, XRenderFindVisualFormat(display, DefaultVisual(display, screen)), 0, 0);
> 
> The issue here is that lpm->img_scaled is an XImage *, but
> XRenderCreatePicture expected a Drawable as its second argument.
> 
> Any idea how to turn an XImage into a Drawable?

After digging through the Xlib sources a bit: an XImage is a
Xlib-specific struct that abstracts some manipulation functions. Unlike
a Drawable which exists on the protocol. You don't do anything with an
XImage except eventually rendering it to a Drawable.

So in this case - I guess look for where the lpm->img_scale is used on a
drawable and assume that's the drawable you want to use for the XRender
call. Which may or may not be lpm->pm_scaled in this case, I don't know
what the code does but it looks like that's the drawable the image
renders to.

> Not sure how this currently works, but GCC 14 refuse to compile this, as
> a C type error (using a pointer as an integer).

It cannot currently work. From XRenderCreatePicture() [1]:
  req->drawable = (CARD32) drawable;

which means that (parts of) the pointer value is sent to the server as
XID and the server should return BadDrawable unless you're really
(un)lucky with your pointer value.

Cheers,
  Peter

[1] https://gitlab.freedesktop.org/xorg/lib/libxrender/-/blob/master/src/Picture.c?ref_type=heads#L91
--
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux