----- Original Message -----
> On 01/27/2012 01:33 AM, Jose Fonseca wrote:
> > Brian,
> >
> > This is probably right but a tad verbose, and error prone.
> >
> > I'm not sure what's the best way to simplify this though. It's not
> > possible to canonize the comparisons because there are missing
> > combinations.
> >
> > But I think that at least using ternary operators would make the
> > code
> > more compact and help ensuring thar cases don't follow through the
> > cracks. For example:
> 
> At the top of the function, why not just do:
> 
>      if (swapBytes && type == GL_UNSIGNED_INT_8_8_8_8)
>          type = GL_UNSIGNED_INT_8_8_8_8_REV;
>      else if (swapBytes && type == GL_UNSIGNED_INT_8_8_8_8_REV)
>          type = GL_UNSIGNED_INT_8_8_8_8;

I tought that too. But one would need to toggle swapBytes too, to avoid 
considering swapBytes twice (e.g., in BGRA vs RGBA), and then you'd also need 
to make sure that all paths can handle the toggled swapBytes...

Jose
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to