xorg: work on offscreen bitmaps

This commit is contained in:
Jay Sorg 2012-05-16 10:14:24 -07:00
parent 26b42fa843
commit da658dc1b4
3 changed files with 61 additions and 21 deletions

View File

@ -33,6 +33,3 @@ static void
rdpDestroyClip(GCPtr pGC); rdpDestroyClip(GCPtr pGC);
static void static void
rdpCopyClip(GCPtr dst, GCPtr src); rdpCopyClip(GCPtr dst, GCPtr src);
static void
rdpPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst,
int w, int h, int x, int y);

View File

@ -54,12 +54,19 @@ Xserver drawing ops and funcs
#define DEBUG_OUT_OPS(arg) ErrorF arg #define DEBUG_OUT_OPS(arg) ErrorF arg
#endif #endif
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; } } while (0)
#define LLOGLN(_level, _args) \
do { if (_level < LOG_LEVEL) { ErrorF _args ; ErrorF("\n"); } } while (0)
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */ extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */ extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */ extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */ extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */ extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */ extern ScreenPtr g_pScreen; /* from rdpmain.c */
extern Bool g_wrapPixmap; /* from rdpmain.c */
ColormapPtr g_rdpInstalledColormap; ColormapPtr g_rdpInstalledColormap;
@ -91,7 +98,34 @@ rdp_get_clip(RegionPtr pRegion, DrawablePtr pDrawable, GCPtr pGC)
int rv; int rv;
rv = 0; rv = 0;
if (pDrawable->type == DRAWABLE_WINDOW) if (pDrawable->type == DRAWABLE_PIXMAP)
{
switch (pGC->clientClipType)
{
case CT_NONE:
rv = 1;
break;
case CT_REGION:
rv = 2;
RegionCopy(pRegion, pGC->clientClip);
break;
default:
rdpLog("unimp clip type %d\n", pGC->clientClipType);
break;
}
if (rv == 2) /* check if the clip is the entire pixmap */
{
box.x1 = 0;
box.y1 = 0;
box.x2 = pDrawable->width;
box.y2 = pDrawable->height;
if (RegionContainsRect(pRegion, &box) == rgnIN)
{
rv = 1;
}
}
}
else if (pDrawable->type == DRAWABLE_WINDOW)
{ {
pWindow = (WindowPtr)pDrawable; pWindow = (WindowPtr)pDrawable;
if (pWindow->viewable) if (pWindow->viewable)
@ -213,27 +247,34 @@ static void
rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d) rdpValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr d)
{ {
rdpGCRec* priv; rdpGCRec* priv;
int viewable; int wrap;
RegionPtr pRegion; RegionPtr pRegion;
DEBUG_OUT_FUNCS(("in rdpValidateGC\n")); LLOGLN(10, ("rdpValidateGC:"));
GC_FUNC_PROLOGUE(pGC); GC_FUNC_PROLOGUE(pGC);
pGC->funcs->ValidateGC(pGC, changes, d); pGC->funcs->ValidateGC(pGC, changes, d);
viewable = d->type == DRAWABLE_WINDOW && ((WindowPtr)d)->viewable; if (g_wrapPixmap)
if (viewable)
{ {
if (pGC->subWindowMode == IncludeInferiors) wrap = 1;
}
else
{
wrap = (d->type == DRAWABLE_WINDOW) && ((WindowPtr)d)->viewable;
if (wrap)
{ {
pRegion = &(((WindowPtr)d)->borderClip); if (pGC->subWindowMode == IncludeInferiors)
{
pRegion = &(((WindowPtr)d)->borderClip);
}
else
{
pRegion = &(((WindowPtr)d)->clipList);
}
wrap = RegionNotEmpty(pRegion);
} }
else
{
pRegion = &(((WindowPtr)d)->clipList);
}
viewable = RegionNotEmpty(pRegion);
} }
priv->ops = 0; priv->ops = 0;
if (viewable) if (wrap)
{ {
priv->ops = pGC->ops; priv->ops = pGC->ops;
} }
@ -351,15 +392,17 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
{ {
PixmapPtr rv; PixmapPtr rv;
rdpPixmapRec* priv; rdpPixmapRec* priv;
int org_width;
//ErrorF("rdpCreatePixmap:\n"); org_width = width;
//ErrorF(" in width %d height %d depth %d\n", width, height, depth); width = (width + 3) & ~3;
LLOGLN(10, ("rdpCreatePixmap: width %d org_width %d", width, org_width));
pScreen->CreatePixmap = g_rdpScreen.CreatePixmap; pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint); rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
priv = GETPIXPRIV(rv); priv = GETPIXPRIV(rv);
priv->status = 1;
pScreen->CreatePixmap = rdpCreatePixmap; pScreen->CreatePixmap = rdpCreatePixmap;
//ErrorF(" out width %d height %d depth %d\n", rv->drawable.width, pScreen->ModifyPixmapHeader(rv, org_width, 0, 0, 0, 0, 0);
// rv->drawable.height, rv->drawable.depth);
return rv; return rv;
} }

View File

@ -43,7 +43,7 @@ DeviceIntPtr g_pointer = 0;
DeviceIntPtr g_keyboard = 0; DeviceIntPtr g_keyboard = 0;
Bool g_wrapWindow = 0; Bool g_wrapWindow = 0;
Bool g_wrapPixmap = 0; Bool g_wrapPixmap = 1;
/* if true, use a unix domain socket instead of a tcp socket */ /* if true, use a unix domain socket instead of a tcp socket */
int g_use_uds = 0; int g_use_uds = 0;