Esempio n. 1
0
/* returns rect in X coordinates BUT without menuHeight deviation */
void
prima_gp_get_clip_rect( Handle self, XRectangle *cr, Bool for_internal_paints)
{
	DEFXX;
	XRectangle r;

	cr-> x = 0;
	cr-> y = 0;
	cr-> width = XX-> size.x;
	cr-> height = XX-> size.y;
	if ( XF_IN_PAINT(XX) && XX-> paint_region) {
		XClipBox( XX-> paint_region, &r);
		prima_rect_intersect( cr, &r);
	}
	if ( XX-> clip_rect. x != 0
		|| XX-> clip_rect. y != 0
		|| XX-> clip_rect. width != XX-> size.x
		|| XX-> clip_rect. height != XX-> size.y) {
		prima_rect_intersect( cr, &XX-> clip_rect);
	}

	if ( for_internal_paints) {
		cr-> x += XX-> btransform. x;
		cr-> y -= XX-> btransform. y;
	}
}
Esempio n. 2
0
void X11Factory::getMonitorInfo( const GenericWindow &rWindow,
                                 int* p_x, int* p_y,
                                 int* p_width, int* p_height ) const
{
    // initialize to default geometry
    *p_x = 0;
    *p_y = 0;
    *p_width = getScreenWidth();
    *p_height = getScreenHeight();

    // Use Xinerama to determine the monitor where the video
    // mostly resides (biggest surface)
    Display *pDisplay = m_pDisplay->getDisplay();
    Window wnd = (Window)rWindow.getOSHandle();
    Window root = DefaultRootWindow( pDisplay );
    Window child_wnd;

    int x, y;
    unsigned int w, h, border, depth;
    XGetGeometry( pDisplay, wnd, &root, &x, &y, &w, &h, &border, &depth );
    XTranslateCoordinates( pDisplay, wnd, root, 0, 0, &x, &y, &child_wnd );

    int num;
    XineramaScreenInfo* info = XineramaQueryScreens( pDisplay, &num );
    if( info )
    {
        Region reg1 = XCreateRegion();
        XRectangle rect1 = { (short)x, (short)y, (unsigned short)w, (unsigned short)h };
        XUnionRectWithRegion( &rect1, reg1, reg1 );

        unsigned int surface = 0;
        for( int i = 0; i < num; i++ )
        {
            Region reg2 = XCreateRegion();
            XRectangle rect2 = { info[i].x_org, info[i].y_org,
                                 (unsigned short)info[i].width, (unsigned short)info[i].height };
            XUnionRectWithRegion( &rect2, reg2, reg2 );

            Region reg = XCreateRegion();
            XIntersectRegion( reg1, reg2, reg );
            XRectangle rect;
            XClipBox( reg, &rect );
            unsigned int surf = rect.width * rect.height;
            if( surf > surface )
            {
               surface = surf;
               *p_x = info[i].x_org;
               *p_y = info[i].y_org;
               *p_width = info[i].width;
               *p_height = info[i].height;
            }
            XDestroyRegion( reg );
            XDestroyRegion( reg2 );
        }
        XDestroyRegion( reg1 );
        XFree( info );
    }
}
Esempio n. 3
0
Bool
apc_gp_set_region( Handle self, Handle rgn)
{
	DEFXX;
	Region region;
	PRegionSysData r;

	if ( PObject( self)-> options. optInDrawInfo) return false;
	if ( !XF_IN_PAINT(XX)) return false;

	if (rgn == nilHandle) {
		Rect r;
		r. left   = 0;
		r. bottom = 0;
		r. right  = XX-> size. x - 1;
		r. top	  = XX-> size. y - 1;
		return apc_gp_set_clip_rect( self, r);
	}

	r = GET_REGION(rgn);

	XClipBox( r-> region, &XX-> clip_rect);
	XX-> clip_rect. y += XX-> size. y - r-> height;
	XX-> clip_mask_extent. x = XX-> clip_rect. width;
	XX-> clip_mask_extent. y = XX-> clip_rect. height;
	if ( XX-> clip_rect. width == 0 || XX-> clip_rect. height == 0) {
		Rect r;
		r. left   = -1;
		r. bottom = -1;
		r. right  = -1;
		r. top	  = -1;
		return apc_gp_set_clip_rect( self, r);
	}

	region = XCreateRegion();
	XUnionRegion( region, r-> region, region);
	/* offset region if drawable is buffered */
	XOffsetRegion( region, XX-> btransform. x, XX-> size.y - r-> height - XX-> btransform. y);
	/* otherwise ( and only otherwise ), and if there's a
		X11 clipping, intersect the region with it. X11 clipping
		must not mix with the buffer clipping */
	if (( !XX-> udrawable || XX-> udrawable == XX-> gdrawable) &&
		XX-> paint_region)
		XIntersectRegion( region, XX-> paint_region, region);
	XSetRegion( DISP, XX-> gc, region);
	if ( XX-> flags. kill_current_region)
		XDestroyRegion( XX-> current_region);
	XX-> flags. kill_current_region = 1;
	XX-> current_region = region;
	XX-> flags. xft_clip = 0;
#ifdef USE_XFT
	if ( XX-> xft_drawable) prima_xft_update_region( self);
#endif
#ifdef HAVE_X11_EXTENSIONS_XRENDER_H
	if ( XX-> argb_picture ) XRenderSetPictureClipRegion(DISP, XX->argb_picture, region);
#endif
	return true;
}
Esempio n. 4
0
static PyObject *
region_ClipBox(PaxRegionObject *self, PyObject *args)
{
    XRectangle r;

    if (!PyArg_ParseTuple(args, ""))
	return NULL;
    XClipBox(self->region, &r);
    return Py_BuildValue("(iiii)", r.x, r.y, r.width, r.height);
}
Esempio n. 5
0
// Return bounding box
FXRectangle FXRegion::bounds() const {
#ifdef WIN32
  RECT rect;
  GetRgnBox((HRGN)region,&rect);
  return FXRectangle((FXshort)rect.left,(FXshort)rect.top,(FXshort)(rect.right-rect.left),(FXshort)(rect.bottom-rect.top));
#else
  XRectangle rect;
  XClipBox((Region)region,&rect);
  return FXRectangle(rect.x,rect.y,rect.width,rect.height);
#endif
  }
