[cairo] xlib re-re-re implementing the API
Carl Worth
cworth at cworth.org
Tue May 17 02:55:23 PDT 2005
On Tue, 17 May 2005 00:00:47 -0700, Keith Packard wrote:
> + } else if (surface->format) {
> + masks.bpp = ximage->bits_per_pixel;
> + masks.red_mask = surface->format->direct.redMask << surface->format->direct.red;
> + masks.green_mask = surface->format->direct.greenMask << surface->format->direct.green;
> + masks.blue_mask = surface->format->direct.blueMask << surface->format->direct.blue;
> + masks.alpha_mask = surface->format->direct.alphaMask << surface->format->direct.alpha;
> } else {
> - image = (cairo_image_surface_t *)
> - cairo_image_surface_create_for_data ((unsigned char*) ximage->data,
> - surface->format,
> - ximage->width,
> - ximage->height,
> - ximage->bytes_per_line);
> + masks.bpp = ximage->bits_per_pixel;
> + masks.red_mask = 0;
> + masks.green_mask = 0;
> + masks.blue_mask = 0;
> + masks.alpha_mask = (1 << surface->depth) - 1;
> + if (!masks.alpha_mask)
> + masks.alpha_mask = 0xffffffff;
> + }
> +
> + if (_CAIRO_MASK_FORMAT (&masks, &format))
> + {
> + image = (cairo_image_surface_t *) cairo_image_surface_create_for_data ((unsigned char *) ximage->data,
The control flow through the above blocks (and above) is quite hard to
follow. Can you guarantee that image won't be assigned here after
already being assigned up in the if (surface->visual) case?
Either way, these blocks could use a few comments to elucidate things
for the unenlightened.
Thanks,
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050517/35b3ebf2/attachment.pgp
More information about the cairo
mailing list