On Wed, Jun 25, 2014 at 5:38 AM, Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com> wrote: > This patch adds 'pixman_texture_conversion' function which will > be used by following patches for converting textures between > different pixel formats. > > Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikk...@gmail.com> > --- > src/mesa/main/texstore.c | 65 > ++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > > diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c > index cb81f3f..a32b406 100644 > --- a/src/mesa/main/texstore.c > +++ b/src/mesa/main/texstore.c > @@ -75,6 +75,10 @@ > #include "../../gallium/auxiliary/util/u_format_r11g11b10f.h" > > > +#ifdef HAVE_PIXMAN > +# include <pixman.h> > +#endif > + > enum { > ZERO = 4, > ONE = 5 > @@ -966,6 +970,67 @@ memcpy_texture(struct gl_context *ctx, > } > } > > +#ifdef HAVE_PIXMAN > +/** > + * Use Pixman library to copy and convert src image to dst image. > + * \param srcFormat pixman_format_code_t of the source image. > + * \param srcBits pointer to source bits. > + * \param srcStride the length of source stride. > + * \param width of the source and destination images. > + * \param height of the source and destination images. > + * \param dstFormat pixman_format_code_t of the destination image. > + * \param dstBits pointer to destination bits. > + * \param dstStride the length of destination stride. > + * \return GLboolean GL_TRUE if everything ok. > + */ > +static GLboolean > +pixman_texture_conversion( > + const pixman_format_code_t srcFormat, > + uint32_t *srcBits, const uint32_t srcStride, > + const uint16_t width, const uint16_t height, > + const pixman_format_code_t dstFormat, > + uint32_t *dstBits, const uint32_t dstStride) > +{ > + pixman_image_t *pixmanImage[2]; > + > + if ((pixmanImage[0] = pixman_image_create_bits_no_clear(srcFormat,
You can just use pixman_image_create_bits() since the bits argument isn't NULL. (pixman_image_create_bits_no_clear doesn't clear the buffer only if bits is NULL). > + width, > + height, > + srcBits, > + srcStride)) > + == NULL) > + return GL_FALSE; > + > + /* Assumption source and destination images are same size here. > + */ > + if ((pixmanImage[1] = pixman_image_create_bits_no_clear(dstFormat, And here. _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev