Remove extraneous whitespace from "blank" lines.

This patch was produced with the following (GNU) sed script:

	sed -i -r -e 's/^[ \t]+$//'

run on all *.[ch] files within cairo.
This commit is contained in:
Carl Worth 2006-06-06 15:25:49 -07:00
parent 28d47d332a
commit 80b8deb1e4
106 changed files with 1311 additions and 1311 deletions

View file

@ -128,6 +128,6 @@ main (int argc, char **argv)
gtk_widget_show_all (window);
gtk_main ();
return 0;
}

View file

@ -58,7 +58,7 @@ main (int argc, char **argv)
}
surface = cairo_pdf_surface_create (filename, WIDTH, HEIGHT);
cr = cairo_create (surface);
draw (cr, WIDTH, HEIGHT);

View file

@ -43,7 +43,7 @@ main (int argc, char **argv)
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
WIDTH, HEIGHT);
cr = cairo_create (surface);
draw (cr, WIDTH, HEIGHT);

View file

@ -19,14 +19,14 @@ draw (cairo_t *cr, int width, int height)
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, 0, 80);
cairo_line_to (cr, 50, 80);
/* C */
cairo_move_to (cr, 110 + 40 * cos (M_PI / 3), 40 + 40 * sin(M_PI / 3));
cairo_arc (cr, 110, 40, 40, M_PI / 3, -M_PI / 3);
/* A */
cairo_move_to (cr, 160, 80);
cairo_curve_to (cr, 160, -30, 210, -30, 210, 80);
cairo_stroke (cr);
}

View file

