Esempio n. 1
0
void
rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode,
             int npt, DDXPointPtr in_pts)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    int index;
    BoxRec box;

    LLOGLN(10, ("rdpPolyPoint:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolyPointCallCount++;
    rdpRegionInit(&reg, NullBox, 0);
    for (index = 0; index < npt; index++)
    {
        box.x1 = in_pts[index].x + pDrawable->x;
        box.y1 = in_pts[index].y + pDrawable->y;
        box.x2 = box.x1 + 1;
        box.y2 = box.y1 + 1;
        rdpRegionUnionRect(&reg, &box);
    }
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolyPoint: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
Esempio n. 2
0
void rdpPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr in_pts)
{
	RegionRec clip_reg;
	int num_clips;
	int cd;
	int i;
	int j;
	int post_process;
	BoxRec box;
	BoxRec total_box;
	DDXPointPtr pts;
	DDXPointRec stack_pts[32];
	WindowPtr pDstWnd;
	PixmapPtr pDstPixmap;
	rdpPixmapRec *pDstPriv;

	LLOGLN(10, ("rdpPolyPoint:"));
	LLOGLN(10, ("rdpPolyPoint:  npt %d", npt));

	if (npt > 32)
	{
		pts = (DDXPointPtr) g_malloc(sizeof(DDXPointRec) * npt, 0);
	}
	else
	{
		pts = stack_pts;
	}

	for (i = 0; i < npt; i++)
	{
		pts[i].x = pDrawable->x + in_pts[i].x;
		pts[i].y = pDrawable->y + in_pts[i].y;

		if (i == 0)
		{
			total_box.x1 = pts[0].x;
			total_box.y1 = pts[0].y;
			total_box.x2 = pts[0].x;
			total_box.y2 = pts[0].y;
		}
		else
		{
			if (pts[i].x < total_box.x1)
			{
				total_box.x1 = pts[i].x;
			}

			if (pts[i].y < total_box.y1)
			{
				total_box.y1 = pts[i].y;
			}

			if (pts[i].x > total_box.x2)
			{
				total_box.x2 = pts[i].x;
			}

			if (pts[i].y > total_box.y2)
			{
				total_box.y2 = pts[i].y;
			}
		}

		/* todo, use this total_box */
	}

	/* do original call */
	rdpPolyPointOrg(pDrawable, pGC, mode, npt, in_pts);

	post_process = 0;

	if (pDrawable->type == DRAWABLE_PIXMAP)
	{
		pDstPixmap = (PixmapPtr) pDrawable;
		pDstPriv = GETPIXPRIV(pDstPixmap);
	}
	else
	{
		if (pDrawable->type == DRAWABLE_WINDOW)
		{
			pDstWnd = (WindowPtr) pDrawable;

			if (pDstWnd->viewable)
			{
				post_process = 1;
			}
		}
	}

	if (!post_process)
		return;

	RegionInit(&clip_reg, NullBox, 0);
	cd = rdp_get_clip(&clip_reg, pDrawable, pGC);

	if (cd == 1)
	{
		if (npt > 0)
		{
			XRDP_MSG_OPAQUE_RECT msg;

			rdpup_begin_update();

			for (i = 0; i < npt; i++)
			{
				msg.nLeftRect = pts[i].x;
				msg.nTopRect = pts[i].y;
				msg.nWidth = 1;
				msg.nHeight = 1;
				msg.color = rdpup_convert_color(pGC->fgPixel);

				rdpup_opaque_rect(&msg);
			}

			rdpup_end_update();
		}
	}
	else if (cd == 2)
	{
		num_clips = REGION_NUM_RECTS(&clip_reg);

		if (npt > 0 && num_clips > 0)
		{
			XRDP_MSG_OPAQUE_RECT msg;

			rdpup_begin_update();

			for (j = num_clips - 1; j >= 0; j--)
			{
				box = REGION_RECTS(&clip_reg)[j];
				rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);

				for (i = 0; i < npt; i++)
				{
					msg.nLeftRect = pts[i].x;
					msg.nTopRect = pts[i].y;
					msg.nWidth = 1;
					msg.nHeight = 1;
					msg.color = rdpup_convert_color(pGC->fgPixel);

					rdpup_opaque_rect(&msg);
				}
			}

			rdpup_reset_clip();
			rdpup_end_update();
		}
	}

	RegionUninit(&clip_reg);

	if (pts != stack_pts)
	{
		free(pts);
	}
}