pixman 0.9.6

This commit is contained in:
matthieu 2007-12-10 21:10:19 +00:00
parent 03229da51b
commit ae131499c7
17 changed files with 166 additions and 30 deletions

View File

@ -0,0 +1,26 @@
pixman is a library that provides low-level pixel manipulation
features such as image compositing and trapezoid rasterization.
Please submit bugs & patches to the libpixman bugzilla:
https://bugs.freedesktop.org/enter_bug.cgi?product=libpixman
All questions regarding this software should be directed to either the
Xorg mailing list:
http://lists.freedesktop.org/mailman/listinfo/xorg
or the cairo mailing list:
http://lists.freedesktop.org/mailman/listinfo/cairo
The master development code repository can be found at:
git://anongit.freedesktop.org/git/pixman
http://gitweb.freedesktop.org/?p=pixman;a=summary
For more information on the git code manager, see:
http://wiki.x.org/wiki/GitPage

View File

@ -57,6 +57,9 @@
/* use MMX compiler intrinsics */
#undef USE_MMX
/* use SSE compiler intrinsics */
#undef USE_SSE
/* Version number of package */
#undef VERSION

View File

@ -1,15 +1,17 @@
lib_LTLIBRARIES = libpixman-1.la
libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
libpixman_1_la_LIBADD = @DEP_LIBS@ -lm libpixmanwrapper.la
libpixman_1_la_LIBADD = @DEP_LIBS@ -lm
libpixman_1_la_SOURCES = \
pixman.h \
pixman-region.c \
pixman-private.h \
pixman-image.c \
pixman-compose.c \
pixman-compose-accessors.c \
pixman-pict.c \
pixman-utils.c \
pixman-edge.c \
pixman-edge-accessors.c \
pixman-edge-imp.h \
pixman-trap.c \
pixman-compute-region.c \
@ -18,18 +20,9 @@ libpixman_1_la_SOURCES = \
libpixmanincludedir = $(includedir)/pixman-1/
libpixmaninclude_HEADERS = pixman.h
# wrapper library
noinst_LTLIBRARIES = libpixmanwrapper.la
libpixmanwrapper_la_SOURCES = \
pixman-compose.c \
pixman-edge.c
libpixmanwrapper_la_CFLAGS = $(DEP_CFLAGS) -DPIXMAN_FB_ACCESSORS
# mmx code
if USE_MMX
noinst_LTLIBRARIES += libpixman-mmx.la
noinst_LTLIBRARIES = libpixman-mmx.la
libpixman_mmx_la_SOURCES = \
pixman-mmx.c \
pixman-mmx.h

View File

@ -0,0 +1,4 @@
#define PIXMAN_FB_ACCESSORS
#include "pixman-compose.c"

View File

