mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-24 20:55:49 +00:00
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.
This commit is contained in:
parent
38d14e8589
commit
84838268b3
3 changed files with 204 additions and 38 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue