#ifndef lint
#ifdef sccs
static char sccsid[] = "@(#)pw_access.c 1.1 92/07/30 Copyr 1986 Sun Micro";
#endif
#endif
/*
* Copyright (c) 1986 by Sun Microsystems, Inc.
*/
/*
* Pw_access.c: Implement the clipping list and locking aspects of
* the pixwin.h interface.
*/
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <stdio.h>
#include <pixrect/pixrect.h>
#include <pixrect/memvar.h>
#include <pixrect/pr_planegroups.h>
#include <sunwindow/rect.h>
#include <sunwindow/rectlist.h>
#include <sunwindow/cms.h>
#include <sunwindow/cms_mono.h>
#include <sunwindow/pixwin.h>
#include <sunwindow/pw_util.h>
#include <pixrect/pr_dblbuf.h>
#include <sunwindow/win_screen.h>
#include <sunwindow/win_input.h>
#include <sunwindow/win_ioctl.h>
#include <sunwindow/win_cursor.h>
#include <sunwindow/win_lock.h>
#include <sunwindow/sv_malloc.h>
/*
* When not zero will immediately release lock after WINLOCKSCREEN ioctl
* so that the debugger is continually getting hung because of the lock.
* USE ONLY DURING DEBUGGING WHEN YOU KNOW WHAT YOUR DOING!
*/
int pixwindebug;
/*
* Buffer used when copying rl from kernel
*/
#define MAXRLBUFBYTES (100*(sizeof(struct rectnode))+sizeof(struct rectlist))
#define RLBUFBYTESINC (10*(sizeof(struct rectnode)))
static rlbufbytes;
static char *rlbuf;
static struct pixwin *pw_open_internal();
/*
* Pixwin standard operations vector.
*/
extern pwo_get(), pwo_put(), pwo_rop(), pwo_vector(), pwo_putcolormap(),
pwo_getcolormap(), pwo_putattributes(), pwo_getattributes(),
pwo_stencil(), pwo_batchrop();
int pw_close();
struct pixrect *pwo_region();
extern struct pixrectops pw_opsstd;
extern struct pixrectops pw_opsstd_null_lock;
/*
* Pixwin standard clipping and locking operations.
*/
int pwco_lockstd(), pwco_unlockstd(),
pwco_resetstd(), pwco_getclippingstd();
struct pixrect *
pwo_region(pwsrc, x, y, w, h)
struct pixwin *pwsrc;
int x, y, w, h;
{
register struct pixwin *pw;
register struct rect *srcrect = pwsrc->pw_clipdata->pwcd_regionrect;
register struct rect *regrect;
if (pw = pw_open_internal(pwsrc->pw_clipdata->pwcd_windowfd)) {
regrect = pw->pw_clipdata->pwcd_regionrect = (struct rect *)
sv_calloc(1, sizeof(struct rect));
rect_construct(regrect, x, y, w, h);
/*
* Clip region request if subregion.
*/
if (srcrect) {
rect_passtoparent(
srcrect->r_left, srcrect->r_top, regrect);
(void)rect_intersection(regrect, srcrect, regrect);
}
if (pwsrc->pw_prretained) {
pw->pw_prretained = pr_region(pwsrc->pw_prretained,
x, y, regrect->r_width, regrect->r_height);
}
/* Inherit offsets */
pw->pw_clipdata->pwcd_x_offset =
pwsrc->pw_clipdata->pwcd_x_offset;
pw->pw_clipdata->pwcd_y_offset =
pwsrc->pw_clipdata->pwcd_y_offset;
pw->pw_clipdata->pwcd_flags = pwsrc->pw_clipdata->pwcd_flags;
/* Inherit cms stuff (will figure new clipping too) */
(void)pw_initcms(pw);
{
/* Inherit the window-id double buffer state */
int pg, save_planes;
struct fb_wid_dbl_info wid_dbl_info;
ioctl(pwsrc->pw_windowfd, WINWIDGET, &wid_dbl_info);
ioctl(pw->pw_windowfd, WINWIDSET, &wid_dbl_info);
pr_ioctl(pw->pw_pixrect, FBIOSWINFD, &pw->pw_windowfd);
pg = pr_get_plane_group(pw->pw_pixrect);
pr_getattributes(pw->pw_pixrect, &save_planes);
pw_set_planes_directly(pw, pg, save_planes);
}
}
return((struct pixrect *)pw);
}
/*
* Pixwin structure operations
*/
struct pixwin *
pw_open(windowfd)
int windowfd;
{
register struct pixwin *pw;
if ((pw = pw_open_internal(windowfd))) {
/* Initialize cms (will figure new clipping too) */
(void)pw_initcms(pw);
/* if it is a cgnine board, use fast mono */
if (pw->pw_clipdata->pwcd_plane_group == PIXPG_24BIT_COLOR &&
strncmp(pw->pw_cmsname, CMS_MONOCHROME, CMS_NAMESIZE) == 0 &&
pw->pw_clipdata->pwcd_plane_groups_available [PIXPG_OVERLAY])
pw_use_fast_monochrome(pw);
}
return (pw);
}
/* open for fullscreen operations without monochrome problems */
struct pixwin *
pw_open_fs(windowfd)
int windowfd;
{
register struct pixwin *pw;
if ((pw = pw_open_internal(windowfd)))
/* Initialize cms (will figure new clipping too) */
(void) pw_initcms(pw);
{
/*
* Some planes are inappropriate for fullscreen operations.
* Remove them from the list to be copied.
*/
int i;
unsigned char elim_groups[PIX_MAX_PLANE_GROUPS];
/* clear all entries in case the FBIO is not implemented for this fb */
(void) pr_ioctl(pw->pw_pixrect, FBIOSWINFD, &pw->pw_windowfd);
(void) bzero(elim_groups, PIX_MAX_PLANE_GROUPS);
(void) pr_ioctl(pw->pw_pixrect, FBIO_FULLSCREEN_ELIMINATION_GROUPS,
elim_groups);
for (i = 0; i < PIX_MAX_PLANE_GROUPS; i++)
if (elim_groups[i])
pw->pw_clipdata->pwcd_plane_groups_available[i] = 0;
}
return (pw);
}
/*
* "pw_open_sb"
*
* Open a pixwin for use with a scrollbar. If the pixwin is for a 24-bit
* color surface, initialize the surface so that the plane mask will be
* PIX_ALL_PLANES rather than a 1. (ACG 22 June 90)
*/
struct pixwin *
pw_open_sb(windowfd)
int windowfd;
{
struct pixwin *pw;
if ((pw = pw_open_internal(windowfd)))
/* Initialize cms (will figure new clipping too) */
(void) pw_initcms(pw);
if (pw->pw_clipdata->pwcd_plane_group == PIXPG_24BIT_COLOR)
pw_use_color24(pw);
return (pw);
}
static struct pixwin *
pw_open_internal(windowfd)
register int windowfd;
{
register struct pixwin *pw;
struct screen screen;
register int i;
extern struct pixrect *pr_open();
extern Win_lock_block *pw_get_lock_block();
struct pwset list;
pw = (struct pixwin *) sv_calloc(1, sizeof(struct pixwin));
/*
* Initialization of data alterred by pwco_reset
*/
pw->pw_fixup = rl_null;
pw->pw_clipdata = (struct pixwin_clipdata *)
sv_calloc(1, sizeof(struct pixwin_clipdata));
pw->pw_clipdata->pwcd_clipping = rl_null;
for (i=0;i<RECTS_SORTS;i++)
pw->pw_clipdata->pwcd_clippingsorted[i] = rl_null;
pw->pw_clipdata->pwcd_lockcount = 0;
pw->pw_clipdata->pwcd_clipid = 0;
pw->pw_clipdata->pwcd_damagedid = 0;
pw->pw_clipdata->pwcd_state = PWCD_NULL;
pw->pw_clipdata->pwcd_prsingle = (struct pixrect *) 0;
pw->pw_clipdata->pwcd_prmulti = (struct pixrect *) 0;
pw->pw_clipdata->pwcd_prl = (struct pixwin_prlist *) 0;
/* Initialized when first used. */
pw->pw_clipdata->pwcd_x_offset = 0;
pw->pw_clipdata->pwcd_y_offset = 0;
(void)pw_reset_batch(pw);
/*
* Initialization of data that is static over life of pixwin
*/
pw->pw_clipops = (struct pixwin_clipops *)
sv_calloc(1, sizeof(struct pixwin_clipops));
pw->pw_clipops->pwco_lock = (int (*)()) pwco_lockstd;
pw->pw_clipops->pwco_unlock = (int (*)()) pwco_unlockstd;
pw->pw_clipops->pwco_reset = (int (*)()) pwco_resetstd;
pw->pw_clipops->pwco_getclipping = (int (*)()) pwco_getclippingstd;
pw->pw_clipdata->pwcd_windowfd = windowfd;
/* set up the shared memory info */
pw->pw_clipdata->pwcd_winnum = win_fdtonumber(windowfd);
pw->pw_clipdata->pwcd_wl = 0;
pw->pw_clipdata->pwcd_client =
(caddr_t) pw_get_lock_block(pw->pw_windowfd);
/*
* Initialization of data that is changed by in pw_region.
*/
pw->pw_clipdata->pwcd_regionrect = (struct rect *)0;
/*
* Initialization of data that is changed by user.
*/
pw->pw_prretained = 0;
/*
* Initialization of data that is determined by pwcd_state when lock
* and reset in pwco_reset.
*/
pw->pw_ops = &pw_opsstd;
pw->pw_opshandle = (caddr_t) pw;
pw->pw_opsx = pw->pw_clipdata->pwcd_x_offset;
pw->pw_opsy = pw->pw_clipdata->pwcd_y_offset;
/*
* Initialization of data that changes when size|position changes.
* The r_left & r_top fields are set up when get clipping.
*/
(void)win_screenget(windowfd, &screen);
if ((pw->pw_pixrect = pr_open(screen.scr_fbname))==0) {
(void)pw_close(pw);
return((struct pixwin *)0);
}
/*
* Check if double bu
没有合适的资源?快使用搜索试试~ 我知道了~
pw_access.rar_Aspects
共1个文件
c:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 127 浏览量
2022-09-24
20:50:52
上传
评论
收藏 6KB RAR 举报
温馨提示
Pw_access.c: Implement the clipping list and locking aspects of the pixwin.h interface.
资源推荐
资源详情
资源评论
收起资源包目录
pw_access.rar (1个子文件)
pw_access.c 23KB
共 1 条
- 1
资源评论
钱亚锋
- 粉丝: 85
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功