示例#1
0
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
    rdpPtr dev;
    RegionRec clip_reg;
    RegionRec reg;
    int cd;
    int index;
    int x1;
    int y1;
    int x2;
    int y2;
    BoxRec box;

    LLOGLN(10, ("rdpPolySegment:"));
    dev = rdpGetDevFromScreen(pGC->pScreen);
    dev->counts.rdpPolySegmentCallCount++;
    rdpRegionInit(&reg, NullBox, 0);
    for (index = 0; index < nseg; index++)
    {
        x1 = pSegs[index].x1 + pDrawable->x;
        y1 = pSegs[index].y1 + pDrawable->y;
        x2 = pSegs[index].x2 + pDrawable->x;
        y2 = pSegs[index].y2 + pDrawable->y;
        box.x1 = RDPMIN(x1, x2);
        box.y1 = RDPMIN(y1, y2);
        box.x2 = RDPMAX(x1, x2) + 1;
        box.y2 = RDPMAX(y1, y2) + 1;
        rdpRegionUnionRect(&reg, &box);
    }
    rdpRegionInit(&clip_reg, NullBox, 0);
    cd = rdpDrawGetClip(dev, &clip_reg, pDrawable, pGC);
    LLOGLN(10, ("rdpPolySegment: cd %d", cd));
    if (cd == XRDP_CD_CLIP)
    {
        rdpRegionIntersect(&reg, &clip_reg, &reg);
    }
    /* do original call */
    rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);
    if (cd != XRDP_CD_NODRAW)
    {
        rdpClientConAddAllReg(dev, &reg, pDrawable);
    }
    rdpRegionUninit(&clip_reg);
    rdpRegionUninit(&reg);
}
示例#2
0
void
rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment* pSegs)
{
  RegionRec clip_reg;
  int cd;
  int i;
  int j;
  int got_id;
  xSegment* segs;
  BoxRec box;
  struct image_data id;
  WindowPtr pDstWnd;
  PixmapPtr pDstPixmap;
  rdpPixmapRec* pDstPriv;

  LLOGLN(10, ("rdpPolySegment:"));

  segs = 0;
  if (nseg) /* get the rects */
  {
    segs = (xSegment*)g_malloc(nseg * sizeof(xSegment), 0);
    for (i = 0; i < nseg; i++)
    {
      segs[i].x1 = pSegs[i].x1 + pDrawable->x;
      segs[i].y1 = pSegs[i].y1 + pDrawable->y;
      segs[i].x2 = pSegs[i].x2 + pDrawable->x;
      segs[i].y2 = pSegs[i].y2 + pDrawable->y;
    }
  }

  /* do original call */
  rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);

  got_id = 0;
  if (pDrawable->type == DRAWABLE_PIXMAP)
  {
    pDstPixmap = (PixmapPtr)pDrawable;
    pDstPriv = GETPIXPRIV(pDstPixmap);
    if (XRDP_IS_OS(pDstPriv))
    {
      rdpup_switch_os_surface(pDstPriv->rdpindex);
      rdpup_get_pixmap_image_rect(pDstPixmap, &id);
      got_id = 1;
    }
  }
  else
  {
    if (pDrawable->type == DRAWABLE_WINDOW)
    {
      pDstWnd = (WindowPtr)pDrawable;
      if (pDstWnd->viewable)
      {
        rdpup_get_screen_image_rect(&id);
        got_id = 1;
      }
    }
  }
  if (!got_id)
  {
    g_free(segs);
    return;
  }

  RegionInit(&clip_reg, NullBox, 0);
  cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
  if (cd == 1) /* no clip */
  {
    if (segs != 0)
    {
      rdpup_begin_update();
      rdpup_set_fgcolor(pGC->fgPixel);
      rdpup_set_opcode(pGC->alu);
      rdpup_set_pen(0, pGC->lineWidth);
      for (i = 0; i < nseg; i++)
      {
        rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
      }
      rdpup_set_opcode(GXcopy);
      rdpup_end_update();
    }
  }
  else if (cd == 2) /* clip */
  {
    if (segs != 0)
    {
      rdpup_begin_update();
      rdpup_set_fgcolor(pGC->fgPixel);
      rdpup_set_opcode(pGC->alu);
      rdpup_set_pen(0, pGC->lineWidth);
      for (j = REGION_NUM_RECTS(&clip_reg) - 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 < nseg; i++)
        {
          rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
        }
      }
      rdpup_reset_clip();
      rdpup_set_opcode(GXcopy);
      rdpup_end_update();
    }
  }
  g_free(segs);
  RegionUninit(&clip_reg);
  rdpup_switch_os_surface(-1);
}
示例#3
0
void rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
	RegionRec clip_reg;
	int cd;
	int i;
	int j;
	int post_process;
	xSegment *segs;
	BoxRec box;
	WindowPtr pDstWnd;
	PixmapPtr pDstPixmap;
	rdpPixmapRec *pDstPriv;

	LLOGLN(10, ("rdpPolySegment:"));
	LLOGLN(10, ("  nseg %d", nseg));

	segs = 0;

	if (nseg) /* get the rects */
	{
		segs = (xSegment*) g_malloc(nseg * sizeof(xSegment), 0);

		for (i = 0; i < nseg; i++)
		{
			segs[i].x1 = pSegs[i].x1 + pDrawable->x;
			segs[i].y1 = pSegs[i].y1 + pDrawable->y;
			segs[i].x2 = pSegs[i].x2 + pDrawable->x;
			segs[i].y2 = pSegs[i].y2 + pDrawable->y;
		}
	}

	/* do original call */
	rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);

	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)
	{
		free(segs);
		return;
	}

	RegionInit(&clip_reg, NullBox, 0);
	cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
	LLOGLN(10, ("rdpPolySegment: cd %d", cd));

	if (cd == 1) /* no clip */
	{
		if (segs != 0)
		{
			XRDP_MSG_LINE_TO msg;

			rdpup_begin_update();

			msg.bRop2 = rdpup_convert_opcode(pGC->alu);
			msg.penColor = rdpup_convert_color(pGC->fgPixel);
			msg.penWidth = pGC->lineWidth;
			msg.penStyle = 0;

			for (i = 0; i < nseg; i++)
			{
				msg.nXStart = segs[i].x1;
				msg.nYStart = segs[i].y1;
				msg.nXEnd = segs[i].x2;
				msg.nYEnd = segs[i].y2;
				rdpup_draw_line(&msg);
			}

			rdpup_end_update();
		}
	}
	else if (cd == 2) /* clip */
	{
		if (segs != 0)
		{
			XRDP_MSG_LINE_TO msg;

			rdpup_begin_update();

			msg.bRop2 = rdpup_convert_opcode(pGC->alu);
			msg.penColor = rdpup_convert_color(pGC->fgPixel);
			msg.penWidth = pGC->lineWidth;
			msg.penStyle = 0;

			for (j = REGION_NUM_RECTS(&clip_reg) - 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 < nseg; i++)
				{
					msg.nXStart = segs[i].x1;
					msg.nYStart = segs[i].y1;
					msg.nXEnd = segs[i].x2;
					msg.nYEnd = segs[i].y2;
					rdpup_draw_line(&msg);
				}
			}

			rdpup_reset_clip();
			rdpup_end_update();
		}
	}

	free(segs);
	RegionUninit(&clip_reg);
}
示例#4
0
void rdpPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSegs)
{
	RegionRec clip_reg;
	int cd;
	int i;
	int j;
	int got_id;
	int dirty_type;
	int post_process;
	int reset_surface;
	xSegment *segs;
	BoxRec box;
	struct image_data id;
	WindowPtr pDstWnd;
	PixmapPtr pDstPixmap;
	rdpPixmapRec *pDstPriv;
	rdpPixmapRec *pDirtyPriv;

	LLOGLN(10, ("rdpPolySegment:"));
	LLOGLN(10, ("  nseg %d", nseg));

	segs = 0;

	if (nseg) /* get the rects */
	{
		segs = (xSegment *)g_malloc(nseg * sizeof(xSegment), 0);

		for (i = 0; i < nseg; i++)
		{
			segs[i].x1 = pSegs[i].x1 + pDrawable->x;
			segs[i].y1 = pSegs[i].y1 + pDrawable->y;
			segs[i].x2 = pSegs[i].x2 + pDrawable->x;
			segs[i].y2 = pSegs[i].y2 + pDrawable->y;
		}
	}

	/* do original call */
	rdpPolySegmentOrg(pDrawable, pGC, nseg, pSegs);

	dirty_type = 0;
	pDirtyPriv = 0;
	post_process = 0;
	reset_surface = 0;
	got_id = 0;

	if (pDrawable->type == DRAWABLE_PIXMAP)
	{
		pDstPixmap = (PixmapPtr)pDrawable;
		pDstPriv = GETPIXPRIV(pDstPixmap);

		if (xrdp_is_os(pDstPixmap, pDstPriv))
		{
			post_process = 1;

			if (g_do_dirty_os)
			{
				LLOGLN(10, ("rdpPolySegment: gettig dirty"));
				pDstPriv->is_dirty = 1;
				pDirtyPriv = pDstPriv;
				dirty_type = RDI_IMGLL;
			}
			else
			{
				rdpup_switch_os_surface(pDstPriv->rdpindex);
				reset_surface = 1;
				rdpup_get_pixmap_image_rect(pDstPixmap, &id);
				got_id = 1;
			}
		}
	}
	else
	{
		if (pDrawable->type == DRAWABLE_WINDOW)
		{
			pDstWnd = (WindowPtr)pDrawable;

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

				if (g_do_dirty_ons)
				{
					LLOGLN(0, ("rdpPolySegment: gettig dirty"));
					g_screenPriv.is_dirty = 1;
					pDirtyPriv = &g_screenPriv;
					dirty_type = RDI_IMGLL;
				}
				else
				{
					rdpup_get_screen_image_rect(&id);
					got_id = 1;
				}
			}
		}
	}

	if (!post_process)
	{
		g_free(segs);
		return;
	}

	RegionInit(&clip_reg, NullBox, 0);
	cd = rdp_get_clip(&clip_reg, pDrawable, pGC);
	LLOGLN(10, ("rdpPolySegment: cd %d", cd));

	if (cd == 1) /* no clip */
	{
		if (segs != 0)
		{
			if (dirty_type != 0)
			{
				RegionUninit(&clip_reg);
				RegionInit(&clip_reg, NullBox, 0);
				RegionAroundSegs(&clip_reg, segs, nseg);
				draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
						pGC->alu, pGC->lineWidth, segs, nseg, 1);
			}
			else if (got_id)
			{
				rdpup_begin_update();
				rdpup_set_fgcolor(pGC->fgPixel);
				rdpup_set_opcode(pGC->alu);
				rdpup_set_pen(0, pGC->lineWidth);

				for (i = 0; i < nseg; i++)
				{
					rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
				}

				rdpup_set_opcode(GXcopy);
				rdpup_end_update();
			}
		}
	}
	else if (cd == 2) /* clip */
	{
		if (segs != 0)
		{
			if (dirty_type != 0)
			{
				draw_item_add_line_region(pDirtyPriv, &clip_reg, pGC->fgPixel,
						pGC->alu, pGC->lineWidth, segs, nseg, 1);
			}
			else if (got_id)
			{
				rdpup_begin_update();
				rdpup_set_fgcolor(pGC->fgPixel);
				rdpup_set_opcode(pGC->alu);
				rdpup_set_pen(0, pGC->lineWidth);

				for (j = REGION_NUM_RECTS(&clip_reg) - 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 < nseg; i++)
					{
						rdpup_draw_line(segs[i].x1, segs[i].y1, segs[i].x2, segs[i].y2);
						LLOGLN(10, ("  %d %d %d %d", segs[i].x1, segs[i].y1,
								segs[i].x2, segs[i].y2));
					}
				}

				rdpup_reset_clip();
				rdpup_set_opcode(GXcopy);
				rdpup_end_update();
			}
		}
	}

	g_free(segs);
	RegionUninit(&clip_reg);

	if (reset_surface)
	{
		rdpup_switch_os_surface(-1);
	}
}