summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-04-23 13:19:54 -0400
committerSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-04-23 13:19:54 -0400
commit84838268b34661d598f8e4856fab355f414930d9 (patch)
tree3143e7e68b6eb95d391fe903f411b10a7f415905 /render
parent38d14e858980a1b0c087344d24bf6aebf755663c (diff)
Gradient fixes
* Port fix for bug 7685 from pixman. Patch by Carl Worth * Add projective version of radial gradient code. * Make sure that all Pict*Gradient types have PictGradient as prefix, since code in various places relies on that.
Diffstat (limited to 'render')
-rw-r--r--render/picture.c16
-rw-r--r--render/picturestr.h23
2 files changed, 31 insertions, 8 deletions
diff --git a/render/picture.c b/render/picture.c
index 3f64182f3..201ceb25b 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1051,6 +1051,7 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
radial = &pPicture->pSourcePict->radial;
radial->type = SourcePictTypeRadial;
+#if 0
{
double x = (double)innerRadius / (double)outerRadius;
radial->dx = (outer->x - inner->x);
@@ -1066,7 +1067,20 @@ CreateRadialGradientPicture (Picture pid, xPointFixed *inner, xPointFixed *outer
x = outerRadius/65536.;
radial->a = x*x - radial->dx*radial->dx - radial->dy*radial->dy;
}
-
+#endif
+ radial->c1.x = inner->x;
+ radial->c1.y = inner->y;
+ radial->c1.radius = innerRadius;
+ radial->c2.x = outer->x;
+ radial->c2.y = outer->y;
+ radial->c2.radius = outerRadius;
+ radial->cdx = (radial->c2.x - radial->c1.x) / 65536.;
+ radial->cdy = (radial->c2.y - radial->c1.y) / 65536.;
+ radial->dr = (radial->c2.radius - radial->c1.radius) / 65536.;
+ radial->A = ( radial->cdx * radial->cdx
+ + radial->cdy * radial->cdy
+ - radial->dr * radial->dr);
+
initGradient(pPicture->pSourcePict, nStops, stops, colors, error);
if (*error) {
xfree(pPicture);
diff --git a/render/picturestr.h b/render/picturestr.h
index 3f3c600f8..62687681d 100644
--- a/render/picturestr.h
+++ b/render/picturestr.h
@@ -105,17 +105,26 @@ typedef struct _PictLinearGradient {
xPointFixed p2;
} PictLinearGradient, *PictLinearGradientPtr;
+typedef struct _PictCircle {
+ xFixed x;
+ xFixed y;
+ xFixed radius;
+} PictCircle, *PictCirclePtr;
+
typedef struct _PictRadialGradient {
unsigned int type;
+ unsigned int class;
int nstops;
PictGradientStopPtr stops;
- double fx;
- double fy;
- double dx;
- double dy;
- double a;
- double m;
- double b;
+ int stopRange;
+ CARD32 *colorTable;
+ int colorTableSize;
+ PictCircle c1;
+ PictCircle c2;
+ double cdx;
+ double cdy;
+ double dr;
+ double A;
} PictRadialGradient, *PictRadialGradientPtr;
typedef struct _PictConicalGradient {