⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xp_pw.c

📁 speech signal process tools
💻 C
📖 第 1 页 / 共 2 页
字号:
	if (PR_IS_SERVER_IMAGE((Pixrect *) src)) {	    /*	     * Since src is a server image, avoid the overhead of NoExpose	     * events by doing stippling/tiling.	     */	    changes.ts_x_origin = x;	    changes.ts_y_origin = y;	    changes_mask = GCTileStipXOrigin | GCTileStipYOrigin;	    	    /* clip to source dimensions */	    width = (width > ((Pixrect *) src)->pr_size.x) ?		((Pixrect *) src)->pr_size.x : width;	    height = (height > ((Pixrect *) src)->pr_size.y) ?		((Pixrect *) src)->pr_size.y : height;	    if (xv_depth(dest_info) == xv_depth(src_info)) {		if (xv_depth(dest_info) == 1) {		    changes.stipple = xv_xid(src_info);		    changes.fill_style = FillOpaqueStippled;		    changes_mask |= GCFillStyle | GCStipple;		} else {		    changes.tile = xv_xid(src_info);		    changes.fill_style = FillTiled;		    changes_mask |=  GCTile | GCFillStyle;		}	    } else if (xv_depth(dest_info) > xv_depth(src_info)) {		changes.stipple = xv_xid(src_info);		changes.fill_style = FillOpaqueStippled;		changes_mask |= GCStipple | GCFillStyle;	    } else {		xv_error(NULL,			 ERROR_STRING,			     XV_MSG("xv_rop: can't handle drawables of different depth"),			 0);		return (XV_ERROR);	    }			    if (changes_mask) 	      XChangeGC(display, gc, changes_mask, &changes);	    XFillRectangle(display, d, gc, x, y, width, height);	} else {	    /* src is a window */	    if (xv_depth(dest_info) == xv_depth(src_info)) {		XCopyArea(display, src_d, d, gc, xr, yr, width, height, x, y);	    } else {		xv_error(NULL,			 ERROR_STRING,			     XV_MSG("xv_rop: Windows of different depth, can't rop"),			 0);		return (XV_ERROR);	    }	}    } else {	if (Xp_xv_rop_mpr_internal(display, d, gc, x, y, width, height, src, 		xr, yr, dest_info, TRUE) == XV_ERROR)	    return(XV_ERROR);    }    return(XV_OK);}	Xv_private intXp_xv_rop_mpr_internal(display, d, gc, x, y, width, height, src, xr, yr, 	dest_info, mpr_bits)    Display        	*display;    Drawable        	d;    GC              	gc;    int             	x, y, width, height;    Xv_opaque       	src;    int             	xr, yr;    Xv_Drawable_info 	*dest_info;    short		mpr_bits;{    int             		 src_depth;    XImage         		*ximage;    Cms_info			*cms = CMS_PRIVATE(xv_cms(dest_info));    static unsigned char	*data = (unsigned char *)NULL;    static unsigned int		 last_size = 0;    src_depth = ((Pixrect *) src)->pr_depth;    /*      * In Sunview, this case is handled by setting all non-zero color values      * to 1's. This is currently a NO-OP in XView. This case must be      * handled by creating a separate array of data bits of setting non-zero      * pixel values to 1's.     */    if ((xv_depth(dest_info) == 1) && (src_depth > 1)) {	return(XV_ERROR);    }    if (src_depth == 1) {	if (!(ximage = xv_image_bitmap(dest_info))) {	    Screen_visual     *visual;	    visual = (Screen_visual *)xv_get(xv_screen(dest_info), SCREEN_DEFAULT_VISUAL);	    xv_image_bitmap(dest_info) = ximage = 		(XImage *) XCreateImage(display, visual->vinfo->visual,				1, XYBitmap, 0,				(char *) mpr_d(((Pixrect *) src))->md_image, 				0, 0, MPR_LINEBITPAD,				mpr_d(((Pixrect *) src))->md_linebytes);	    if (!ximage) {		return (XV_ERROR);	    }	}    } else if ((src_depth == 8) && (xv_depth(dest_info) == 8)) {        if (!(ximage = xv_image_pixmap(dest_info))) {	    Screen_visual *visual;	    	    visual = (Screen_visual *)xv_get(xv_screen(dest_info), SCREEN_DEFAULT_VISUAL);	    xv_image_pixmap(dest_info) = ximage = 		(XImage *) XCreateImage(display, visual->vinfo->visual,				8, ZPixmap, 0,				(char *) mpr_d(((Pixrect *) src))->md_image,				0, 0, MPR_LINEBITPAD,				mpr_d(((Pixrect *) src))->md_linebytes);	    if (!ximage) {		return (XV_ERROR);	    }	}    } else {	return (XV_ERROR);    }					    ximage->bitmap_unit = MPR_LINEBITPAD;    ximage->bitmap_pad = MPR_LINEBITPAD;    ximage->height = ((Pixrect *) src)->pr_height;    ximage->width = ((Pixrect *) src)->pr_width;    ximage->bytes_per_line = mpr_d(((Pixrect *) src))->md_linebytes;    ximage->data = (char *) mpr_d(((Pixrect *) src))->md_image;    /*      * The bitmap data being passed in might be in either of 2 formats:     *    1. memory pixrect format.     *    2. Xlib bitmap format.     */    if (mpr_bits == TRUE) {    /* bitmap data is in memory pixrect format */#ifdef i386        ximage->byte_order = LSBFirst;        /*         * Check to see if the pixrect data was set by mpr_static(), or by         * actually creating the pixrect with mem_create() and drawing into         * it.         */        if (mpr_d((Pixrect *) src)->md_flags & MP_I386)	    ximage->bitmap_bit_order = LSBFirst;        else	    ximage->bitmap_bit_order = MSBFirst;#else#ifdef ultrix        ximage->byte_order = LSBFirst;        ximage->bitmap_bit_order = MSBFirst;#else        ximage->byte_order = MSBFirst;        ximage->bitmap_bit_order = MSBFirst;#endif				/* ~VAX */#endif				/* ~i386 */    } else {    /* bitmap data is in Xlib bitmap format */	ximage->byte_order = LSBFirst;	ximage->bitmap_bit_order = LSBFirst;        if (src_depth == 1)           ximage->bytes_per_line = (width + 7) >> 3;    }    if (src_depth == 1) {	XPutImage(display, d, gc, ximage, xr, yr, x, y,	    MIN(width, ximage->width), MIN(height, ximage->height));    } else {	register int     i, j;	unsigned long    index;	unsigned int	 size;	char		*image_data;		/*	 * Create any space needed to convert the image data to pixel values	 */	size = ximage->height * ximage->bytes_per_line;	if (size > last_size) {	    if (data)	      xv_free(data);	    data = (unsigned char *)xv_malloc(size);	    last_size = size;	}		/* 	 * convert image from cms indices to X pixel values.	 */	image_data = ximage->data;	for (i = 0; i < ximage->height; i++) {	    for (j = 0; j < ximage->bytes_per_line; j++) {		index = j + i * ximage->bytes_per_line;		data[index] = cms->index_table[(unsigned char)image_data[index]];	    }	}		ximage->data = (char *)data;	XPutImage(display, d, gc, ximage, xr, yr, x, y,		  MIN(width, ximage->width), MIN(height, ximage->height));	ximage->data = image_data;    }    return (XV_OK);}Pkg_private     GCXp_xv_find_proper_gc(display, info, op)    Display        	*display;    Xv_Drawable_info 	*info;    int	        	op;{    int             depth = xv_depth(info), i;    Drawable        xid = xv_xid(info);    XGCValues       gv;    Xv_Screen       screen = xv_screen(info);    Xv_xrectlist   *clip_xrects = screen_get_clip_rects(screen);    short           xv_in_fullscreen = server_get_fullscreen(xv_server(info));    struct gc_chain   *gcs, *gc_list, **ops_private_gcs;    if (!GC_CHAIN_KEY)  	    GC_CHAIN_KEY = xv_unique_key();    ops_private_gcs = (struct gc_chain **) xv_get( screen, XV_KEY_DATA, GC_CHAIN_KEY );    if (!ops_private_gcs) {		ops_private_gcs = (struct gc_chain **) xv_calloc((PW_NUM_OPS+1),sizeof(struct gc_chain));	    xv_set( screen, XV_KEY_DATA, GC_CHAIN_KEY, ops_private_gcs, 0 );    }    gc_list = ops_private_gcs[op];    /*     * If a new clipping rectangle has been set for this drawable since the     * last invocation of this function, set all xid's in the gc list to an     * invalid xid.     */    if (info->new_clipping) {#ifndef SVR4	for (i = 0; i < PW_NUM_OPS; i++)#else SVR4	for (i = 0; i <= PW_NUM_OPS; i++)#endif SVR4	    for (gcs = ops_private_gcs[i]; gcs != NULL; gcs = gcs->next)		gcs->xid = INVALID_XID;	info->new_clipping = FALSE;    }    if (!gc_list) {	gc_list = ops_private_gcs[op] =	    (struct gc_chain *) xv_calloc(1, sizeof(struct gc_chain));	if (xv_in_fullscreen) {	    gv.subwindow_mode = IncludeInferiors;	    gc_list->gc = XCreateGC(display, xid, GCSubwindowMode, &gv);	} else {	    gc_list->gc = XCreateGC(display, xid, 0, 0);	}	gc_list->clipping_set = FALSE;	gc_list->depth = depth;	gc_list->next = NULL;	/*	 * Newly created GC. If clipping is enabled on the drawable, set the	 * GCClipMask for the GC.	 */	if (clip_xrects->count) {	    XSetClipRectangles(display, gc_list->gc, 0, 0,		     clip_xrects->rect_array, clip_xrects->count, Unsorted);	    gc_list->clipping_set = TRUE;	}	gc_list->xid = xid;	return (gc_list->gc);    } else {	gcs = gc_list;	while (gcs) {	    if (gcs->depth == depth) {		if (xv_in_fullscreen) {		    gv.subwindow_mode = IncludeInferiors;		} else {		    gv.subwindow_mode = ClipByChildren;		}		/*		 * The clipping_set field is redundant. A bug in XChangeGC		 * (in Xlib) needs to fixed. If the current clip_mask and the		 * cached clip_mask are both None, the cache need not be		 * flushed. Remove clipping_set field when this gets fixed.		 */		if (gcs->clipping_set && !clip_xrects->count) {		    gcs->clipping_set = FALSE;		    gv.clip_mask = None;		    XChangeGC(display, gcs->gc, GCSubwindowMode | GCClipMask, &gv);		} else {		    XChangeGC(display, gcs->gc, GCSubwindowMode, &gv);		}		/*		 * If this is a different drawable since the last invocation		 * and it has a clipping rectangle enabled, or, the clipping		 * for the same drawable has changed since the last		 * invocation, reset the clipping.		 */		if (clip_xrects->count && (gcs->xid != xid)) {		    XSetClipRectangles(display, gcs->gc, 0, 0,		     clip_xrects->rect_array, clip_xrects->count, Unsorted);		    gcs->clipping_set = TRUE;		}		gcs->xid = xid;		return (gcs->gc);	    } else {		if (gcs->next) {		    gcs = gcs->next;		} else {		    struct gc_chain *new;		    /*		     * no gc of the same depth, need to create a new gc		     */		    gcs->next = new = (struct gc_chain *) xv_malloc(sizeof(struct gc_chain));		    if (xv_in_fullscreen) {			gv.subwindow_mode = IncludeInferiors;			new->gc = XCreateGC(display, xid, GCSubwindowMode, &gv);		    } else {			new->gc = XCreateGC(display, xid, 0, 0);		    }		    new->depth = depth;		    new->next = NULL;		    /*		     * Newly created GC. If clipping is enabled on the		     * window, set the GC.		     */		    if (clip_xrects->count) {			XSetClipRectangles(display, new->gc, 0, 0,					   clip_xrects->rect_array, clip_xrects->count, Unsorted);			new->clipping_set = TRUE;		    }		    new->xid = xid;		    return (new->gc);		}	    }	}    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -