diff options
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 121 |
1 files changed, 96 insertions, 25 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 0918ecfaf..1da3dc8bd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -124,7 +124,9 @@ extern void nxagentRenderCreateConicalGradient(PicturePtr pPicture, xFixed *stops, xRenderColor *colors); +#ifdef NXAGENT_SERVER extern int nxagentAlphaEnabled; +#endif /* * The void pointer is actually a XGlyphElt8. @@ -141,8 +143,13 @@ ProcRenderQueryVersion (ClientPtr client) .type = X_Reply, .sequenceNumber = client->sequence, .length = 0, +#ifdef NXAGENT_SERVER .majorVersion = nxagentRenderVersionMajor, .minorVersion = nxagentRenderVersionMinor +#else + .majorVersion = SERVER_RENDER_MAJOR_VERSION, + .minorVersion = SERVER_RENDER_MINOR_VERSION +#endif }; REQUEST(xRenderQueryVersionReq); @@ -262,7 +269,11 @@ ProcRenderQueryPictFormats (ClientPtr client) pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blueMask = pFormat->direct.blueMask; +#ifdef NXAGENT_SERVER pictForm->direct.alpha = nxagentAlphaEnabled ? pFormat->direct.alpha : 0; +#else + pictForm->direct.alpha = pFormat->direct.alpha; +#endif pictForm->direct.alphaMask = pFormat->direct.alphaMask; if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) pictForm->colormap = pFormat->index.pColormap->mid; @@ -409,7 +420,10 @@ ProcRenderCreatePicture (ClientPtr client) &error); if (!pPicture) return error; +#ifdef NXAGENT_SERVER + /* FIXME: shouldn't this be integrated into CreatePicture? */ nxagentCreatePicture(pPicture, stuff -> mask); +#endif if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; @@ -422,7 +436,6 @@ ProcRenderChangePicture (ClientPtr client) PicturePtr pPicture; REQUEST(xRenderChangePictureReq); int len; - int error; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, @@ -432,12 +445,19 @@ ProcRenderChangePicture (ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), - (DevUnion *) 0, client); +#ifdef NXAGENT_SERVER + { + int error = ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), + (DevUnion *) 0, client); - nxagentChangePicture(pPicture, stuff->mask); + nxagentChangePicture(pPicture, stuff->mask); - return error; + return error; + } +#else + return ChangePicture (pPicture, stuff->mask, (XID *) (stuff + 1), + (DevUnion *) 0, client); +#endif } static int @@ -454,6 +474,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) if (!pPicture->pDrawable) return BadDrawable; +#ifdef NXAGENT_SERVER /* * The original code used sizeof(xRenderChangePictureReq). * This was harmless, as both structures have the same size. @@ -461,18 +482,23 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) * nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); */ nr = (client->req_len << 2) - sizeof(xRenderSetPictureClipRectanglesReq); +#else + nr = (client->req_len << 2) - sizeof(xRenderChangePictureReq); +#endif if (nr & 4) return BadLength; nr >>= 3; result = SetPictureClipRects (pPicture, stuff->xOrigin, stuff->yOrigin, nr, (xRectangle *) &stuff[1]); +#ifdef NXAGENT_SERVER nxagentChangePictureClip (pPicture, CT_NONE, nr, (xRectangle *) &stuff[1], (int)stuff -> xOrigin, (int)stuff -> yOrigin); +#endif if (client->noClientException != Success) return(client->noClientException); @@ -713,6 +739,7 @@ ProcRenderTrapezoids (ClientPtr client) return BadLength; ntraps /= sizeof (xTrapezoid); if (ntraps) +#ifdef NXAGENT_SERVER { if (pFormat != NULL) { @@ -742,6 +769,11 @@ ProcRenderTrapezoids (ClientPtr client) nxagentTrapezoidExtents = NullBox; } } +#else + CompositeTrapezoids (stuff->op, pSrc, pDst, pFormat, + stuff->xSrc, stuff->ySrc, + ntraps, (xTrapezoid *) &stuff[1]); +#endif return client->noClientException; } @@ -793,7 +825,9 @@ ProcRenderCreateGlyphSet (ClientPtr client) if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; +#ifdef NXAGENT_SERVER nxagentCreateGlyphSet(glyphSet); +#endif return Success; } @@ -819,7 +853,9 @@ ProcRenderReferenceGlyphSet (ClientPtr client) } glyphSet->refcnt++; +#ifdef NXAGENT_SERVER nxagentReferenceGlyphSet(glyphSet); +#endif if (!AddResource (stuff->gsid, GlyphSetType, (void *)glyphSet)) return BadAlloc; @@ -843,7 +879,9 @@ ProcRenderFreeGlyphSet (ClientPtr client) return RenderErrBase + BadGlyphSet; } +#ifdef NXAGENT_SERVER nxagentFreeGlyphSet(glyphSet); +#endif FreeResource (stuff->glyphset, RT_NONE); return client->noClientException; @@ -871,7 +909,9 @@ ProcRenderFreeGlyphs (ClientPtr client) nglyph = ((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)) >> 2; gids = (CARD32 *) (stuff + 1); +#ifdef NXAGENT_SERVER nxagentFreeGlyphs(glyphSet, gids, nglyph); +#endif while (nglyph-- > 0) { @@ -913,7 +953,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) int size; int n; +#ifdef NXAGENT_SERVER XGlyphElt8 *elements, *elementsBase; +#endif REQUEST(xRenderCompositeGlyphsReq); @@ -1007,6 +1049,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) } } +#ifdef NXAGENT_SERVER elementsBase = malloc(nlist * sizeof(XGlyphElt8)); if (!elementsBase) { @@ -1016,11 +1059,12 @@ ProcRenderCompositeGlyphs (ClientPtr client) free(listsBase); return BadAlloc; } + elements = elementsBase; +#endif buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; lists = listsBase; - elements = elementsBase; while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; @@ -1028,10 +1072,12 @@ ProcRenderCompositeGlyphs (ClientPtr client) if (elt->len == 0xff) { +#ifdef NXAGENT_SERVER #ifdef DEBUG fprintf(stderr, "ProcRenderCompositeGlyphs: Glyphset change with base size [%d].\n", size); #endif +#endif if (buffer + sizeof (GlyphSet) < end) { @@ -1062,6 +1108,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) lists->format = glyphSet->format; lists->len = 0; +#ifdef NXAGENT_SERVER if (glyphSet -> remoteID == 0) { #ifdef TEST @@ -1077,6 +1124,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) elements -> nchars = elt->len; elements -> xOff = elt->deltax; elements -> yOff = elt->deltay; +#endif n = elt->len; while (n--) { @@ -1103,7 +1151,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) if (space & 3) buffer += 4 - (space & 3); lists++; +#ifdef NXAGENT_SERVER elements++; +#endif } } if (buffer > end) @@ -1118,6 +1168,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) return BadLength; } +#ifdef NXAGENT_SERVER /* * We need to know the glyphs extents to synchronize * the drawables involved in the composite text ope- @@ -1160,17 +1211,28 @@ ProcRenderCompositeGlyphs (ClientPtr client) listsBase, glyphsBase); } - free(nxagentGlyphsExtents); nxagentGlyphsExtents = NullBox; + free(elementsBase); + +#else + CompositeGlyphs (stuff->op, + pSrc, + pDst, + pFormat, + stuff->xSrc, + stuff->ySrc, + nlist, + listsBase, + glyphsBase); +#endif + if (glyphsBase != glyphsLocal) free (glyphsBase); if (listsBase != listsLocal) free (listsBase); - free(elementsBase); - return client->noClientException; } @@ -1203,12 +1265,14 @@ ProcRenderFillRectangles (ClientPtr client) things, (xRectangle *) &stuff[1]); +#ifdef NXAGENT_SERVER ValidatePicture (pDst); nxagentCompositeRects(stuff -> op, pDst, &stuff -> color, things, (xRectangle *) &stuff[1]); +#endif return client->noClientException; } @@ -1231,8 +1295,6 @@ ProcRenderCreateCursor (ClientPtr client) CARD32 twocolor[3]; int ncolor; - RealizeCursorProcPtr saveRealizeCursor; - REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); @@ -1292,7 +1354,7 @@ ProcRenderCreateCursor (ClientPtr client) return (BadImplementation); } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, - CREATE_PIXMAP_USAGE_SCRATCH); + CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free (argbbits); @@ -1402,6 +1464,7 @@ ProcRenderCreateCursor (ClientPtr client) cm.xhot = stuff->x; cm.yhot = stuff->y; +#ifdef NXAGENT_SERVER /* * This cursor uses RENDER, so we make sure * that it is allocated in a way that allows @@ -1411,10 +1474,10 @@ ProcRenderCreateCursor (ClientPtr client) * client. */ - saveRealizeCursor = pScreen -> RealizeCursor; + RealizeCursorProcPtr saveRealizeCursor = pScreen -> RealizeCursor; pScreen -> RealizeCursor = nxagentCursorSaveRenderInfo; - +#endif pCursor = AllocCursorARGB (srcbits, mskbits, argbbits, &cm, GetColor(twocolor[0], 16), GetColor(twocolor[0], 8), @@ -1423,6 +1486,7 @@ ProcRenderCreateCursor (ClientPtr client) GetColor(twocolor[1], 8), GetColor(twocolor[1], 0)); +#ifdef NXAGENT_SERVER pScreen -> RealizeCursor = saveRealizeCursor; /* @@ -1441,8 +1505,8 @@ ProcRenderCreateCursor (ClientPtr client) nxagentCursorPostSaveRenderInfo(pCursor, pScreen, pSrc, stuff -> x, stuff -> y); nxagentRenderRealizeCursor(pScreen, pCursor); - - if (AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) +#endif + if (pCursor && AddResource(stuff->cid, RT_CURSOR, (void *)pCursor)) return (client->noClientException); return BadAlloc; } @@ -1459,8 +1523,10 @@ ProcRenderSetPictureTransform (ClientPtr client) RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); +#ifdef NXAGENT_SERVER nxagentSetPictureTransform(pPicture, &stuff->transform); - +#endif + if (client->noClientException != Success) return(client->noClientException); else @@ -1485,7 +1551,9 @@ ProcRenderSetPictureFilter (ClientPtr client) nparams = ((xFixed *) stuff + client->req_len) - params; result = SetPictureFilter (pPicture, name, stuff->nbytes, params, nparams); +#ifdef NXAGENT_SERVER nxagentSetPictureFilter(pPicture, name, stuff->nbytes, params, nparams); +#endif return result; } @@ -1530,12 +1598,14 @@ ProcRenderCreateAnimCursor (ClientPtr client) if (ret != Success) return ret; +#ifdef NXAGENT_SERVER nxagentAnimCursorBits = pCursor -> bits; for (i = 0; i < MAXSCREENS; i++) { pCursor -> devPriv[i] = NULL; } +#endif if (AddResource (stuff->cid, RT_CURSOR, (void *)pCursor)) return client->noClientException; @@ -1555,11 +1625,11 @@ static int ProcRenderCreateSolidFill(ClientPtr client) pPicture = CreateSolidPicture(stuff->pid, &stuff->color, &error); if (!pPicture) return error; - /* AGENT SERVER */ +#ifdef NXAGENT_SERVER nxagentRenderCreateSolidFill(pPicture, &stuff -> color); +#endif - /* AGENT SERVER */ if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; @@ -1591,12 +1661,12 @@ static int ProcRenderCreateLinearGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - /* AGENT SERVER */ +#ifdef NXAGENT_SERVER nxagentRenderCreateLinearGradient(pPicture, &stuff->p1, &stuff->p2, stuff->nStops, stops, colors); +#endif - /* AGENT SERVER */ if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; @@ -1627,14 +1697,15 @@ static int ProcRenderCreateRadialGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - /* AGENT SERVER */ +#ifdef NXAGENT_SERVER nxagentRenderCreateRadialGradient(pPicture, &stuff->inner, &stuff->outer, stuff->inner_radius, stuff->outer_radius, stuff->nStops, stops, colors); - /* AGENT SERVER */ +#endif + if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; @@ -1664,13 +1735,13 @@ static int ProcRenderCreateConicalGradient (ClientPtr client) stuff->nStops, stops, colors, &error); if (!pPicture) return error; - /* AGENT SERVER */ +#ifdef NXAGENT_SERVER nxagentRenderCreateConicalGradient(pPicture, &stuff->center, stuff->angle, stuff->nStops, stops, colors); +#endif - /* AGENT SERVER */ if (!AddResource (stuff->pid, PictureType, (void *)pPicture)) return BadAlloc; return Success; |