[fbdev_backend]: support of DIRECTCOLOR Frame buffer
Bill Spitzak
spitzak at gmail.com
Mon Jun 10 09:39:26 PDT 2013
On 06/10/2013 03:18 AM, Pekka Paalanen wrote:
> On Fri, 7 Jun 2013 17:13:59 +0200
> Marc Chalain <marc.chalain at gmail.com> wrote:
>> + cmap->start = 0;
>> + cmap->len = cols;
>> + cmap->red = colors;
>> + cmap->blue = colors;
>> + cmap->green = colors;
>
> If there actually is a difference between rcols, gcols, and bcols,
> should you not compute a different a 'colors' array for each different
> _cols?
I don't know if this cmap structure could be changed, but it would be a
lot easier if it was a single 2-D array, indexed as
cmap->map[index][channel].
Structures like this usually mean I have to make a kludge so that I can
turn an index number back into a location, for instance on this I would
do something like "((&cmap->red)+channel)[index]".
May want to add an alpha channel as well? Though I suspect most systems
doing direct color only have a single non-opaque color...
> Now, 'colors' is malloc'd here. How does the caller of this function
> know what to free? Freeing each of cmap->{red,blue,green,transp} would
> lead to double-free errors.
> Right, you free only 'red'. But that's rather surprising.
Changing it to a single 2-d array would fix this mystery as well.
More information about the wayland-devel
mailing list