@ -23,7 +23,9 @@
* SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <string.h>
@ -2878,7 +2880,7 @@ static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t
static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
{
uint32_t *bits;
uint32_t stride;
int32_t stride;
fetchProc fetch = fetchProcForPicture(pict);
const pixman_indexed_t * indexed = pict->indexed;
@ -3558,7 +3560,7 @@ static void pixmanFetchSourcePict(source_image_t * pict, int x, int y, int width
static void fbFetchTransformed(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
{
uint32_t *bits;
uint32_t stride;
int32_t stride;
fetchPixelProc fetch;
pixman_vector_t v;
pixman_vector_t unit;
@ -4091,7 +4093,7 @@ static void fbFetchExternalAlpha(bits_image_t * pict, int x, int y, int width, u
static void fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
{
uint32_t *bits;
uint32_t stride;
int32_t stride;
storeProc store = storeProcForPicture(pict);
const pixman_indexed_t * indexed = pict->indexed;
@ -4105,7 +4107,7 @@ static void fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buff
static void fbStoreExternalAlpha(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
{
uint32_t *bits, *alpha_bits;
uint32_t stride, astride;
int32_t stride, astride;
int ax, ay;
storeProc store;
storeProc astore;
@ -4161,7 +4163,7 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
unsigned int srcClass = SOURCE_IMAGE_CLASS_UNKNOWN;
unsigned int maskClass = SOURCE_IMAGE_CLASS_UNKNOWN;
uint32_t *bits;
uint32_t stride;
int32_t stride;
int xoff, yoff;
if (data->op == PIXMAN_OP_CLEAR)

View File

@ -21,7 +21,10 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include "pixman-private.h"

View File

@ -0,0 +1,4 @@
#define PIXMAN_FB_ACCESSORS
#include "pixman-edge.c"

View File

@ -1,5 +1,5 @@
/*
* $Id: pixman-edge.c,v 1.1.1.1 2007/10/03 20:48:55 matthieu Exp $
* $Id: pixman-edge.c,v 1.1.1.2 2007/12/10 21:10:23 matthieu Exp $
*
* Copyright © 2004 Keith Packard
*
@ -21,7 +21,11 @@
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include "pixman.h"
#include "pixman-private.h"

View File

@ -20,7 +20,9 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
@ -284,8 +286,31 @@ create_bits (pixman_format_code_t format,
int buf_size;
int bpp;
/* what follows is a long-winded way, avoiding any possibility of integer
* overflows, of saying:
* stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
*/
bpp = PIXMAN_FORMAT_BPP (format);
stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
if (pixman_multiply_overflows_int (width, bpp))
return NULL;
stride = width * bpp;
if (pixman_addition_overflows_int (stride, FB_MASK))
return NULL;
stride += FB_MASK;
stride >>= FB_SHIFT;
#if FB_SHIFT < 2
if (pixman_multiply_overflows_int (stride, sizeof (uint32_t)))
return NULL;
#endif
stride *= sizeof (uint32_t);
if (pixman_multiply_overflows_int (height, stride))
return NULL;
buf_size = height * stride;
if (rowstride_bytes)
@ -325,7 +350,7 @@ pixman_image_create_bits (pixman_format_code_t format,
return_val_if_fail (bits == NULL ||
(rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
if (!bits)
if (!bits && width && height)
{
free_me = bits = create_bits (format, width, height, &rowstride_bytes);
if (!bits)
@ -334,8 +359,11 @@ pixman_image_create_bits (pixman_format_code_t format,
image = allocate_image();
if (!image)
if (!image) {
if (free_me)
free (free_me);
return NULL;
}
image->type = BITS;
image->bits.format = format;

View File

@ -28,14 +28,13 @@
*
* Based on work by Owen Taylor
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef USE_MMX
#if defined(__amd64__) || defined(__x86_64__)
#define USE_SSE
#endif
#include <mmintrin.h>
#ifdef USE_SSE
#include <xmmintrin.h> /* for _mm_shuffle_pi16 and _MM_SHUFFLE */

View File

@ -22,7 +22,10 @@
* Author: Keith Packard, SuSE, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -1426,6 +1429,7 @@ pixman_image_composite (pixman_op_t op,
{
maskRepeat = pMask->common.repeat == PIXMAN_REPEAT_NORMAL;
maskTransform = pMask->common.transform != 0;
if (pMask->common.filter == PIXMAN_FILTER_CONVOLUTION)
maskTransform = TRUE;
@ -1778,7 +1782,6 @@ pixman_image_composite (pixman_op_t op,
break;
case PIXMAN_x8r8g8b8:
switch (pDst->bits.format) {
case PIXMAN_a8r8g8b8:
case PIXMAN_x8r8g8b8:
#ifdef USE_MMX
if (pixman_have_mmx())
@ -1790,7 +1793,6 @@ pixman_image_composite (pixman_op_t op,
}
case PIXMAN_x8b8g8r8:
switch (pDst->bits.format) {
case PIXMAN_a8b8g8r8:
case PIXMAN_x8b8g8r8:
#ifdef USE_MMX
if (pixman_have_mmx())

View File

@ -37,6 +37,28 @@
# define FUNC ((const char*) ("???"))
#endif
#ifndef INT16_MIN
# define INT16_MIN (-32767-1)
# define INT16_MAX (32767)
#endif
#ifndef INT32_MIN
# define INT32_MIN (-2147483647-1)
# define INT32_MAX (2147483647)
#endif
#ifndef UINT32_MIN
# define UINT32_MIN (0)
# define UINT32_MAX (4294967295U)
#endif
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
#ifdef _MSC_VER
#define inline __inline
#endif
#define FB_SHIFT 5
#define FB_UNIT (1 << FB_SHIFT)
@ -47,6 +69,8 @@
/* Memory allocation helpers */
void *pixman_malloc_ab (unsigned int n, unsigned int b);
void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
pixman_bool_t pixman_multiply_overflows_int (unsigned int a, unsigned int b);
pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
#if DEBUG
@ -774,6 +798,8 @@ pixman_rasterize_edges_accessors (pixman_image_t *image,
pixman_fixed_t b);
#ifdef PIXMAN_TIMING
/* Timing */
static inline uint64_t
oil_profile_stamp_rdtsc (void)
@ -817,5 +843,6 @@ void pixman_timer_register (PixmanTimer *timer);
timer##tname.total += OIL_STAMP() - begin##tname; \
}
#endif /* PIXMAN_TIMING */
#endif /* PIXMAN_PRIVATE_H */

View File

@ -45,7 +45,10 @@ SOFTWARE.
******************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <limits.h>
#include <string.h>
@ -2515,6 +2518,8 @@ pixman_region_init_rects (pixman_region16_t *region,
{
int overlap;
/* if it's 1, then we just want to set the extents, so call
* the existing method. */
if (count == 1) {
pixman_region_init_rect(region,
boxes[0].x1,
@ -2525,6 +2530,15 @@ pixman_region_init_rects (pixman_region16_t *region,
}
pixman_region_init(region);
/* if it's 0, don't call pixman_rect_alloc -- 0 rectangles is
* a special case, and causing pixman_rect_alloc would cause
* us to leak memory (because the 0-rect case should be the
* static pixman_region_emptyData data).
*/
if (count == 0)
return TRUE;
if (!pixman_rect_alloc(region, count))
return FALSE;

View File

@ -19,11 +19,16 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include "pixman-private.h"
#ifdef PIXMAN_TIMER
static PixmanTimer *timers;
static void
@ -57,3 +62,5 @@ pixman_timer_register (PixmanTimer *timer)
timer->next = timers;
timers = timer;
}
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: pixman-trap.c,v 1.1.1.1 2007/10/03 20:48:54 matthieu Exp $
* $Id: pixman-trap.c,v 1.1.1.2 2007/12/10 21:10:22 matthieu Exp $
*
* Copyright © 2004 Keith Packard
*
@ -22,7 +22,10 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include "pixman-private.h"

View File

@ -21,7 +21,10 @@
* Author: Keith Packard, SuSE, Inc.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include "pixman.h"
#include "pixman-private.h"
@ -368,6 +371,20 @@ pixman_line_fixed_edge_init (pixman_edge_t *e,
bot->y + y_off_fixed);
}
pixman_bool_t
pixman_multiply_overflows_int (unsigned int a,
unsigned int b)
{
return a >= INT32_MAX / b;
}
pixman_bool_t
pixman_addition_overflows_int (unsigned int a,
unsigned int b)
{
return a > INT32_MAX - b;
}
void *
pixman_malloc_ab(unsigned int a,
unsigned int b)

View File

@ -452,7 +452,7 @@ typedef enum {
/* 1bpp formats */
PIXMAN_a1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0)
} pixman_format_code_t;
/* Constructors */
@ -498,7 +498,7 @@ pixman_bool_t pixman_image_set_filter (pixman_image_t
void pixman_image_set_filter_params (pixman_image_t *image,
pixman_fixed_t *params,
int n_params);
void pixman_image_set_source_cliping (pixman_image_t *image,
void pixman_image_set_source_clipping (pixman_image_t *image,
pixman_bool_t source_clipping);
void pixman_image_set_alpha_map (pixman_image_t *image,
pixman_image_t *alpha_map,