@ -3548,10 +3548,10 @@ static void fbFetchExternalAlpha(PicturePtr pict, int x, int y, int width, CARD3
fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
return;
}
if (width > SCANLINE_BUFFER_LENGTH)
alpha_buffer = (CARD32 *) malloc(width*sizeof(CARD32));
fbFetchTransformed(pict, x, y, width, buffer, mask, maskBits);
fbFetchTransformed(pict->alphaMap, x - pict->alphaOrigin.x,
y - pict->alphaOrigin.y, width, alpha_buffer,
@ -3930,7 +3930,7 @@ pixman_compositeGeneral (pixman_operator_t op,
CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3];
CARD32 *scanline_buffer = _scanline_buffer;
FbComposeData compose_data;
if (pSrc->pDrawable)
srcRepeat = pSrc->repeat == RepeatNormal && !pSrc->transform
&& (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1);

View file

@ -127,7 +127,7 @@ fbRasterizeEdges8 (FbBits *buf,
CARD8 *ap = (CARD8 *) line;
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
@ -135,7 +135,7 @@ fbRasterizeEdges8 (FbBits *buf,
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{

View file

@ -34,14 +34,14 @@ rasterizeEdges (FbBits *buf,
{
xFixed y = t;
FbBits *line;
line = buf + xFixedToInt (y) * stride;
for (;;)
{
xFixed lx, rx;
int lxi, rxi;
/* clip X */
lx = l->x;
if (lx < 0)
@ -49,7 +49,7 @@ rasterizeEdges (FbBits *buf,
rx = r->x;
if (xFixedToInt (rx) >= width)
rx = IntToxFixed (width);
/* Skip empty (or backwards) sections */
if (rx > lx)
{

File diff suppressed because it is too large Load diff

View file

@ -1362,7 +1362,7 @@ pixman_composite (pixman_operator_t op,
mmx_setup = TRUE;
}
#endif
xDst += pDst->pDrawable->x;
yDst += pDst->pDrawable->y;
if (pSrc->pDrawable) {
@ -1821,7 +1821,7 @@ pixman_composite (pixman_operator_t op,
region = pixman_region_create();
pixman_region_union_rect (region, region, xDst, yDst, width, height);
if (!FbComputeCompositeRegion (region,
pSrc,
pMask,
@ -1835,7 +1835,7 @@ pixman_composite (pixman_operator_t op,
width,
height))
return;
n = pixman_region_num_rects (region);
pbox = pixman_region_rects (region);
while (n--)
@ -2009,7 +2009,7 @@ fbHaveMMX (void)
mmx_present = (features & (MMX|MMX_Extensions)) == (MMX|MMX_Extensions);
initialized = TRUE;
}
return mmx_present;
}
#endif /* USE_MMX && !amd64 */

View file

@ -144,7 +144,7 @@
((*((CARD16 *) (a)) = (CARD16) (v)),\
(*((a)+2) = (CARD8) ((v) >> 16))))
#endif
/*
The methods below use some tricks to be able to do two color
components at the same time.

View file

@ -46,14 +46,14 @@ fbAddTraps (PicturePtr pPicture,
xFixed y_off_fixed;
RenderEdge l, r;
xFixed t, b;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(y_off);
y_off_fixed = IntToxFixed(y_off);
@ -63,12 +63,12 @@ fbAddTraps (PicturePtr pPicture,
if (t < 0)
t = 0;
t = RenderSampleCeilY (t, bpp);
b = traps->bot.y + y_off_fixed;
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
@ -77,13 +77,13 @@ fbAddTraps (PicturePtr pPicture,
traps->top.y + y_off_fixed,
traps->bot.l + x_off_fixed,
traps->bot.y + y_off_fixed);
RenderEdgeInit (&r, bpp, t,
traps->top.r + x_off_fixed,
traps->top.y + y_off_fixed,
traps->bot.r + x_off_fixed,
traps->bot.y + y_off_fixed);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
traps++;
@ -108,14 +108,14 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
xFixed y_off_fixed;
RenderEdge l, r;
xFixed t, b;
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
width = pPicture->pDrawable->width;
height = pPicture->pDrawable->height;
x_off += pxoff;
y_off += pyoff;
x_off_fixed = IntToxFixed(x_off);
y_off_fixed = IntToxFixed(y_off);
t = trap->top + y_off_fixed;
@ -127,13 +127,13 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
if (xFixedToInt (b) >= height)
b = IntToxFixed (height) - 1;
b = RenderSampleFloorY (b, bpp);
if (b >= t)
{
/* initialize edge walkers */
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
}
}
@ -190,7 +190,7 @@ fbAddTriangles (PicturePtr pPicture,
if (_Clockwise (top, right, left)) {
tmp = right; right = left; left = tmp;
}
/*
* Two cases:
*
@ -203,7 +203,7 @@ fbAddTriangles (PicturePtr pPicture,
* / --- --- \
* +-- --+
*/
trap.top = top->y;
trap.left.p1 = *top;
trap.left.p2 = *left;

View file

@ -40,18 +40,18 @@ void
fbBlt (FbBits *srcLine,
FbStride srcStride,
int srcX,
FbBits *dstLine,
FbStride dstStride,
int dstX,
int width,
int height,
int alu,
FbBits pm,
int bpp,
Bool reverse,
Bool upsidedown)
{
@ -63,7 +63,7 @@ fbBlt (FbBits *srcLine,
Bool destInvarient;
int startbyte, endbyte;
FbDeclareMergeRop ();
/* are we just copying multiples of 8 bits? if so, run, forrest, run!
the memcpy()'s should be pluggable ala mplayer|xine - perhaps we can get
one of the above to give up their code for us.
@ -84,10 +84,10 @@ fbBlt (FbBits *srcLine,
else
for(j=(height-1);j>=0;j--)
memcpy(idst+j*dstride, isrc+j*sstride, width);
return;
}
#ifdef FB_24BIT
if (bpp == 24 && !FbCheck24Pix (pm))
{
@ -231,7 +231,7 @@ fbBlt (FbBits *srcLine,
srcLine += srcStride;
dst = dstLine;
dstLine += dstStride;
bits1 = 0;
if (reverse)
{
@ -360,7 +360,7 @@ fbBlt24Line (FbBits *src,
int alu,
FbBits pm,
Bool reverse)
{
#ifdef DEBUG_BLT24
@ -369,17 +369,17 @@ fbBlt24Line (FbBits *src,
int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3;
int origX = dstX / 24;
#endif
int leftShift, rightShift;
FbBits startmask, endmask;
int n;
FbBits bits, bits1;
FbBits mask;
int rot;
FbDeclareMergeRop ();
FbInitializeMergeRop (alu, FB_ALLONES);
FbMaskBits(dstX, width, startmask, n, endmask);
#ifdef DEBUG_BLT24
@ -472,7 +472,7 @@ fbBlt24Line (FbBits *src,
rightShift = dstX - srcX;
leftShift = FB_UNIT - rightShift;
}
bits1 = 0;
if (reverse)
{
@ -631,7 +631,7 @@ fbBltOdd (FbBits *srcLine,
int leftShiftEven, rightShiftEven;
FbBits startmaskEven, endmaskEven;
int nmiddleEven;
FbBits *dst;
int leftShiftOdd, rightShiftOdd;
FbBits startmaskOdd, endmaskOdd;
@ -640,12 +640,12 @@ fbBltOdd (FbBits *srcLine,
int leftShift, rightShift;
FbBits startmask, endmask;
int nmiddle;
int srcX, dstX;
FbBits bits, bits1;
int n;
Bool destInvarient;
Bool even;
FbDeclareMergeRop ();
@ -662,7 +662,7 @@ fbBltOdd (FbBits *srcLine,
FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven);
FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd);
even = TRUE;
InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven);
InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd);
@ -800,7 +800,7 @@ fbBltOdd24 (FbBits *srcLine,
FbBits pm)
{
Bool even = TRUE;
while (height--)
{
if (even)
@ -864,7 +864,7 @@ fbSetBltOdd (FbStip *stip,
{
*strideEven = FbStipStrideToBitsStride (stipStride);
*strideOdd = FbStipStrideToBitsStride (stipStride + 1);
*srcXEven = srcX;
*srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT);
}
@ -875,7 +875,7 @@ void
fbBltStip (FbStip *src,
FbStride srcStride, /* in FbStip units, not FbBits units */
int srcX,
FbStip *dst,
FbStride dstStride, /* in FbStip units, not FbBits units */
int dstX,
@ -897,22 +897,22 @@ fbBltStip (FbStip *src,
int dstXEven, dstXOdd;
FbBits *s, *d;
int sx, dx;
src += srcX >> FB_STIP_SHIFT;
srcX &= FB_STIP_MASK;
dst += dstX >> FB_STIP_SHIFT;
dstX &= FB_STIP_MASK;
fbSetBltOdd (src, srcStride, srcX,
&s,
&srcStrideEven, &srcStrideOdd,
&srcXEven, &srcXOdd);
fbSetBltOdd (dst, dstStride, dstX,
&d,
&dstStrideEven, &dstStrideOdd,
&dstXEven, &dstXOdd);
#ifdef FB_24BIT
if (bpp == 24 && !FbCheck24Pix (pm))
{
@ -929,10 +929,10 @@ fbBltStip (FbStip *src,
{
fbBltOdd (s, srcStrideEven, srcStrideOdd,
srcXEven, srcXOdd,
d, dstStrideEven, dstStrideOdd,
dstXEven, dstXOdd,
width, height, alu, pm, bpp);
}
}

View file

@ -54,9 +54,9 @@
} else \
bits = *src++; \
}
#ifndef FBNOPIXADDR
#define LaneCases1(n,a) case n: (void)FbLaneCase(n,a); break
#define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a)
#define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a)
@ -66,15 +66,15 @@
#define LaneCases64(n,a) LaneCases32(n,a); LaneCases32(n+32,a)
#define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a)
#define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a)
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
#if FB_SHIFT == 6
static uint8_t const fb8Lane[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
@ -182,7 +182,7 @@ fbBltOne (FbStip *src,
return;
}
#endif
/*
* Number of destination units in FbBits == number of stipple pixels
* used each time
@ -193,7 +193,7 @@ fbBltOne (FbStip *src,
* Number of source stipple patterns in FbStip
*/
unitsPerSrc = FB_STIP_UNIT / pixelsPerDst;
copy = FALSE;
transparent = FALSE;
if (bgand == 0 && fgand == 0)
@ -241,7 +241,7 @@ fbBltOne (FbStip *src,
if (transparent && fgand == 0 && dstBpp >= 8)
fbLane = fbLaneTable(dstBpp);
#endif
/*
* Compute total number of destination words written, but
* don't count endmask
@ -249,15 +249,15 @@ fbBltOne (FbStip *src,
nDst = nmiddle;
if (startmask)
nDst++;
dstStride -= nDst;
/*
* Compute total number of source words consumed
*/
srcinc = (nDst + unitsPerSrc - 1) / unitsPerSrc;
if (srcX > dstS)
srcinc++;
if (endmask)
@ -268,7 +268,7 @@ fbBltOne (FbStip *src,
}
srcStride -= srcinc;
/*
* Copy rectangle
*/
@ -278,7 +278,7 @@ fbBltOne (FbStip *src,
n = unitsPerSrc; /* units avail in single stipple */
if (n > w)
n = w;
bitsLeft = 0;
if (srcX > dstS)
bitsLeft = *src++;
@ -549,7 +549,7 @@ static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = {
fbFirstStipBits(len,stip); \
stip = FbMergeStip24Bits (0, stip, len); \
}
#define fbNextStipBits(rot,stip) {\
int __new = FbStip24New(rot); \
FbStip __right; \
@ -593,23 +593,23 @@ fbBltOne24 (FbStip *srcLine,
int firstlen;
int rot0, rot;
int nDst;
srcLine += srcX >> FB_STIP_SHIFT;
dst += dstX >> FB_SHIFT;
srcX &= FB_STIP_MASK;
dstX &= FB_MASK;
rot0 = FbFirst24Rot (dstX);
FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask);
dstS = (dstX + 23) / 24;
firstlen = FbStip24Len - dstS;
nDst = nlMiddle;
if (leftMask)
nDst++;
dstStride -= nDst;
/* opaque copy */
if (bgand == 0 && fgand == 0)
{

View file

@ -94,7 +94,7 @@ void
pixman_format_init (pixman_format_t *format, int format_code)
{
memset (format, 0, sizeof (pixman_format_t));
/* XXX: What do we want to lodge in here?
format->id = FakeClientID (0);
*/
@ -102,45 +102,45 @@ pixman_format_init (pixman_format_t *format, int format_code)
switch (PICT_FORMAT_TYPE(format_code)) {
case PICT_TYPE_ARGB:
format->alphaMask = Mask(PICT_FORMAT_A(format_code));
if (format->alphaMask)
format->alpha = (PICT_FORMAT_R(format_code) +
PICT_FORMAT_G(format_code) +
PICT_FORMAT_B(format_code));
format->redMask = Mask(PICT_FORMAT_R(format_code));
format->red = (PICT_FORMAT_G(format_code) +
PICT_FORMAT_B(format_code));
format->greenMask = Mask(PICT_FORMAT_G(format_code));
format->green = PICT_FORMAT_B(format_code);
format->blueMask = Mask(PICT_FORMAT_B(format_code));
format->blue = 0;
break;
case PICT_TYPE_ABGR:
format->alphaMask = Mask(PICT_FORMAT_A(format_code));
if (format->alphaMask)
format->alpha = (PICT_FORMAT_B(format_code) +
PICT_FORMAT_G(format_code) +
PICT_FORMAT_R(format_code));
format->blueMask = Mask(PICT_FORMAT_B(format_code));
format->blue = (PICT_FORMAT_G(format_code) +
PICT_FORMAT_R(format_code));
format->greenMask = Mask(PICT_FORMAT_G(format_code));
format->green = PICT_FORMAT_R(format_code);
format->redMask = Mask(PICT_FORMAT_R(format_code));
format->red = 0;
break;
case PICT_TYPE_A:
format->alpha = 0;
format->alphaMask = Mask(PICT_FORMAT_A(format_code));

View file

@ -34,7 +34,7 @@ pixman_image_create (pixman_format_t *format,
pixels = FbPixelsCreate (width, height, format->depth);
if (pixels == NULL)
return NULL;
image = pixman_image_createForPixels (pixels, format);
if (image == NULL) {
FbPixelsDestroy (pixels);
@ -382,7 +382,7 @@ pixman_image_set_transform (pixman_image_t *image,
if (transform && memcmp (transform, &identity, sizeof (pixman_transform_t)) == 0)
transform = NULL;
if (transform)
{
if (!image->transform)
@ -481,7 +481,7 @@ pixman_image_destroy (pixman_image_t *image)
pixman_region_destroy (image->pCompositeClip);
image->pCompositeClip = NULL;
}
if (image->freeSourceClip) {
pixman_region_destroy (image->pSourceClip);
image->pSourceClip = NULL;
@ -537,7 +537,7 @@ pixman_image_set_clip_region (pixman_image_t *image,
image->stateChanges |= CPClipMask;
if (image->pSourcePict)
return 0;
if (image->freeCompClip)
pixman_region_destroy (image->pCompositeClip);
image->pCompositeClip = pixman_region_create();
@ -555,7 +555,7 @@ pixman_image_set_clip_region (pixman_image_t *image,
image->clipOrigin.x,
image->clipOrigin.y);
}
return 0;
}
@ -596,7 +596,7 @@ FbClipImageReg (pixman_region16_t *region,
}
return 1;
}
static __inline int
FbClipImageSrc (pixman_region16_t *region,
pixman_image_t *image,
@ -654,7 +654,7 @@ pixman_image_change (pixman_image_t *image,
BITS32 index2;
int error = 0;
BITS32 maskQ;
maskQ = vmask;
while (vmask && !error)
{
@ -679,7 +679,7 @@ pixman_image_change (pixman_image_t *image,
case CPAlphaMap:
{
pixman_image_t *iAlpha;
iAlpha = NEXT_PTR(pixman_image_t *);
if (iAlpha)
iAlpha->refcnt++;
@ -917,7 +917,7 @@ int
miIsSolidAlpha (pixman_image_t *src)
{
char line[1];
/* Alpha-only */
if (PICT_FORMAT_TYPE (src->format_code) != PICT_TYPE_A)
return 0;

View file

@ -138,7 +138,7 @@ struct pixman_image {
pixman_format_t image_format;
int format_code;
int refcnt;
unsigned int repeat : 2;
unsigned int graphicsExposures : 1;
unsigned int subWindowMode : 1;
@ -164,7 +164,7 @@ struct pixman_image {
pixman_region16_t *pCompositeClip;
pixman_region16_t *pSourceClip;
pixman_transform_t *transform;
pixman_filter_t filter;
@ -306,7 +306,7 @@ struct _FbCompositeOperand {
struct {
pixman_bits_t *top_line;
int left_offset;
int start_offset;
pixman_bits_t *line;
uint32_t offset;

View file

@ -136,7 +136,7 @@ typedef pixman_triangle_t xTriangle;
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
#define FB_MASK (FB_UNIT - 1)
#define FB_ALLONES ((pixman_bits_t) -1)
/* whether to bother to include 24bpp support */
#ifndef ICNO24BIT
#define FB_24BIT
@ -157,13 +157,13 @@ typedef pixman_triangle_t xTriangle;
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
#define FB_STIP_ALLONES ((FbStip) -1)
#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0)
#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0)
#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT)))
#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT)))
#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1))
@ -593,18 +593,18 @@ pixman_private void
fbBlt (pixman_bits_t *src,
FbStride srcStride,
int srcX,
FbBits *dst,
FbStride dstStride,
int dstX,
int width,
int height,
int alu,
FbBits pm,
int bpp,
Bool reverse,
Bool upsidedown);
@ -625,12 +625,12 @@ fbBlt24 (pixman_bits_t *srcLine,
Bool reverse,
Bool upsidedown);
pixman_private void
fbBltStip (FbStip *src,
FbStride srcStride, /* in FbStip units, not FbBits units */
int srcX,
FbStip *dst,
FbStride dstStride, /* in FbStip units, not FbBits units */
int dstX,
@ -641,7 +641,7 @@ fbBltStip (FbStip *src,
int alu,
FbBits pm,
int bpp);
/*
* icbltone.c
*/
@ -661,7 +661,7 @@ fbBltOne (FbStip *src,
FbBits fbxor,
FbBits bgand,
FbBits bgxor);
#ifdef FB_24BIT
pixman_private void
fbBltOne24 (FbStip *src,
@ -956,7 +956,7 @@ typedef struct _PictFormat *PictFormatPtr;
#define PICT_b1g2r1 PICT_FORMAT(4,PICT_TYPE_ABGR,0,1,2,1)
#define PICT_a1r1g1b1 PICT_FORMAT(4,PICT_TYPE_ARGB,1,1,1,1)
#define PICT_a1b1g1r1 PICT_FORMAT(4,PICT_TYPE_ABGR,1,1,1,1)
#define PICT_c4 PICT_FORMAT(4,PICT_TYPE_COLOR,0,0,0,0)
#define PICT_g4 PICT_FORMAT(4,PICT_TYPE_GRAY,0,0,0,0)

View file

@ -135,7 +135,7 @@ pixman_fill_rect_32bpp (pixman_image_t *dst,
line = (char *)dst->pixels->data +
xDst * 4 + yDst * dst->pixels->stride;
int_pixel = *(uint32_t *)pixel;
while (height-- > 0) {
data = line;
@ -165,7 +165,7 @@ pixman_fill_rect_general (pixman_image_t *dst,
line = (char *)dst->pixels->data +
xDst * pixel_size + yDst * dst->pixels->stride;
while (height-- > 0) {
data = line;
w = width;
@ -201,7 +201,7 @@ pixman_color_rects (pixman_image_t *dst,
/* offset to the right place on the destination image */
xoff -= dst->pixels->x;
yoff -= dst->pixels->y;
clip = pixman_region_create();
pixman_region_union_rect (clip, clip,
dst->pixels->x, dst->pixels->y,
@ -250,7 +250,7 @@ pixman_color_rects (pixman_image_t *dst,
func = pixman_fill_rect_1bpp;
else
func = pixman_fill_rect_general;
for (i = 0; i < n_clipped_rects; i++) {
(*func) (dst,
clipped_rects[i].x1,
@ -326,11 +326,11 @@ pixman_fill_rectangles (pixman_operator_t op,
pixman_bits_t pixel;
pixman_format_init (&rgbaFormat, PICT_a8r8g8b8);
pixels = FbPixelsCreate (1, 1, rgbaFormat.depth);
if (!pixels)
goto bail1;
pixman_color_to_pixel (&rgbaFormat, &color_s, &pixel);
/* XXX: Originally, fb had the following:

View file

@ -110,7 +110,7 @@ fbStippleTable(int bits);
#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \
(FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b))
#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \
FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \
FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \
@ -122,7 +122,7 @@ fbStippleTable(int bits);
}
#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b)))
/*
* Compute rop for using tile code for 1-bit dest stipples; modifies
* existing rop to flip depending on pixel values

View file

@ -41,15 +41,15 @@
#define LaneCases64(c,a) LaneCases32(c,a); LaneCases32(c+32,a)
#define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a)
#define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a)
#if FB_SHIFT == 6
#define LaneCases(a) LaneCases256(0,a)
#endif
#if FB_SHIFT == 5
#define LaneCases(a) LaneCases16(0,a)
#endif
/*
* Repeat a transparent stipple across a scanline n times
*/

View file

@ -81,16 +81,16 @@ pixman_trapezoid_bounds (int ntrap, const pixman_trapezoid_t *traps, pixman_box1
y1 = xFixedToInt (traps->top);
if (y1 < box->y1)
box->y1 = y1;
y2 = xFixedToInt (xFixedCeil (traps->bottom));
if (y2 > box->y2)
box->y2 = y2;
x1 = xFixedToInt (MIN (pixman_line_fixed_x (&traps->left, traps->top, 0),
pixman_line_fixed_x (&traps->left, traps->bottom, 0)));
if (x1 < box->x1)
box->x1 = x1;
x2 = xFixedToInt (xFixedCeil (MAX (pixman_line_fixed_x (&traps->right, traps->top, 1),
pixman_line_fixed_x (&traps->right, traps->bottom, 1))));
if (x2 > box->x2)
@ -132,7 +132,7 @@ pixman_composite_trapezoids (pixman_operator_t op,
xDst = traps[0].left.p1.x >> 16;
yDst = traps[0].left.p1.y >> 16;
pixman_trapezoid_bounds (ntraps, traps, &traps_bounds);
traps_region = pixman_region_create_simple (&traps_bounds);

View file

@ -94,25 +94,25 @@ FbRasterizeTriangle (pixman_image_t *image,
* / --- --- \
* +-- --+
*/
trap[0].top = top->y;
trap[0].left.p1.x = top->x;
trap[0].left.p1.y = trap[0].top;
trap[0].left.p2.x = left->x;
trap[0].left.p2.y = left->y;
trap[0].right.p1 = trap[0].left.p1;
trap[0].right.p2.x = right->x;
trap[0].right.p2.y = right->y;
if (right->y < left->y)
{
trap[0].bottom = trap[0].right.p2.y;
trap[1].top = trap[0].bottom;
trap[1].bottom = trap[0].left.p2.y;
trap[1].left = trap[0].left;
trap[1].right.p1 = trap[0].right.p2;
trap[1].right.p2 = trap[0].left.p2;
@ -120,10 +120,10 @@ FbRasterizeTriangle (pixman_image_t *image,
else
{
trap[0].bottom = trap[0].left.p2.y;
trap[1].top = trap[0].bottom;
trap[1].bottom = trap[0].right.p2.y;
trap[1].right = trap[0].right;
trap[1].left.p1 = trap[0].left.p2;
trap[1].left.p2 = trap[0].right.p2;
@ -148,12 +148,12 @@ pixman_composite_triangles (pixman_operator_t op,
int xDst, yDst;
int xRel, yRel;
pixman_format_t *format;
xDst = tris[0].p1.x >> 16;
yDst = tris[0].p1.y >> 16;
format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
if (format)
{
pixman_triangle_bounds (ntris, tris, &bounds);
@ -223,12 +223,12 @@ pixman_composite_tri_strip (pixman_operator_t op,
if (npoints < 3)
return;
xDst = points[0].x >> 16;
yDst = points[0].y >> 16;
format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
if (format)
{
pixman_point_fixed_bounds (npoints, points, &bounds);
@ -298,7 +298,7 @@ pixman_composite_tri_fan (pixman_operator_t op,
int xDst, yDst;
int xRel, yRel;
pixman_format_t *format;
if (npoints < 3)
return;
@ -306,7 +306,7 @@ pixman_composite_tri_fan (pixman_operator_t op,
yDst = points[0].y >> 16;
format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
if (format)
{
pixman_point_fixed_bounds (npoints, points, &bounds);

View file

@ -28,7 +28,7 @@ pixman_bits_t
fbReplicatePixel (Pixel p, int bpp)
{
pixman_bits_t b = p;
b &= FbFullMask (bpp);
while (bpp < FB_UNIT)
{

View file

@ -21,7 +21,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of The Open Group shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
Copyright 1987, 1988, 1989 by
Digital Equipment Corporation, Maynard, Massachusetts.
@ -244,7 +244,7 @@ pixman_region16_tsEqual(reg1, reg2)
if (reg1->extents.y1 != reg2->extents.y1) return PIXMAN_REGION_STATUS_FAILURE;
if (reg1->extents.y2 != reg2->extents.y2) return PIXMAN_REGION_STATUS_FAILURE;
if (PIXREGION_NUM_RECTS(reg1) != PIXREGION_NUM_RECTS(reg2)) return PIXMAN_REGION_STATUS_FAILURE;
rects1 = PIXREGION_RECTS(reg1);
rects2 = PIXREGION_RECTS(reg2);
for (i = 0; i != PIXREGION_NUM_RECTS(reg1); i++) {
@ -321,7 +321,7 @@ pixman_region16_t *
pixman_region_create_simple (pixman_box16_t *extents)
{
pixman_region16_t *region;
region = malloc (sizeof (pixman_region16_t));
if (region == NULL)
return &pixman_brokenregion;
@ -393,7 +393,7 @@ static pixman_region_status_t
pixman_rect_alloc(pixman_region16_t * region, int n)
{
pixman_region16_data_t *data;
if (!region->data)
{
n++;
@ -690,7 +690,7 @@ pixman_op(
*/
if (PIXREGION_NAR (reg1) || PIXREGION_NAR(reg2))
return pixman_break (newReg);
/*
* Initialization:
* set r1, r2, r1End and r2End appropriately, save the rectangles
@ -742,7 +742,7 @@ pixman_op(
*/
ybot = MIN(r1->y1, r2->y1);
/*
* prevBand serves to mark the start of the previous band so rectangles
* can be coalesced into larger rectangles. qv. pixman_coalesce, above.
@ -753,7 +753,7 @@ pixman_op(
* array of rectangles.
*/
prevBand = 0;
do {
/*
* This algorithm proceeds one source-band (as opposed to a
@ -764,7 +764,7 @@ pixman_op(
*/
assert(r1 != r1End);
assert(r2 != r2End);
FindBand(r1, r1BandEnd, r1End, r1y1);
FindBand(r2, r2BandEnd, r2End, r2y1);
@ -1141,7 +1141,7 @@ pixman_region_unionO (
MERGERECT(r2);
} while (r2 != r2End);
}
/* Add current rectangle */
NEWRECT(region, pNextRect, x1, y1, x2, y2);
@ -1274,7 +1274,7 @@ pixman_region_append(dstrgn, rgn)
if (PIXREGION_NAR(rgn))
return pixman_break (dstrgn);
if (!rgn->data && (dstrgn->data == &pixman_region_emptyData))
{
dstrgn->extents = rgn->extents;
@ -1349,7 +1349,7 @@ pixman_region_append(dstrgn, rgn)
return PIXMAN_REGION_STATUS_SUCCESS;
}
#define ExchangeRects(a, b) \
{ \
pixman_box16_t t; \
@ -1758,7 +1758,7 @@ pixman_region_subtractO (
int x1;
x1 = r1->x1;
assert(y1<y2);
assert(r1 != r1End && r2 != r2End);
@ -1852,7 +1852,7 @@ pixman_region_subtractO (
}
return PIXMAN_REGION_STATUS_SUCCESS;
}
/*-
*-----------------------------------------------------------------------
* pixman_region_subtract --
@ -1894,7 +1894,7 @@ pixman_region_subtract(regD, regM, regS)
regD->data = &pixman_region_emptyData;
return PIXMAN_REGION_STATUS_SUCCESS;
}
/* Add those rectangles in region 1 that aren't in region 2,
do yucky substraction for overlaps, and
just throw away rectangles in region 2 that aren't in region 1 */
@ -2430,7 +2430,7 @@ pixman_region16_clip_spans(
clipy1 = prgnDst->extents.y1;
clipx2 = prgnDst->extents.x2;
clipy2 = prgnDst->extents.y2;
for (; ppt != pptLast; ppt++, pwidth++)
{
y = ppt->y;
@ -2468,7 +2468,7 @@ pixman_region16_clip_spans(
pboxBandStart = PIXREGION_BOXPTR(prgnDst);
pboxLast = pboxBandStart + numRects;
NextBand();
for (; ppt != pptLast; )

View file

@ -32,7 +32,7 @@ RenderSampleCeilY (xFixed y, int n)
{
xFixed f = xFixedFrac(y);
xFixed i = xFixedFloor(y);
f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
if (f > Y_FRAC_LAST(n))
{
@ -53,7 +53,7 @@ RenderSampleFloorY (xFixed y, int n)
{
xFixed f = xFixedFrac(y);
xFixed i = xFixedFloor (y);
f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
if (f < Y_FRAC_FIRST(n))
{
@ -72,9 +72,9 @@ RenderEdgeStep (RenderEdge *e, int n)
xFixed_48_16 ne;
e->x += n * e->stepx;
ne = e->e + n * (xFixed_48_16) e->dx;
if (n >= 0)
{
if (ne > 0)
@ -104,7 +104,7 @@ _RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p)
{
xFixed stepx;
xFixed_48_16 ne;
ne = n * (xFixed_48_16) e->dx;
stepx = n * e->stepx;
if (ne > 0)
@ -153,7 +153,7 @@ RenderEdgeInit (RenderEdge *e,
e->dx = -dx % dy;
e->e = 0;
}
_RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
_RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
}

View file

@ -43,7 +43,7 @@ typedef struct {
int height;
cairo_surface_t *target;
cairo_bool_t fallback;
} cairo_analysis_surface_t;

View file

@ -190,7 +190,7 @@ _cairo_arc_in_direction (cairo_t *cr,
_cairo_arc_in_direction (cr, xc, yc, radius,
angle_min, angle_mid,
dir);
_cairo_arc_in_direction (cr, xc, yc, radius,
angle_mid, angle_max,
dir);

View file

@ -186,7 +186,7 @@ _cairo_atsui_font_set_metrics (cairo_atsui_font_t *font)
if (err == noErr) {
cairo_font_extents_t extents;
extents.ascent = metrics.ascent;
extents.descent = -metrics.descent;
extents.height = metrics.capHeight;
@ -407,7 +407,7 @@ _line_to (const Float32Point *point,
_cairo_path_fixed_line_to (path,
_cairo_fixed_from_double(point->x),
_cairo_fixed_from_double(point->y));
return noErr;
}
@ -426,7 +426,7 @@ _curve_to (const Float32Point *point1,
_cairo_fixed_from_double(point2->y),
_cairo_fixed_from_double(point3->x),
_cairo_fixed_from_double(point3->y));
return noErr;
}
@ -553,7 +553,7 @@ _cairo_atsui_font_text_to_glyphs (void *abstract_font,
kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
(void *) &layoutRecords);
ATSUDisposeTextLayout(textLayout);
return CAIRO_STATUS_SUCCESS;
}
@ -599,7 +599,7 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
/* Create a CGBitmapContext for the dest surface for drawing into */
colorSpace = CGColorSpaceCreateDeviceRGB();
myBitmapContext = CGBitmapContextCreate(destImageSurface->data,
destImageSurface->width,
destImageSurface->height,
@ -658,23 +658,23 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
rects = malloc (sizeof (CGRect) * num_boxes);
else
rects = stack_rects;
for (i = 0; i < num_boxes; i++) {
rects[i].origin.x = boxes[i].x1;
rects[i].origin.y = boxes[i].y1;
rects[i].size.width = boxes[i].x2 - boxes[i].x1;
rects[i].size.height = boxes[i].y2 - boxes[i].y1;
}
CGContextClipToRects (drawingContext, rects, num_boxes);
if (rects != stack_rects)
free(rects);
}
} else {
/* XXX: Need to get the text clipped */
}
/* TODO - bold and italic text
*
* We could draw the text using ATSUI and get bold, italics
@ -682,10 +682,10 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
* that we don't really need...
*/
for (i = 0; i < num_glyphs; i++) {
CGGlyph theGlyph = glyphs[i].index;
CGContextShowGlyphsAtPoint(drawingContext,
glyphs[i].x,
glyphs[i].y,
@ -695,7 +695,7 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
if (!can_draw_directly) {
CGColorSpaceRelease(colorSpace);
CGContextRelease(myBitmapContext);
_cairo_surface_release_dest_image(generic_surface,
&rect,
destImageSurface,

View file

@ -49,7 +49,7 @@ _expand_four_tuple_to_five (unsigned char four_tuple[4],
{
uint32_t value;
int digit, i;
value = four_tuple[0] << 24 | four_tuple[1] << 16 | four_tuple[2] << 8 | four_tuple[3];
if (all_zero)
*all_zero = TRUE;

View file

@ -114,7 +114,7 @@ _cairo_clip_reset (cairo_clip_t *clip)
_cairo_clip_path_destroy (clip->path);
clip->path = NULL;
return CAIRO_STATUS_SUCCESS;
}
@ -133,11 +133,11 @@ _cairo_clip_intersect_to_rectangle (cairo_clip_t *clip,
pixman_region16_t *intersection;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
pixman_region_status_t pixman_status;
intersection = _cairo_region_create_from_rectangle (rectangle);
if (intersection == NULL)
return CAIRO_STATUS_NO_MEMORY;
pixman_status = pixman_region_intersect (intersection,
clip->region,
intersection);
@ -176,11 +176,11 @@ _cairo_clip_intersect_to_region (cairo_clip_t *clip,
pixman_region16_t *clip_rect;
pixman_region_status_t pixman_status;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
clip_rect = _cairo_region_create_from_rectangle (&clip->surface_rect);
if (clip_rect == NULL)
return CAIRO_STATUS_NO_MEMORY;
pixman_status = pixman_region_intersect (region,
clip_rect,
region);
@ -212,7 +212,7 @@ _cairo_clip_combine_to_surface (cairo_clip_t *clip,
cairo_status_t status;
_cairo_pattern_init_for_surface (&pattern.surface, clip->surface);
status = _cairo_surface_composite (op,
&pattern.base,
NULL,
@ -223,7 +223,7 @@ _cairo_clip_combine_to_surface (cairo_clip_t *clip,
extents->x - dst_x,
extents->y - dst_y,
extents->width, extents->height);
_cairo_pattern_fini (&pattern.base);
return status;
@ -298,11 +298,11 @@ _cairo_clip_intersect_region (cairo_clip_t *clip,
if (clip->mode != CAIRO_CLIP_MODE_REGION)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_traps_extract_region (traps, &region);
if (status)
return status;
if (region == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
@ -311,7 +311,7 @@ _cairo_clip_intersect_region (cairo_clip_t *clip,
clip->region = region;
} else {
pixman_region16_t *intersection = pixman_region_create();
if (pixman_region_intersect (intersection,
clip->region, region)
== PIXMAN_REGION_STATUS_SUCCESS) {
@ -369,7 +369,7 @@ _cairo_clip_intersect_mask (cairo_clip_t *clip,
_cairo_traps_translate (traps, -surface_rect.x, -surface_rect.y);
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN,
&pattern.base,
surface,
@ -442,7 +442,7 @@ _cairo_clip_clip (cairo_clip_t *clip,
_cairo_fixed_from_double (target->device_y_offset));
path = &path_transformed;
}
status = _cairo_clip_intersect_path (clip,
path, fill_rule, tolerance,
antialias);
@ -466,7 +466,7 @@ _cairo_clip_clip (cairo_clip_t *clip,
goto bail;
status = _cairo_clip_intersect_mask (clip, &traps, antialias, target);
bail:
_cairo_traps_fini (&traps);
if (path == &path_transformed)

View file

@ -266,7 +266,7 @@ _cairo_directfb_surface_get_image (cairo_directfb_surface_t *surface,
surface->buffer_data=NULL;
}
surface->buffer->Unlock(surface->buffer);
surface->main_surface->GetSize(surface->main_surface,&width,&height);
surface->main_surface->GetPixelFormat(surface->main_surface,&dfbformat);
@ -508,7 +508,7 @@ _cairo_directfb_surface_composite (cairo_operator_t op,
if (src->base.backend != dst->base.backend){
return CAIRO_INT_STATUS_UNSUPPORTED;
}
integer_transform = _cairo_matrix_is_integer_translation (&src_pattern->matrix, &itx, &ity);
if (!integer_transform) {
return CAIRO_INT_STATUS_UNSUPPORTED;
@ -776,7 +776,7 @@ _cairo_directfb_surface_show_glyphs (cairo_scaled_font_t *scaled_font,
surface->buffer->SetColor(surface->buffer,0,0xff,0xff,0xff);
#endif
surface->buffer->Blit(surface->buffer,tmpbuffer,NULL,x,y);
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}

View file

@ -54,7 +54,7 @@ _cairo_font_options_init_default (cairo_font_options_t *options)
{
if (options == (cairo_font_options_t *)&cairo_font_options_nil)
return;
options->antialias = CAIRO_ANTIALIAS_DEFAULT;
options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
@ -237,7 +237,7 @@ cairo_font_options_set_antialias (cairo_font_options_t *options,
{
if (options == (cairo_font_options_t *)&cairo_font_options_nil)
return;
options->antialias = antialias;
}
@ -272,7 +272,7 @@ cairo_font_options_set_subpixel_order (cairo_font_options_t *options,
{
if (options == (cairo_font_options_t *)&cairo_font_options_nil)
return;
options->subpixel_order = subpixel_order;
}
@ -307,7 +307,7 @@ cairo_font_options_set_hint_style (cairo_font_options_t *options,
{
if (options == (cairo_font_options_t *)&cairo_font_options_nil)
return;
options->hint_style = hint_style;
}

View file

@ -331,7 +331,7 @@ cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font,
status = cairo_pdf_ft_font_allocate_write_buffer (font, size, &buffer);
/* XXX: Need to check status here. */
FT_Load_Sfnt_Table (font->face, tag, 0, buffer, &size);
return 0;
}
@ -371,7 +371,7 @@ cairo_pdf_ft_font_remap_composite_glyph (cairo_pdf_ft_font_t *font,
glyph_data = (glyph_data_t *) buffer;
if ((short)be16_to_cpu (glyph_data->num_contours) >= 0)
return;
composite_glyph = &glyph_data->glyph;
do {
flags = be16_to_cpu (composite_glyph->flags);
@ -573,7 +573,7 @@ cairo_pdf_ft_font_write_maxp_table (cairo_pdf_ft_font_t *font,
TT_MaxProfile *maxp;
maxp = FT_Get_Sfnt_Table (font->face, ft_sfnt_maxp);
cairo_pdf_ft_font_write_be32 (font, maxp->version);
cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs);
cairo_pdf_ft_font_write_be16 (font, maxp->maxPoints);

View file

@ -202,7 +202,7 @@ cairo_font_face_set_user_data (cairo_font_face_t *font_face,
{
if (font_face->ref_count == -1)
return CAIRO_STATUS_NO_MEMORY;
return _cairo_user_data_array_set_data (&font_face->user_data,
key, user_data, destroy);
}
@ -277,7 +277,7 @@ _cairo_toy_font_face_init_key (cairo_toy_font_face_t *key,
hash = _cairo_hash_string (family);
hash += ((unsigned long) slant) * 1607;
hash += ((unsigned long) weight) * 1451;
key->base.hash_entry.hash = hash;
}
@ -350,7 +350,7 @@ _cairo_toy_font_face_create (const char *family,
goto UNWIND;
_cairo_toy_font_face_init_key (&key, family, slant, weight);
/* Return existing font_face if it exists in the hash table. */
if (_cairo_hash_table_lookup (hash_table,
&key.base.hash_entry,
@ -400,9 +400,9 @@ _cairo_toy_font_face_destroy (void *abstract_face)
assert (hash_table != NULL);
_cairo_hash_table_remove (hash_table, &font_face->base.hash_entry);
_cairo_toy_font_face_hash_table_unlock ();
_cairo_toy_font_face_fini (font_face);
}

View file

@ -96,7 +96,7 @@ struct _cairo_ft_unscaled_font {
double x_scale; /* Extracted X scale factor */
double y_scale; /* Extracted Y scale factor */
cairo_bool_t have_shape; /* true if the current scale has a non-scale component*/
int lock; /* count of how many times this font has been locked */
cairo_ft_font_face_t *faces; /* Linked list of faces for this font */
@ -276,7 +276,7 @@ _cairo_ft_unscaled_font_init_key (cairo_ft_unscaled_font_t *key,
/* 1607 is just an arbitrary prime. */
hash = _cairo_hash_string (filename);
hash += ((unsigned long) id) * 1607;
key->base.hash_entry.hash = hash;
}
@ -330,7 +330,7 @@ _cairo_ft_unscaled_font_init (cairo_ft_unscaled_font_t *unscaled,
unscaled->have_scale = FALSE;
unscaled->lock = 0;
unscaled->faces = NULL;
return CAIRO_STATUS_SUCCESS;
@ -387,14 +387,14 @@ _cairo_ft_unscaled_font_create_for_pattern (FcPattern *pattern)
FcChar8 *fc_filename;
char *filename;
int id;
if (FcPatternGetString (pattern, FC_FILE, 0, &fc_filename) != FcResultMatch)
goto UNWIND;
filename = (char *) fc_filename;
if (FcPatternGetInteger (pattern, FC_INDEX, 0, &id) != FcResultMatch)
goto UNWIND;
font_map = _cairo_ft_unscaled_font_map_lock ();
if (font_map == NULL)
goto UNWIND;
@ -473,7 +473,7 @@ _cairo_ft_unscaled_font_destroy (void *abstract_font)
cairo_font_face_destroy (&unscaled->faces->base);
} else {
cairo_ft_unscaled_font_map_t *font_map;
font_map = _cairo_ft_unscaled_font_map_lock ();
/* All created objects must have been mapped in the font map. */
assert (font_map != NULL);
@ -516,14 +516,14 @@ _cairo_ft_unscaled_font_lock_face (cairo_ft_unscaled_font_t *unscaled)
/* If this unscaled font was created from an FT_Face then we just
* returned it above. */
assert (!unscaled->from_face);
font_map = _cairo_ft_unscaled_font_map_lock ();
assert (font_map != NULL);
while (font_map->num_open_faces >= MAX_OPEN_FACES)
{
cairo_ft_unscaled_font_t *entry;
entry = _cairo_hash_table_random_entry (font_map->hash_table,
_has_unlocked_face);
if (entry == NULL)
@ -555,7 +555,7 @@ void
_cairo_ft_unscaled_font_unlock_face (cairo_ft_unscaled_font_t *unscaled)
{
assert (unscaled->lock > 0);
unscaled->lock--;
}
@ -565,7 +565,7 @@ _compute_transform (cairo_ft_font_transform_t *sf,
{
cairo_matrix_t normalized = *scale;
double tx, ty;
/* The font matrix has x and y "scale" components which we extract and
* use as character scale values. These influence the way freetype
* chooses hints, as well as selecting different bitmaps in
@ -576,10 +576,10 @@ _compute_transform (cairo_ft_font_transform_t *sf,
_cairo_matrix_compute_scale_factors (&normalized,
&sf->x_scale, &sf->y_scale,
/* XXX */ 1);
if (sf->x_scale != 0 && sf->y_scale != 0) {
cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale);
_cairo_matrix_get_affine (&normalized,
&sf->shape[0][0], &sf->shape[0][1],
&sf->shape[1][0], &sf->shape[1][1],
@ -603,7 +603,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
FT_Error error;
assert (unscaled->face != NULL);
if (unscaled->have_scale &&
scale->xx == unscaled->current_scale.xx &&
scale->yx == unscaled->current_scale.yx &&
@ -613,12 +613,12 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
unscaled->have_scale = TRUE;
unscaled->current_scale = *scale;
_compute_transform (&sf, scale);
unscaled->x_scale = sf.x_scale;
unscaled->y_scale = sf.y_scale;
mat.xx = DOUBLE_TO_16_16(sf.shape[0][0]);
mat.yx = - DOUBLE_TO_16_16(sf.shape[0][1]);
mat.xy = - DOUBLE_TO_16_16(sf.shape[1][0]);
@ -628,7 +628,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
mat.yx != 0x00000 ||
mat.xy != 0x00000 ||
mat.yy != 0x10000);
FT_Set_Transform(unscaled->face, &mat, NULL);
if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
@ -644,7 +644,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
int best_i = 0;
pixel_width = pixel_height = 0;
for (i = 0; i < unscaled->face->num_fixed_sizes; i++) {
#if HAVE_FT_BITMAP_SIZE_Y_PPEM
double size = unscaled->face->available_sizes[i].y_ppem / 64.;
@ -652,7 +652,7 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
double size = unscaled->face->available_sizes[i].height;
#endif
double distance = fabs (size - sf.y_scale);
if (distance <= min_distance) {
min_distance = distance;
best_i = i;
@ -711,10 +711,10 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
unsigned char *data;
int format = CAIRO_FORMAT_A8;
cairo_bool_t subpixel = FALSE;
width = bitmap->width;
height = bitmap->rows;
switch (bitmap->pixel_mode) {
case FT_PIXEL_MODE_MONO:
stride = (((width + 31) & ~31) >> 3);
@ -731,24 +731,24 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
} else {
int i;
unsigned char *source, *dest;
source = bitmap->buffer;
dest = data;
for (i = height; i; i--) {
memcpy (dest, source, bitmap->pitch);
memset (dest + bitmap->pitch, '\0', stride - bitmap->pitch);
source += bitmap->pitch;
dest += stride;
}
}
}
if (_native_byte_order_lsb())
{
unsigned char *d = data, c;
int count = stride * height;
while (count--) {
c = *d;
c = ((c << 1) & 0xaa) | ((c >> 1) & 0x55);
@ -791,7 +791,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
unsigned int width_rgba, stride_rgba;
int vmul = 1;
int hmul = 1;
switch (font_options->subpixel_order) {
case CAIRO_SUBPIXEL_ORDER_DEFAULT:
case CAIRO_SUBPIXEL_ORDER_RGB:
@ -813,7 +813,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
stride = bitmap->pitch;
stride_rgba = (width_rgba * 4 + 3) & ~3;
data_rgba = calloc (1, stride_rgba * height);
os = 1;
switch (font_options->subpixel_order) {
case CAIRO_SUBPIXEL_ORDER_VRGB:
@ -858,11 +858,11 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
*out++ = (green << 24) | (red << 16) | (green << 8) | blue;
}
}
/* Images here are stored in native format. The
* backend must convert to its own format as needed
*/
if (own_buffer)
free (bitmap->buffer);
data = data_rgba;
@ -879,7 +879,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
default:
return CAIRO_STATUS_NO_MEMORY;
}
*surface = (cairo_image_surface_t *)
cairo_image_surface_create_for_data (data,
format,
@ -888,7 +888,7 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
free (data);
return CAIRO_STATUS_NO_MEMORY;
}
if (subpixel)
pixman_image_set_component_alpha ((*surface)->pixman_image, TRUE);
@ -964,7 +964,7 @@ _render_glyph_outline (FT_Face face,
matrix.xx = matrix.yy = 0x10000L;
matrix.xy = matrix.yx = 0;
switch (font_options->antialias) {
case CAIRO_ANTIALIAS_NONE:
bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
@ -999,18 +999,18 @@ _render_glyph_outline (FT_Face face,
bitmap.num_grays = 256;
stride = (width * hmul + 3) & -4;
}
bitmap.pitch = stride;
bitmap.width = width * hmul;
bitmap.rows = height * vmul;
bitmap.buffer = calloc (1, stride * bitmap.rows);
if (bitmap.buffer == NULL) {
return CAIRO_STATUS_NO_MEMORY;
}
FT_Outline_Translate (outline, -cbox.xMin*hmul, -cbox.yMin*vmul);
if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) {
free (bitmap.buffer);
return CAIRO_STATUS_NO_MEMORY;
@ -1070,7 +1070,7 @@ _render_glyph_bitmap (FT_Face face,
status = _get_bitmap_surface (&glyphslot->bitmap, FALSE, font_options, surface);
if (status)
return status;
/*
* Note: the font's coordinate system is upside down from ours, so the
* Y coordinate of the control box needs to be negated.
@ -1099,7 +1099,7 @@ _transform_glyph_bitmap (cairo_image_glyph_cache_entry_t *val)
int width, height;
cairo_status_t status;
cairo_surface_pattern_t pattern;
/* We want to compute a transform that takes the origin
* (val->size.x, val->size.y) to 0,0, then applies the "shape"
* portion of the font transform
@ -1128,7 +1128,7 @@ _transform_glyph_bitmap (cairo_image_glyph_cache_entry_t *val)
x_min = floor (x[0]); y_min = floor (y[0]);
x_max = ceil (x[0]); y_max = ceil (y[0]);
for (i = 1; i < 4; i++) {
if (x[i] < x_min)
x_min = floor (x[i]);
@ -1199,7 +1199,7 @@ _transform_glyph_bitmap (cairo_image_glyph_cache_entry_t *val)
val->size.height = height;
val->size.x = - floor (origin_x + 0.5);
val->size.y = - floor (origin_y + 0.5);
return status;
}
#endif
@ -1255,7 +1255,7 @@ _get_pattern_ft_options (FcPattern *pattern)
if (FcPatternGetBool (pattern,
FC_EMBEDDED_BITMAP, 0, &bitmap) != FcResultMatch)
bitmap = FcFalse;
/* disable antialiasing if requested */
if (FcPatternGetBool (pattern,
FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
@ -1265,7 +1265,7 @@ _get_pattern_ft_options (FcPattern *pattern)
ft_options.load_flags |= FT_LOAD_NO_BITMAP;
else if (!antialias)
ft_options.load_flags |= FT_LOAD_MONOCHROME;
/* disable hinting if requested */
if (FcPatternGetBool (pattern,
FC_HINTING, 0, &hinting) != FcResultMatch)
@ -1277,7 +1277,7 @@ _get_pattern_ft_options (FcPattern *pattern)
if (!hinting || hintstyle == FC_HINT_NONE)
ft_options.load_flags |= FT_LOAD_NO_HINTING;
if (antialias) {
switch (hintstyle) {
case FC_HINT_SLIGHT:
@ -1318,22 +1318,22 @@ _get_pattern_ft_options (FcPattern *pattern)
}
ft_options.load_flags |= target_flags;
/* force autohinting if requested */
if (FcPatternGetBool (pattern,
FC_AUTOHINT, 0, &autohint) != FcResultMatch)
autohint = FcFalse;
if (autohint)
ft_options.load_flags |= FT_LOAD_FORCE_AUTOHINT;
if (FcPatternGetBool (pattern,
FC_VERTICAL_LAYOUT, 0, &vertical_layout) != FcResultMatch)
vertical_layout = FcFalse;
if (vertical_layout)
ft_options.load_flags |= FT_LOAD_VERTICAL_LAYOUT;
#ifdef FC_EMBOLDEN
{
FcBool embolden;
@ -1341,12 +1341,12 @@ _get_pattern_ft_options (FcPattern *pattern)
if (FcPatternGetBool (pattern,
FC_EMBOLDEN, 0, &embolden) != FcResultMatch)
embolden = FcFalse;
if (embolden)
ft_options.extra_flags |= CAIRO_FT_OPTIONS_EMBOLDEN;
}
#endif
return ft_options;
}
@ -1381,7 +1381,7 @@ _get_options_load_flags (const cairo_font_options_t *options)
load_flags |= FT_LOAD_NO_BITMAP;
break;
}
/* disable hinting if requested */
switch (options->hint_style) {
case CAIRO_HINT_STYLE_NONE:
@ -1396,7 +1396,7 @@ _get_options_load_flags (const cairo_font_options_t *options)
load_flags |= FT_LOAD_TARGET_NORMAL;
break;
}
return load_flags;
}
@ -1416,7 +1416,7 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
face = _cairo_ft_unscaled_font_lock_face (unscaled);
if (!face)
return NULL;
scaled_font = malloc (sizeof(cairo_ft_scaled_font_t));
if (scaled_font == NULL) {
_cairo_ft_unscaled_font_unlock_face (unscaled);
@ -1471,10 +1471,10 @@ _cairo_ft_scaled_font_create (cairo_ft_unscaled_font_t *unscaled,
fs_metrics.max_x_advance = face->max_advance_width / scale;
}
/* FIXME: this doesn't do vertical layout atm. */
fs_metrics.max_y_advance = 0.0;
_cairo_scaled_font_set_metrics (&scaled_font->base, &fs_metrics);
return &scaled_font->base;
@ -1548,7 +1548,7 @@ _cairo_ft_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
FcConfigSubstitute (NULL, pattern, FcMatchPattern);
cairo_ft_font_options_substitute (font_options, pattern);
FcDefaultSubstitute (pattern);
resolved = FcFontMatch (NULL, pattern, &result);
if (!resolved)
goto FREE_PATTERN;
@ -1584,10 +1584,10 @@ static void
_cairo_ft_scaled_font_fini (void *abstract_font)
{
cairo_ft_scaled_font_t *scaled_font = abstract_font;
if (scaled_font == NULL)
return;
_cairo_unscaled_font_destroy (&scaled_font->unscaled->base);
}
@ -1696,7 +1696,7 @@ _decompose_glyph_outline (FT_Face face,
DOUBLE_TO_16_16 (1.0), 0,
0, DOUBLE_TO_16_16 (-1.0),
};
FT_GlyphSlot glyph;
cairo_path_fixed_t *path;
@ -1709,11 +1709,11 @@ _decompose_glyph_outline (FT_Face face,
/* Font glyphs have an inverted Y axis compared to cairo. */
FT_Outline_Transform (&glyph->outline, &invert_y);
FT_Outline_Decompose (&glyph->outline, &outline_funcs, path);
_cairo_path_fixed_close_path (path);
*pathp = path;
return CAIRO_STATUS_SUCCESS;
}
@ -1739,16 +1739,16 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
if ((info & CAIRO_SCALED_GLYPH_INFO_PATH) != 0 &&
(info & CAIRO_SCALED_GLYPH_INFO_SURFACE) == 0)
load_flags |= FT_LOAD_NO_BITMAP;
error = FT_Load_Glyph (scaled_font->unscaled->face,
_cairo_scaled_glyph_index(scaled_glyph),
load_flags);
if (error) {
cairo_ft_scaled_font_unlock_face (abstract_font);
return CAIRO_STATUS_NO_MEMORY;
}
glyph = face->glyph;
#if HAVE_FT_GLYPHSLOT_EMBOLDEN
@ -1758,23 +1758,23 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
if (scaled_font->ft_options.extra_flags & CAIRO_FT_OPTIONS_EMBOLDEN)
FT_GlyphSlot_Embolden (glyph);
#endif
if (info & CAIRO_SCALED_GLYPH_INFO_METRICS) {
/*
* Compute font-space metrics
*/
metrics = &glyph->metrics;
if (unscaled->x_scale == 0)
x_factor = 0;
else
x_factor = 1 / unscaled->x_scale;
if (unscaled->y_scale == 0)
y_factor = 0;
else
y_factor = 1 / unscaled->y_scale;
/*
* Note: the font's coordinate system is upside down from ours, so the
* Y coordinates of the bearing and advance need to be negated.
@ -1785,27 +1785,27 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
* If we want hinted metrics but aren't asking for hinted glyphs from
* FreeType, then we need to do the metric hinting ourselves.
*/
if ((scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF) &&
(load_flags & FT_LOAD_NO_HINTING))
{
FT_Pos x1, x2;
FT_Pos y1, y2;
FT_Pos advance;
x1 = (metrics->horiBearingX) & -64;
x2 = (metrics->horiBearingX + metrics->width + 63) & -64;
y1 = (-metrics->horiBearingY) & -64;
y2 = (-metrics->horiBearingY + metrics->height + 63) & -64;
advance = ((metrics->horiAdvance + 32) & -64);
fs_metrics.x_bearing = DOUBLE_FROM_26_6 (x1) * x_factor;
fs_metrics.y_bearing = DOUBLE_FROM_26_6 (y1) * y_factor;
fs_metrics.width = DOUBLE_FROM_26_6 (x2 - x1) * x_factor;
fs_metrics.height = DOUBLE_FROM_26_6 (y2 - y1) * y_factor;
/*
* use untransformed advance values
* XXX uses horizontal advance only at present; should provide FT_LOAD_VERTICAL_LAYOUT
@ -1815,19 +1815,19 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
} else {
fs_metrics.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) * x_factor;
fs_metrics.y_bearing = DOUBLE_FROM_26_6 (-metrics->horiBearingY) * y_factor;
fs_metrics.width = DOUBLE_FROM_26_6 (metrics->width) * x_factor;
fs_metrics.height = DOUBLE_FROM_26_6 (metrics->height) * y_factor;
fs_metrics.x_advance = DOUBLE_FROM_26_6 (metrics->horiAdvance) * x_factor;
fs_metrics.y_advance = 0 * y_factor;
}
_cairo_scaled_glyph_set_metrics (scaled_glyph,
&scaled_font->base,
&fs_metrics);
}
if ((info & CAIRO_SCALED_GLYPH_INFO_SURFACE) != 0) {
cairo_image_surface_t *surface;
cairo_status_t status;
@ -1845,11 +1845,11 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
&scaled_font->base,
surface);
}
if (info & CAIRO_SCALED_GLYPH_INFO_PATH) {
cairo_path_fixed_t *path;
cairo_status_t status;
/*
* A kludge -- the above code will trash the outline,
* so reload it. This will probably never occur though
@ -1869,7 +1869,7 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
&path);
else
status = CAIRO_STATUS_NO_MEMORY;
if (status) {
cairo_ft_scaled_font_unlock_face (abstract_font);
return status;
@ -1878,9 +1878,9 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
&scaled_font->base,
path);
}
cairo_ft_scaled_font_unlock_face (abstract_font);
return CAIRO_STATUS_SUCCESS;
}
@ -1934,7 +1934,7 @@ static void
_cairo_ft_font_face_destroy (void *abstract_face)
{
cairo_ft_font_face_t *font_face = abstract_face;
cairo_ft_font_face_t *tmp_face = NULL;
cairo_ft_font_face_t *last_face = NULL;
@ -1960,13 +1960,13 @@ _cairo_ft_font_face_destroy (void *abstract_face)
font_face->unscaled->base.ref_count > 1)
{
cairo_font_face_reference (&font_face->base);
_cairo_unscaled_font_destroy (&font_face->unscaled->base);
font_face->unscaled = NULL;
return;
}
if (font_face->unscaled) {
/* Remove face from linked list */
for (tmp_face = font_face->unscaled->faces;
@ -1979,7 +1979,7 @@ _cairo_ft_font_face_destroy (void *abstract_face)
else
font_face->unscaled->faces = tmp_face->next;
}
last_face = tmp_face;
}
@ -2007,7 +2007,7 @@ _cairo_ft_font_face_scaled_font_create (void *abstract_face,
* cairo_ft_font_options_substitute(), so *just* use those load
* flags and ignore the options.
*/
ft_options = font_face->ft_options;
if (font_face->unscaled->from_face)
ft_options.load_flags |= _get_options_load_flags (options);
@ -2048,15 +2048,15 @@ _cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled,
font_face = malloc (sizeof (cairo_ft_font_face_t));
if (!font_face)
return NULL;
font_face->unscaled = unscaled;
_cairo_unscaled_font_reference (&unscaled->base);
font_face->ft_options = ft_options;
font_face->next = unscaled->faces;
unscaled->faces = font_face;
_cairo_font_face_init (&font_face->base, &_cairo_ft_font_face_backend);
return &font_face->base;
@ -2094,7 +2094,7 @@ cairo_ft_font_options_substitute (const cairo_font_options_t *options,
if (FcPatternGet (pattern, FC_RGBA, 0, &v) == FcResultNoMatch)
{
int rgba;
if (options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) {
switch (options->subpixel_order) {
case CAIRO_SUBPIXEL_ORDER_DEFAULT:
@ -2115,7 +2115,7 @@ cairo_ft_font_options_substitute (const cairo_font_options_t *options,
} else {
rgba = FC_RGBA_NONE;
}
FcPatternAddInteger (pattern, FC_RGBA, rgba);
}
}
@ -2144,7 +2144,7 @@ cairo_ft_font_options_substitute (const cairo_font_options_t *options,
hint_style = FC_HINT_FULL;
break;
}
FcPatternAddInteger (pattern, FC_HINT_STYLE, hint_style);
}
#endif
@ -2243,7 +2243,7 @@ cairo_ft_font_face_create_for_ft_face (FT_Face face,
ft_options.load_flags = load_flags;
ft_options.extra_flags = 0;
font_face = _cairo_ft_font_face_create (unscaled, ft_options);
_cairo_unscaled_font_destroy (&unscaled->base);
@ -2279,7 +2279,7 @@ cairo_ft_font_face_create_for_ft_face (FT_Face face,
* cairo_ft_unlock() after you are done. (These functions are not yet
* implemented, so this function cannot be currently safely used in a
* threaded application.)
* Return value: The #FT_Face object for @font, scaled appropriately,
* or %NULL if @scaled_font is in an error state (see
* cairo_scaled_font_status()) or there is insufficient memory.
@ -2298,7 +2298,7 @@ cairo_ft_scaled_font_lock_face (cairo_scaled_font_t *abstract_font)
_cairo_scaled_font_set_error (&scaled_font->base, CAIRO_STATUS_NO_MEMORY);
return NULL;
}
_cairo_ft_unscaled_font_set_scale (scaled_font->unscaled,
&scaled_font->base.scale);

View file

@ -40,7 +40,7 @@
struct _cairo_gstate {
cairo_operator_t op;
double tolerance;
cairo_antialias_t antialias;

View file

@ -115,7 +115,7 @@ _cairo_gstate_init (cairo_gstate_t *gstate,
CAIRO_GSTATE_DEFAULT_FONT_SIZE);
_cairo_font_options_init_default (&gstate->font_options);
_cairo_clip_init (&gstate->clip, target);
gstate->target = cairo_surface_reference (target);
@ -145,7 +145,7 @@ static cairo_status_t
_cairo_gstate_init_copy (cairo_gstate_t *gstate, cairo_gstate_t *other)
{
cairo_status_t status;
gstate->op = other->op;
gstate->tolerance = other->tolerance;
@ -394,7 +394,7 @@ _cairo_gstate_set_source (cairo_gstate_t *gstate,
cairo_pattern_destroy (gstate->source);
gstate->source = source;
gstate->source_ctm_inverse = gstate->ctm_inverse;
return CAIRO_STATUS_SUCCESS;
}
@ -499,7 +499,7 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
if (gstate->stroke_style.dash)
free (gstate->stroke_style.dash);
gstate->stroke_style.num_dashes = num_dashes;
if (gstate->stroke_style.num_dashes == 0) {
@ -515,7 +515,7 @@ _cairo_gstate_set_dash (cairo_gstate_t *gstate, double *dash, int num_dashes, do
}
memcpy (gstate->stroke_style.dash, dash, gstate->stroke_style.num_dashes * sizeof (double));
dash_total = 0.0;
for (i = 0; i < gstate->stroke_style.num_dashes; i++) {
if (gstate->stroke_style.dash[i] < 0)
@ -567,7 +567,7 @@ _cairo_gstate_translate (cairo_gstate_t *gstate, double tx, double ty)
cairo_matrix_t tmp;
_cairo_gstate_unset_scaled_font (gstate);
cairo_matrix_init_translate (&tmp, tx, ty);
cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
@ -586,7 +586,7 @@ _cairo_gstate_scale (cairo_gstate_t *gstate, double sx, double sy)
return CAIRO_STATUS_INVALID_MATRIX;
_cairo_gstate_unset_scaled_font (gstate);
cairo_matrix_init_scale (&tmp, sx, sy);
cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
@ -602,7 +602,7 @@ _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle)
cairo_matrix_t tmp;
_cairo_gstate_unset_scaled_font (gstate);
cairo_matrix_init_rotate (&tmp, angle);
cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
@ -619,7 +619,7 @@ _cairo_gstate_transform (cairo_gstate_t *gstate,
cairo_matrix_t tmp;
_cairo_gstate_unset_scaled_font (gstate);
tmp = *matrix;
cairo_matrix_multiply (&gstate->ctm, &tmp, &gstate->ctm);
@ -636,7 +636,7 @@ _cairo_gstate_set_matrix (cairo_gstate_t *gstate,
cairo_status_t status;
_cairo_gstate_unset_scaled_font (gstate);
gstate->ctm = *matrix;
gstate->ctm_inverse = *matrix;
@ -651,7 +651,7 @@ cairo_status_t
_cairo_gstate_identity_matrix (cairo_gstate_t *gstate)
{
_cairo_gstate_unset_scaled_font (gstate);
cairo_matrix_init_identity (&gstate->ctm);
cairo_matrix_init_identity (&gstate->ctm_inverse);
@ -818,7 +818,7 @@ _cairo_operator_bounded_by_mask (cairo_operator_t op)
case CAIRO_OPERATOR_DEST_ATOP:
return FALSE;
}
ASSERT_NOT_REACHED;
return FALSE;
}
@ -858,7 +858,7 @@ _cairo_operator_bounded_by_source (cairo_operator_t op)
case CAIRO_OPERATOR_DEST_ATOP:
return FALSE;
}
ASSERT_NOT_REACHED;
return FALSE;
}
@ -923,7 +923,7 @@ _cairo_gstate_stroke (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
gstate->antialias);
_cairo_pattern_fini (&source_pattern.base);
return status;
}
@ -967,11 +967,11 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
if (gstate->source->status)
return gstate->source->status;
status = _cairo_surface_set_clip (gstate->target, &gstate->clip);
if (status)
return status;
_cairo_gstate_copy_transformed_source (gstate, &pattern.base);
status = _cairo_surface_fill (gstate->target,
@ -983,7 +983,7 @@ _cairo_gstate_fill (cairo_gstate_t *gstate, cairo_path_fixed_t *path)
gstate->antialias);
_cairo_pattern_fini (&pattern.base);
return status;
}
@ -1009,7 +1009,7 @@ _cairo_gstate_in_fill (cairo_gstate_t *gstate,
goto BAIL;
*inside_ret = _cairo_traps_contain (&traps, x, y);
BAIL:
_cairo_traps_fini (&traps);
@ -1053,9 +1053,9 @@ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
cairo_status_t status;
cairo_traps_t traps;
cairo_box_t extents;
_cairo_traps_init (&traps);
status = _cairo_path_fixed_stroke_to_traps (path,
&gstate->stroke_style,
&gstate->ctm,
@ -1074,10 +1074,10 @@ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
_cairo_gstate_backend_to_user (gstate, x1, y1);
_cairo_gstate_backend_to_user (gstate, x2, y2);
BAIL:
_cairo_traps_fini (&traps);
return status;
}
@ -1090,16 +1090,16 @@ _cairo_gstate_fill_extents (cairo_gstate_t *gstate,
cairo_status_t status;
cairo_traps_t traps;
cairo_box_t extents;
_cairo_traps_init (&traps);
status = _cairo_path_fixed_fill_to_traps (path,
gstate->fill_rule,
gstate->tolerance,
&traps);
if (status)
goto BAIL;
_cairo_traps_extents (&traps, &extents);
*x1 = _cairo_fixed_to_double (extents.p1.x);
@ -1109,10 +1109,10 @@ _cairo_gstate_fill_extents (cairo_gstate_t *gstate,
_cairo_gstate_backend_to_user (gstate, x1, y1);
_cairo_gstate_backend_to_user (gstate, x2, y2);
BAIL:
_cairo_traps_fini (&traps);
return status;
}
@ -1213,7 +1213,7 @@ _cairo_gstate_get_font_face (cairo_gstate_t *gstate,
status = _cairo_gstate_ensure_font_face (gstate);
if (status)
return status;
*font_face = gstate->font_face;
return CAIRO_STATUS_SUCCESS;
@ -1309,31 +1309,31 @@ _cairo_gstate_ensure_font_face (cairo_gstate_t *gstate)
else
gstate->font_face = font_face;
}
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_gstate_ensure_scaled_font (cairo_gstate_t *gstate)
{
cairo_status_t status;
cairo_font_options_t options;
if (gstate->scaled_font)
return CAIRO_STATUS_SUCCESS;
status = _cairo_gstate_ensure_font_face (gstate);
if (status)
return status;
cairo_surface_get_font_options (gstate->target, &options);
cairo_font_options_merge (&options, &gstate->font_options);
gstate->scaled_font = cairo_scaled_font_create (gstate->font_face,
&gstate->font_matrix,
&gstate->ctm,
&options);
if (!gstate->scaled_font)
return CAIRO_STATUS_NO_MEMORY;
@ -1366,7 +1366,7 @@ _cairo_gstate_text_to_glyphs (cairo_gstate_t *gstate,
status = _cairo_gstate_ensure_scaled_font (gstate);
if (status)
return status;
status = _cairo_scaled_font_text_to_glyphs (gstate->scaled_font, x, y,
utf8, glyphs, num_glyphs);
@ -1382,14 +1382,14 @@ _cairo_gstate_set_font_face (cairo_gstate_t *gstate,
{
if (font_face && font_face->status)
return font_face->status;
if (font_face != gstate->font_face) {
cairo_font_face_destroy (gstate->font_face);
gstate->font_face = cairo_font_face_reference (font_face);
}
_cairo_gstate_unset_scaled_font (gstate);
return CAIRO_STATUS_SUCCESS;
}
@ -1436,7 +1436,7 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate,
transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
if (transformed_glyphs == NULL)
return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < num_glyphs; ++i)
{
transformed_glyphs[i] = glyphs[i];
@ -1473,11 +1473,11 @@ _cairo_gstate_glyph_path (cairo_gstate_t *gstate,
status = _cairo_gstate_ensure_scaled_font (gstate);
if (status)
return status;
transformed_glyphs = malloc (num_glyphs * sizeof(cairo_glyph_t));
if (transformed_glyphs == NULL)
return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < num_glyphs; ++i)
{
transformed_glyphs[i] = glyphs[i];

View file

@ -196,7 +196,7 @@ _cairo_hash_table_destroy (cairo_hash_table_t *hash_table)
assert (hash_table->live_entries == 0);
/* No iterators can be running. Otherwise, halt. */
assert (hash_table->iterating == 0);
free (hash_table->entries);
hash_table->entries = NULL;
@ -234,7 +234,7 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table,
{
cairo_hash_entry_t **entry, **first_available = NULL;
unsigned long table_size, i, idx, step;
table_size = hash_table->arrangement->size;
idx = key->hash % table_size;
@ -330,7 +330,7 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table)
tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t*));
if (tmp.entries == NULL)
return CAIRO_STATUS_NO_MEMORY;
for (i = 0; i < hash_table->arrangement->size; ++i) {
if (ENTRY_IS_LIVE (hash_table->entries[i])) {
entry = _cairo_hash_table_lookup_internal (&tmp,
@ -464,13 +464,13 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table,
{
cairo_status_t status;
cairo_hash_entry_t **entry;
/* Insert is illegal while an iterator is running. */
assert (hash_table->iterating == 0);
entry = _cairo_hash_table_lookup_internal (hash_table,
key_and_value, FALSE);
if (ENTRY_IS_LIVE(*entry))
{
/* User is being bad, let's crash. */
@ -549,7 +549,7 @@ _cairo_hash_table_foreach (cairo_hash_table_t *hash_table,
if (hash_table == NULL)
return;
/* Mark the table for iteration */
++hash_table->iterating;
for (i = 0; i < hash_table->arrangement->size; i++) {

View file

@ -295,7 +295,7 @@ cairo_image_surface_create_for_data (unsigned char *data,
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t*) &_cairo_surface_nil;
}
pixman_image = pixman_image_create_for_data ((pixman_bits_t *) data, pixman_format,
width, height,
_cairo_format_bpp (format),
@ -515,7 +515,7 @@ _cairo_image_surface_acquire_source_image (void *abstract_sur
{
*image_out = abstract_surface;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
@ -534,7 +534,7 @@ _cairo_image_surface_acquire_dest_image (void *abstract_surfa
void **image_extra)
{
cairo_image_surface_t *surface = abstract_surface;
image_rect_out->x = 0;
image_rect_out->y = 0;
image_rect_out->width = surface->width;
@ -542,7 +542,7 @@ _cairo_image_surface_acquire_dest_image (void *abstract_surfa
*image_out = surface;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
@ -567,7 +567,7 @@ _cairo_image_surface_clone_similar (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -619,7 +619,7 @@ _cairo_image_surface_set_attributes (cairo_image_surface_t *surface,
cairo_surface_attributes_t *attributes)
{
cairo_int_status_t status;
status = _cairo_image_surface_set_matrix (surface, &attributes->matrix);
if (status)
return status;
@ -638,9 +638,9 @@ _cairo_image_surface_set_attributes (cairo_image_surface_t *surface,
pixman_image_set_repeat (surface->pixman_image, PIXMAN_REPEAT_PAD);
break;
}
status = _cairo_image_surface_set_filter (surface, attributes->filter);
return status;
}
@ -719,7 +719,7 @@ _cairo_image_surface_composite (cairo_operator_t op,
&src_attr, &mask_attr);
if (status)
return status;
status = _cairo_image_surface_set_attributes (src, &src_attr);
if (status)
goto CLEANUP_SURFACES;
@ -729,7 +729,7 @@ _cairo_image_surface_composite (cairo_operator_t op,
status = _cairo_image_surface_set_attributes (mask, &mask_attr);
if (status)
goto CLEANUP_SURFACES;
pixman_composite (_pixman_operator (op),
src->pixman_image,
mask->pixman_image,
@ -753,7 +753,7 @@ _cairo_image_surface_composite (cairo_operator_t op,
dst_x, dst_y,
width, height);
}
if (!_cairo_operator_bounded_by_source (op))
status = _cairo_surface_composite_fixup_unbounded (&dst->base,
&src_attr, src->width, src->height,
@ -767,9 +767,9 @@ _cairo_image_surface_composite (cairo_operator_t op,
CLEANUP_SURFACES:
if (mask)
_cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr);
_cairo_pattern_release_surface (src_pattern, &src->base, &src_attr);
return status;
}
@ -800,7 +800,7 @@ static cairo_bool_t
_cairo_image_surface_is_alpha_only (cairo_image_surface_t *surface)
{
int bpp, alpha, red, green, blue;
if (surface->format != (cairo_format_t) -1)
return surface->format == CAIRO_FORMAT_A1 || surface->format == CAIRO_FORMAT_A8;

View file

@ -335,7 +335,7 @@ _cairo_lzw_compress (unsigned char *data, unsigned long *size_in_out)
_lzw_buf_init (&buf, *size_in_out);
_lzw_symbol_table_init (&table);
/* The LZW header is a clear table code. */
_lzw_buf_store_bits (&buf, LZW_CODE_CLEAR_TABLE, code_bits);

View file

@ -460,7 +460,7 @@ cairo_matrix_invert (cairo_matrix_t *matrix)
double det;
_cairo_matrix_compute_determinant (matrix, &det);
if (det == 0)
return CAIRO_STATUS_INVALID_MATRIX;
@ -501,7 +501,7 @@ _cairo_matrix_compute_scale_factors (const cairo_matrix_t *matrix,
double x = x_major != 0;
double y = x == 0;
double major, minor;
cairo_matrix_transform_distance (matrix, &x, &y);
major = sqrt(x*x + y*y);
/*
@ -561,105 +561,105 @@ _cairo_matrix_is_integer_translation(const cairo_matrix_t *m,
The following is a derivation of a formula to calculate the length of the
major axis for this ellipse; this is useful for error bounds calculations.
Thanks to Walter Brisken <wbrisken@aoc.nrao.edu> for this derivation:
1. First some notation:
All capital letters represent vectors in two dimensions. A prime '
represents a transformed coordinate. Matrices are written in underlined
form, ie _R_. Lowercase letters represent scalar real values.
2. The question has been posed: What is the maximum expansion factor
achieved by the linear transformation
X' = X _R_
where _R_ is a real-valued 2x2 matrix with entries:
_R_ = [a b]
[c d] .
In other words, what is the maximum radius, MAX[ |X'| ], reached for any
X on the unit circle ( |X| = 1 ) ?
3. Some useful formulae
(A) through (C) below are standard double-angle formulae. (D) is a lesser
known result and is derived below:
(A) sin²(θ) = (1 - cos(2*θ))/2
(B) cos²(θ) = (1 + cos(2*θ))/2
(C) sin(θ)*cos(θ) = sin(2*θ)/2
(D) MAX[a*cos(θ) + b*sin(θ)] = sqrt(a² + b²)
Proof of (D):
find the maximum of the function by setting the derivative to zero:
-a*sin(θ)+b*cos(θ) = 0
From this it follows that
tan(θ) = b/a
and hence
sin(θ) = b/sqrt(a² + b²)
and
cos(θ) = a/sqrt(a² + b²)
Thus the maximum value is
MAX[a*cos(θ) + b*sin(θ)] = (a² + b²)/sqrt(a² + b²)
= sqrt(a² + b²)
4. Derivation of maximum expansion
To find MAX[ |X'| ] we search brute force method using calculus. The unit
circle on which X is constrained is to be parameterized by t:
X(θ) = (cos(θ), sin(θ))
Thus
X'(θ) = X(θ) * _R_ = (cos(θ), sin(θ)) * [a b]
[c d]
= (a*cos(θ) + c*sin(θ), b*cos(θ) + d*sin(θ)).
Define
r(θ) = |X'(θ)|
Thus
r²(θ) = (a*cos(θ) + c*sin(θ))² + (b*cos(θ) + d*sin(θ))²
= (a² + b²)*cos²(θ) + (c² + d²)*sin²(θ)
+ 2*(a*c + b*d)*cos(θ)*sin(θ)
Now apply the double angle formulae (A) to (C) from above:
r²(θ) = (a² + b² + c² + d²)/2
+ (a² + b² - c² - d²)*cos(2*θ)/2
+ (a*c + b*d)*sin(2*θ)
= f + g*cos(φ) + h*sin(φ)
Where
f = (a² + b² + c² + d²)/2
g = (a² + b² - c² - d²)/2
h = (a*c + d*d)
φ = 2*θ
It is clear that MAX[ |X'| ] = sqrt(MAX[ r² ]). Here we determine MAX[ r² ]
using (D) from above:
MAX[ r² ] = f + sqrt(g² + h²)
And finally
MAX[ |X'| ] = sqrt( f + sqrt(g² + h²) )

View file

@ -128,7 +128,7 @@ _cairo_meta_surface_finish (void *abstract_surface)
_cairo_pattern_fini (&command->mask.mask.base);
free (command);
break;
case CAIRO_COMMAND_STROKE:
_cairo_pattern_fini (&command->stroke.source.base);
_cairo_path_fixed_fini (&command->stroke.path);
@ -246,7 +246,7 @@ _cairo_meta_surface_paint (void *abstract_surface,
status = _init_pattern_with_snapshot (&command->source.base, source);
if (status)
goto CLEANUP_COMMAND;
status = _cairo_array_append (&meta->commands, &command);
if (status)
goto CLEANUP_SOURCE;
@ -284,7 +284,7 @@ _cairo_meta_surface_mask (void *abstract_surface,
status = _init_pattern_with_snapshot (&command->mask.base, mask);
if (status)
goto CLEANUP_SOURCE;
status = _cairo_array_append (&meta->commands, &command);
if (status)
goto CLEANUP_MASK;
@ -314,7 +314,7 @@ _cairo_meta_surface_stroke (void *abstract_surface,
cairo_status_t status;
cairo_meta_surface_t *meta = abstract_surface;
cairo_command_stroke_t *command;
command = malloc (sizeof (cairo_command_stroke_t));
if (command == NULL)
return CAIRO_STATUS_NO_MEMORY;
@ -598,7 +598,7 @@ static const cairo_surface_backend_t cairo_meta_surface_backend = {
/* Here are the 5 basic drawing operations, (which are in some
* sense the only things that cairo_meta_surface should need to
* implement). */
_cairo_meta_surface_paint,
_cairo_meta_surface_mask,
_cairo_meta_surface_stroke,

View file

@ -56,7 +56,7 @@ _cairo_operator_always_opaque (cairo_operator_t op)
case CAIRO_OPERATOR_SOURCE:
return FALSE;
case CAIRO_OPERATOR_OVER:
case CAIRO_OPERATOR_IN:
case CAIRO_OPERATOR_OUT:
@ -65,7 +65,7 @@ _cairo_operator_always_opaque (cairo_operator_t op)
case CAIRO_OPERATOR_DEST:
return TRUE;
case CAIRO_OPERATOR_DEST_OVER:
case CAIRO_OPERATOR_DEST_IN:
case CAIRO_OPERATOR_DEST_OUT:
@ -94,7 +94,7 @@ _cairo_operator_always_translucent (cairo_operator_t op)
case CAIRO_OPERATOR_SOURCE:
return FALSE;
case CAIRO_OPERATOR_OVER:
case CAIRO_OPERATOR_IN:
case CAIRO_OPERATOR_OUT:
@ -103,7 +103,7 @@ _cairo_operator_always_translucent (cairo_operator_t op)
case CAIRO_OPERATOR_DEST:
return FALSE;
case CAIRO_OPERATOR_DEST_OVER:
case CAIRO_OPERATOR_DEST_IN:
case CAIRO_OPERATOR_DEST_OUT:

View file

@ -180,20 +180,20 @@ _cairo_dtostr (char *buffer, size_t size, double d)
int decimal_len;
snprintf (buffer, size, "%f", d);
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
assert (decimal_point_len != 0);
p = buffer;
if (*p == '+' || *p == '-')
p++;
while (isdigit (*p))
p++;
if (strncmp (p, decimal_point, decimal_point_len) == 0) {
*p = '.';
decimal_len = strlen (p + decimal_point_len);
@ -209,7 +209,7 @@ _cairo_dtostr (char *buffer, size_t size, double d)
p--;
}
}
return p + 1 - buffer;
}
@ -298,7 +298,7 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream,
p = buffer + strlen (buffer);
f++;
}
_cairo_output_stream_write (stream, buffer, p - buffer);
}
@ -385,6 +385,6 @@ _cairo_output_stream_create_for_filename (const char *filename)
file = fopen (filename, "wb");
if (file == NULL)
return (cairo_output_stream_t *) &cairo_output_stream_nil_write_error;
return _cairo_output_stream_create (stdio_write, stdio_close, file);
}

View file

@ -159,7 +159,7 @@ _cairo_paginated_surface_finish (void *abstract_surface)
cairo_surface_destroy (surface->meta);
cairo_surface_destroy (surface->target);
return CAIRO_STATUS_SUCCESS;
}
@ -177,7 +177,7 @@ _cairo_paginated_surface_acquire_source_image (void *abstract_surface,
image = _cairo_image_surface_create_with_content (surface->content,
extents.width,
extents.height);
_cairo_meta_surface_replay (surface->meta, image);
*image_out = (cairo_image_surface_t*) image;
@ -214,7 +214,7 @@ _paint_page (cairo_paginated_surface_t *surface)
cairo_surface_destroy (analysis);
return status;
}
if (_cairo_analysis_surface_has_unsupported (analysis))
{
image = _cairo_image_surface_create_with_content (surface->content,
@ -237,7 +237,7 @@ _paint_page (cairo_paginated_surface_t *surface)
}
cairo_surface_destroy (analysis);
return CAIRO_STATUS_SUCCESS;
}

View file

@ -87,13 +87,13 @@ _cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *poi
if (bounder->has_point) {
if (point->x < bounder->min_x)
bounder->min_x = point->x;
if (point->y < bounder->min_y)
bounder->min_y = point->y;
if (point->x > bounder->max_x)
bounder->max_x = point->x;
if (point->y > bounder->max_y)
bounder->max_y = point->y;
} else {
@ -104,7 +104,7 @@ _cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *poi
bounder->has_point = 1;
}
return CAIRO_STATUS_SUCCESS;
}

View file

@ -94,7 +94,7 @@ _cairo_filler_move_to (void *closure, cairo_point_t *point)
status = _cairo_polygon_close (polygon);
if (status)
return status;
status = _cairo_polygon_move_to (polygon, point);
if (status)
return status;

View file

@ -161,7 +161,7 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
_cairo_pen_init (&stroker->pen,
stroke_style->line_width / 2.0,
tolerance, ctm);
stroker->has_current_face = FALSE;
stroker->has_first_face = FALSE;
@ -307,14 +307,14 @@ _cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_st
dx1 = in->usr_vector.x;
dy1 = in->usr_vector.y;
cairo_matrix_transform_distance (stroker->ctm, &dx1, &dy1);
/* outer point of outgoing line face */
x2 = _cairo_fixed_to_double (outpt->x);
y2 = _cairo_fixed_to_double (outpt->y);
dx2 = out->usr_vector.x;
dy2 = out->usr_vector.y;
cairo_matrix_transform_distance (stroker->ctm, &dx2, &dy2);
/*
* Compute the location of the outer corner of the miter.
* That's pretty easy -- just the intersection of the two
@ -329,7 +329,7 @@ _cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_st
mx = (my - y1) * dx1 / dy1 + x1;
else
mx = (my - y2) * dx2 / dy2 + x2;
/*
* Draw the quadrilateral
*/
@ -368,7 +368,7 @@ _cairo_stroker_add_cap (cairo_stroker_t *stroker, cairo_stroke_face_t *f)
if (stroker->style->line_cap == CAIRO_LINE_CAP_BUTT)
return CAIRO_STATUS_SUCCESS;
switch (stroker->style->line_cap) {
case CAIRO_LINE_CAP_ROUND: {
int i;
@ -644,7 +644,7 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point)
}
_cairo_slope_init (&slope, p1, p2);
status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &slope, &start, &end);
if (status)
return status;
@ -827,7 +827,7 @@ _cairo_stroker_curve_to (void *closure,
}
stroker->current_face = end;
stroker->has_current_face = 1;
extra_points[0] = start.cw;
extra_points[0].x -= start.point.x;
extra_points[0].y -= start.point.y;
@ -840,7 +840,7 @@ _cairo_stroker_curve_to (void *closure,
extra_points[3] = end.ccw;
extra_points[3].x -= end.point.x;
extra_points[3].y -= end.point.y;
status = _cairo_pen_add_points (&pen, extra_points, 4);
if (status)
goto CLEANUP_PEN;

View file

@ -135,14 +135,14 @@ _cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t *pattern,
{
cairo_linear_pattern_t *dst = (cairo_linear_pattern_t *) pattern;
cairo_linear_pattern_t *src = (cairo_linear_pattern_t *) other;
*dst = *src;
}
else
{
cairo_radial_pattern_t *dst = (cairo_radial_pattern_t *) pattern;
cairo_radial_pattern_t *src = (cairo_radial_pattern_t *) other;
*dst = *src;
}
@ -154,7 +154,7 @@ _cairo_gradient_pattern_init_copy (cairo_gradient_pattern_t *pattern,
_cairo_pattern_set_error (&pattern->base, CAIRO_STATUS_NO_MEMORY);
return;
}
memcpy (pattern->stops, other->stops,
other->n_stops * sizeof (pixman_gradient_stop_t));
}
@ -179,7 +179,7 @@ _cairo_pattern_init_copy (cairo_pattern_t *pattern,
case CAIRO_PATTERN_TYPE_SURFACE: {
cairo_surface_pattern_t *dst = (cairo_surface_pattern_t *) pattern;
cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) other;
*dst = *src;
cairo_surface_reference (dst->surface);
} break;
@ -187,11 +187,11 @@ _cairo_pattern_init_copy (cairo_pattern_t *pattern,
case CAIRO_PATTERN_TYPE_RADIAL: {
cairo_gradient_pattern_t *dst = (cairo_gradient_pattern_t *) pattern;
cairo_gradient_pattern_t *src = (cairo_gradient_pattern_t *) other;
_cairo_gradient_pattern_init_copy (dst, src);
} break;
}
pattern->ref_count = 1;
}
@ -204,14 +204,14 @@ _cairo_pattern_fini (cairo_pattern_t *pattern)
case CAIRO_PATTERN_TYPE_SURFACE: {
cairo_surface_pattern_t *surface_pattern =
(cairo_surface_pattern_t *) pattern;
cairo_surface_destroy (surface_pattern->surface);
} break;
case CAIRO_PATTERN_TYPE_LINEAR:
case CAIRO_PATTERN_TYPE_RADIAL: {
cairo_gradient_pattern_t *gradient =
(cairo_gradient_pattern_t *) pattern;
if (gradient->stops)
free (gradient->stops);
} break;
@ -238,7 +238,7 @@ _cairo_pattern_init_for_surface (cairo_surface_pattern_t *pattern,
}
_cairo_pattern_init (&pattern->base, CAIRO_PATTERN_TYPE_SURFACE);
pattern->surface = cairo_surface_reference (surface);
}
@ -486,7 +486,7 @@ cairo_pattern_create_radial (double cx0, double cy0, double radius0,
double cx1, double cy1, double radius1)
{
cairo_radial_pattern_t *pattern;
pattern = malloc (sizeof (cairo_radial_pattern_t));
if (pattern == NULL) {
_cairo_error (CAIRO_STATUS_NO_MEMORY);
@ -874,7 +874,7 @@ _cairo_linear_pattern_classify (cairo_linear_pattern_t *pattern,
/* transform fragment into pattern space */
double qx = a * qx_device + c * qy_device + tx;
double qy = b * qx_device + d * qy_device + ty;
factors[i] = _cairo_fixed_from_double (((dx * qx + dy * qy) - start) * scale);
}
@ -1046,7 +1046,7 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t *pattern,
attribs->extend = CAIRO_EXTEND_REPEAT;
attribs->filter = CAIRO_FILTER_NEAREST;
attribs->acquired = FALSE;
return CAIRO_STATUS_SUCCESS;
}
@ -1078,7 +1078,7 @@ static cairo_bool_t
_gradient_is_opaque (const cairo_gradient_pattern_t *gradient)
{
int i;
for (i = 0; i < gradient->n_stops; i++)
if (! CAIRO_ALPHA_IS_OPAQUE (gradient->stops[i].color.alpha))
return FALSE;
@ -1129,11 +1129,11 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
int tx, ty;
attr->acquired = FALSE;
if (_cairo_surface_is_image (dst))
{
cairo_image_surface_t *image;
status = _cairo_surface_acquire_source_image (pattern->surface,
&image,
&attr->extra);
@ -1147,7 +1147,7 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
{
status = _cairo_surface_clone_similar (dst, pattern->surface, out);
}
attr->extend = pattern->base.extend;
attr->filter = pattern->base.filter;
if (_cairo_matrix_is_integer_translation (&pattern->base.matrix,
@ -1163,7 +1163,7 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
attr->matrix = pattern->base.matrix;
attr->x_offset = attr->y_offset = 0;
}
return status;
}
@ -1195,7 +1195,7 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
cairo_surface_attributes_t *attributes)
{
cairo_status_t status;
if (pattern->status) {
*surface_out = NULL;
attributes->acquired = FALSE;
@ -1205,7 +1205,7 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
switch (pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID: {
cairo_solid_pattern_t *src = (cairo_solid_pattern_t *) pattern;
status = _cairo_pattern_acquire_surface_for_solid (src, dst,
x, y, width, height,
surface_out,
@ -1257,7 +1257,7 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern,
} break;
case CAIRO_PATTERN_TYPE_SURFACE: {
cairo_surface_pattern_t *src = (cairo_surface_pattern_t *) pattern;
status = _cairo_pattern_acquire_surface_for_surface (src, dst,
x, y, width, height,
surface_out,
@ -1365,12 +1365,12 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src,
}
_cairo_pattern_init_copy (&mask_tmp.base, mask);
status = _cairo_pattern_acquire_surface (&mask_tmp.base, dst,
mask_x, mask_y,
width, height,
mask_out, mask_attributes);
if (status)
_cairo_pattern_release_surface (&src_tmp.base,
*src_out, src_attributes);

View file

@ -79,7 +79,7 @@ _cairo_pen_init (cairo_pen_t *pen,
pen->num_vertices = _cairo_pen_vertices_needed (tolerance,
radius,
ctm);
pen->vertices = malloc (pen->num_vertices * sizeof (cairo_pen_vertex_t));
if (pen->vertices == NULL) {
return CAIRO_STATUS_NO_MEMORY;
@ -252,21 +252,21 @@ _cairo_pen_vertices_needed (double tolerance,
* compute major axis length for a pen with the specified radius.
* we don't need the minor axis length.
*/
double major_axis = _cairo_matrix_transformed_circle_major_axis(matrix, radius);
/*
* compute number of vertices needed
*/
int num_vertices;
/* Where tolerance / M is > 1, we use 4 points */
if (tolerance >= major_axis) {
num_vertices = 4;
} else {
double delta = acos (1 - tolerance / major_axis);
num_vertices = ceil (M_PI / delta);
/* number of vertices must be even */
if (num_vertices % 2)
num_vertices++;
@ -443,6 +443,6 @@ _cairo_pen_stroke_spline (cairo_pen_t *pen,
_cairo_polygon_close (&polygon);
_cairo_traps_tessellate_polygon (traps, &polygon, CAIRO_FILL_RULE_WINDING);
_cairo_polygon_fini (&polygon);
return CAIRO_STATUS_SUCCESS;
}

View file

@ -74,7 +74,7 @@ convert_data_to_bytes (png_structp png, png_row_infop row_info, png_bytep data)
uint32_t pixel;
memcpy (&pixel, b, sizeof (uint32_t));
b[0] = (pixel & 0xff0000) >> 16;
b[1] = (pixel & 0x00ff00) >> 8;
b[2] = (pixel & 0x0000ff) >> 0;
@ -133,7 +133,7 @@ write_png (cairo_surface_t *surface,
status = CAIRO_STATUS_NO_MEMORY;
goto BAIL3;
}
png_set_write_fn (png, closure, write_func, NULL);
switch (image->format) {
@ -179,14 +179,14 @@ write_png (cairo_surface_t *surface,
* that is needed for the write transformation functions to work.
*/
png_write_info (png, info);
if (image->format == CAIRO_FORMAT_ARGB32)
png_set_write_user_transform_fn (png, unpremultiply_data);
else if (image->format == CAIRO_FORMAT_RGB24)
png_set_write_user_transform_fn (png, convert_data_to_bytes);
if (image->format == CAIRO_FORMAT_RGB24)
png_set_filler (png, 0, PNG_FILLER_AFTER);
png_write_image (png, rows);
png_write_end (png, info);
@ -235,7 +235,7 @@ cairo_surface_write_to_png (cairo_surface_t *surface,
fp = fopen (filename, "wb");
if (fp == NULL)
return CAIRO_STATUS_WRITE_ERROR;
status = write_png (surface, stdio_write_func, fp);
if (fclose (fp) && status == CAIRO_STATUS_SUCCESS)
@ -481,7 +481,7 @@ cairo_image_surface_create_from_png (const char *filename)
return (cairo_surface_t*) &_cairo_surface_nil_read_error;
}
}
surface = read_png (stdio_read_func, fp);
fclose (fp);

View file

@ -81,7 +81,7 @@ typedef struct cairo_ps_surface {
cairo_array_t dsc_page_setup_comments;
cairo_array_t *dsc_comment_target;
} cairo_ps_surface_t;
#define PS_SURFACE_DPI_DEFAULT 300.0
@ -96,7 +96,7 @@ _cairo_ps_surface_path_move_to (void *closure, cairo_point_t *point)
"%f %f moveto ",
_cairo_fixed_to_double (point->x),
_cairo_fixed_to_double (point->y));
return CAIRO_STATUS_SUCCESS;
}
@ -129,7 +129,7 @@ _cairo_ps_surface_path_curve_to (void *closure,
_cairo_fixed_to_double (c->y),
_cairo_fixed_to_double (d->x),
_cairo_fixed_to_double (d->y));
return CAIRO_STATUS_SUCCESS;
}
@ -137,7 +137,7 @@ static cairo_status_t
_cairo_ps_surface_path_close_path (void *closure)
{
cairo_output_stream_t *output_stream = closure;
_cairo_output_stream_printf (output_stream,
"closepath\n");
@ -251,7 +251,7 @@ _cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
-_cairo_fixed_to_double (scaled_glyph->bbox.p2.y),
_cairo_fixed_to_double (scaled_glyph->bbox.p2.x),
-_cairo_fixed_to_double (scaled_glyph->bbox.p1.y));
status = _cairo_path_fixed_interpret (scaled_glyph->path,
CAIRO_DIRECTION_FORWARD,
_cairo_ps_surface_path_move_to,
@ -259,10 +259,10 @@ _cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
_cairo_ps_surface_path_curve_to,
_cairo_ps_surface_path_close_path,
surface->final_stream);
_cairo_output_stream_printf (surface->final_stream,
"F\n");
_cairo_output_stream_printf (surface->final_stream,
"\t\t}\n");
}
@ -326,7 +326,7 @@ _cairo_ps_surface_emit_body (cairo_ps_surface_t *surface)
{
char buf[4096];
int n;
rewind (surface->tmpfile);
while ((n = fread (buf, 1, sizeof (buf), surface->tmpfile)) > 0)
_cairo_output_stream_write (surface->final_stream, buf, n);
@ -915,9 +915,9 @@ _cairo_ps_surface_finish (void *abstract_surface)
word_wrap = _word_wrap_stream_create (final_stream, 79);
surface->final_stream = word_wrap;
_cairo_ps_surface_emit_header (surface);
_cairo_ps_surface_emit_font_subsets (surface);
_cairo_ps_surface_emit_body (surface);
@ -1065,7 +1065,7 @@ pattern_supported (const cairo_pattern_t *pattern)
if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE)
return surface_pattern_supported ((const cairo_surface_pattern_t *) pattern);
return FALSE;
}
@ -1242,9 +1242,9 @@ emit_image (cairo_ps_surface_t *surface,
status = CAIRO_STATUS_NO_MEMORY;
goto bail0;
}
_cairo_pattern_init_for_surface (&pattern.surface, &image->base);
_cairo_surface_fill_rectangle (opaque,
CAIRO_OPERATOR_SOURCE,
CAIRO_COLOR_WHITE,
@ -1259,7 +1259,7 @@ emit_image (cairo_ps_surface_t *surface,
0, 0,
image->width,
image->height);
_cairo_pattern_fini (&pattern.base);
opaque_image = (cairo_image_surface_t *) opaque;
} else {
@ -1550,7 +1550,7 @@ _cairo_ps_surface_paint (void *abstract_surface,
/*
assert (_operation_supported (op, source));
*/
_cairo_output_stream_printf (stream,
"%% _cairo_ps_surface_paint\n");
@ -1616,7 +1616,7 @@ _cairo_ps_surface_stroke (void *abstract_surface,
return _analyze_operation (surface, op, source);
assert (operation_supported (surface, op, source));
_cairo_output_stream_printf (stream,
"%% _cairo_ps_surface_stroke\n");
@ -1684,7 +1684,7 @@ _cairo_ps_surface_fill (void *abstract_surface,
return _analyze_operation (surface, op, source);
assert (operation_supported (surface, op, source));
_cairo_output_stream_printf (stream,
"%% _cairo_ps_surface_fill\n");
@ -1806,7 +1806,7 @@ static const cairo_surface_backend_t cairo_ps_surface_backend = {
NULL, /* scaled_glyph_fini */
/* Here are the drawing functions */
_cairo_ps_surface_paint, /* paint */
NULL, /* mask */
_cairo_ps_surface_stroke,

View file

@ -44,7 +44,7 @@ _cairo_quartz_surface_finish(void *abstract_surface)
if (surface->clip_region)
pixman_region_destroy (surface->clip_region);
return CAIRO_STATUS_SUCCESS;
}
@ -91,7 +91,7 @@ _cairo_quartz_surface_acquire_dest_image(void *abstract_surfa
if (x1 >= x2 || y1 >= y2) {
*image_out = NULL;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
@ -125,7 +125,7 @@ create_image_from_surface (cairo_image_surface_t *image_surface, void *data)
width = cairo_image_surface_get_width ((cairo_surface_t *)image_surface);
height = cairo_image_surface_get_height ((cairo_surface_t *)image_surface);
color_space = CGColorSpaceCreateDeviceRGB();
data_provider = CGDataProviderCreateWithData (NULL, data,
width * height * 4, NULL);
@ -140,7 +140,7 @@ create_image_from_surface (cairo_image_surface_t *image_surface, void *data)
CGColorSpaceRelease (color_space);
CGDataProviderRelease (data_provider);
return image;
}
@ -154,7 +154,7 @@ _cairo_quartz_surface_release_dest_image(void *abstract_surfa
cairo_quartz_surface_t *surface = abstract_surface;
CGImageRef image_ref;
CGRect rect;
image_ref = create_image_from_surface (image, image_extra);
rect = CGRectMake (image_rect->x, image_rect->y, image_rect->width, image_rect->height);
@ -167,11 +167,11 @@ _cairo_quartz_surface_release_dest_image(void *abstract_surfa
CGContextDrawImage(surface->context, rect, image_ref);
CFRelease (image_ref);
if (surface->y_grows_down) {
CGContextRestoreGState (surface->context);
}
cairo_surface_destroy ((cairo_surface_t *)image);
free (image_extra);
}
@ -184,7 +184,7 @@ _cairo_quartz_surface_set_clip_region(void *abstract_surface,
if (surface->clip_region)
pixman_region_destroy (surface->clip_region);
if (region) {
surface->clip_region = pixman_region_create ();
pixman_region_copy (surface->clip_region, region);

View file

@ -58,7 +58,7 @@ _cairo_region_create_from_rectangle (cairo_rectangle_fixed_t *rect)
pixman_region_destroy (region);
return NULL;
}
return region;
}

View file

@ -246,7 +246,7 @@ _cairo_sub_font_map_glyph (cairo_sub_font_t *sub_font,
sub_font->current_subset++;
sub_font->num_glyphs_in_current_subset = 0;
}
sub_font_glyph = _cairo_sub_font_glyph_create (scaled_font_glyph_index,
sub_font->current_subset,
sub_font->num_glyphs_in_current_subset++);

View file

@ -61,7 +61,7 @@ _cairo_scaled_glyph_fini (cairo_scaled_glyph_t *scaled_glyph)
if (scaled_glyph->path != NULL)
_cairo_path_fixed_destroy (scaled_glyph->path);
}
static void
_cairo_scaled_glyph_destroy (void *abstract_glyph)
{
@ -168,7 +168,7 @@ cairo_scaled_font_status (cairo_scaled_font_t *scaled_font)
* of scaled fonts we keep around even when not otherwise referenced
*/
#define CAIRO_SCALED_FONT_MAX_HOLDOVERS 256
typedef struct _cairo_scaled_font_map {
cairo_hash_table_t *hash_table;
cairo_scaled_font_t *holdovers[CAIRO_SCALED_FONT_MAX_HOLDOVERS];
@ -339,10 +339,10 @@ _cairo_scaled_font_init (cairo_scaled_font_t *scaled_font,
scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
_cairo_scaled_glyph_destroy,
256);
scaled_font->surface_backend = NULL;
scaled_font->surface_private = NULL;
scaled_font->backend = backend;
return CAIRO_STATUS_SUCCESS;
@ -353,16 +353,16 @@ _cairo_scaled_font_set_metrics (cairo_scaled_font_t *scaled_font,
cairo_font_extents_t *fs_metrics)
{
double font_scale_x, font_scale_y;
_cairo_matrix_compute_scale_factors (&scaled_font->font_matrix,
&font_scale_x, &font_scale_y,
/* XXX */ 1);
/*
* The font responded in unscaled units, scale by the font
* matrix scale factors to get to user space
*/
scaled_font->extents.ascent = fs_metrics->ascent * font_scale_y;
scaled_font->extents.descent = fs_metrics->descent * font_scale_y;
scaled_font->extents.height = fs_metrics->height * font_scale_y;
@ -378,7 +378,7 @@ _cairo_scaled_font_fini (cairo_scaled_font_t *scaled_font)
if (scaled_font->glyphs != NULL)
_cairo_cache_destroy (scaled_font->glyphs);
if (scaled_font->surface_backend != NULL &&
scaled_font->surface_backend->scaled_font_fini != NULL)
scaled_font->surface_backend->scaled_font_fini (scaled_font);
@ -423,7 +423,7 @@ cairo_scaled_font_create (cairo_font_face_t *font_face,
font_map = _cairo_scaled_font_map_lock ();
if (font_map == NULL)
goto UNWIND;
_cairo_scaled_font_init_key (&key, font_face,
font_matrix, ctm, options);
@ -561,12 +561,12 @@ cairo_scaled_font_destroy (cairo_scaled_font_t *scaled_font)
lru = font_map->holdovers[0];
assert (lru->ref_count == 0);
_cairo_hash_table_remove (font_map->hash_table, &lru->hash_entry);
_cairo_scaled_font_fini (lru);
free (lru);
font_map->num_holdovers--;
memmove (&font_map->holdovers[0],
&font_map->holdovers[1],
@ -674,14 +674,14 @@ cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
extents->height = 0.0;
extents->x_advance = 0.0;
extents->y_advance = 0.0;
return;
}
for (i = 0; i < num_glyphs; i++) {
cairo_scaled_glyph_t *scaled_glyph;
double left, top, right, bottom;
status = _cairo_scaled_glyph_lookup (scaled_font,
glyphs[i].index,
CAIRO_SCALED_GLYPH_INFO_METRICS,
@ -690,12 +690,12 @@ cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font,
_cairo_scaled_font_set_error (scaled_font, status);
return;
}
left = scaled_glyph->metrics.x_bearing + glyphs[i].x;
right = left + scaled_glyph->metrics.width;
top = scaled_glyph->metrics.y_bearing + glyphs[i].y;
bottom = top + scaled_glyph->metrics.height;
if (i == 0) {
min_x = left;
max_x = right;
@ -757,7 +757,7 @@ _cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
ucs4_to_index) (scaled_font, ucs4[i]);
(*glyphs)[i].x = x;
(*glyphs)[i].y = y;
status = _cairo_scaled_glyph_lookup (scaled_font,
(*glyphs)[i].index,
CAIRO_SCALED_GLYPH_INFO_METRICS,
@ -767,14 +767,14 @@ _cairo_scaled_font_text_to_glyphs (cairo_scaled_font_t *scaled_font,
*glyphs = NULL;
goto FAIL;
}
x += scaled_glyph->metrics.x_advance;
y += scaled_glyph->metrics.y_advance;
}
FAIL:
free (ucs4);
return status;
}
@ -800,7 +800,7 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
int left, top;
int right, bottom;
int x, y;
status = _cairo_scaled_glyph_lookup (scaled_font,
glyphs[i].index,
CAIRO_SCALED_GLYPH_INFO_METRICS,
@ -809,16 +809,16 @@ _cairo_scaled_font_glyph_device_extents (cairo_scaled_font_t *scaled_font,
_cairo_scaled_font_set_error (scaled_font, status);
return status;
}
/* glyph images are snapped to pixel locations */
x = (int) floor (glyphs[i].x + 0.5);
y = (int) floor (glyphs[i].y + 0.5);
left = x + _cairo_fixed_integer_floor(scaled_glyph->bbox.p1.x);
top = y + _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y);
right = x + _cairo_fixed_integer_ceil(scaled_glyph->bbox.p2.x);
bottom = y + _cairo_fixed_integer_ceil (scaled_glyph->bbox.p2.y);
if (left < min_x) min_x = left;
if (right > max_x) max_x = right;
if (top < min_y) min_y = top;
@ -858,7 +858,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
* they are implemented in terms of other operators in cairo-gstate.c
*/
assert (op != CAIRO_OPERATOR_SOURCE && op != CAIRO_OPERATOR_CLEAR);
if (scaled_font->status)
return scaled_font->status;
@ -875,7 +875,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
}
/* Font display routine either does not exist or failed. */
status = CAIRO_STATUS_SUCCESS;
_cairo_cache_freeze (scaled_font->glyphs);
@ -885,7 +885,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
cairo_surface_pattern_t glyph_pattern;
cairo_image_surface_t *glyph_surface;
cairo_scaled_glyph_t *scaled_glyph;
status = _cairo_scaled_glyph_lookup (scaled_font,
glyphs[i].index,
CAIRO_SCALED_GLYPH_INFO_SURFACE,
@ -893,7 +893,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
if (status)
goto CLEANUP_MASK;
glyph_surface = scaled_glyph->surface;
/* Create the mask using the format from the first glyph */
@ -917,7 +917,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
pixman_image, TRUE);
}
/* round glyph locations to the nearest pixel */
x = (int) floor (glyphs[i].x +
glyph_surface->base.device_x_offset +
@ -925,7 +925,7 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
y = (int) floor (glyphs[i].y +
glyph_surface->base.device_y_offset +
0.5);
_cairo_pattern_init_for_surface (&glyph_pattern, &glyph_surface->base);
status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
@ -943,25 +943,25 @@ _cairo_scaled_font_show_glyphs (cairo_scaled_font_t *scaled_font,
if (status)
break;
}
if (mask != NULL) {
cairo_surface_pattern_t mask_pattern;
_cairo_pattern_init_for_surface (&mask_pattern, mask);
status = _cairo_surface_composite (op, pattern, &mask_pattern.base,
surface,
source_x, source_y,
0, 0,
dest_x, dest_y,
width, height);
_cairo_pattern_fini (&mask_pattern.base);
}
CLEANUP_MASK:
_cairo_cache_thaw (scaled_font->glyphs);
if (mask != NULL)
cairo_surface_destroy (mask);
return status;
@ -1027,14 +1027,14 @@ _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
cairo_status_t status;
int i;
cairo_scaled_glyph_path_closure_t closure;
if (scaled_font->status)
return scaled_font->status;
closure.path = path;
for (i = 0; i < num_glyphs; i++) {
cairo_scaled_glyph_t *scaled_glyph;
status = _cairo_scaled_glyph_lookup (scaled_font,
glyphs[i].index,
CAIRO_SCALED_GLYPH_INFO_PATH,
@ -1044,7 +1044,7 @@ _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
closure.offset.x = _cairo_fixed_from_double (glyphs[i].x);
closure.offset.y = _cairo_fixed_from_double (glyphs[i].y);
status = _cairo_path_fixed_interpret (scaled_glyph->path,
CAIRO_DIRECTION_FORWARD,
_scaled_glyph_path_move_to,
@ -1053,7 +1053,7 @@ _cairo_scaled_font_glyph_path (cairo_scaled_font_t *scaled_font,
_scaled_glyph_path_close_path,
&closure);
}
return CAIRO_STATUS_SUCCESS;
}
@ -1077,7 +1077,7 @@ _cairo_scaled_glyph_set_metrics (cairo_scaled_glyph_t *scaled_glyph,
double hm, wm;
double min_user_x = 0.0, max_user_x = 0.0, min_user_y = 0.0, max_user_y = 0.0;
double min_device_x = 0.0, max_device_x = 0.0, min_device_y = 0.0, max_device_y = 0.0;
for (hm = 0.0; hm <= 1.0; hm += 1.0)
for (wm = 0.0; wm <= 1.0; wm += 1.0) {
double x, y;
@ -1102,7 +1102,7 @@ _cairo_scaled_glyph_set_metrics (cairo_scaled_glyph_t *scaled_glyph,
y = fs_metrics->y_bearing + fs_metrics->height * hm;
cairo_matrix_transform_distance (&scaled_font->scale,
&x, &y);
if (first) {
min_device_x = max_device_x = x;
min_device_y = max_device_y = y;
@ -1178,7 +1178,7 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
cairo_cache_entry_t key;
cairo_scaled_glyph_t *scaled_glyph;
cairo_scaled_glyph_info_t need_info;
if (scaled_font->status)
return scaled_font->status;
@ -1200,14 +1200,14 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
status = CAIRO_STATUS_NO_MEMORY;
goto CLEANUP;
}
_cairo_scaled_glyph_set_index(scaled_glyph, index);
scaled_glyph->cache_entry.size = 1; /* XXX */
scaled_glyph->scaled_font = scaled_font;
scaled_glyph->surface = NULL;
scaled_glyph->path = NULL;
scaled_glyph->surface_private = NULL;
/* ask backend to initialize metrics and shape fields */
status = (*scaled_font->backend->
scaled_glyph_init) (scaled_font, scaled_glyph, info);
@ -1232,11 +1232,11 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
if ((info & CAIRO_SCALED_GLYPH_INFO_SURFACE) != 0 &&
scaled_glyph->surface == NULL)
need_info |= CAIRO_SCALED_GLYPH_INFO_SURFACE;
if (((info & CAIRO_SCALED_GLYPH_INFO_PATH) != 0 &&
scaled_glyph->path == NULL))
need_info |= CAIRO_SCALED_GLYPH_INFO_PATH;
if (need_info) {
status = (*scaled_font->backend->
scaled_glyph_init) (scaled_font, scaled_glyph, need_info);

View file

@ -256,7 +256,7 @@ _cairo_spline_decompose_into (cairo_spline_t *spline, double tolerance_squared,
status = _cairo_spline_decompose_into (&s1, tolerance_squared, result);
if (status)
return status;
status = _cairo_spline_decompose_into (&s2, tolerance_squared, result);
if (status)
return status;

View file

@ -70,7 +70,7 @@ _fallback_init (fallback_state_t *state,
state->extents.y = y;
state->extents.width = width;
state->extents.height = height;
state->dst = dst;
status = _cairo_surface_acquire_dest_image (dst, &state->extents,
@ -116,14 +116,14 @@ _create_composite_mask_pattern (cairo_surface_pattern_t *mask_pattern,
{
cairo_surface_t *mask;
cairo_status_t status;
mask = cairo_surface_create_similar (dst,
CAIRO_CONTENT_ALPHA,
extents->width,
extents->height);
if (mask->status)
return CAIRO_STATUS_NO_MEMORY;
status = (*draw_func) (draw_closure, CAIRO_OPERATOR_ADD,
NULL, mask,
extents->x, extents->y,
@ -138,7 +138,7 @@ _create_composite_mask_pattern (cairo_surface_pattern_t *mask_pattern,
extents);
if (status)
goto CLEANUP_SURFACE;
_cairo_pattern_init_for_surface (mask_pattern, mask);
CLEANUP_SURFACE:
@ -168,7 +168,7 @@ _clip_and_composite_with_mask (cairo_clip_t *clip,
dst, extents);
if (status)
return status;
status = _cairo_surface_composite (op,
src, &mask_pattern.base, dst,
extents->x, extents->y,
@ -254,7 +254,7 @@ _clip_and_composite_combine (cairo_clip_t *clip,
/* Now add the two results together
*/
_cairo_pattern_init_for_surface (&intermediate_pattern, intermediate);
status = _cairo_surface_composite (CAIRO_OPERATOR_ADD,
&intermediate_pattern.base, NULL, dst,
0, 0,
@ -263,7 +263,7 @@ _clip_and_composite_combine (cairo_clip_t *clip,
extents->width, extents->height);
_cairo_pattern_fini (&intermediate_pattern.base);
CLEANUP_SURFACE:
cairo_surface_destroy (intermediate);
@ -292,7 +292,7 @@ _clip_and_composite_source (cairo_clip_t *clip,
dst, extents);
if (status)
return status;
/* Compute dest' = dest OUT (mask IN clip)
*/
status = _cairo_surface_composite (CAIRO_OPERATOR_DEST_OUT,
@ -425,11 +425,11 @@ _composite_trap_region (cairo_clip_t *clip,
if (num_rects == 0)
return CAIRO_STATUS_SUCCESS;
if (num_rects > 1) {
if (_cairo_surface_get_clip_mode (dst) != CAIRO_CLIP_MODE_REGION)
return CAIRO_INT_STATUS_UNSUPPORTED;
clip_serial = _cairo_surface_allocate_clip_serial (dst);
status = _cairo_surface_set_clip_region (dst,
trap_region,
@ -437,10 +437,10 @@ _composite_trap_region (cairo_clip_t *clip,
if (status)
return status;
}
if (clip_surface)
_cairo_pattern_init_for_surface (&mask.surface, clip_surface);
status = _cairo_surface_composite (op,
src,
clip_surface ? &mask.base : NULL,
@ -481,14 +481,14 @@ _composite_traps_draw_func (void *closure,
cairo_composite_traps_info_t *info = closure;
cairo_pattern_union_t pattern;
cairo_status_t status;
if (dst_x != 0 || dst_y != 0)
_cairo_traps_translate (info->traps, - dst_x, - dst_y);
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
if (!src)
src = &pattern.base;
status = _cairo_surface_composite_trapezoids (op,
src, dst, info->antialias,
extents->x, extents->y,
@ -515,7 +515,7 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
pixman_region16_t *clear_region = NULL;
cairo_rectangle_fixed_t extents;
cairo_composite_traps_info_t traps_info;
if (traps->num_traps == 0)
return CAIRO_STATUS_SUCCESS;
@ -538,11 +538,11 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
else
{
cairo_surface_t *clip_surface = clip ? clip->surface : NULL;
status = _cairo_surface_get_extents (dst, &extents);
if (status)
return status;
if (trap_region && !clip_surface) {
/* If we optimize drawing with an unbounded operator to
* _cairo_surface_fill_rectangles() or to drawing with a
@ -551,7 +551,7 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
status = _cairo_surface_get_extents (dst, &extents);
if (status)
return status;
clear_region = _cairo_region_create_from_rectangle (&extents);
if (clear_region == NULL)
return CAIRO_STATUS_NO_MEMORY;
@ -559,12 +559,12 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
status = _cairo_clip_intersect_to_region (clip, clear_region);
if (status)
return status;
_cairo_region_extents_rectangle (clear_region, &extents);
if (pixman_region_subtract (clear_region, clear_region, trap_region) != PIXMAN_REGION_STATUS_SUCCESS)
return CAIRO_STATUS_NO_MEMORY;
if (!pixman_region_not_empty (clear_region)) {
pixman_region_destroy (clear_region);
clear_region = NULL;
@ -575,14 +575,14 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
return status;
}
}
if (status)
goto out;
if (trap_region)
{
cairo_surface_t *clip_surface = clip ? clip->surface : NULL;
if ((src->type == CAIRO_PATTERN_TYPE_SOLID || op == CAIRO_OPERATOR_CLEAR) &&
!clip_surface)
{
@ -592,7 +592,7 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
color = CAIRO_COLOR_TRANSPARENT;
else
color = &((cairo_solid_pattern_t *)src)->color;
/* Solid rectangles special case */
status = _cairo_surface_fill_region (dst, op, color, trap_region);
if (!status && clear_region)
@ -646,7 +646,7 @@ _clip_and_composite_trapezoids (cairo_pattern_t *src,
pixman_region_destroy (trap_region);
if (clear_region)
pixman_region_destroy (clear_region);
return status;
}
@ -672,7 +672,7 @@ _cairo_surface_fallback_paint (cairo_surface_t *surface,
_cairo_rectangle_intersect (&extents, &source_extents);
}
status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents);
if (status)
return status;
@ -685,7 +685,7 @@ _cairo_surface_fallback_paint (cairo_surface_t *surface,
status = _cairo_traps_init_box (&traps, &box);
if (status)
return status;
_clip_and_composite_trapezoids (source,
op,
surface,
@ -745,7 +745,7 @@ _cairo_surface_fallback_mask (cairo_surface_t *surface,
_cairo_rectangle_intersect (&extents, &source_extents);
}
if (_cairo_operator_bounded_by_mask (op)) {
status = _cairo_pattern_get_extents (mask, &mask_extents);
if (status)
@ -781,7 +781,7 @@ _cairo_surface_fallback_stroke (cairo_surface_t *surface,
{
cairo_status_t status;
cairo_traps_t traps;
_cairo_traps_init (&traps);
status = _cairo_path_fixed_stroke_to_traps (path,
@ -866,7 +866,7 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure
*/
if (dst_x != 0 || dst_y != 0) {
int i;
for (i = 0; i < glyph_info->num_glyphs; ++i)
{
((cairo_glyph_t *) glyph_info->glyphs)[i].x -= dst_x;
@ -877,7 +877,7 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure
_cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE);
if (!src)
src = &pattern.base;
status = _cairo_surface_old_show_glyphs (glyph_info->font, op, src,
dst,
extents->x, extents->y,
@ -890,7 +890,7 @@ _cairo_surface_old_show_glyphs_draw_func (void *closure
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
return status;
status = _cairo_scaled_font_show_glyphs (glyph_info->font,
op,
src, dst,
@ -933,15 +933,15 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t *surface,
_cairo_rectangle_intersect (&extents, &glyph_extents);
}
status = _cairo_clip_intersect_to_rectangle (surface->clip, &extents);
if (status)
return status;
glyph_info.font = scaled_font;
glyph_info.glyphs = glyphs;
glyph_info.num_glyphs = num_glyphs;
status = _clip_and_composite (surface->clip,
op,
source,
@ -949,7 +949,7 @@ _cairo_surface_fallback_show_glyphs (cairo_surface_t *surface,
&glyph_info,
surface,
&extents);
return status;
}
@ -1063,7 +1063,7 @@ _cairo_surface_fallback_fill_rectangles (cairo_surface_t *surface,
y1 = rects[0].y;
x2 = rects[0].x + rects[0].width;
y2 = rects[0].y + rects[0].height;
for (i = 1; i < num_rects; i++) {
if (rects[i].x < x1)
x1 = rects[i].x;
@ -1084,7 +1084,7 @@ _cairo_surface_fallback_fill_rectangles (cairo_surface_t *surface,
}
/* If the fetched image isn't at 0,0, we need to offset the rectangles */
if (state.image_rect.x != 0 || state.image_rect.y != 0) {
offset_rects = malloc (sizeof (cairo_rectangle_fixed_t) * num_rects);
if (offset_rects == NULL) {
@ -1140,7 +1140,7 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t op,
}
/* If the destination image isn't at 0,0, we need to offset the trapezoids */
if (state.image_rect.x != 0 || state.image_rect.y != 0) {
offset_traps = malloc (sizeof (cairo_trapezoid_t) * num_traps);
if (!offset_traps) {
@ -1166,6 +1166,6 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t op,
DONE:
_fallback_fini (&state);
return status;
}

View file

@ -188,7 +188,7 @@ _cairo_surface_init (cairo_surface_t *surface,
surface->backend = backend;
surface->content = content;
surface->type = backend->type;
surface->ref_count = 1;
@ -294,7 +294,7 @@ _cairo_surface_create_similar_solid (cairo_surface_t *other,
CAIRO_OPERATOR_SOURCE, source);
cairo_pattern_destroy (source);
if (status) {
cairo_surface_destroy (surface);
_cairo_error (status);
@ -466,7 +466,7 @@ cairo_surface_set_user_data (cairo_surface_t *surface,
{
if (surface->ref_count == -1)
return CAIRO_STATUS_NO_MEMORY;
return _cairo_user_data_array_set_data (&surface->user_data,
key, user_data, destroy);
}
@ -520,7 +520,7 @@ cairo_surface_flush (cairo_surface_t *surface)
cairo_status_t status;
status = surface->backend->flush (surface);
if (status)
_cairo_surface_set_error (surface, status);
}
@ -584,12 +584,12 @@ cairo_surface_mark_dirty_rectangle (cairo_surface_t *surface,
if (surface->backend->mark_dirty_rectangle) {
cairo_status_t status;
status = surface->backend->mark_dirty_rectangle (surface,
SURFACE_TO_BACKEND_X(surface, x),
SURFACE_TO_BACKEND_Y(surface, y),
width, height);
if (status)
_cairo_surface_set_error (surface, status);
}
@ -799,13 +799,13 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
cairo_status_t status;
cairo_image_surface_t *image;
void *image_extra;
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
if (surface->backend->clone_similar == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = surface->backend->clone_similar (surface, src, clone_out);
if (status == CAIRO_STATUS_SUCCESS) {
(*clone_out)->device_x_offset = src->device_x_offset;
@ -830,7 +830,7 @@ _cairo_surface_clone_similar (cairo_surface_t *surface,
* inefficient compared to a backend-specific implementation of
* clone_similar() with an image source. So we don't bother
*/
_cairo_surface_release_source_image (src, image, image_extra);
return status;
}
@ -891,7 +891,7 @@ _cairo_surface_composite (cairo_operator_t op,
if (dst->status)
return dst->status;
if (dst->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
@ -985,7 +985,7 @@ _cairo_surface_fill_region (cairo_surface_t *surface,
if (!num_rects)
return CAIRO_STATUS_SUCCESS;
rects = malloc (sizeof (pixman_rectangle_t) * num_rects);
if (!rects)
return CAIRO_STATUS_NO_MEMORY;
@ -999,7 +999,7 @@ _cairo_surface_fill_region (cairo_surface_t *surface,
status = _cairo_surface_fill_rectangles (surface, op,
color, rects, num_rects);
free (rects);
return status;
@ -1207,7 +1207,7 @@ FINISH:
return status;
}
cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t op,
cairo_pattern_t *pattern,
@ -1326,7 +1326,7 @@ unsigned int
_cairo_surface_allocate_clip_serial (cairo_surface_t *surface)
{
unsigned int serial;
if (surface->status)
return 0;
@ -1354,7 +1354,7 @@ _cairo_surface_reset_clip (cairo_surface_t *surface)
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
surface->current_clip_serial = 0;
if (surface->backend->intersect_clip_path) {
@ -1398,7 +1398,7 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface,
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
assert (surface->backend->set_clip_region != NULL);
surface->current_clip_serial = serial;
@ -1423,7 +1423,7 @@ _cairo_surface_intersect_clip_path (cairo_surface_t *surface,
if (surface->finished)
return CAIRO_STATUS_SURFACE_FINISHED;
assert (surface->backend->intersect_clip_path != NULL);
status = surface->backend->intersect_clip_path (surface,
@ -1500,7 +1500,7 @@ cairo_status_t
_cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
{
unsigned int serial = 0;
if (!surface)
return CAIRO_STATUS_NULL_POINTER;
@ -1515,7 +1515,7 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
if (serial == 0)
clip = NULL;
}
surface->clip = clip;
if (serial == _cairo_surface_get_current_clip_serial (surface))
@ -1526,13 +1526,13 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip)
return _cairo_surface_set_clip_path (surface,
clip->path,
clip->serial);
if (clip->region)
return _cairo_surface_set_clip_region (surface,
clip->region,
clip->serial);
}
return _cairo_surface_reset_clip (surface);
}
@ -1866,7 +1866,7 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t *dst,
mask_tmp.y = dst_y - mask_y;
mask_tmp.width = mask_width;
mask_tmp.height = mask_height;
mask_rectangle = &mask_tmp;
return _cairo_surface_composite_fixup_unbounded_internal (dst, src_rectangle, mask_rectangle,

View file

@ -396,7 +396,7 @@ _cairo_svg_surface_create_for_document (cairo_svg_document_t *document,
surface->id = document->surface_id++;
clip_id = document->clip_id++;
clip = xmlNewChild (document->xml_node_defs, NULL, CC2XML ("clipPath"), NULL);
snprintf (buffer, sizeof buffer, "clip%d", clip_id);
xmlSetProp (clip, CC2XML ("id"), C2XML (buffer));
@ -405,14 +405,14 @@ _cairo_svg_surface_create_for_document (cairo_svg_document_t *document,
xmlSetProp (rect, CC2XML ("width"), C2XML (buffer));
_cairo_dtostr (buffer, sizeof buffer, height);
xmlSetProp (rect, CC2XML ("height"), C2XML (buffer));
/* Use of xlink namespace requires node to be linked to tree.
* So by default we link surface main node to document svg node.
* For surfaces that don't own document, their main node will be
* unlinked and freed in surface finish. */
surface->xml_node = xmlNewChild (document->xml_node_main, NULL, CC2XML ("g"), NULL);
surface->xml_root_node = surface->xml_node;
snprintf (buffer, sizeof buffer, "surface%d", surface->id);
xmlSetProp (surface->xml_node, CC2XML ("id"), C2XML (buffer));
snprintf (buffer, sizeof buffer, "url(#clip%d)", clip_id);
@ -581,7 +581,7 @@ _cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
svg_path_info_t info;
xmlNodePtr symbol, child;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
status = _cairo_scaled_glyph_lookup (scaled_font,
scaled_font_glyph_index,
CAIRO_SCALED_GLYPH_INFO_METRICS|
@ -600,7 +600,7 @@ _cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
_cairo_surface_set_error (document->owner, status);
return;
}
info.document = document;
info.path = xmlBufferCreate ();
info.ctm_inverse = NULL;
@ -622,7 +622,7 @@ _cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
child = xmlNewChild (symbol, NULL, CC2XML ("path"), NULL);
xmlSetProp (child, CC2XML ("d"), xmlBufferContent (info.path));
xmlSetProp (child, CC2XML ("style"), CC2XML ("stroke: none;"));
xmlBufferFree (info.path);
}
@ -657,7 +657,7 @@ _operation_supported (cairo_svg_surface_t *surface,
const cairo_pattern_t *pattern)
{
cairo_svg_document_t *document = surface->document;
if (document->svg_version < CAIRO_SVG_VERSION_1_2)
if (op != CAIRO_OPERATOR_OVER)
return FALSE;
@ -691,7 +691,7 @@ _cairo_svg_surface_finish (void *abstract_surface)
cairo_status_t status;
cairo_svg_surface_t *surface = abstract_surface;
cairo_svg_document_t *document = surface->document;
if (document->owner == &surface->base) {
status = _cairo_svg_document_finish (document);
} else {
@ -736,7 +736,7 @@ emit_transform (xmlNodePtr node,
{
xmlBufferPtr matrix_buffer;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
matrix_buffer = xmlBufferCreate ();
xmlBufferCat (matrix_buffer, CC2XML ("matrix("));
_cairo_dtostr (buffer, sizeof buffer, matrix->xx);
@ -835,7 +835,7 @@ _cairo_surface_base64_encode (cairo_surface_t *surface,
if (buffer == NULL)
return CAIRO_STATUS_NULL_POINTER;
info.buffer = xmlBufferCreate();
info.in_mem = 0;
info.trailing = 0;
@ -852,7 +852,7 @@ _cairo_surface_base64_encode (cairo_surface_t *surface,
*buffer = NULL;
return status;
}
if (info.in_mem > 0) {
for (i = info.in_mem; i < 3; i++)
info.src[i] = '\x0';
@ -860,7 +860,7 @@ _cairo_surface_base64_encode (cairo_surface_t *surface,
info.in_mem = 3;
base64_write_func (&info, NULL, 0);
}
return CAIRO_STATUS_SUCCESS;
}
@ -900,7 +900,7 @@ emit_composite_image_pattern (xmlNodePtr node,
_cairo_dtostr (buffer, sizeof buffer, image->height);
xmlSetProp (child, CC2XML ("height"), C2XML (buffer));
xmlSetProp (child, CC2XML ("xlink:href"), C2XML (xmlBufferContent (image_buffer)));
xmlBufferFree (image_buffer);
if (!is_pattern) {
@ -939,7 +939,7 @@ emit_meta_surface (cairo_svg_document_t *document,
break;
}
}
if (i >= num_elements) {
cairo_surface_t *paginated_surface;
cairo_surface_t *svg_surface;
@ -958,11 +958,11 @@ emit_meta_surface (cairo_svg_document_t *document,
&cairo_svg_surface_paginated_backend);
_cairo_meta_surface_replay ((cairo_surface_t *)meta, paginated_surface);
_cairo_surface_show_page (paginated_surface);
new_snapshot.meta = meta;
new_snapshot.id = ((cairo_svg_surface_t *) svg_surface)->id;
_cairo_array_append (&document->meta_snapshots, &new_snapshot);
if (meta->content == CAIRO_CONTENT_ALPHA)
emit_alpha_filter (document);
child = xmlAddChild (document->xml_node_defs,
@ -994,13 +994,13 @@ emit_composite_meta_pattern (xmlNodePtr node,
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
meta_surface = (cairo_meta_surface_t *) pattern->surface;
id = emit_meta_surface (document, meta_surface);
child = xmlNewChild (node, NULL, CC2XML("use"), NULL);
snprintf (buffer, sizeof buffer, "#surface%d", id);
xmlSetProp (child, CC2XML ("xlink:href"), C2XML (buffer));
if (!is_pattern) {
p2u = pattern->base.matrix;
cairo_matrix_invert (&p2u);
@ -1038,13 +1038,13 @@ emit_operator (xmlNodePtr node,
{
char const *op_str[] = {
"clear",
"src", "src-over", "src-in",
"src-out", "src-atop",
"dst", "dst-over", "dst-in",
"dst-out", "dst-atop",
"xor", "plus",
"color-dodge" /* FIXME: saturate ? */
};
@ -1102,9 +1102,9 @@ emit_surface_pattern (cairo_svg_surface_t *surface,
cairo_matrix_t p2u;
double width, height;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
child = xmlNewChild (document->xml_node_defs, NULL, CC2XML ("pattern"), NULL);
id = xmlBufferCreate ();
xmlBufferCat (id, CC2XML ("pattern"));
snprintf (buffer, sizeof buffer, "%d", document->pattern_id);
@ -1180,7 +1180,7 @@ emit_pattern_extend (xmlNodePtr node, cairo_extend_t extend)
/* FIXME not implemented */
break;
}
if (value != NULL)
xmlSetProp (node, CC2XML ("spreadMethod"), CC2XML (value));
}
@ -1197,9 +1197,9 @@ emit_linear_pattern (cairo_svg_surface_t *surface,
double x0, y0, x1, y1;
cairo_matrix_t p2u;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
child = xmlNewChild (document->xml_node_defs, NULL, CC2XML ("linearGradient"), NULL);
id = xmlBufferCreate ();
xmlBufferCat (id, CC2XML ("linear"));
snprintf (buffer, sizeof buffer, "%d", document->linear_pattern_id);
@ -1222,7 +1222,7 @@ emit_linear_pattern (cairo_svg_surface_t *surface,
y0 = _cairo_fixed_to_double (pattern->gradient.p1.y);
x1 = _cairo_fixed_to_double (pattern->gradient.p2.x);
y1 = _cairo_fixed_to_double (pattern->gradient.p2.y);
_cairo_dtostr (buffer, sizeof buffer, x0);
xmlSetProp (child, CC2XML ("x1"), C2XML (buffer));
_cairo_dtostr (buffer, sizeof buffer, y0);
@ -1231,13 +1231,13 @@ emit_linear_pattern (cairo_svg_surface_t *surface,
xmlSetProp (child, CC2XML ("x2"), C2XML (buffer));
_cairo_dtostr (buffer, sizeof buffer, y1);
xmlSetProp (child, CC2XML ("y2"), C2XML (buffer));
p2u = pattern->base.base.matrix;
cairo_matrix_invert (&p2u);
emit_transform (child, "gradientTransform", &p2u);
}
static void
emit_radial_pattern (cairo_svg_surface_t *surface,
cairo_radial_pattern_t *pattern,
@ -1250,9 +1250,9 @@ emit_radial_pattern (cairo_svg_surface_t *surface,
double x0, y0, x1, y1, r0, r1;
double fx, fy;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
child = xmlNewChild (document->xml_node_defs, NULL, CC2XML ("radialGradient"), NULL);
id = xmlBufferCreate ();
xmlBufferCat (id, CC2XML ("radial"));
snprintf (buffer, sizeof buffer, "%d", document->radial_pattern_id);
@ -1260,7 +1260,7 @@ emit_radial_pattern (cairo_svg_surface_t *surface,
xmlSetProp (child, CC2XML ("id"), C2XML (xmlBufferContent (id)));
xmlSetProp (child, CC2XML ("gradientUnits"), CC2XML ("userSpaceOnUse"));
emit_pattern_extend (child, pattern->base.base.extend);
xmlBufferCat (style, CC2XML (is_stroke ? "color: url(#" : "fill: url(#"));
xmlBufferCat (style, xmlBufferContent (id));
xmlBufferCat (style, CC2XML (");"));
@ -1302,7 +1302,7 @@ emit_radial_pattern (cairo_svg_surface_t *surface,
emit_transform (child, "gradientTransform", &p2u);
}
static void
emit_pattern (cairo_svg_surface_t *surface, cairo_pattern_t *pattern,
xmlBufferPtr style, int is_stroke)
@ -1350,7 +1350,7 @@ _cairo_svg_surface_fill (void *abstract_surface,
info.document = document;
info.path = xmlBufferCreate ();
info.ctm_inverse = NULL;
style = xmlBufferCreate ();
emit_pattern (surface, source, style, 0);
xmlBufferCat (style, CC2XML (" stroke: none;"));
@ -1437,7 +1437,7 @@ _cairo_svg_surface_paint (void *abstract_surface,
cairo_pattern_t *source)
{
cairo_svg_surface_t *surface = abstract_surface;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return _analyze_operation (surface, op, source);
@ -1463,7 +1463,7 @@ _cairo_svg_surface_paint (void *abstract_surface,
(op == CAIRO_OPERATOR_CLEAR ||
op == CAIRO_OPERATOR_SOURCE)) {
xmlNodePtr child = surface->xml_root_node->children;
while (child != NULL) {
xmlUnlinkNode (child);
xmlFreeNode (child);
@ -1487,7 +1487,7 @@ _cairo_svg_surface_paint (void *abstract_surface,
}
emit_paint (surface->xml_node, surface, op, source);
return CAIRO_STATUS_SUCCESS;
}
@ -1506,7 +1506,7 @@ _cairo_svg_surface_mask (void *abstract_surface,
return _analyze_operation (surface, op, source);
assert (_operation_supported (surface, op, source));
emit_alpha_filter (document);
mask_node = xmlNewChild (document->xml_node_defs, NULL, CC2XML ("mask"), NULL);
@ -1553,7 +1553,7 @@ _cairo_svg_surface_stroke (void *abstract_dst,
svg_path_info_t info;
unsigned int i;
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return _analyze_operation (surface, op, source);
@ -1569,7 +1569,7 @@ _cairo_svg_surface_stroke (void *abstract_dst,
_cairo_dtostr (buffer, sizeof buffer, stroke_style->line_width);
xmlBufferCat (style, C2XML (buffer));
xmlBufferCat (style, CC2XML (";"));
switch (stroke_style->line_cap) {
case CAIRO_LINE_CAP_BUTT:
xmlBufferCat (style, CC2XML ("stroke-linecap: butt;"));
@ -1623,13 +1623,13 @@ _cairo_svg_surface_stroke (void *abstract_dst,
_cairo_svg_path_curve_to,
_cairo_svg_path_close_path,
&info);
child = xmlNewChild (surface->xml_node, NULL, CC2XML ("path"), NULL);
emit_transform (child, "transform", ctm);
xmlSetProp (child, CC2XML ("d"), xmlBufferContent (info.path));
xmlSetProp (child, CC2XML ("style"), xmlBufferContent (style));
emit_operator (child, surface, op);
xmlBufferFree (info.path);
xmlBufferFree (style);
@ -1654,7 +1654,7 @@ _cairo_svg_surface_show_glyphs (void *abstract_surface,
char buffer[CAIRO_SVG_DTOSTR_BUFFER_LEN];
unsigned int font_id, subset_id, subset_glyph_index;
int i;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return _analyze_operation (surface, op, pattern);
@ -1698,7 +1698,7 @@ _cairo_svg_surface_show_glyphs (void *abstract_surface,
return CAIRO_STATUS_SUCCESS;
FALLBACK:
_cairo_path_fixed_init (&path);
status = _cairo_scaled_font_glyph_path (scaled_font,(cairo_glyph_t *) glyphs, num_glyphs, &path);
@ -1835,7 +1835,7 @@ _cairo_svg_document_create (cairo_output_stream_t *output_stream,
free (document);
return NULL;
}
document->output_stream = output_stream;
document->refcount = 1;
document->owner = NULL;
@ -1863,13 +1863,13 @@ _cairo_svg_document_create (cairo_output_stream_t *output_stream,
document->xml_node_defs = xmlNewChild (node, NULL, CC2XML ("defs"), NULL);
xml_buffer = xmlBufferCreate ();
_cairo_dtostr (buffer, sizeof buffer, width);
xmlBufferCat (xml_buffer, C2XML (buffer));
xmlBufferCat (xml_buffer, CC2XML ("pt"));
xmlSetProp (node, CC2XML ("width"), C2XML (xmlBufferContent (xml_buffer)));
xmlBufferEmpty (xml_buffer);
_cairo_dtostr (buffer, sizeof buffer, height);
xmlBufferCat (xml_buffer, C2XML (buffer));
xmlBufferCat (xml_buffer, CC2XML ("pt"));
@ -1883,7 +1883,7 @@ _cairo_svg_document_create (cairo_output_stream_t *output_stream,
_cairo_dtostr (buffer, sizeof buffer, height);
xmlBufferCat (xml_buffer, C2XML (buffer));
xmlSetProp (node, CC2XML ("viewBox"), C2XML (xmlBufferContent (xml_buffer)));
xmlBufferFree (xml_buffer);
xmlNewNs (node, CC2XML ("http://www.w3.org/2000/svg"), NULL);
@ -1927,7 +1927,7 @@ _cairo_svg_document_write (cairo_output_stream_t *output_stream,
int len)
{
cairo_status_t status;
_cairo_output_stream_write (output_stream, buffer, len);
status = _cairo_output_stream_get_status (output_stream);
if (status) {

View file

@ -102,13 +102,13 @@ _cairo_traps_init_box (cairo_traps_t *traps,
cairo_box_t *box)
{
cairo_status_t status;
_cairo_traps_init (traps);
status = _cairo_traps_grow_by (traps, 1);
if (status)
return status;
traps->num_traps = 1;
traps->traps[0].top = box->p1.y;
@ -165,12 +165,12 @@ _cairo_traps_add_trap (cairo_traps_t *traps, cairo_fixed_t top, cairo_fixed_t bo
traps->extents.p1.x = left->p1.x;
if (left->p2.x < traps->extents.p1.x)
traps->extents.p1.x = left->p2.x;
if (right->p1.x > traps->extents.p2.x)
traps->extents.p2.x = right->p1.x;
if (right->p2.x > traps->extents.p2.x)
traps->extents.p2.x = right->p2.x;
traps->num_traps++;
return CAIRO_STATUS_SUCCESS;
@ -540,7 +540,7 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
dy2 = l2->p1.y - l2->p2.y;
den_det = _det16_32 (dx1, dy1,
dx2, dy2);
if (_cairo_int64_eq (den_det, _cairo_int32_to_int64(0)))
return 0;
@ -549,26 +549,26 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
l2_det = _det16_32 (l2->p1.x, l2->p1.y,
l2->p2.x, l2->p2.y);
num_det = _det32_64 (l1_det, _fixed_16_16_to_fixed_32_32 (dy1),
l2_det, _fixed_16_16_to_fixed_32_32 (dy2));
/*
* Ok, this one is a bit tricky in fixed point, the denominator
* needs to be left with 32-bits of fraction so that the
* result of the divide ends up with 32-bits of fraction (64 - 32 = 32)
*/
qr = _cairo_int128_divrem (num_det, _cairo_int64_to_int128 (den_det));
intersect_32_32 = _cairo_int128_to_int64 (qr.quo);
/*
* Find the ceiling of the quotient -- divrem returns
* the quotient truncated towards zero, so if the
* quotient should be positive (num_den and den_det have same sign)
* bump the quotient up by one.
*/
if (_cairo_int128_ne (qr.rem, _cairo_int32_to_int128 (0)) &&
(_cairo_int128_ge (num_det, _cairo_int32_to_int128 (0)) ==
_cairo_int64_ge (den_det, _cairo_int32_to_int64 (0))))
@ -576,7 +576,7 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
intersect_32_32 = _cairo_int64_add (intersect_32_32,
_cairo_int32_to_int64 (1));
}
/*
* Now convert from 32.32 to 48.16 and take the ceiling;
* this requires adding in 15 1 bits and shifting the result
@ -585,12 +585,12 @@ _line_segs_intersect_ceil (cairo_line_t *l1, cairo_line_t *l2, cairo_fixed_t *y_
intersect_32_32 = _cairo_int64_add (intersect_32_32,
_cairo_int32_to_int64 ((1 << 16) - 1));
intersect_48_16 = _cairo_int64_rsa (intersect_32_32, 16);
/*
* And drop the top bits
*/
intersect_16_16 = _cairo_int64_to_int32 (intersect_48_16);
*y_intersection = intersect_16_16;
return 1;
@ -741,7 +741,7 @@ _cairo_traps_tessellate_polygon (cairo_traps_t *traps,
return CAIRO_STATUS_SUCCESS;
qsort (edges, num_edges, sizeof (cairo_edge_t), _compare_cairo_edge_by_top);
y = edges[0].edge.p1.y;
active = 0;
inactive = 0;
@ -809,12 +809,12 @@ static cairo_bool_t
_cairo_trap_contains (cairo_trapezoid_t *t, cairo_point_t *pt)
{
cairo_slope_t slope_left, slope_pt, slope_right;
if (t->top > pt->y)
return FALSE;
if (t->bottom < pt->y)
return FALSE;
_cairo_slope_init (&slope_left, &t->left.p1, &t->left.p2);
_cairo_slope_init (&slope_pt, &t->left.p1, pt);
@ -882,7 +882,7 @@ _cairo_traps_extract_region (cairo_traps_t *traps,
*region = NULL;
return CAIRO_STATUS_SUCCESS;
}
*region = pixman_region_create ();
for (i = 0; i < traps->num_traps; i++) {
@ -897,7 +897,7 @@ _cairo_traps_extract_region (cairo_traps_t *traps,
*/
if (width == 0 || height == 0)
continue;
if (pixman_region_union_rect (*region, *region,
x, y, width, height) != PIXMAN_REGION_STATUS_SUCCESS) {
pixman_region_destroy (*region);

View file

@ -84,7 +84,7 @@
((Char) < 0x10000 ? 3 : \
((Char) < 0x200000 ? 4 : \
((Char) < 0x4000000 ? 5 : 6)))))
#define UTF8_GET(Result, Chars, Count, Mask, Len) \
(Result) = (Chars)[0] & (Mask); \
@ -104,8 +104,8 @@
(((Char) & 0xFFFFF800) != 0xD800) && \
((Char) < 0xFDD0 || (Char) > 0xFDEF) && \
((Char) & 0xFFFE) != 0xFFFE)
static const char utf8_skip_data[256] = {
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
@ -170,7 +170,7 @@ _utf8_get_char_extended (const unsigned char *p,
} else {
return (uint32_t)-1;
}
if (max_len >= 0 && len > max_len) {
for (i = 1; i < max_len; i++) {
if ((((unsigned char *)p)[i] & 0xc0) != 0x80)
@ -181,7 +181,7 @@ _utf8_get_char_extended (const unsigned char *p,
for (i = 1; i < len; ++i) {
uint32_t ch = ((unsigned char *)p)[i];
if ((ch & 0xc0) != 0x80) {
if (ch)
return (uint32_t)-1;
@ -195,7 +195,7 @@ _utf8_get_char_extended (const unsigned char *p,
if (UTF8_LENGTH(wc) != len)
return (uint32_t)-1;
return wc;
}
@ -228,7 +228,7 @@ _cairo_utf8_to_ucs4 (const unsigned char *str,
uint32_t *str32 = NULL;
int n_chars, i;
const unsigned char *in;
in = str;
n_chars = 0;
while ((len < 0 || str + len - in > 0) && *in)
@ -236,7 +236,7 @@ _cairo_utf8_to_ucs4 (const unsigned char *str,
uint32_t wc = _utf8_get_char_extended (in, str + len - in);
if (wc & 0x80000000 || !UNICODE_VALID (wc))
return CAIRO_STATUS_INVALID_STRING;
n_chars++;
if (n_chars == INT_MAX)
return CAIRO_STATUS_INVALID_STRING;
@ -247,7 +247,7 @@ _cairo_utf8_to_ucs4 (const unsigned char *str,
str32 = malloc (sizeof (uint32_t) * (n_chars + 1));
if (!str32)
return CAIRO_STATUS_NO_MEMORY;
in = str;
for (i=0; i < n_chars; i++) {
str32[i] = _utf8_get_char (in);
@ -299,23 +299,23 @@ _cairo_utf8_to_utf16 (const unsigned char *str,
uint32_t wc = _utf8_get_char_extended (in, str + len - in);
if (wc & 0x80000000 || !UNICODE_VALID (wc))
return CAIRO_STATUS_INVALID_STRING;
if (wc < 0x10000)
n16 += 1;
else
n16 += 2;
if (n16 == INT_MAX - 1 || n16 == INT_MAX)
return CAIRO_STATUS_INVALID_STRING;
in = UTF8_NEXT_CHAR (in);
}
str16 = malloc (sizeof (uint16_t) * (n16 + 1));
if (!str16)
return CAIRO_STATUS_NO_MEMORY;
in = str;
for (i = 0; i < n16;) {
uint32_t wc = _utf8_get_char (in);
@ -326,7 +326,7 @@ _cairo_utf8_to_utf16 (const unsigned char *str,
str16[i++] = (wc - 0x10000) / 0x400 + 0xd800;
str16[i++] = (wc - 0x10000) % 0x400 + 0xdc00;
}
in = UTF8_NEXT_CHAR (in);
}

View file

@ -113,7 +113,7 @@ cairo_uint64_t
_cairo_uint32x32_64_mul (uint32_t a, uint32_t b)
{
cairo_uint64_t s;
uint16_t ah, al, bh, bl;
uint32_t r0, r1, r2, r3;
@ -153,7 +153,7 @@ cairo_uint64_t
_cairo_uint64_mul (cairo_uint64_t a, cairo_uint64_t b)
{
cairo_uint64_t s;
s = _cairo_uint32x32_64_mul (a.lo, b.lo);
s.hi += a.lo * b.hi + a.hi * b.lo;
return s;
@ -262,9 +262,9 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den)
cairo_uquorem64_t qr;
cairo_uint64_t bit;
cairo_uint64_t quo;
bit = _cairo_uint32_to_uint64 (1);
/* normalize to make den >= num, but not overflow */
while (_cairo_uint64_lt (den, num) && (den.hi & 0x80000000) == 0)
{
@ -272,7 +272,7 @@ _cairo_uint64_divrem (cairo_uint64_t num, cairo_uint64_t den)
den = _cairo_uint64_lsl (den, 1);
}
quo = _cairo_uint32_to_uint64 (0);
/* generate quotient, one bit at a time */
while (bit.hi | bit.lo)
{
@ -588,9 +588,9 @@ _cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den)
cairo_uquorem128_t qr;
cairo_uint128_t bit;
cairo_uint128_t quo;
bit = _cairo_uint32_to_uint128 (1);
/* normalize to make den >= num, but not overflow */
while (_cairo_uint128_lt (den, num) && !_cairo_msbset64(den.hi))
{
@ -598,7 +598,7 @@ _cairo_uint128_divrem (cairo_uint128_t num, cairo_uint128_t den)
den = _cairo_uint128_lsl (den, 1);
}
quo = _cairo_uint32_to_uint128 (0);
/* generate quotient, one bit at a time */
while (_cairo_uint128_ne (bit, _cairo_uint32_to_uint128(0)))
{

View file

@ -185,7 +185,7 @@ _cairo_int64_divrem (cairo_int64_t num, cairo_int64_t den);
* case the machine has a native 128-bit datatype. GCC supports int128_t
* on ia64
*/
#if !HAVE_UINT128_T
typedef struct cairo_uint128 {

View file

@ -89,7 +89,7 @@ typedef struct {
cairo_bool_t swap_y;
double x_scale;
double y_scale;
/* The size of the design unit of the font
*/
int em_square;
@ -126,7 +126,7 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
scaled_font->y_scale = sc->yy;
scaled_font->swap_y = (sc->yy < 0);
scaled_font->swap_axes = FALSE;
} else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy)) {
scaled_font->preserve_axes = TRUE;
scaled_font->x_scale = sc->yx;
@ -145,7 +145,7 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
scaled_font->x_scale = - scaled_font->x_scale;
if (scaled_font->swap_y)
scaled_font->y_scale = - scaled_font->y_scale;
scaled_font->logical_scale = WIN32_FONT_LOGICAL_SCALE * scaled_font->y_scale;
scaled_font->logical_size = WIN32_FONT_LOGICAL_SCALE * floor (scaled_font->y_scale + 0.5);
}
@ -169,7 +169,7 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font,
1.0 / scaled_font->logical_scale, 1.0 / scaled_font->logical_scale);
scaled_font->device_to_logical = scaled_font->logical_to_device;
status = cairo_matrix_invert (&scaled_font->device_to_logical);
if (status)
cairo_matrix_init_identity (&scaled_font->device_to_logical);
@ -179,14 +179,14 @@ static cairo_bool_t
_have_cleartype_quality (void)
{
OSVERSIONINFO version_info;
version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
if (!GetVersionEx (&version_info)) {
_cairo_win32_print_gdi_error ("_have_cleartype_quality");
return FALSE;
}
return (version_info.dwMajorVersion > 5 ||
(version_info.dwMajorVersion == 5 &&
version_info.dwMinorVersion >= 1)); /* XP or newer */
@ -268,7 +268,7 @@ _win32_scaled_font_create (LOGFONTW *logfont,
ASSERT_NOT_REACHED;
}
}
f->em_square = 0;
f->scaled_hfont = hfont;
f->unscaled_hfont = NULL;
@ -297,7 +297,7 @@ _win32_scaled_font_set_world_transform (cairo_win32_scaled_font_t *scaled_font,
HDC hdc)
{
XFORM xform;
xform.eM11 = scaled_font->logical_to_device.xx;
xform.eM21 = scaled_font->logical_to_device.xy;
xform.eM12 = scaled_font->logical_to_device.yx;
@ -387,7 +387,7 @@ _win32_scaled_font_get_unscaled_hfont (cairo_win32_scaled_font_t *scaled_font,
_cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:GetOutlineTextMetrics");
return NULL;
}
otm = malloc (otm_size);
if (!otm)
return NULL;
@ -400,14 +400,14 @@ _win32_scaled_font_get_unscaled_hfont (cairo_win32_scaled_font_t *scaled_font,
scaled_font->em_square = otm->otmEMSquare;
free (otm);
logfont = scaled_font->logfont;
logfont.lfHeight = -scaled_font->em_square;
logfont.lfWidth = 0;
logfont.lfEscapement = 0;
logfont.lfOrientation = 0;
logfont.lfQuality = scaled_font->quality;
scaled_font->unscaled_hfont = CreateFontIndirectW (&logfont);
if (!scaled_font->unscaled_hfont) {
_cairo_win32_print_gdi_error ("_win32_scaled_font_get_unscaled_hfont:CreateIndirect");
@ -518,7 +518,7 @@ _cairo_win32_scaled_font_create_toy (cairo_toy_font_face_t *toy_face,
if (!logfont.lfFaceName)
return CAIRO_STATUS_NO_MEMORY;
scaled_font = _win32_scaled_font_create (&logfont, NULL, &toy_face->base,
font_matrix, ctm, options);
if (!scaled_font)
@ -570,7 +570,7 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
cairo_matrix_transform_distance (&scaled_font->base.font_matrix, &x_incr, &y_incr);
x_incr /= scaled_font->logical_scale;
y_incr /= scaled_font->logical_scale;
status = _cairo_utf8_to_utf16 (utf8, -1, &utf16, &n16);
if (status)
return status;
@ -580,13 +580,13 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
gcp_results.lpOrder = NULL;
gcp_results.lpCaretPos = NULL;
gcp_results.lpClass = NULL;
buffer_size = MAX (n16 * 1.2, 16); /* Initially guess number of chars plus a few */
if (buffer_size > INT_MAX) {
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL1;
}
hdc = _get_global_font_dc ();
if (!hdc) {
status = CAIRO_STATUS_NO_MEMORY;
@ -596,7 +596,7 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
if (status)
goto FAIL1;
while (TRUE) {
if (glyph_indices) {
free (glyph_indices);
@ -606,7 +606,7 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
free (dx);
dx = NULL;
}
glyph_indices = malloc (sizeof (WCHAR) * buffer_size);
dx = malloc (sizeof (int) * buffer_size);
if (!glyph_indices || !dx) {
@ -630,7 +630,7 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
break;
/* Too small a buffer, try again */
buffer_size *= 1.5;
if (buffer_size > INT_MAX) {
status = CAIRO_STATUS_NO_MEMORY;
@ -647,7 +647,7 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
x_pos = x;
y_pos = y;
for (i = 0; i < gcp_results.nGlyphs; i++) {
(*glyphs)[i].index = glyph_indices[i];
(*glyphs)[i].x = x_pos ;
@ -662,12 +662,12 @@ _cairo_win32_scaled_font_text_to_glyphs (void *abstract_font,
free (glyph_indices);
if (dx)
free (dx);
cairo_win32_scaled_font_done_font (&scaled_font->base);
FAIL1:
free (utf16);
return status;
}
@ -718,7 +718,7 @@ _cairo_win32_scaled_font_set_metrics (cairo_win32_scaled_font_t *scaled_font)
extents.height = (double)(metrics.tmHeight + metrics.tmExternalLeading) / scaled_font->em_square;
extents.max_x_advance = (double)(metrics.tmMaxCharWidth) / scaled_font->em_square;
extents.max_y_advance = 0;
}
_cairo_scaled_font_set_metrics (&scaled_font->base, &extents);
@ -780,7 +780,7 @@ _cairo_win32_scaled_font_init_glyph_metrics (cairo_win32_scaled_font_t *scaled_f
extents.y_bearing = (- extents.y_bearing - extents.height);
extents.y_advance = - extents.y_advance;
}
} else {
/* For all other transformations, we use the design metrics
* of the font.
@ -870,7 +870,7 @@ _cairo_win32_scaled_font_glyph_bbox (void *abstract_font,
typedef struct {
cairo_win32_scaled_font_t *scaled_font;
HDC hdc;
cairo_array_t glyphs;
cairo_array_t dx;
@ -902,7 +902,7 @@ _flush_glyphs (cairo_glyph_state_t *state)
status = _cairo_array_append (&state->dx, &dx);
if (status)
return status;
elements = _cairo_array_index (&state->glyphs, 0);
dx_elements = _cairo_array_index (&state->dx, 0);
if (!ExtTextOutW (state->hdc,
@ -914,7 +914,7 @@ _flush_glyphs (cairo_glyph_state_t *state)
dx_elements)) {
return _cairo_win32_print_gdi_error ("_flush_glyphs");
}
_cairo_array_truncate (&state->glyphs, 0);
_cairo_array_truncate (&state->dx, 0);
@ -940,14 +940,14 @@ _add_glyph (cairo_glyph_state_t *state,
if (state->glyphs.num_elements > 0) {
int dx;
if (logical_y != state->last_y) {
status = _flush_glyphs (state);
if (status)
return status;
state->start_x = logical_x;
}
dx = logical_x - state->last_x;
status = _cairo_array_append (&state->dx, &dx);
if (status)
@ -958,7 +958,7 @@ _add_glyph (cairo_glyph_state_t *state,
state->last_x = logical_x;
state->last_y = logical_y;
status = _cairo_array_append (&state->glyphs, &glyph_index);
if (status)
return status;
@ -998,7 +998,7 @@ _draw_glyphs_on_surface (cairo_win32_surface_t *surface,
SetTextColor (surface->dc, color);
SetTextAlign (surface->dc, TA_BASELINE | TA_LEFT);
SetBkMode (surface->dc, TRANSPARENT);
_start_glyphs (&state, scaled_font, surface->dc);
for (i = 0; i < num_glyphs; i++) {
@ -1013,10 +1013,10 @@ _draw_glyphs_on_surface (cairo_win32_surface_t *surface,
cairo_win32_scaled_font_done_font (&scaled_font->base);
FAIL1:
RestoreDC (surface->dc, -1);
return status;
}
/* Duplicate the green channel of a 4-channel mask in the alpha channel, then
* invert the whole mask.
*/
@ -1069,7 +1069,7 @@ _compute_a8_mask (cairo_win32_surface_t *mask_surface)
for (i = 0; i < image24->height; i++) {
uint32_t *p = (uint32_t *) (image24->data + i * image24->stride);
unsigned char *q = (unsigned char *) (image8->data + i * image8->stride);
for (j = 0; j < image24->width; j++) {
*q = 255 - ((*p & 0x0000ff00) >> 8);
p++;
@ -1140,7 +1140,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
* solid opaque color, we can just call ExtTextOut directly.
*/
COLORREF new_color;
new_color = RGB (((int)solid_pattern->color.red_short) >> 8,
((int)solid_pattern->color.green_short) >> 8,
((int)solid_pattern->color.blue_short) >> 8);
@ -1148,7 +1148,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
status = _draw_glyphs_on_surface (surface, scaled_font, new_color,
0, 0,
glyphs, num_glyphs);
return status;
} else {
/* Otherwise, we need to draw using software fallbacks. We create a mask
@ -1187,12 +1187,12 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
_compute_argb32_mask_alpha (tmp_surface);
else
_invert_argb32_mask (tmp_surface);
mask_surface = &tmp_surface->base;
/* XXX: Hacky, should expose this in cairo_image_surface */
pixman_image_set_component_alpha (((cairo_image_surface_t *)tmp_surface->image)->pixman_image, TRUE);
} else {
mask_surface = _compute_a8_mask (tmp_surface);
cairo_surface_destroy (&tmp_surface->base);
@ -1215,7 +1215,7 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font,
width, height);
_cairo_pattern_fini (&mask.base);
cairo_surface_destroy (mask_surface);
return status;
@ -1251,18 +1251,18 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc);
if (status)
goto CLEANUP_PATH;
bytesGlyph = GetGlyphOutlineW (hdc, _cairo_scaled_glyph_index (scaled_glyph),
GGO_NATIVE | GGO_GLYPH_INDEX,
&metrics, 0, NULL, &matrix);
if (bytesGlyph == GDI_ERROR) {
status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_glyph_path");
goto CLEANUP_FONT;
}
ptr = buffer = malloc (bytesGlyph);
if (!buffer) {
status = CAIRO_STATUS_NO_MEMORY;
goto CLEANUP_FONT;
@ -1275,13 +1275,13 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
free (buffer);
goto CLEANUP_FONT;
}
while (ptr < buffer + bytesGlyph) {
TTPOLYGONHEADER *header = (TTPOLYGONHEADER *)ptr;
unsigned char *endPoly = ptr + header->cb;
ptr += sizeof (TTPOLYGONHEADER);
_cairo_path_fixed_move_to (path,
_cairo_fixed_from_FIXED (header->pfxStart.x),
_cairo_fixed_from_FIXED (header->pfxStart.y));
@ -1304,7 +1304,7 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
_cairo_path_fixed_get_current_point (path, &p1x, &p1y);
cx = _cairo_fixed_from_FIXED (points[i].x);
cy = _cairo_fixed_from_FIXED (points[i].y);
if (i + 1 == curve->cpfx - 1) {
p2x = _cairo_fixed_from_FIXED (points[i + 1].x);
p2y = _cairo_fixed_from_FIXED (points[i + 1].y);
@ -1314,12 +1314,12 @@ _cairo_win32_scaled_font_init_glyph_path (cairo_win32_scaled_font_t *scaled_font
p2x = (cx + _cairo_fixed_from_FIXED (points[i + 1].x)) / 2;
p2y = (cy + _cairo_fixed_from_FIXED (points[i + 1].y)) / 2;
}
c1x = 2 * cx / 3 + p1x / 3;
c1y = 2 * cy / 3 + p1y / 3;
c2x = 2 * cx / 3 + p2x / 3;
c2y = 2 * cy / 3 + p2y / 3;
_cairo_path_fixed_curve_to (path, c1x, c1y, c2x, c2y, p2x, p2y);
}
break;
@ -1434,10 +1434,10 @@ cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont)
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_face_t *)&_cairo_font_face_nil;
}
font_face->logfont = *logfont;
font_face->hfont = NULL;
_cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
return &font_face->base;
@ -1454,9 +1454,9 @@ cairo_win32_font_face_create_for_hfont (HFONT font)
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_font_face_t *)&_cairo_font_face_nil;
}
font_face->hfont = font;
_cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
return &font_face->base;

View file

@ -52,7 +52,7 @@ typedef struct _cairo_win32_surface {
cairo_surface_t base;
cairo_format_t format;
HDC dc;
/* We create off-screen surfaces as DIBs */
@ -66,9 +66,9 @@ typedef struct _cairo_win32_surface {
* on some versions of Windows.
*/
HBITMAP saved_dc_bitmap;
cairo_surface_t *image;
cairo_rectangle_fixed_t clip_rect;
HRGN saved_clip;

View file

@ -75,7 +75,7 @@ _cairo_win32_print_gdi_error (const char *context)
fprintf (stderr, "%s: Unknown GDI error", context);
} else {
fprintf (stderr, "%s: %s", context, (char *)lpMsgBuf);
LocalFree (lpMsgBuf);
}
@ -116,11 +116,11 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
case CAIRO_FORMAT_RGB24:
num_palette = 0;
break;
case CAIRO_FORMAT_A8:
num_palette = 256;
break;
case CAIRO_FORMAT_A1:
num_palette = 2;
break;
@ -141,7 +141,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
bitmap_info->bmiHeader.biXPelsPerMeter = 72. / 0.0254; /* unused here */
bitmap_info->bmiHeader.biYPelsPerMeter = 72. / 0.0254; /* unused here */
bitmap_info->bmiHeader.biPlanes = 1;
switch (format) {
/* We can't create real RGB24 bitmaps because something seems to
* break if we do, especially if we don't set up an image
@ -155,7 +155,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
bitmap_info->bmiHeader.biClrUsed = 0; /* unused */
bitmap_info->bmiHeader.biClrImportant = 0;
break;
case CAIRO_FORMAT_A8:
bitmap_info->bmiHeader.biBitCount = 8;
bitmap_info->bmiHeader.biCompression = BI_RGB;
@ -168,9 +168,9 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
bitmap_info->bmiColors[i].rgbRed = i;
bitmap_info->bmiColors[i].rgbReserved = 0;
}
break;
case CAIRO_FORMAT_A1:
bitmap_info->bmiHeader.biBitCount = 1;
bitmap_info->bmiHeader.biCompression = BI_RGB;
@ -204,7 +204,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
surface->bitmap);
if (!surface->saved_dc_bitmap)
goto FAIL;
if (bitmap_info && num_palette > 2)
free (bitmap_info);
@ -218,11 +218,11 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
case CAIRO_FORMAT_RGB24:
*rowstride_out = 4 * width;
break;
case CAIRO_FORMAT_A8:
*rowstride_out = (width + 3) & ~3;
break;
case CAIRO_FORMAT_A1:
*rowstride_out = ((width + 31) & ~31) / 8;
break;
@ -233,7 +233,7 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
FAIL:
status = _cairo_win32_print_gdi_error ("_create_dc_and_bitmap");
if (bitmap_info && num_palette > 2)
free (bitmap_info);
@ -241,17 +241,17 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
SelectObject (surface->dc, surface->saved_dc_bitmap);
surface->saved_dc_bitmap = NULL;
}
if (surface->bitmap) {
DeleteObject (surface->bitmap);
surface->bitmap = NULL;
}
if (surface->dc) {
DeleteDC (surface->dc);
surface->dc = NULL;
}
return status;
}
@ -284,9 +284,9 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
status = CAIRO_STATUS_NO_MEMORY;
goto FAIL;
}
surface->format = format;
surface->clip_rect.x = 0;
surface->clip_rect.y = 0;
surface->clip_rect.width = width;
@ -375,7 +375,7 @@ _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface,
height);
if (local->base.status)
return CAIRO_STATUS_NO_MEMORY;
if (!BitBlt (local->dc,
0, 0,
width, height,
@ -395,7 +395,7 @@ _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface,
}
*local_out = local;
return CAIRO_STATUS_SUCCESS;
FAIL:
@ -441,7 +441,7 @@ _cairo_win32_surface_release_source_image (void *abstract_surf
void *image_extra)
{
cairo_win32_surface_t *local = image_extra;
if (local)
cairo_surface_destroy ((cairo_surface_t *)local);
}
@ -489,14 +489,14 @@ _cairo_win32_surface_acquire_dest_image (void *abstract_surfa
x2 = interest_rect->x + interest_rect->width;
if (interest_rect->y + interest_rect->height < y2)
y2 = interest_rect->y + interest_rect->height;
if (x1 >= x2 || y1 >= y2) {
*image_out = NULL;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
status = _cairo_win32_surface_get_subimage (abstract_surface,
x1, y1, x2 - x1, y2 - y1,
&local);
@ -505,7 +505,7 @@ _cairo_win32_surface_acquire_dest_image (void *abstract_surfa
*image_out = (cairo_image_surface_t *)local->image;
*image_extra = local;
image_rect->x = x1;
image_rect->y = y1;
image_rect->width = x2 - x1;
@ -523,7 +523,7 @@ _cairo_win32_surface_release_dest_image (void *abstract_surfa
{
cairo_win32_surface_t *surface = abstract_surface;
cairo_win32_surface_t *local = image_extra;
if (!local)
return;
@ -588,22 +588,22 @@ _composite_alpha_blend (cairo_win32_surface_t *dst,
*/
if (!alpha_blend_checked) {
OSVERSIONINFO os;
os.dwOSVersionInfoSize = sizeof (os);
GetVersionEx (&os);
/* If running on Win98, disable using AlphaBlend()
* to avoid Win98 AlphaBlend() bug */
if (VER_PLATFORM_WIN32_WINDOWS != os.dwPlatformId ||
os.dwMajorVersion != 4 || os.dwMinorVersion != 10)
{
HMODULE msimg32_dll = LoadLibrary ("msimg32");
if (msimg32_dll != NULL)
alpha_blend = (cairo_alpha_blend_func_t)GetProcAddress (msimg32_dll,
"AlphaBlend");
}
alpha_blend_checked = TRUE;
}
@ -611,7 +611,7 @@ _composite_alpha_blend (cairo_win32_surface_t *dst,
return CAIRO_INT_STATUS_UNSUPPORTED;
if (GetDeviceCaps(dst->dc, SHADEBLENDCAPS) == SB_NONE)
return CAIRO_INT_STATUS_UNSUPPORTED;
blend_function.BlendOp = AC_SRC_OVER;
blend_function.BlendFlags = 0;
blend_function.SourceConstantAlpha = alpha;
@ -625,7 +625,7 @@ _composite_alpha_blend (cairo_win32_surface_t *dst,
width, height,
blend_function))
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_composite");
return CAIRO_STATUS_SUCCESS;
}
@ -671,7 +671,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
if (src->base.backend != dst->base.backend)
return CAIRO_INT_STATUS_UNSUPPORTED;
integer_transform = _cairo_matrix_is_integer_translation (&pattern->matrix, &itx, &ity);
if (!integer_transform)
return CAIRO_INT_STATUS_UNSUPPORTED;
@ -706,7 +706,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
if (alpha == 255 &&
(op == CAIRO_OPERATOR_SOURCE ||
(src->format == CAIRO_FORMAT_RGB24 && op == CAIRO_OPERATOR_OVER))) {
if (!BitBlt (dst->dc,
dst_x, dst_y,
width, height,
@ -716,7 +716,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_composite");
return CAIRO_STATUS_SUCCESS;
} else if ((src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) &&
(dst->format == CAIRO_FORMAT_RGB24 || dst->format == CAIRO_FORMAT_ARGB32) &&
op == CAIRO_OPERATOR_OVER) {
@ -725,7 +725,7 @@ _cairo_win32_surface_composite (cairo_operator_t op,
src_x, src_y,
dst_x, dst_y, width, height);
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -747,13 +747,13 @@ categorize_solid_dest_operator (cairo_operator_t op,
source = SOURCE_TRANSPARENT;
else
source = SOURCE_OTHER;
switch (op) {
case CAIRO_OPERATOR_CLEAR: /* 0 0 */
case CAIRO_OPERATOR_OUT: /* 1 - Ab 0 */
return DO_CLEAR;
break;
case CAIRO_OPERATOR_SOURCE: /* 1 0 */
case CAIRO_OPERATOR_IN: /* Ab 0 */
return DO_SOURCE;
@ -768,7 +768,7 @@ categorize_solid_dest_operator (cairo_operator_t op,
else
return DO_UNSUPPORTED;
break;
case CAIRO_OPERATOR_DEST_OUT: /* 0 1 - Aa */
case CAIRO_OPERATOR_XOR: /* 1 - Ab 1 - Aa */
if (source == SOURCE_SOLID)
@ -778,7 +778,7 @@ categorize_solid_dest_operator (cairo_operator_t op,
else
return DO_UNSUPPORTED;
break;
case CAIRO_OPERATOR_DEST: /* 0 1 */
case CAIRO_OPERATOR_DEST_OVER:/* 1 - Ab 1 */
case CAIRO_OPERATOR_SATURATE: /* min(1,(1-Ab)/Aa) 1 */
@ -794,7 +794,7 @@ categorize_solid_dest_operator (cairo_operator_t op,
else
return DO_UNSUPPORTED;
break;
case CAIRO_OPERATOR_ADD: /* 1 1 */
if (source == SOURCE_TRANSPARENT)
return DO_NOTHING;
@ -843,11 +843,11 @@ _cairo_win32_surface_fill_rectangles (void *abstract_surface,
default:
return CAIRO_INT_STATUS_UNSUPPORTED;
}
new_brush = CreateSolidBrush (new_color);
if (!new_brush)
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_fill_rectangles");
for (i = 0; i < num_rects; i++) {
RECT rect;
@ -861,14 +861,14 @@ _cairo_win32_surface_fill_rectangles (void *abstract_surface,
}
DeleteObject (new_brush);
return CAIRO_STATUS_SUCCESS;
FAIL:
status = _cairo_win32_print_gdi_error ("_cairo_win32_surface_fill_rectangles");
DeleteObject (new_brush);
return status;
}
@ -901,7 +901,7 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
return _cairo_win32_print_gdi_error ("_cairo_win32_surface_set_clip_region (reset)");
return CAIRO_STATUS_SUCCESS;
} else {
pixman_box16_t *boxes = pixman_region_rects (region);
int num_boxes = pixman_region_num_rects (region);
@ -938,7 +938,7 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface,
gdi_region = ExtCreateRegion (NULL, data_size, data);
free (data);
if (!gdi_region)
return CAIRO_STATUS_NO_MEMORY;
@ -1143,11 +1143,11 @@ cairo_win32_surface_create (HDC hdc)
surface->image = NULL;
surface->format = format;
surface->dc = hdc;
surface->bitmap = NULL;
surface->saved_dc_bitmap = NULL;
surface->clip_rect.x = rect.left;
surface->clip_rect.y = rect.top;
surface->clip_rect.width = rect.right - rect.left;

View file

@ -277,7 +277,7 @@ _cairo_xcb_surface_create_similar (void *abstract_src,
d.pixmap, src->drawable,
width <= 0 ? 1 : width,
height <= 0 ? 1 : height);
surface = (cairo_xcb_surface_t *)
cairo_xcb_surface_create_with_xrender_format (dpy, d,
&xrender_format,
@ -402,7 +402,7 @@ _get_image_surface (cairo_xcb_surface_t *surface,
rect.y = interest_rect->y;
rect.width = interest_rect->width;
rect.height = interest_rect->height;
if (rect.x > x1)
x1 = rect.x;
if (rect.y > y1)
@ -670,7 +670,7 @@ _cairo_xcb_surface_clone_similar (void *abstract_surface,
if (xcb_src->dpy == surface->dpy) {
*clone_out = cairo_surface_reference (src);
return CAIRO_STATUS_SUCCESS;
}
} else if (_cairo_surface_is_image (src)) {
@ -679,20 +679,20 @@ _cairo_xcb_surface_clone_similar (void *abstract_surface,
if (surface->base.status)
return surface->base.status;
clone = (cairo_xcb_surface_t *)
_cairo_xcb_surface_create_similar (surface, content,
image_src->width, image_src->height);
if (clone->base.status)
return CAIRO_STATUS_NO_MEMORY;
_draw_image_surface (clone, image_src, 0, 0);
*clone_out = &clone->base;
return CAIRO_STATUS_SUCCESS;
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -727,10 +727,10 @@ _cairo_xcb_surface_set_matrix (cairo_xcb_surface_t *surface,
if (memcmp (&xtransform, &identity, sizeof (XCBRenderTRANSFORM)) == 0)
return CAIRO_STATUS_SUCCESS;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
XCBRenderSetPictureTransform (surface->dpy, surface->picture, xtransform);
return CAIRO_STATUS_SUCCESS;
@ -744,15 +744,15 @@ _cairo_xcb_surface_set_filter (cairo_xcb_surface_t *surface,
if (!surface->picture.xid)
return CAIRO_STATUS_SUCCESS;
if (!CAIRO_SURFACE_RENDER_HAS_FILTERS (surface))
{
if (filter == CAIRO_FILTER_FAST || filter == CAIRO_FILTER_NEAREST)
return CAIRO_STATUS_SUCCESS;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
switch (filter) {
case CAIRO_FILTER_FAST:
render_filter = "fast";
@ -803,7 +803,7 @@ _cairo_xcb_surface_set_attributes (cairo_xcb_surface_t *surface,
status = _cairo_xcb_surface_set_matrix (surface, &attributes->matrix);
if (status)
return status;
switch (attributes->extend) {
case CAIRO_EXTEND_NONE:
_cairo_xcb_surface_set_repeat (surface, 0);
@ -894,7 +894,7 @@ _cairo_xcb_surface_composite (cairo_operator_t op,
&src_attr, &mask_attr);
if (status)
return status;
status = _cairo_xcb_surface_set_attributes (src, &src_attr);
if (status == CAIRO_STATUS_SUCCESS)
{
@ -917,7 +917,7 @@ _cairo_xcb_surface_composite (cairo_operator_t op,
else
{
static XCBRenderPICTURE maskpict = { 0 };
XCBRenderComposite (dst->dpy,
_render_operator (op),
src->picture,
@ -933,7 +933,7 @@ _cairo_xcb_surface_composite (cairo_operator_t op,
if (mask)
_cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr);
_cairo_pattern_release_surface (src_pattern, &src->base, &src_attr);
return status;
@ -990,14 +990,14 @@ _cairo_xcb_surface_composite_trapezoids (cairo_operator_t op,
if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst))
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
src_x, src_y, width, height,
(cairo_surface_t **) &src,
&attributes);
if (status)
return status;
if (traps[0].left.p1.y < traps[0].left.p2.y) {
render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x);
render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p1.y);

View file

@ -40,11 +40,11 @@ typedef struct _cairo_xlib_screen_info cairo_xlib_screen_info_t;
struct _cairo_xlib_screen_info {
cairo_xlib_screen_info_t *next;
Display *display;
Screen *screen;
cairo_bool_t has_render;
cairo_font_options_t font_options;
};

View file

@ -65,7 +65,7 @@ static int
parse_boolean (const char *v)
{
char c0, c1;
c0 = *v;
if (c0 == 't' || c0 == 'T' || c0 == 'y' || c0 == 'Y' || c0 == '1')
return 1;
@ -79,7 +79,7 @@ parse_boolean (const char *v)
if (c1 == 'f' || c1 == 'F')
return 0;
}
return -1;
}
@ -90,7 +90,7 @@ get_boolean_default (Display *dpy,
{
char *v;
int i;
v = XGetDefault (dpy, "Xft", option);
if (v) {
i = parse_boolean (v);
@ -99,7 +99,7 @@ get_boolean_default (Display *dpy,
return TRUE;
}
}
return FALSE;
}
@ -110,17 +110,17 @@ get_integer_default (Display *dpy,
{
int i;
char *v, *e;
v = XGetDefault (dpy, "Xft", option);
if (v) {
if (FcNameConstant ((FcChar8 *) v, value))
return TRUE;
i = strtol (v, &e, 0);
if (e != v)
return TRUE;
}
return FALSE;
}
@ -145,23 +145,23 @@ _cairo_xlib_init_screen_font_options (cairo_xlib_screen_info_t *info)
if (!get_boolean_default (info->display, "antialias", &xft_antialias))
xft_antialias = TRUE;
if (!get_boolean_default (info->display, "hinting", &xft_hinting))
xft_hinting = TRUE;
if (!get_integer_default (info->display, "hintstyle", &xft_hintstyle))
xft_hintstyle = FC_HINT_FULL;
if (!get_integer_default (info->display, "rgba", &xft_rgba))
{
xft_rgba = FC_RGBA_UNKNOWN;
#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6
if (info->has_render)
{
int render_order = XRenderQuerySubpixelOrder (info->display,
XScreenNumberOfScreen (info->screen));
switch (render_order)
{
default:
@ -208,7 +208,7 @@ _cairo_xlib_init_screen_font_options (cairo_xlib_screen_info_t *info)
} else {
hint_style = CAIRO_HINT_STYLE_NONE;
}
switch (xft_rgba) {
case FC_RGBA_RGB:
subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
@ -352,7 +352,7 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen)
info = NULL;
goto out;
}
XESetCloseDisplay (dpy, codes->extension, _cairo_xlib_close_display);
}
@ -360,15 +360,15 @@ _cairo_xlib_screen_info_get (Display *dpy, Screen *screen)
info->screen = screen;
info->has_render = (XRenderQueryExtension (dpy, &event_base, &error_base) &&
(XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy))) != 0));
_cairo_xlib_init_screen_font_options (info);
info->next = _cairo_xlib_screen_list;
_cairo_xlib_screen_list = info;
out:
CAIRO_MUTEX_UNLOCK (_xlib_screen_mutex);
return info;
}

View file

@ -86,13 +86,13 @@ struct _cairo_xlib_surface {
Display *dpy;
cairo_xlib_screen_info_t *screen_info;
GC gc;
Drawable drawable;
Screen *screen;
cairo_bool_t owns_pixmap;
Visual *visual;
int use_pixmap;
int render_major;
@ -225,11 +225,11 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE(src)) {
return cairo_image_surface_create (format, width, height);
}
pix = XCreatePixmap (dpy, RootWindowOfScreen (src->screen),
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
depth);
surface = (cairo_xlib_surface_t *)
cairo_xlib_surface_create_with_xrender_format (dpy, pix, src->screen,
xrender_format,
@ -238,7 +238,7 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t*) &_cairo_surface_nil;
}
surface->owns_pixmap = TRUE;
return &surface->base;
@ -315,7 +315,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
_cairo_error (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t*) &_cairo_surface_nil;
}
surface->owns_pixmap = TRUE;
return &surface->base;
@ -327,7 +327,7 @@ _cairo_xlib_surface_finish (void *abstract_surface)
cairo_xlib_surface_t *surface = abstract_surface;
if (surface->dst_picture != None)
XRenderFreePicture (surface->dpy, surface->dst_picture);
if (surface->src_picture != None)
XRenderFreePicture (surface->dpy, surface->src_picture);
@ -440,14 +440,14 @@ _swap_ximage_bits (XImage *ximage)
for (j = ximage->height; j; j--) {
char *p = line;
for (i = line_bytes; i; i--) {
char b = *p;
b = ((b << 1) & 0xaa) | ((b >> 1) & 0x55);
b = ((b << 2) & 0xcc) | ((b >> 2) & 0x33);
b = ((b << 4) & 0xf0) | ((b >> 4) & 0x0f);
*p = b;
p++;
}
@ -467,7 +467,7 @@ _swap_ximage_to_native (XImage *ximage)
if (ximage->bitmap_bit_order == ximage->byte_order)
return;
}
if (ximage->byte_order == native_byte_order)
return;
@ -521,12 +521,12 @@ _get_image_surface (cairo_xlib_surface_t *surface,
if (interest_rect) {
cairo_rectangle_fixed_t rect;
rect.x = interest_rect->x;
rect.y = interest_rect->y;
rect.width = interest_rect->width;
rect.height = interest_rect->height;
if (rect.x > x1)
x1 = rect.x;
if (rect.y > y1)
@ -556,7 +556,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
cairo_xlib_error_func_t old_handler;
old_handler = XSetErrorHandler (_noop_error_handler);
ximage = XGetImage (surface->dpy,
surface->drawable,
x1, y1,
@ -564,7 +564,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
AllPlanes, ZPixmap);
XSetErrorHandler (old_handler);
/* If we get an error, the surface must have been a window,
* so retry with the safe code path.
*/
@ -576,7 +576,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
surface->use_pixmap--;
ximage = NULL;
}
if (!ximage)
{
@ -594,20 +594,20 @@ _get_image_surface (cairo_xlib_surface_t *surface,
XCopyArea (surface->dpy, surface->drawable, pixmap, surface->gc,
x1, y1, x2 - x1, y2 - y1, 0, 0);
ximage = XGetImage (surface->dpy,
pixmap,
0, 0,
x2 - x1, y2 - y1,
AllPlanes, ZPixmap);
XFreePixmap (surface->dpy, pixmap);
}
if (!ximage)
return CAIRO_STATUS_NO_MEMORY;
_swap_ximage_to_native (ximage);
/*
* Compute the pixel format masks from either a visual or a
* XRenderFormat, failing we assume the drawable is an
@ -675,7 +675,7 @@ _get_image_surface (cairo_xlib_surface_t *surface,
_cairo_image_surface_assume_ownership_of_data (image);
ximage->data = NULL;
XDestroyImage (ximage);
*image_out = image;
return CAIRO_STATUS_SUCCESS;
@ -693,7 +693,7 @@ _cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface)
surface->xrender_format,
0, NULL);
}
static void
_cairo_xlib_surface_set_picture_clip_rects (cairo_xlib_surface_t *surface)
{
@ -713,7 +713,7 @@ _cairo_xlib_surface_set_gc_clip_rects (cairo_xlib_surface_t *surface)
surface->clip_rects,
surface->num_clip_rects, YXSorted);
}
static void
_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface)
{
@ -724,9 +724,9 @@ _cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface)
0, NULL);
_cairo_xlib_surface_set_picture_clip_rects (surface);
}
}
static void
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface)
{
@ -750,10 +750,10 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
XImage ximage;
int bpp, alpha, red, green, blue;
int native_byte_order = _native_byte_order_lsb () ? LSBFirst : MSBFirst;
pixman_format_get_masks (pixman_image_get_format (image->pixman_image),
&bpp, &alpha, &red, &green, &blue);
ximage.width = image->width;
ximage.height = image->height;
ximage.format = ZPixmap;
@ -771,7 +771,7 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
ximage.xoffset = 0;
XInitImage (&ximage);
_cairo_xlib_surface_ensure_gc (surface);
XPutImage(surface->dpy, surface->drawable, surface->gc,
&ximage, 0, 0, dst_x, dst_y,
@ -825,7 +825,7 @@ _cairo_xlib_surface_acquire_dest_image (void *abstract_surfac
*image_out = image;
*image_extra = NULL;
return CAIRO_STATUS_SUCCESS;
}
@ -869,25 +869,25 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
if (_cairo_xlib_surface_same_screen (surface, xlib_src)) {
*clone_out = cairo_surface_reference (src);
return CAIRO_STATUS_SUCCESS;
}
} else if (_cairo_surface_is_image (src)) {
cairo_image_surface_t *image_src = (cairo_image_surface_t *)src;
clone = (cairo_xlib_surface_t *)
_cairo_xlib_surface_create_similar_with_format (surface, image_src->format,
image_src->width, image_src->height);
if (clone->base.status)
return CAIRO_STATUS_NO_MEMORY;
_draw_image_surface (clone, image_src, 0, 0);
*clone_out = &clone->base;
return CAIRO_STATUS_SUCCESS;
}
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -899,7 +899,7 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
if (!surface->src_picture)
return CAIRO_STATUS_SUCCESS;
xtransform.matrix[0][0] = _cairo_fixed_from_double (matrix->xx);
xtransform.matrix[0][1] = _cairo_fixed_from_double (matrix->xy);
xtransform.matrix[0][2] = _cairo_fixed_from_double (matrix->x0);
@ -922,7 +922,7 @@ _cairo_xlib_surface_set_matrix (cairo_xlib_surface_t *surface,
if (memcmp (&xtransform, &identity, sizeof (XTransform)) == 0)
return CAIRO_STATUS_SUCCESS;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -944,10 +944,10 @@ _cairo_xlib_surface_set_filter (cairo_xlib_surface_t *surface,
{
if (filter == CAIRO_FILTER_FAST || filter == CAIRO_FILTER_NEAREST)
return CAIRO_STATUS_SUCCESS;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
switch (filter) {
case CAIRO_FILTER_FAST:
render_filter = FilterFast;
@ -983,7 +983,7 @@ _cairo_xlib_surface_set_repeat (cairo_xlib_surface_t *surface, int repeat)
if (!surface->src_picture)
return CAIRO_STATUS_SUCCESS;
mask = CPRepeat;
pa.repeat = repeat;
@ -1003,7 +1003,7 @@ _cairo_xlib_surface_set_attributes (cairo_xlib_surface_t *surface,
status = _cairo_xlib_surface_set_matrix (surface, &attributes->matrix);
if (status)
return status;
switch (attributes->extend) {
case CAIRO_EXTEND_NONE:
_cairo_xlib_surface_set_repeat (surface, 0);
@ -1034,7 +1034,7 @@ _surfaces_compatible (cairo_xlib_surface_t *dst,
/* same screen */
if (!_cairo_xlib_surface_same_screen (dst, src))
return FALSE;
/* same depth (for core) */
if (src->depth != dst->depth)
return FALSE;
@ -1042,7 +1042,7 @@ _surfaces_compatible (cairo_xlib_surface_t *dst,
/* if Render is supported, match picture formats */
if (src->xrender_format != NULL && src->xrender_format == dst->xrender_format)
return TRUE;
/* Without Render, match visuals instead */
if (src->visual == dst->visual)
return TRUE;
@ -1060,7 +1060,7 @@ _surface_has_alpha (cairo_xlib_surface_t *surface)
else
return FALSE;
} else {
/* In the no-render case, we never have alpha */
return FALSE;
}
@ -1117,7 +1117,7 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
cairo_bool_t have_mask)
{
if (!dst->buggy_repeat)
return DO_RENDER;
@ -1125,7 +1125,7 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst,
if (src_pattern->type == CAIRO_PATTERN_TYPE_SURFACE)
{
cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *)src_pattern;
if (_cairo_matrix_is_integer_translation (&src_pattern->matrix, NULL, NULL) &&
src_pattern->extend == CAIRO_EXTEND_REPEAT)
{
@ -1143,7 +1143,7 @@ _categorize_composite_operation (cairo_xlib_surface_t *dst,
if (op == CAIRO_OPERATOR_OVER && _surface_has_alpha (src))
return DO_UNSUPPORTED;
/* If these are on the same screen but otherwise incompatible,
* make a copy as core drawing can't cross depths and doesn't
* work rightacross visuals of the same depth
@ -1195,7 +1195,7 @@ _recategorize_composite_operation (cairo_xlib_surface_t *dst,
if (!dst->buggy_repeat)
return DO_RENDER;
if (is_integer_translation &&
src_attr->extend == CAIRO_EXTEND_REPEAT &&
(src->width != 1 || src->height != 1))
@ -1206,10 +1206,10 @@ _recategorize_composite_operation (cairo_xlib_surface_t *dst,
{
return DO_XTILE;
}
return DO_UNSUPPORTED;
}
return DO_RENDER;
}
@ -1282,7 +1282,7 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
mask_pattern != NULL);
if (operation == DO_UNSUPPORTED)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_pattern_acquire_surfaces (src_pattern, mask_pattern,
&dst->base,
src_x, src_y,
@ -1293,14 +1293,14 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
&src_attr, &mask_attr);
if (status)
return status;
operation = _recategorize_composite_operation (dst, op, src, &src_attr,
mask_pattern != NULL);
if (operation == DO_UNSUPPORTED) {
status = CAIRO_INT_STATUS_UNSUPPORTED;
goto FAIL;
}
status = _cairo_xlib_surface_set_attributes (src, &src_attr);
if (status)
goto FAIL;
@ -1313,7 +1313,7 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
status = _cairo_xlib_surface_set_attributes (mask, &mask_attr);
if (status)
goto FAIL;
XRenderComposite (dst->dpy,
_render_operator (op),
src->src_picture,
@ -1386,12 +1386,12 @@ _cairo_xlib_surface_composite (cairo_operator_t op,
src_x, src_y,
mask_x, mask_y,
dst_x, dst_y, width, height);
FAIL:
if (mask)
_cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr);
_cairo_pattern_release_surface (src_pattern, &src->base, &src_attr);
return status;
@ -1447,14 +1447,14 @@ _create_a8_picture (cairo_xlib_surface_t *surface,
pa.repeat = TRUE;
mask = CPRepeat;
}
picture = XRenderCreatePicture (surface->dpy, pixmap,
XRenderFindStandardFormat (surface->dpy, PictStandardA8),
mask, &pa);
XRenderFillRectangle (surface->dpy, PictOpSrc, picture, color,
0, 0, width, height);
XFreePixmap (surface->dpy, pixmap);
return picture;
}
@ -1509,7 +1509,7 @@ _create_trapezoid_mask (cairo_xlib_surface_t *dst,
pict_format,
0, 0,
offset_traps, num_traps);
XRenderFreePicture (dst->dpy, solid_picture);
free (offset_traps);
@ -1545,7 +1545,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
operation = _categorize_composite_operation (dst, op, pattern, TRUE);
if (operation == DO_UNSUPPORTED)
return CAIRO_INT_STATUS_UNSUPPORTED;
status = _cairo_pattern_acquire_surface (pattern, &dst->base,
src_x, src_y, width, height,
(cairo_surface_t **) &src,
@ -1567,7 +1567,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
pict_format = XRenderFindStandardFormat (dst->dpy, PictStandardA8);
break;
}
if (traps[0].left.p1.y < traps[0].left.p2.y) {
render_reference_x = _cairo_fixed_integer_floor (traps[0].left.p1.x);
render_reference_y = _cairo_fixed_integer_floor (traps[0].left.p1.y);
@ -1612,9 +1612,9 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
0, 0,
dst_x, dst_y,
width, height);
XRenderFreePicture (dst->dpy, mask_picture);
status = _cairo_surface_composite_shape_fixup_unbounded (&dst->base,
&attributes, src->width, src->height,
width, height,
@ -1622,7 +1622,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t op,
0, 0,
dst_x, dst_y, width, height);
} else {
/* XXX: The XTrapezoid cast is evil and needs to go away somehow. */
XRenderCompositeTrapezoids (dst->dpy,
@ -1657,7 +1657,7 @@ _cairo_xlib_surface_set_clip_region (void *abstract_surface,
if (region == NULL) {
if (surface->gc)
XSetClipMask (surface->dpy, surface->gc, None);
if (surface->xrender_format && surface->dst_picture) {
XRenderPictureAttributes pa;
pa.clip_mask = None;
@ -1668,7 +1668,7 @@ _cairo_xlib_surface_set_clip_region (void *abstract_surface,
pixman_box16_t *boxes;
XRectangle *rects = NULL;
int n_boxes, i;
n_boxes = pixman_region_num_rects (region);
if (n_boxes > 0) {
rects = malloc (sizeof(XRectangle) * n_boxes);
@ -1679,7 +1679,7 @@ _cairo_xlib_surface_set_clip_region (void *abstract_surface,
}
boxes = pixman_region_rects (region);
for (i = 0; i < n_boxes; i++) {
rects[i].x = boxes[i].x1;
rects[i].y = boxes[i].y1;
@ -1697,7 +1697,7 @@ _cairo_xlib_surface_set_clip_region (void *abstract_surface,
if (surface->dst_picture)
_cairo_xlib_surface_set_picture_clip_rects (surface);
}
return CAIRO_STATUS_SUCCESS;
}
@ -1721,7 +1721,7 @@ _cairo_xlib_surface_get_font_options (void *abstract_surface,
cairo_font_options_t *options)
{
cairo_xlib_surface_t *surface = abstract_surface;
*options = surface->screen_info->font_options;
}
@ -1862,7 +1862,7 @@ _cairo_xlib_surface_create_internal (Display *dpy,
surface->use_pixmap = 0;
surface->width = width;
surface->height = height;
surface->buggy_repeat = FALSE;
if (strstr (ServerVendor (dpy), "X.Org") != NULL) {
if (VendorRelease (dpy) <= 60802000)
@ -1942,7 +1942,7 @@ cairo_xlib_surface_create (Display *dpy,
_cairo_error (CAIRO_STATUS_INVALID_VISUAL);
return (cairo_surface_t*) &_cairo_surface_nil;
}
return _cairo_xlib_surface_create_internal (dpy, drawable, screen,
visual, NULL, width, height, 0);
}
@ -2065,17 +2065,17 @@ cairo_xlib_surface_set_drawable (cairo_surface_t *abstract_surface,
/* XXX: and what about this case? */
if (surface->owns_pixmap)
return;
if (surface->drawable != drawable) {
if (surface->dst_picture)
XRenderFreePicture (surface->dpy, surface->dst_picture);
if (surface->src_picture)
XRenderFreePicture (surface->dpy, surface->src_picture);
surface->dst_picture = None;
surface->src_picture = None;
surface->drawable = drawable;
}
surface->width = width;
@ -2297,7 +2297,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
glyph_info.yOff = 0;
data = glyph_surface->data;
/* flip formats around */
switch (scaled_glyph->surface->format) {
case CAIRO_FORMAT_A1:
@ -2306,7 +2306,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
int c = glyph_surface->stride * glyph_surface->height;
unsigned char *d;
unsigned char *new, *n;
new = malloc (c);
if (!new) {
status = CAIRO_STATUS_NO_MEMORY;
@ -2332,7 +2332,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
int c = glyph_surface->stride * glyph_surface->height;
unsigned char *d;
unsigned char *new, *n;
new = malloc (c);
if (new == NULL) {
status = CAIRO_STATUS_NO_MEMORY;
@ -2360,7 +2360,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
/* XXX assume X server wants pixman padding. Xft assumes this as well */
glyph_index = _cairo_scaled_glyph_index (scaled_glyph);
XRenderAddGlyphs (dpy, font_private->glyphset,
&glyph_index, &(glyph_info), 1,
(char *) data,
@ -2368,7 +2368,7 @@ _cairo_xlib_surface_add_glyph (Display *dpy,
if (data != glyph_surface->data)
free (data);
BAIL:
if (glyph_surface != scaled_glyph->surface)
cairo_surface_destroy (&glyph_surface->base);

View file

@ -227,7 +227,7 @@ cairo_reference (cairo_t *cr)
return cr;
assert (cr->ref_count > 0);
cr->ref_count++;
return cr;
@ -251,7 +251,7 @@ cairo_destroy (cairo_t *cr)
return;
assert (cr->ref_count > 0);
cr->ref_count--;
if (cr->ref_count)
return;
@ -1285,7 +1285,7 @@ cairo_curve_to (cairo_t *cr,
cairo_fixed_t x1_fixed, y1_fixed;
cairo_fixed_t x2_fixed, y2_fixed;
cairo_fixed_t x3_fixed, y3_fixed;
if (cr->status)
return;
@ -1680,7 +1680,7 @@ cairo_paint_with_alpha (cairo_t *cr,
{
cairo_color_t color;
cairo_pattern_union_t pattern;
if (cr->status)
return;
@ -1724,7 +1724,7 @@ cairo_mask (cairo_t *cr,
_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
return;
}
if (pattern->status) {
_cairo_set_error (cr, pattern->status);
return;
@ -1765,7 +1765,7 @@ cairo_mask_surface (cairo_t *cr,
cairo_pattern_set_matrix (pattern, &matrix);
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
}
@ -1918,7 +1918,7 @@ cairo_stroke_extents (cairo_t *cr,
{
if (cr->status)
return;
cr->status = _cairo_gstate_stroke_extents (cr->gstate,
&cr->path,
x1, y1, x2, y2);
@ -1932,7 +1932,7 @@ cairo_fill_extents (cairo_t *cr,
{
if (cr->status)
return;
cr->status = _cairo_gstate_fill_extents (cr->gstate,
&cr->path,
x1, y1, x2, y2);
@ -2325,7 +2325,7 @@ cairo_text_extents (cairo_t *cr,
_cairo_set_error (cr, cr->status);
return;
}
cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
if (glyphs)
free (glyphs);

View file

@ -726,7 +726,7 @@ typedef enum _cairo_font_slant {
CAIRO_FONT_SLANT_ITALIC,
CAIRO_FONT_SLANT_OBLIQUE
} cairo_font_slant_t;
typedef enum _cairo_font_weight {
CAIRO_FONT_WEIGHT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD
@ -839,7 +839,7 @@ cairo_font_options_set_subpixel_order (cairo_font_options_t *options,
cairo_subpixel_order_t subpixel_order);
cairo_public cairo_subpixel_order_t
cairo_font_options_get_subpixel_order (const cairo_font_options_t *options);
cairo_public void
cairo_font_options_set_hint_style (cairo_font_options_t *options,
cairo_hint_style_t hint_style);
@ -1413,7 +1413,7 @@ cairo_pattern_reference (cairo_pattern_t *pattern);
cairo_public void
cairo_pattern_destroy (cairo_pattern_t *pattern);
cairo_public cairo_status_t
cairo_pattern_status (cairo_pattern_t *pattern);
@ -1507,7 +1507,7 @@ typedef enum _cairo_filter {
CAIRO_FILTER_BILINEAR,
CAIRO_FILTER_GAUSSIAN
} cairo_filter_t;
cairo_public void
cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter);

View file

@ -451,18 +451,18 @@ struct _cairo_scaled_font {
/* useful bits for _cairo_scaled_font_nil */
cairo_status_t status;
int ref_count;
/* hash key members */
cairo_font_face_t *font_face; /* may be NULL */
cairo_matrix_t font_matrix; /* font space => user space */
cairo_matrix_t ctm; /* user space => device space */
cairo_font_options_t options;
/* "live" scaled_font members */
cairo_matrix_t scale; /* font space => device space */
cairo_font_extents_t extents; /* user space */
cairo_cache_t *glyphs; /* glyph index -> cairo_scaled_glyph_t */
/*
* One surface backend may store data in each glyph.
* Whichever surface manages to store its pointer here
@ -470,7 +470,7 @@ struct _cairo_scaled_font {
*/
const cairo_surface_backend_t *surface_backend;
void *surface_private;
/* font backend managing this scaled font */
const cairo_scaled_font_backend_t *backend;
};
@ -549,7 +549,7 @@ struct _cairo_scaled_font_backend {
const char *utf8,
cairo_glyph_t **glyphs,
int *num_glyphs);
unsigned long
(*ucs4_to_index) (void *scaled_font,
uint32_t ucs4);
@ -566,7 +566,7 @@ struct _cairo_scaled_font_backend {
unsigned int height,
const cairo_glyph_t *glyphs,
int num_glyphs);
};
struct _cairo_font_face_backend {
@ -655,7 +655,7 @@ struct _cairo_surface_backend {
(*clone_similar) (void *surface,
cairo_surface_t *src,
cairo_surface_t **clone_out);
/* XXX: dst should be the first argument for consistency */
cairo_int_status_t
(*composite) (cairo_operator_t op,
@ -893,7 +893,7 @@ struct _cairo_image_surface {
unsigned char *data;
cairo_bool_t owns_data;
cairo_bool_t has_clip;
int width;
int height;
@ -951,26 +951,26 @@ extern const cairo_private cairo_solid_pattern_t cairo_pattern_nil;
typedef struct _cairo_surface_pattern {
cairo_pattern_t base;
cairo_surface_t *surface;
} cairo_surface_pattern_t;
typedef struct _cairo_gradient_pattern {
cairo_pattern_t base;
pixman_gradient_stop_t *stops;
int n_stops;
} cairo_gradient_pattern_t;
typedef struct _cairo_linear_pattern {
cairo_gradient_pattern_t base;
pixman_linear_gradient_t gradient;
} cairo_linear_pattern_t;
typedef struct _cairo_radial_pattern {
cairo_gradient_pattern_t base;
pixman_radial_gradient_t gradient;
} cairo_radial_pattern_t;
@ -983,7 +983,7 @@ typedef union {
typedef union {
cairo_pattern_t base;
cairo_solid_pattern_t solid;
cairo_surface_pattern_t surface;
cairo_gradient_pattern_union_t gradient;
@ -1272,7 +1272,7 @@ _cairo_gstate_set_font_size (cairo_gstate_t *gstate,
cairo_private void
_cairo_gstate_get_font_matrix (cairo_gstate_t *gstate,
cairo_matrix_t *matrix);
cairo_private cairo_status_t
_cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
const cairo_matrix_t *matrix);
@ -1280,7 +1280,7 @@ _cairo_gstate_set_font_matrix (cairo_gstate_t *gstate,
cairo_private void
_cairo_gstate_get_font_options (cairo_gstate_t *gstate,
cairo_font_options_t *options);
cairo_private cairo_status_t
_cairo_gstate_set_font_options (cairo_gstate_t *gstate,
const cairo_font_options_t *options);
@ -1727,7 +1727,7 @@ _cairo_surface_show_glyphs (cairo_surface_t *surface,
const cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
cairo_private cairo_status_t
_cairo_surface_composite_trapezoids (cairo_operator_t op,
cairo_pattern_t *pattern,
@ -1771,7 +1771,7 @@ _cairo_surface_release_dest_image (cairo_surface_t *surface,
cairo_image_surface_t *image,
cairo_rectangle_fixed_t *image_rect,
void *image_extra);
cairo_private cairo_status_t
_cairo_surface_clone_similar (cairo_surface_t *surface,
cairo_surface_t *src,

View file

@ -108,7 +108,7 @@ _test_fallback_surface_finish (void *abstract_surface)
test_fallback_surface_t *surface = abstract_surface;
cairo_surface_destroy (surface->backing);
return CAIRO_STATUS_SUCCESS;
}
@ -142,7 +142,7 @@ _test_fallback_surface_acquire_dest_image (void *abstract_surface,
void **image_extra)
{
test_fallback_surface_t *surface = abstract_surface;
return _cairo_surface_acquire_dest_image (surface->backing,
interest_rect,
image_out,

View file

@ -110,7 +110,7 @@ _test_meta_surface_finish (void *abstract_surface)
cairo_surface_destroy (surface->meta);
cairo_surface_destroy (surface->image);
return CAIRO_STATUS_SUCCESS;
}

View file

@ -122,7 +122,7 @@ xasprintf (char **strp, const char *fmt, ...)
#ifdef HAVE_VASPRINTF
va_list va;
int ret;
va_start (va, fmt);
ret = vasprintf (strp, fmt, va);
va_end (va);
@ -136,7 +136,7 @@ xasprintf (char **strp, const char *fmt, ...)
va_list va;
char buffer[BUF_SIZE];
int ret;
va_start (va, fmt);
ret = vsnprintf (buffer, sizeof(buffer), fmt, va);
va_end (va);
@ -145,12 +145,12 @@ xasprintf (char **strp, const char *fmt, ...)
cairo_test_log ("Failure in vsnprintf\n");
exit (1);
}
if (strlen (buffer) == sizeof(buffer) - 1) {
cairo_test_log ("Overflowed fixed buffer\n");
exit (1);
}
*strp = strdup (buffer);
if (!*strp) {
cairo_test_log ("Out of memory\n");
@ -496,7 +496,7 @@ create_cairo_glitz_glx_surface (cairo_test_t *test,
width = 1;
if (height == 0)
height = 1;
gxtc->dpy = XOpenDisplay (getenv("CAIRO_TEST_GLITZ_DISPLAY"));
if (!gxtc->dpy) {
cairo_test_log ("Failed to open display: %s\n", XDisplayName(0));
@ -1007,7 +1007,7 @@ create_xcb_surface (cairo_test_t *test,
cairo_test_log ("Invalid content for XCB test: %d\n", content);
return NULL;
}
render_format = _format_from_cairo (c, format);
if (render_format.id.xid == 0)
return NULL;
@ -1087,7 +1087,7 @@ create_xlib_surface (cairo_test_t *test,
cairo_test_log ("X server does not have the Render extension.\n");
return NULL;
}
xtc->pixmap = XCreatePixmap (dpy, DefaultRootWindow (dpy),
width, height, xrender_format->depth);
@ -1250,7 +1250,7 @@ create_pdf_surface (cairo_test_t *test,
ptc->width = width;
ptc->height = height;
xasprintf (&ptc->filename, "%s-pdf-%s-out.pdf",
test->name, _cairo_test_content_name (content));
@ -1360,10 +1360,10 @@ create_svg_surface (cairo_test_t *test,
ptc->width = width;
ptc->height = height;
xasprintf (&ptc->filename, "%s-svg-%s-out.svg",
test->name, _cairo_test_content_name (content));
surface = cairo_svg_surface_create (ptc->filename, width, height);
if (cairo_surface_status (surface)) {
free (ptc->filename);
@ -1419,7 +1419,7 @@ svg_surface_write_to_png (cairo_surface_t *surface, const char *filename)
if (system (command) != 0)
return CAIRO_STATUS_WRITE_ERROR;
return CAIRO_STATUS_SUCCESS;
}
@ -1457,7 +1457,7 @@ cairo_test_for_target (cairo_test_t *test,
xasprintf (&offset_str, "-%d", dev_offset);
else
offset_str = strdup("");
if (dev_offset)
xasprintf (&offset_str, "-%d", dev_offset);
else

View file

@ -57,7 +57,7 @@ draw (cairo_t *cr, int width, int height)
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */
cairo_paint (cr);
cairo_restore (cr);
cairo_set_line_width (cr, LINE_WIDTH);
cairo_translate (cr, PAD, PAD);

View file

@ -46,7 +46,7 @@ draw (cairo_t *cr, int width, int height)
cairo_clip (cr);
cairo_rectangle (cr, 3*CLIP_SIZE, 3*CLIP_SIZE, CLIP_SIZE, CLIP_SIZE);
cairo_clip (cr);
cairo_translate (cr, .5, .5);
cairo_reset_clip (cr);

View file

@ -48,7 +48,7 @@ draw (cairo_t *cr, int width, int height)
cr2 = cairo_create (target_surface);
/* Draw a diagonal line and clip to it */
cairo_move_to (cr2, BORDER, BORDER);
cairo_line_to (cr2, BORDER + LINE_WIDTH, BORDER);
cairo_line_to (cr2, SIZE - BORDER, SIZE - BORDER);
@ -86,7 +86,7 @@ draw (cairo_t *cr, int width, int height)
BORDER, BORDER,
LINE_WIDTH, SIZE - 2 * BORDER);
cairo_fill (cr);
return CAIRO_TEST_SUCCESS;
}

View file

@ -43,7 +43,7 @@ draw_mask (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_ALPHA,
width, height);
@ -73,7 +73,7 @@ draw_glyphs (cairo_t *cr, int x, int y)
cairo_text_extents_t extents;
cairo_set_font_size (cr, 0.8 * HEIGHT);
cairo_text_extents (cr, "FG", &extents);
cairo_move_to (cr,
x + (WIDTH - extents.width) / 2 - extents.x_bearing,
@ -88,7 +88,7 @@ draw_polygon (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
cairo_new_path (cr);
cairo_move_to (cr, x, y);
cairo_line_to (cr, x, y + height);
@ -161,7 +161,7 @@ draw (cairo_t *cr, int width, int height)
for (op = CAIRO_OPERATOR_CLEAR; op < N_OPERATORS; op++) {
x = op * (WIDTH + PAD) + PAD;
y = j * (HEIGHT + PAD) + PAD;
cairo_save (cr);
pattern = cairo_pattern_create_linear (x + WIDTH, y,
@ -172,7 +172,7 @@ draw (cairo_t *cr, int width, int height)
0.0, 0.0, 1.0, 0.0); /* Transparent blue */
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr, x, y, WIDTH, HEIGHT);
cairo_fill (cr);
@ -187,7 +187,7 @@ draw (cairo_t *cr, int width, int height)
draw_funcs[j] (cr, x, y);
if (cairo_status (cr))
cairo_test_log ("%d %d HERE!\n", op, j);
cairo_restore (cr);
}
}

View file

@ -55,7 +55,7 @@ draw (cairo_t *cr, int width, int height)
/* Basic 1-1 dash pattern */
cairo_set_dash (cr, dashes, 1, 0.);
cairo_move_to (cr, 1, 2);
cairo_line_to (cr, 18, 2);
cairo_stroke (cr);
@ -69,7 +69,7 @@ draw (cairo_t *cr, int width, int height)
/* Offset dash by 0.5, rather than the path */
cairo_set_dash (cr, dashes, 1, 0.5);
cairo_move_to (cr, 1, 8);
cairo_line_to (cr, 18, 8);
cairo_stroke (cr);
@ -78,7 +78,7 @@ draw (cairo_t *cr, int width, int height)
/* Basic 1-1 dash pattern dashing */
cairo_set_dash (cr, dashes, 1, -4);
cairo_move_to (cr, 1, 11);
cairo_line_to (cr, 18, 11);
cairo_stroke (cr);
@ -90,7 +90,7 @@ draw (cairo_t *cr, int width, int height)
/* Offset dash by 0.5 */
cairo_set_dash (cr, dashes, 1, -3.5);
cairo_move_to (cr, 1, 17);
cairo_line_to (cr, 18, 17);
cairo_stroke (cr);

View file

@ -52,7 +52,7 @@ draw (cairo_t *cr, int width, int height)
cairo_fill_preserve (cr);
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_stroke (cr);
return CAIRO_TEST_SUCCESS;
}

View file

@ -89,7 +89,7 @@ draw (cairo_t *cr, int width, int height)
PAD + j * (STAMP_HEIGHT + PAD) + j_step);
cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
cairo_paint (cr);
cairo_restore (cr);
}
}

View file

@ -61,4 +61,4 @@ main (void)

View file

@ -116,7 +116,7 @@ get_and_set (cairo_t *cr, int width, int height)
settings_t check;
settings_set (cr, &settings[0]);
cairo_save (cr);
{
settings_set (cr, &settings[1]);

View file

@ -50,7 +50,7 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
cairo_pattern_destroy (gradient);
return CAIRO_TEST_SUCCESS;
}

View file

@ -71,15 +71,15 @@ draw_unit (cairo_t *cr,
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_clip (cr);
cairo_new_path(cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_rectangle (cr, 0, 0, 1, 1);
cairo_fill (cr);
cairo_translate (cr, 0.5, 0.5);
cairo_scale (cr, 1 / 1.5, 1 / 1.5);
cairo_rotate (cr, rotate_angle);
pattern = cairo_pattern_create_linear (-0.5 * cos (gradient_angle), -0.5 * sin (gradient_angle),
0.5 * cos (gradient_angle), 0.5 * sin (gradient_angle));
@ -119,7 +119,7 @@ draw (cairo_t *cr, int width, int height)
PAD + (PAD + UNIT_SIZE) * i,
PAD + (PAD + UNIT_SIZE) * (N_ROTATE_ANGLES * k + j));
cairo_scale (cr, UNIT_SIZE, UNIT_SIZE);
draw_unit (cr,
gradient_angles[i] * M_PI / 180.,
rotate_angles[j] * M_PI / 180.,

View file

@ -86,7 +86,7 @@ mask_polygon (cairo_t *cr, int x, int y)
cairo_restore (cr2);
cairo_set_source_rgb (cr2, 1, 1, 1); /* white */
cairo_new_path (cr2);
cairo_move_to (cr2, 0, 0);
cairo_line_to (cr2, 0, HEIGHT);
@ -126,7 +126,7 @@ mask_gradient (cairo_t *cr, int x, int y)
1, 1, 1, 0);
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
}
@ -139,7 +139,7 @@ static void
clip_rects (cairo_t *cr, int x, int y)
{
int height = HEIGHT / 3;
cairo_new_path (cr);
cairo_rectangle (cr, x, y, WIDTH, height);
cairo_rectangle (cr, x, y + 2 * height, WIDTH, height);
@ -211,7 +211,7 @@ draw (cairo_t *cr, int width, int height)
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
int x = i * (WIDTH + PAD) + PAD;
int y = (ARRAY_SIZE (mask_funcs) * k + j) * (HEIGHT + PAD) + PAD;
/* Clear intermediate surface we are going to be drawing onto */
cairo_save (cr2);
cairo_set_operator (cr2, CAIRO_OPERATOR_CLEAR);

View file

@ -62,7 +62,7 @@ draw_mask (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_ALPHA,
width, height);
@ -86,7 +86,7 @@ draw_glyphs (cairo_t *cr, int x, int y)
cairo_text_extents_t extents;
cairo_set_font_size (cr, 0.8 * HEIGHT);
cairo_text_extents (cr, "FG", &extents);
cairo_move_to (cr,
x + (WIDTH - extents.width) / 2 - extents.x_bearing,
@ -101,7 +101,7 @@ draw_polygon (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
cairo_new_path (cr);
cairo_move_to (cr, x, y);
cairo_line_to (cr, x, y + height);
@ -175,7 +175,7 @@ draw (cairo_t *cr, int width, int height)
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
x = i * (WIDTH + PAD) + PAD;
y = j * (HEIGHT + PAD) + PAD;
cairo_save (cr);
pattern = cairo_pattern_create_linear (x + WIDTH, y,
@ -186,7 +186,7 @@ draw (cairo_t *cr, int width, int height)
0.0, 0.0, 1.0, 0.0); /* Transparent blue */
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr, x, y, WIDTH, HEIGHT);
cairo_fill_preserve (cr);
cairo_clip (cr);
@ -196,7 +196,7 @@ draw (cairo_t *cr, int width, int height)
draw_funcs[j] (cr, x, y);
if (cairo_status (cr))
cairo_test_log ("%d %d HERE!\n", i, j);
cairo_restore (cr);
}
}

View file

@ -68,7 +68,7 @@ set_surface_pattern (cairo_t *cr, int x, int y)
double height = (int)(0.6 * HEIGHT);
x += 0.2 * WIDTH;
y += 0.2 * HEIGHT;
source_surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_COLOR_ALPHA,
width, height);
@ -99,7 +99,7 @@ draw_mask (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
mask_surface = cairo_surface_create_similar (cairo_get_target (cr),
CAIRO_CONTENT_ALPHA,
width, height);
@ -123,7 +123,7 @@ draw_glyphs (cairo_t *cr, int x, int y)
cairo_text_extents_t extents;
cairo_set_font_size (cr, 0.8 * HEIGHT);
cairo_text_extents (cr, "FG", &extents);
cairo_move_to (cr,
x + (WIDTH - extents.width) / 2 - extents.x_bearing,
@ -138,7 +138,7 @@ draw_polygon (cairo_t *cr, int x, int y)
double height = (int)(0.9 * HEIGHT);
x += 0.05 * WIDTH;
y += 0.05 * HEIGHT;
cairo_new_path (cr);
cairo_move_to (cr, x, y);
cairo_line_to (cr, x, y + height);
@ -214,7 +214,7 @@ draw (cairo_t *cr, int width, int height)
for (i = 0; i < ARRAY_SIZE (pattern_funcs); i++) {
x = i * (WIDTH + PAD) + PAD;
y = j * (HEIGHT + PAD) + PAD;
cairo_save (cr);
pattern = cairo_pattern_create_linear (x + WIDTH, y,
@ -225,7 +225,7 @@ draw (cairo_t *cr, int width, int height)
0.0, 0.0, 1.0, 0.0); /* Transparent blue */
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_rectangle (cr, x, y, WIDTH, HEIGHT);
cairo_fill_preserve (cr);
cairo_clip (cr);
@ -235,7 +235,7 @@ draw (cairo_t *cr, int width, int height)
draw_funcs[j] (cr, x, y);
if (cairo_status (cr))
cairo_test_log ("%d %d HERE!\n", i, j);
cairo_restore (cr);
}
}

View file

@ -133,7 +133,7 @@ main (void)
snprintf (dsc, 255, "%%IncludeFeature: *MediaType Glossy");
cairo_ps_surface_dsc_comment (surface, dsc);
}
cairo_move_to (cr, TEXT_SIZE, TEXT_SIZE);
cairo_show_text (cr, pages[i].page_size);
cairo_show_text (cr, " - ");

View file

@ -49,7 +49,7 @@ draw (cairo_t *cr, int width, int height)
cairo_translate(cr, -300, -300);
cairo_scale(cr, 677.0/26, 677.0/26);
cairo_translate(cr, 1, 1);
/* this should draw a seamless 2x2 rectangle */
cairo_rectangle(cr, 11, 11, 1, 1);
cairo_rectangle(cr, 11, 12, 1, 1);

View file

@ -43,9 +43,9 @@ draw (cairo_t *cr, int width, int height)
SIZE/2, -SIZE/2,
SIZE*2/3, -SIZE/3,
SIZE/2, -SIZE);
cairo_stroke (cr);
return CAIRO_TEST_SUCCESS;
}

View file

@ -40,7 +40,7 @@ draw (cairo_t *cr, int width, int height)
{
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
/* Paint a diagonal division as a test image */
cairo_set_source_rgb (cr, 1, 1, 1); /* White */
cairo_paint (cr);
@ -56,10 +56,10 @@ draw (cairo_t *cr, int width, int height)
* offset by SIZE/2
*/
pattern = cairo_pattern_create_for_surface (cairo_get_target (cr));
cairo_matrix_init_translate (&matrix, - SIZE / 2, - SIZE / 2);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);

View file

@ -68,7 +68,7 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
/* As the clip shouldn't matter, the result should be solid black */
cairo_destroy (cr2);
cairo_pattern_destroy (pattern);
cairo_surface_destroy (source_surface);

View file

@ -46,7 +46,7 @@ draw (cairo_t *cr, int width, int height)
cairo_rectangle (cr2, 3, 3, 3, 3);
cairo_set_source_rgb (cr2, 1, 1, 0);
cairo_fill (cr2);
cairo_rectangle (cr2, 3, 0, 3, 3);
cairo_rectangle (cr2, 0, 3, 3, 3);
cairo_set_source_rgb (cr2, 0, 0, 1);

View file

@ -69,7 +69,7 @@ test_clip (cairo_t *cr, double width, double height)
cairo_move_to (cr, 600, 0);
cairo_curve_to (cr, 300, 600, 0, 300, 600, 0);
cairo_clip (cr);
cairo_rectangle (cr, 0, 0, 600, 600);
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_fill (cr);

View file

@ -41,17 +41,17 @@ draw (cairo_t *cr, int width, int height)
cairo_pattern_t *pat;
font_options = cairo_font_options_create ();
cairo_font_options_set_hint_style (font_options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_antialias (font_options, CAIRO_ANTIALIAS_GRAY);
cairo_set_font_options (cr, font_options);
cairo_font_options_destroy (font_options);
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_scale (cr, width, height);
pat = cairo_pattern_create_linear (0.0, 0.0, 1, 1);
@ -62,7 +62,7 @@ draw (cairo_t *cr, int width, int height)
/* test rectangle - make sure the gradient is set correctly */
cairo_rectangle (cr, 0, 0, 0.1, 1);
cairo_fill (cr);
cairo_set_font_size (cr, 0.4);
cairo_move_to (cr, 0.1, 0.6);
cairo_show_text (cr, "cairo");

View file

@ -125,7 +125,7 @@ draw (cairo_t *cr, int width, int height)
y_off = - floor (0.5 + extents.height / 2.0);
x_off = floor (0.5 + (extents.height+1) / (2 * tan (M_PI/NUM_TEXT)));
}
for (i=0; i < NUM_TEXT; i++) {
cairo_save (cr);
cairo_rotate (cr, 2*M_PI*i/NUM_TEXT);

Some files were not shown because too many files have changed in this diff Show more