Esempio n. 6
0
Box
apc_region_get_box( Handle self)
{
	Box box;
	XRectangle xr;
	XClipBox( REGION, &xr);
	box. x	    = xr. x;
	box. y	    = HEIGHT - xr. height - xr.y;
	box. width  = xr. width;
	box. height = xr. height;
	return box;
}
Esempio n. 7
0
// Return bounding box
FXRectangle FXRegion::bounds() const {
  FXRectangle result;
#ifndef WIN32
  XClipBox((Region)region,(XRectangle*)&result);
#else
  RECT rect;
  GetRgnBox((HRGN)region,&rect);
  result.x=(FXshort)rect.left;
  result.y=(FXshort)rect.top;
  result.w=(FXshort)(rect.right-rect.left);
  result.h=(FXshort)(rect.bottom-rect.top);
#endif
  return result;
  }
Esempio n. 8
0
/* ARGSUSED */
static void
Redisplay(Widget w, XEvent *event, Region region)
{
	DviWidget	dw = (DviWidget) w;
	XRectangle	extents;
	
	XClipBox (region, &extents);
	dw->dvi.extents.x1 = extents.x;
	dw->dvi.extents.y1 = extents.y;
	dw->dvi.extents.x2 = extents.x + extents.width;
	dw->dvi.extents.y2 = extents.y + extents.height;
	ShowDvi (dw);

	event = event;		/* unused; suppress compiler warning */
}
Esempio n. 9
0
/* lpStruct - Pointer to RECT */
DWORD
DrvRegionsRegionBox(LPARAM dwParm1, LPARAM dwParm2, LPVOID lpStruct)
{
	XRectangle xRect;
	LPRECT lpRect;
	
	if (!(lpRect = (LPRECT)lpStruct))
		return (DWORD)ERROR;

	XClipBox((Region)dwParm1, &xRect);
	lpRect->left = xRect.x;
	lpRect->top = xRect.y;
	lpRect->right = xRect.x + xRect.width;
	lpRect->bottom = xRect.y + xRect.height;

	return (DWORD)(IsRectEmpty(lpRect)?
			NULLREGION:COMPLEXREGION);
}
Esempio n. 10
0
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
{
#if 0
    if (m_refData)
    {
        XRectangle rect;
        XClipBox( M_REGIONDATA->m_region, &rect );
        x = rect.x;
        y = rect.y;
        w = rect.width;
        h = rect.height;
    }
    else
    {
        x = 0;
        y = 0;
        w = -1;
        h = -1;
    }
#endif
}
Esempio n. 11
0
static void
update (Display *display,
	Pixmap   pixmap,
	Window   window,
	Region  *update_region)
{
  GC gc;
  XRectangle extents;

  XClipBox (*update_region, &extents);

  gc = XCreateGC (display, pixmap, 0, NULL);

  XCopyArea (display, pixmap, window, gc,
	     extents.x, extents.y,
	     extents.width, extents.height,
	     extents.x, extents.y);

  XFreeGC (display, gc);
	     
  XDestroyRegion (*update_region);
  *update_region = NULL;
}
Esempio n. 12
0
bool wxRegion::DoGetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
{
    if (m_refData)
    {
        XRectangle rect;
        XClipBox( M_REGIONDATA->m_region, &rect );
        x = rect.x;
        y = rect.y;
        w = rect.width;
        h = rect.height;

        return true;
    }
    else
    {
        x = 0;
        y = 0;
        w = -1;
        h = -1;

        return false;
    }
}
Esempio n. 13
0
// return rectangle surrounding intersection of this rectangle and clip,
int Fl_Device::clip_box(int x, int y, int w, int h, int& X, int& Y, int& W, int& H)
{
    Region r = rstack[rstackptr];
    if (!r) {X = x; Y = y; W = w; H = h; return 0;}
    // Test against the window to get 16-bit values (this is only done if
    // a clip region exists as otherwise it breaks fl_push_no_clip()):
    int ret = 1;
    int dx = x; 
	int dy = y; 
	fl_transform(x,y); 
	dx = x-dx; 
	dy = y-dy;
    if (x < 0) { w += x; x = 0; ret = 2; }
    int t = Fl_Window::current()->w(); 
	if (x+w > t) { w = t-x; ret = 2; }
    if (y < 0) { h += y; y = 0; ret = 2; }
    t = Fl_Window::current()->h(); 
	if (y+h > t) { h = t-y; ret = 2; }
    
	// check for total clip (or for empty rectangle):
    if (w <= 0 || h <= 0) { W = H = 0; return 0; }

#ifndef _WIN32
    switch (XRectInRegion(r, x, y, w, h))
    {
        case 0:                  // completely outside
            W = H = 0;
            return 0;
        case 1:                  // completely inside:
            X = x-dx;
            Y = y-dy;
            W = w; H = h;
            return ret;
        default:                 // partial:
        {
            Region rr = XRectangleRegion(x,y,w,h);
            Region temp = XCreateRegion();
            XIntersectRegion(r, rr, temp);
            XRectangle rect;
            XClipBox(temp, &rect);
            X = rect.x-dx; Y = rect.y-dy; W = rect.width; H = rect.height;
            XDestroyRegion(temp);
            XDestroyRegion(rr);
            return 2;
        }
    }
#else
    // The win32 API makes no distinction between partial and complete
    // intersection, so we have to check for partial intersection ourselves.
    // However, given that the regions may be composite, we have to do
    // some voodoo stuff...
    Region rr = XRectangleRegion(x,y,w,h);
    Region temp = CreateRectRgn(0,0,0,0);
	
    if (CombineRgn(temp, rr, r, RGN_AND) == NULLREGION) {
		// disjoint
        W = H = 0;
        ret = 0;
    }
    else if (EqualRgn(temp, rr)) {
		// complete
        X = x-dx;
        Y = y-dy;
        W = w; H = h;
        // ret = ret
    } else {
		// parital intersection
        RECT rect;
        GetRgnBox(temp, &rect);
        X = rect.left-dx; Y = rect.top-dy;
        W = rect.right - rect.left; H = rect.bottom - rect.top;
        ret = 2;
    }
    DeleteObject(temp);
    DeleteObject(rr);
    return ret;
#endif
}
Esempio n. 14
0
static void drawimage (Display *dpy, Drawable dbl, Region region,
					   FGC fgc, Model *m, float fmin, float fmax, int style)
{
  int scr=-1;
  int x,y,width,height;
  int i,j,k,line,iline,jline,widthpad;
  unsigned long pmin,pmax,p;

  float fx,fy,s,base,scale;
  Tri *t=NULL;
  TriAttributes *ta;
  XRectangle rect;
  XImage *image=NULL;
  int bitmap_pad=0;
  int nbpr=0;


	 

#if 0 /* OLD VERSION . See JG fix below */ 
  unsigned char *data=NULL;

  scr=DefaultScreen(dpy);

  /* Kludge to fix problem with XCreateImage introduced in */
  /* Xorg 7.0 update for security */
 
  if (BitmapPad(dpy)>16) {
	bitmap_pad = 16;
  } else if (BitmapPad(dpy) < 16) {
	bitmap_pad = 8;
  }


  /* determine smallest box enclosing region */
  XClipBox(region,&rect);
  x = rect.x;  y = rect.y;  width = rect.width;  height = rect.height;
  if (width==0 || height==0) return;

  /* allocate memory for image data */
  widthpad = (1+(width-1)/bitmap_pad)*bitmap_pad;
  nbpr = widthpad-1;

  data = alloc1(widthpad*height,sizeof(unsigned char));
  if (data==NULL) err("width,widthpad,height = %d %d %d",
					  width,widthpad,height);

  warn("nbpr = %d  widthpad = %d height = %d bitmap_pad = %d ",
	   nbpr,widthpad,height,bitmap_pad);
  /* determine min and max pixels from standard colormap */
  pmin = XtcwpGetFirstPixel(dpy);  
  pmax = XtcwpGetLastPixel(dpy);

  /* determine base and scale factor */
  scale = (fmax!=fmin) ? ((float) (pmax-pmin))/(fmax-fmin) : 0.0;
  base = ((float) pmin)-fmin*scale;
	
  /* loop over scan lines */
  for (line=0; line<height; line++) {
	iline = line*width;
	jline = line*widthpad;
		
	/* loop over pixels in scan line */
	for (i=iline,j=jline,k=0; k<width; ++i,++j,++k) {
		
	  /* determine float x and y coordinates */
	  if (style==XtcwpNORMAL) {
		fx = MapX(fgc,x+k);
		fy = MapY(fgc,y+line);
	  } else {
		fx = MapY(fgc,y+line);
		fy = MapX(fgc,x+k);
	  }
			
	  /* determine sloth */
	  t = insideTriInModel(m,t,fx,fy);
	  ta = (TriAttributes*)t->fa;
	  s = ta->s00+fy*ta->dsdx+fx*ta->dsdz;
			
	  /* convert to pixel and put in image */
	  p = (unsigned long) (base+s*scale);
	  if (p<pmin) p = pmin;
	  if (p>pmax) p = pmax;
	  data[j] = (unsigned char) p;
	}
	for (j=jline+width,k=width; k<widthpad; ++j,++k)
	  data[j] = data[jline+width-1];
  }
  
	
  /* create, put, and destroy image */
  image = XCreateImage(	(Display *) dpy,
						(Visual *) DefaultVisual(dpy,scr),
						(unsigned int) DefaultDepth(dpy,scr),
						(int)ZPixmap,
						(int) 0,
						(char*)data,
						(unsigned int) widthpad,
						(unsigned int) height,
						(int) bitmap_pad, 
						(int) nbpr);

#else
  char *data=NULL;
  char noCmap;

  scr=DefaultScreen(dpy);

  /* JG: get bitmap_pad from X */ 
  bitmap_pad = BitmapPad(dpy);
	
  /* determine smallest box enclosing region */
  XClipBox(region,&rect);
  x = rect.x;  y = rect.y;  width = rect.width;  height = rect.height;
  if (width==0 || height==0) return;

  /* allocate memory for image data */
  widthpad = (1+(width-1)/bitmap_pad)*bitmap_pad;
  nbpr = widthpad-1;

  /* create image & determine alloc size from X */
  image = XCreateImage(	(Display *) dpy,
						(Visual *) DefaultVisual(dpy,scr),
						(unsigned int) DefaultDepth(dpy,scr),
						(int)ZPixmap,
						(int) 0,
						NULL ,
						(unsigned int) widthpad,
						(unsigned int) height,
						(int) bitmap_pad, 
						0);
  /* JG XCreateImage(....,0)  gets X to compute the size it needs. Then we alloc. */
  image->data = (char *)calloc(image->bytes_per_line, image->height);
  if (image->data==NULL) err("width,widthpad,height = %d %d %d",
					  width,widthpad,height);

  /* warn("nbpr = %d  widthpad = %d height = %d bitmap_pad = %d ", nbpr,widthpad,height,bitmap_pad); */
  /* determine min and max pixels from standard colormap */
  pmin = XtcwpGetFirstPixel(dpy);  
  pmax = XtcwpGetLastPixel(dpy);
  /* JGHACK ... When colormap fails, we get pmax=pmin=0 */
  noCmap = (pmax==0 && pmin==0) ? 1:0;
  if (noCmap) 
	{
	  pmax = 255; 
	  warn("No colormap found....");
	}
  /* ...JGHACK */

  /* determine base and scale factor */
  scale = (fmax!=fmin) ? ((float) (pmax-pmin))/(fmax-fmin) : 0.0;
  base = ((float) pmin)-fmin*scale;
	

  data = (char *)image->data ;
  /* loop over scan lines */
  for (line=0; line<height; line++) {
	iline = line*width;
	jline = line*widthpad;
		
	/* loop over pixels in scan line */
	for (i=iline,j=jline,k=0; k<width; ++i,++j,++k) {
		
	  /* determine float x and y coordinates */
	  if (style==XtcwpNORMAL) {
		fx = MapX(fgc,x+k);
		fy = MapY(fgc,y+line);
	  } else {
		fx = MapY(fgc,y+line);
		fy = MapX(fgc,x+k);
	  }
			
	  /* determine sloth */
	  t = insideTriInModel(m,t,fx,fy);
	  ta = (TriAttributes*)t->fa;
	  s = ta->s00+fy*ta->dsdx+fx*ta->dsdz;
			
	  /* convert to pixel and put in image */
	  p = (unsigned long) (base+s*scale);
	  if (p<pmin) p = pmin;
	  if (p>pmax) p = pmax;

	  if (noCmap) 
		{
		  /* JG. Can't get colormap. Might as well write RGB pixels as grayscale */
		  XPutPixel(image,k,line, p | (p<<8)| (p<<16));
		}
	  else 
		{
		  /* original */
		  /* data[j] = (unsigned char) p; */
		  XPutPixel(image,k,line,p);
		}
	}
	/* original. Not sure this is needed JG */
	/*
	  for (j=jline+width,k=width; k<widthpad; ++j,++k) data[j] = data[jline+width-1]; 
	*/
  }
	

#endif

  XPutImage(dpy,dbl,fgc->gc,image,0,0,x,y,image->width,image->height);

  /* free(data); */
  XDestroyImage(image);
}
Esempio n. 15
0
static void sRegionBoundingRect(Region region,sRect &r)
{
  XRectangle rect;
  XClipBox(region,&rect);
  r.Init(rect.x,rect.y,rect.x+rect.width,rect.y+rect.height);
}
Esempio n. 16
0
*/ static void process_gobs(REBCMP_CTX* ctx, REBGOB* gob)
/*
**	Recursively process and compose gob and its children.
**
** NOTE: this function is used internally by rebcmp_compose() call only.
**
***********************************************************************/
{
	//RL_Print("process_gobs: %x\n", gob);

	REBINT x = ROUND_TO_INT(ctx->absOffset.x);
	REBINT y = ROUND_TO_INT(ctx->absOffset.y);
	REBYTE* color;
	Region saved_win_region = XCreateRegion();

	if (GET_GOB_STATE(gob, GOBS_NEW)){
		//reset old-offset and old-size if newly added
		GOB_XO(gob) = GOB_LOG_X(gob);
		GOB_YO(gob) = GOB_LOG_Y(gob);
		GOB_WO(gob) = GOB_LOG_W(gob);
		GOB_HO(gob) = GOB_LOG_H(gob);

		CLR_GOB_STATE(gob, GOBS_NEW);
	}

	//intersect gob dimensions with actual window clip region
	REBOOL valid_intersection = 1;

	
	//------------------------------
	//Put backend specific code here
	//------------------------------
	XRectangle rect;
	rect.x = x;
	rect.y = y;
	rect.width = GOB_LOG_W(gob);
	rect.height = GOB_LOG_H(gob);
	/*
	RL_Print("gob        , left: %d,\ttop: %d,\tright: %d,\tbottom: %d\n",
			 rect.x,
			 rect.y,
			 rect.x + rect.width,
			 rect.y + rect.height);
	*/

	Region reg = XCreateRegion();
	XUnionRectWithRegion(&rect, reg, reg);
	/*
	XClipBox(ctx->Win_Region, &rect);
	RL_Print("Win Region , left: %d,\ttop: %d,\tright: %d,\tbottom: %d\n",
			 rect.x,
			 rect.y,
			 rect.x + rect.width,
			 rect.y + rect.height);
	*/
	XUnionRegion(saved_win_region, ctx->Win_Region, saved_win_region);
	XIntersectRegion(reg, ctx->Win_Region, ctx->Win_Region);
	XClipBox(ctx->Win_Region, &rect);
	/*
	RL_Print("Win and Gob, left: %d,\ttop: %d,\tright: %d,\tbottom: %d\n",
			 rect.x,
			 rect.y,
			 rect.x + rect.width,
			 rect.y + rect.height);
			 */

	//get the current Window clip box
	REBRECT gob_clip = {
		rect.x, //left
		rect.y, //top
		rect.width + rect.x, //right
		rect.height + rect.y //bottom
			/*
		GOB_LOG_X(gob), //left
		GOB_LOG_Y(gob), //top
		GOB_LOG_W(gob) + GOB_LOG_X(gob), //right
		GOB_LOG_H(gob) + GOB_LOG_Y(gob), //bottom
		*/
	};

	//RL_Print("Window_Buffer: 0x%x\n", ctx->Window_Buffer);
	/*
	RL_Print("gob clip   , left: %d,\ttop: %d,\tright: %d,\tbottom: %d\n",
			 gob_clip.left,
			 gob_clip.top,
			 gob_clip.right,
			 gob_clip.bottom);
			 */
	if (!XEmptyRegion(ctx->Win_Region))
	//if (valid_intersection)
	{
		//render GOB content
		switch (GOB_TYPE(gob)) {
			case GOBT_COLOR:
				//------------------------------
				//Put backend specific code here
				//------------------------------
				// or use the similar draw api call:
				//RL_Print("Draw Color at: %d, %d\n", x, y);
				rebdrw_gob_color(gob, ctx->Window_Buffer, ctx->winBufSize, (REBXYI){x,y}, (REBXYI){gob_clip.left, gob_clip.top}, (REBXYI){gob_clip.right, gob_clip.bottom});
				break;

			case GOBT_IMAGE:
				{
				//RL_Print("Draw Image\n");
					//------------------------------
					//Put backend specific code here
					//------------------------------
					// or use the similar draw api call:
					rebdrw_gob_image(gob, ctx->Window_Buffer, ctx->winBufSize, (REBXYI){x,y}, (REBXYI){gob_clip.left, gob_clip.top}, (REBXYI){gob_clip.right, gob_clip.bottom});
				}
				break;

			case GOBT_DRAW:
				{
				//RL_Print("Draw Draw at: %d, %d\n", x, y);
					//------------------------------
					//Put backend specific code here
					//------------------------------
					// or use the similar draw api call:
					rebdrw_gob_draw(gob, ctx->Window_Buffer ,ctx->winBufSize, (REBXYI){x,y}, (REBXYI){gob_clip.left, gob_clip.top}, (REBXYI){gob_clip.right, gob_clip.bottom});
				}
				break;

			case GOBT_TEXT:
			case GOBT_STRING:
				//RL_Print("Draw Text at: %d, %d\n", x, y);
				//------------------------------
				//Put backend specific code here
				//------------------------------
				// or use the similar draw api call:
				rt_gob_text(gob, ctx->Window_Buffer ,ctx->winBufSize,ctx->absOffset, (REBXYI){gob_clip.left, gob_clip.top}, (REBXYI){gob_clip.right, gob_clip.bottom});
				break;

			case GOBT_EFFECT:
				//RL_Print("Draw Effect\n");
				//not yet implemented
				break;
		}


		//recursively process sub GOBs
		if (GOB_PANE(gob)) {
			REBINT n;
			REBINT len = GOB_TAIL(gob);
			REBGOB **gp = GOB_HEAD(gob);

			for (n = 0; n < len; n++, gp++) {
				REBINT g_x = GOB_LOG_X(*gp);
				REBINT g_y = GOB_LOG_Y(*gp);

				//restore the "parent gob" clip region
				//------------------------------
				//Put backend specific code here
				//------------------------------

				ctx->absOffset.x += g_x;
				ctx->absOffset.y += g_y;

				process_gobs(ctx, *gp);

				ctx->absOffset.x -= g_x;
				ctx->absOffset.y -= g_y;
			}
		}
	}
	XDestroyRegion(reg);
	XDestroyRegion(ctx->Win_Region);
	ctx->Win_Region = saved_win_region;
}
Esempio n. 17
0
void TkClipBox(TkRegion a, XRectangle *b)
{
    XClipBox((Region) a, b);
}
// Returns FALSE if the subject is destroyed or if there was an error when
// calculating the dodge box
static Bool
fxDodgeFindDodgeBox (CompWindow *w, XRectangle *dodgeBox)
{
    ANIM_SCREEN(w->screen);
    ANIM_WINDOW(w);

    if (!aw->dodgeSubjectWin)  // if the subject is destroyed
	return FALSE;

    // Find the box to be dodged, it can contain multiple windows
    // when there are dialog/utility windows of subject windows
    // (stacked in the moreToBePaintedNext chain)
    // Then this would be a bounding box of the subject windows
    // intersecting with dodger.
    Region wRegion = XCreateRegion();
    if (!wRegion)
	return FALSE;

    Region dodgeRegion = XCreateRegion();
    if (!dodgeRegion)
    {
	XDestroyRegion (wRegion);
	return FALSE;
    }

    XRectangle rect;
    rect.x = WIN_X(w);
    rect.y = WIN_Y(w);
    rect.width = WIN_W(w);
    rect.height = WIN_H(w);

    int dodgeMaxAmount = (int)aw->dodgeMaxAmount;

    // to compute if subject(s) intersect with dodger w,
    // enlarge dodger window's box so that it encloses all of the covered
    // region during dodge movement. This corrects the animation when
    // there are >1 subjects (a window with its dialog/utility windows).
    switch (aw->dodgeDirection)
    {
    case 0:
	rect.y += dodgeMaxAmount;
	rect.height -= dodgeMaxAmount;
	break;
    case 1:
	rect.height += dodgeMaxAmount;
	break;
    case 2:
	rect.x += dodgeMaxAmount;
	rect.width -= dodgeMaxAmount;
	break;
    case 3:
	rect.width += dodgeMaxAmount;
	break;
    }
    XUnionRectWithRegion(&rect, &emptyRegion, wRegion);

    AnimWindow *awCur;
    CompWindow *wCur = aw->dodgeSubjectWin;
    for (; wCur; wCur = awCur->moreToBePaintedNext)
    {
	fxDodgeProcessSubject(wCur, wRegion, dodgeRegion,
			      wCur == aw->dodgeSubjectWin);
	awCur = GET_ANIM_WINDOW(wCur, as);
	if (!awCur)
	    break;
    }

    AnimWindow *awSubj = GET_ANIM_WINDOW(aw->dodgeSubjectWin, as);
    wCur = awSubj->moreToBePaintedPrev;
    for (; wCur; wCur = awCur->moreToBePaintedPrev)
    {
	fxDodgeProcessSubject(wCur, wRegion, dodgeRegion, FALSE);
	awCur = GET_ANIM_WINDOW(wCur, as);
	if (!awCur)
	    break;
    }

    XClipBox(dodgeRegion, dodgeBox);

    XDestroyRegion (wRegion);
    XDestroyRegion (dodgeRegion);

    return TRUE;
}