[Commit] Xr/src Xr.h,1.27,1.28 xrfont.c,1.6,1.7 xrgstate.c,1.35,1.36 xrint.h,1.41,1.42 xrmatrix.c,1.1,1.2 xrsurface.c,1.16,1.17
Carl Worth
commit@keithp.com
Wed, 28 May 2003 19:28:56 -0700
Committed by: cworth
Update of /local/src/CVS/Xr/src
In directory home.keithp.com:/tmp/cvs-serv13127/src
Modified Files:
Xr.h xrfont.c xrgstate.c xrint.h xrmatrix.c xrsurface.c
Log Message:
Added XrSurfacePutImage. Fixed missing translation of clip region.
Index: Xr.h
===================================================================
RCS file: /local/src/CVS/Xr/src/Xr.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- Xr.h 16 May 2003 04:16:26 -0000 1.27
+++ Xr.h 29 May 2003 02:28:53 -0000 1.28
@@ -184,6 +184,8 @@
void
XrDefaultMatrix(XrState *xrs);
+/* XXX: There's been a proposal to add XrDefaultMatrixExact */
+
void
XrIdentityMatrix(XrState *xrs);
@@ -379,6 +381,14 @@
void
XrSurfaceDestroy(XrSurface *surface);
+
+/* XXX: Should this take an X/Y offset as well? (Probably) */
+XrStatus
+XrSurfacePutImage (XrSurface *surface,
+ char *data,
+ int width,
+ int height,
+ int stride);
/* XXX: The Xc version of this function isn't quite working yet
XrStatus
Index: xrfont.c
===================================================================
RCS file: /local/src/CVS/Xr/src/xrfont.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xrfont.c 15 May 2003 01:30:57 -0000 1.6
+++ xrfont.c 29 May 2003 02:28:53 -0000 1.7
@@ -105,7 +105,7 @@
XrMatrix m;
XrMatrixSetAffine(&m, a, b, c, d, 0, 0);
- _XrMatrixMultiplyIntoRight(&m, &font->matrix);
+ XrMatrixMultiply (&font->matrix, &m, &font->matrix);
return XrStatusSuccess;
}
@@ -130,7 +130,7 @@
matrix = gstate->ctm;
- _XrMatrixMultiplyIntoRight(&font->matrix, &matrix);
+ XrMatrixMultiply (&matrix, &font->matrix, &matrix);
/* Pull the scale factor out of the final matrix and use it to set
the direct pixelsize of the font. This enables freetype to
Index: xrgstate.c
===================================================================
RCS file: /local/src/CVS/Xr/src/xrgstate.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- xrgstate.c 16 May 2003 04:16:26 -0000 1.35
+++ xrgstate.c 29 May 2003 02:28:53 -0000 1.36
@@ -484,10 +484,10 @@
XrMatrix tmp;
_XrMatrixSetTranslate(&tmp, tx, ty);
- _XrMatrixMultiplyIntoRight(&tmp, &gstate->ctm);
+ XrMatrixMultiply (&gstate->ctm, &tmp, &gstate->ctm);
_XrMatrixSetTranslate(&tmp, -tx, -ty);
- _XrMatrixMultiplyIntoLeft(&gstate->ctm_inverse, &tmp);
+ XrMatrixMultiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
return XrStatusSuccess;
}
@@ -498,10 +498,10 @@
XrMatrix tmp;
_XrMatrixSetScale(&tmp, sx, sy);
- _XrMatrixMultiplyIntoRight(&tmp, &gstate->ctm);
+ XrMatrixMultiply (&gstate->ctm, &tmp, &gstate->ctm);
_XrMatrixSetScale(&tmp, 1/sx, 1/sy);
- _XrMatrixMultiplyIntoLeft(&gstate->ctm_inverse, &tmp);
+ XrMatrixMultiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
return XrStatusSuccess;
}
@@ -512,10 +512,10 @@
XrMatrix tmp;
_XrMatrixSetRotate(&tmp, angle);
- _XrMatrixMultiplyIntoRight(&tmp, &gstate->ctm);
+ XrMatrixMultiply (&gstate->ctm, &tmp, &gstate->ctm);
_XrMatrixSetRotate(&tmp, -angle);
- _XrMatrixMultiplyIntoLeft(&gstate->ctm_inverse, &tmp);
+ XrMatrixMultiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
return XrStatusSuccess;
}
@@ -527,10 +527,10 @@
XrMatrix tmp;
XrMatrixCopy(&tmp, matrix);
- _XrMatrixMultiplyIntoRight(&tmp, &gstate->ctm);
+ XrMatrixMultiply (&gstate->ctm, &tmp, &gstate->ctm);
XrMatrixInvert(&tmp);
- _XrMatrixMultiplyIntoLeft(&gstate->ctm_inverse, &tmp);
+ XrMatrixMultiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
return XrStatusSuccess;
}
@@ -796,6 +796,7 @@
return XrStatusSuccess;
}
+/* Warning: This call modifies the coordinates of traps */
static XrStatus
_XrGStateClipAndCompositeTrapezoids(XrGState *gstate,
XrSurface *src,
@@ -807,6 +808,10 @@
return XrStatusSuccess;
if (gstate->clip.surface) {
+ XFixed xoff, yoff;
+ XTrapezoid *t;
+ int i;
+
XrSurface *intermediate, *white;
white = XrSurfaceCreateNextToSolid(gstate->surface, XrFormatA8,
@@ -818,6 +823,25 @@
XrFormatA8,
gstate->clip.width, gstate->clip.height,
0.0, 0.0, 0.0, 0.0);
+
+ /* Ugh. The Xc/(Render) interface doesn't allow an offset for
+ the trapezoids. Need to manually shift all the coordinates
+ to align with the offset origin of the clip surface. */
+ xoff = XDoubleToFixed (gstate->clip.x);
+ yoff = XDoubleToFixed (gstate->clip.y);
+ for (i=0, t=traps->xtraps; i < traps->num_xtraps; i++, t++) {
+ t->top -= yoff;
+ t->bottom -= yoff;
+ t->left.p1.x -= xoff;
+ t->left.p1.y -= yoff;
+ t->left.p2.x -= xoff;
+ t->left.p2.y -= yoff;
+ t->right.p1.x -= xoff;
+ t->right.p1.y -= yoff;
+ t->right.p2.x -= xoff;
+ t->right.p2.y -= yoff;
+ }
+
XcCompositeTrapezoids(XrOperatorAdd,
white->xc_surface,
intermediate->xc_surface,
@@ -836,7 +860,8 @@
dst->xc_surface,
0, 0,
0, 0,
- 0, 0,
+ gstate->clip.x,
+ gstate->clip.y,
gstate->clip.width,
gstate->clip.height);
XrSurfaceDestroy(intermediate);
@@ -1057,7 +1082,8 @@
&device_x, &device_y,
&device_width, &device_height);
- /* XXX: The +2 here looks bogus to me */
+ /* XXX: The rendered size is sometimes 1 or 2 pixels short from
+ what I expect. Need to fix this. */
XcComposite(gstate->operator,
surface->xc_surface,
mask->xc_surface,
@@ -1065,8 +1091,8 @@
device_x, device_y,
0, 0,
device_x, device_y,
- device_width + 2,
- device_height + 2);
+ device_width,
+ device_height);
XrSurfaceDestroy (mask);
Index: xrint.h
===================================================================
RCS file: /local/src/CVS/Xr/src/xrint.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- xrint.h 16 May 2003 04:16:26 -0000 1.41
+++ xrint.h 29 May 2003 02:28:53 -0000 1.42
@@ -665,13 +665,6 @@
double angle);
XrStatus
-_XrMatrixMultiplyIntoLeft(XrMatrix *t1, const XrMatrix *t2);
-
-XrStatus
-_XrMatrixMultiplyIntoRight(const XrMatrix *t1, XrMatrix *t2);
-
-
-XrStatus
_XrMatrixTransformBoundingBox(XrMatrix *matrix,
double *x, double *y,
double *width, double *height);
Index: xrmatrix.c
===================================================================
RCS file: /local/src/CVS/Xr/src/xrmatrix.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- xrmatrix.c 15 May 2003 01:30:57 -0000 1.1
+++ xrmatrix.c 29 May 2003 02:28:53 -0000 1.2
@@ -121,7 +121,7 @@
_XrMatrixSetTranslate(&tmp, tx, ty);
- return _XrMatrixMultiplyIntoRight(&tmp, matrix);
+ return XrMatrixMultiply (matrix, &tmp, matrix);
}
XrStatus
@@ -141,7 +141,7 @@
_XrMatrixSetScale (&tmp, sx, sy);
- return _XrMatrixMultiplyIntoRight (&tmp, matrix);
+ return XrMatrixMultiply (matrix, &tmp, matrix);
}
XrStatus
@@ -161,19 +161,7 @@
_XrMatrixSetRotate (&tmp, radians);
- return _XrMatrixMultiplyIntoRight (&tmp, matrix);
-}
-
-XrStatus
-_XrMatrixMultiplyIntoLeft(XrMatrix *m1, const XrMatrix *m2)
-{
- return XrMatrixMultiply(m1, m1, m2);
-}
-
-XrStatus
-_XrMatrixMultiplyIntoRight(const XrMatrix *m1, XrMatrix *m2)
-{
- return XrMatrixMultiply(m2, m1, m2);
+ return XrMatrixMultiply (matrix, &tmp, matrix);
}
XrStatus
Index: xrsurface.c
===================================================================
RCS file: /local/src/CVS/Xr/src/xrsurface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- xrsurface.c 16 May 2003 04:16:26 -0000 1.16
+++ xrsurface.c 29 May 2003 02:28:53 -0000 1.17
@@ -215,7 +215,11 @@
NULL,
format,
DefaultColormap (dpy, scr));
+/* XXX: huh? This should be fine since we already created a picture
+ from the pixmap, right?? (Somehow, it seems to be causing some
+ breakage).
XFreePixmap(surface->dpy, pix);
+*/
} else {
char *data;
int stride;
@@ -272,6 +276,21 @@
free(surface);
}
+
+XrStatus
+XrSurfacePutImage (XrSurface *surface,
+ char *data,
+ int width,
+ int height,
+ int stride)
+{
+ XcSurfacePutImage (surface->xc_surface, data,
+ width, height, stride);
+
+ return XrStatusSuccess;
+}
+
+/* XXX: Symmetry demands an XrSurfaceGetImage as well */
/* XXX: We may want to move to projective matrices at some point. If
nothing else, that would eliminate the two different transform data