RENDER: Fix gradient and solid fill pictures with Xinerama, and misc cleanup

If these aren't wrapped, then procs that are wrapped (such as
RenderChangePicture) will fail in Xinerama when they see the resource
type of a picture created through one of these interfaces is PictureType
and not XRT_PICTURE like those allocated via RenderCreatePicture.

Signed-off-by: Robert Morell <rmorell@nvidia.com>
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
(cherry picked from commit 4d575b0559)
This commit is contained in:
Robert Morell 2010-01-29 19:07:03 -08:00 committed by Aaron Plattner
parent 85b04bb0eb
commit 34cedd1e3d

View file

@ -3235,6 +3235,138 @@ PanoramiXRenderAddTraps (ClientPtr client)
return result;
}
static int
PanoramiXRenderCreateSolidFill (ClientPtr client)
{
REQUEST(xRenderCreateSolidFillReq);
PanoramiXRes *newPict;
int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateSolidFillReq);
if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPict->type = XRT_PICTURE;
newPict->info[0].id = stuff->pid;
newPict->u.pict.root = FALSE;
for(j = 1; j < PanoramiXNumScreens; j++)
newPict->info[j].id = FakeClientID(client->index);
FOR_NSCREENS_BACKWARD(j) {
stuff->pid = newPict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderCreateSolidFill]) (client);
if(result != Success) break;
}
if (result == Success)
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
xfree(newPict);
return result;
}
static int
PanoramiXRenderCreateLinearGradient (ClientPtr client)
{
REQUEST(xRenderCreateLinearGradientReq);
PanoramiXRes *newPict;
int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateLinearGradientReq);
if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPict->type = XRT_PICTURE;
newPict->info[0].id = stuff->pid;
newPict->u.pict.root = FALSE;
for(j = 1; j < PanoramiXNumScreens; j++)
newPict->info[j].id = FakeClientID(client->index);
FOR_NSCREENS_BACKWARD(j) {
stuff->pid = newPict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderCreateLinearGradient]) (client);
if(result != Success) break;
}
if (result == Success)
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
xfree(newPict);
return result;
}
static int
PanoramiXRenderCreateRadialGradient (ClientPtr client)
{
REQUEST(xRenderCreateRadialGradientReq);
PanoramiXRes *newPict;
int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateRadialGradientReq);
if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPict->type = XRT_PICTURE;
newPict->info[0].id = stuff->pid;
newPict->u.pict.root = FALSE;
for(j = 1; j < PanoramiXNumScreens; j++)
newPict->info[j].id = FakeClientID(client->index);
FOR_NSCREENS_BACKWARD(j) {
stuff->pid = newPict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderCreateRadialGradient]) (client);
if(result != Success) break;
}
if (result == Success)
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
xfree(newPict);
return result;
}
static int
PanoramiXRenderCreateConicalGradient (ClientPtr client)
{
REQUEST(xRenderCreateConicalGradientReq);
PanoramiXRes *newPict;
int result = Success, j;
REQUEST_AT_LEAST_SIZE(xRenderCreateConicalGradientReq);
if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes))))
return BadAlloc;
newPict->type = XRT_PICTURE;
newPict->info[0].id = stuff->pid;
newPict->u.pict.root = FALSE;
for(j = 1; j < PanoramiXNumScreens; j++)
newPict->info[j].id = FakeClientID(client->index);
FOR_NSCREENS_BACKWARD(j) {
stuff->pid = newPict->info[j].id;
result = (*PanoramiXSaveRenderVector[X_RenderCreateConicalGradient]) (client);
if(result != Success) break;
}
if (result == Success)
AddResource(newPict->info[0].id, XRT_PICTURE, newPict);
else
xfree(newPict);
return result;
}
void
PanoramiXRenderInit (void)
{
@ -3263,6 +3395,11 @@ PanoramiXRenderInit (void)
ProcRenderVector[X_RenderTriStrip] = PanoramiXRenderTriStrip;
ProcRenderVector[X_RenderTriFan] = PanoramiXRenderTriFan;
ProcRenderVector[X_RenderAddTraps] = PanoramiXRenderAddTraps;
ProcRenderVector[X_RenderCreateSolidFill] = PanoramiXRenderCreateSolidFill;
ProcRenderVector[X_RenderCreateLinearGradient] = PanoramiXRenderCreateLinearGradient;
ProcRenderVector[X_RenderCreateRadialGradient] = PanoramiXRenderCreateRadialGradient;
ProcRenderVector[X_RenderCreateConicalGradient] = PanoramiXRenderCreateConicalGradient;
}
void