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

📄 out_bl2d.c

📁 unix vnc 协议源码. VNC是一款远程控制工具软件.
💻 C
📖 第 1 页 / 共 2 页
字号:
               sp_globals.clip_xmin = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));               sp_globals.clip_xmin = sp_globals.clip_xmin >> sp_globals.multshift;	       sp_globals.clip_xmin = -1 * sp_globals.clip_xmin;               bmap_min = (sp_globals.bmap_xmin + sp_globals.pixrnd + 1) >> sp_globals.pixshift;               /* let the minimum be the larger of these two values */	       if (bmap_min > sp_globals.clip_xmin)		    sp_globals.clip_xmin = bmap_min;	       /* normalize the x value to new xorgin */               sp_globals.clip_xmin -= sp_globals.xmin;               }            if (sp_globals.specs.flags & CLIP_BOTTOM)               {               sp_globals.clip_xmax = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));               sp_globals.clip_xmax = sp_globals.clip_xmax >> sp_globals.multshift;               bmap_max = (sp_globals.bmap_xmax + sp_globals.pixrnd) >> sp_globals.pixshift;	       /* let the max be the lesser of these two values */	       if (bmap_max < sp_globals.clip_xmax)		    {		    sp_globals.xmax = bmap_max; 		    sp_globals.clip_xmax = bmap_max;		    }               else                    sp_globals.xmax = sp_globals.clip_xmax;	       /* normalize the x value to new x origin */	       sp_globals.clip_xmax -= sp_globals.xmin;               }               /* compute y clip values */	       sp_globals.clip_ymax = ((sp_globals.set_width.y+32768L) >> 16);	       if ((sp_globals.specs.flags & CLIP_TOP) &&                    (sp_globals.ymax > sp_globals.clip_ymax))		    sp_globals.ymax = sp_globals.clip_ymax;	       sp_globals.clip_ymin = 0;               if ((sp_globals.specs.flags & CLIP_BOTTOM) &&                    (sp_globals.ymin < sp_globals.clip_ymin))                    sp_globals.ymin = sp_globals.clip_ymin;               break;       default: /* this is for zero degree rotation and arbitrary rotation */            if (sp_globals.specs.flags & CLIP_TOP)               {	       sp_globals.clip_ymax = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));               sp_globals.clip_ymax = sp_globals.clip_ymax >> sp_globals.multshift;               bmap_max = (sp_globals.bmap_ymax + sp_globals.pixrnd) >> sp_globals.pixshift;	       if (bmap_max > sp_globals.clip_ymax)                    sp_globals.ymax = bmap_max;               else		    sp_globals.ymax = sp_globals.clip_ymax;               }            if (sp_globals.specs.flags & CLIP_BOTTOM)               {	       sp_globals.clip_ymin = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo +  ((1<<sp_globals.multshift)/2));               sp_globals.clip_ymin = sp_globals.clip_ymin >> sp_globals.multshift;	       sp_globals.clip_ymin = - sp_globals.clip_ymin;               bmap_min = (sp_globals.bmap_ymin + sp_globals.pixrnd + 1) >> sp_globals.pixshift;	       if (bmap_min < sp_globals.clip_ymin)		    sp_globals.ymin = sp_globals.clip_ymin;               else                    sp_globals.ymin = bmap_min;               }               sp_globals.clip_xmin = -sp_globals.xmin;               sp_globals.clip_xmax = ((sp_globals.set_width.x+32768L) >> 16) -                                      sp_globals.xmin;               break;       }if ( !(sp_globals.specs.flags & CLIP_TOP))#endif            sp_globals.ymax = (sp_globals.bmap_ymax + sp_globals.pixrnd) >> sp_globals.pixshift;#if INCL_CLIPPINGif ( !(sp_globals.specs.flags & CLIP_BOTTOM))#endif        sp_globals.ymin = (sp_globals.bmap_ymin + sp_globals.pixrnd + 1) >> sp_globals.pixshift;        }    else        {        sp_globals.ymin = sp_globals.ymax = 0;        }    /* add in the rounded out part (from xform.) of the left edge */    if (sp_globals.tcb.xmode == 0)    /* for X pix is function of X orus only add the round */    	xorg = (((fix31)sp_globals.xmin << 16) + (sp_globals.rnd_xmin << sp_globals.poshift));    else        if (sp_globals.tcb.xmode == 1) /* for X pix is function of -X orus only, subtr. round */        	xorg = (((fix31)sp_globals.xmin << 16) - (sp_globals.rnd_xmin << sp_globals.poshift)) ;        else        	xorg = (fix31)sp_globals.xmin << 16;   /* for other cases don't use round on x */               if (sp_globals.tcb.ymode == 2)   /* for Y pix is function of X orus only, add round error */     	yorg = (((fix31)sp_globals.ymin << 16) + (sp_globals.rnd_xmin << sp_globals.poshift));    else        if (sp_globals.tcb.ymode == 3) /* for Y pix is function of -X orus only, sub round */        	yorg = (((fix31)sp_globals.ymin << 16) - (sp_globals.rnd_xmin << sp_globals.poshift));        else                          /* all other cases have no round error on yorg */         	yorg = (fix31)sp_globals.ymin << 16;    open_bitmap(sp_globals.set_width.x, sp_globals.set_width.y, xorg, yorg,				 sp_globals.xmax - sp_globals.xmin, sp_globals.ymax -  sp_globals.ymin);    if (sp_globals.intercept_oflo)        {        sp_globals.y_band.band_min = sp_globals.ymin;        sp_globals.y_band.band_max = sp_globals.ymax;        sp_globals.x_scan_active = FALSE;        sp_globals.no_x_lists = 0;        init_intercepts_out();        sp_globals.first_pass = FALSE;        sp_globals.extents_running = FALSE;        return FALSE;        }    else        {        sp_proc_intercepts_2d();        close_bitmap();        return TRUE;        }    }else    {    if (sp_globals.intercept_oflo)        {        reduce_band_size_out();        init_intercepts_out();        return FALSE;        }    else        {        sp_proc_intercepts_2d();        if (next_band_out())            {            init_intercepts_out();            return FALSE;            }        close_bitmap();        return TRUE;        }    }}#endif#if INCL_2DFUNCTION static  void sp_add_intercept_2d(y, x)GDECLfix15 y;                 /* Y coordinate in relative pixel units */                         /* (0 is lowest sample in band) */fix15 x;                 /* X coordinate of intercept in subpixel units *//*  Called by line() to add an intercept to the intercept list structure */{register fix15 from;   /* Insertion pointers for the linked list sort */register fix15 to;#if DEBUG/* Bounds checking IS done in debug mode */if ((y >= MAX_INTERCEPTS) || (y < 0))    {    printf("Intercept out of table!!!!! (%d)\n",y);    return;    }if (y >= sp_globals.no_y_lists)    {    printf("    Add x intercept(%2d, %f)\n",         y + sp_globals.x_band.band_min - sp_globals.no_y_lists,        (real)x/(real)sp_globals.onepix);    if (y > (sp_globals.no_x_lists + sp_globals.no_y_lists))        {        printf(" Intercept too big for band!!!!!\007\n");        return;        }    }    else    {    printf("    Add y intercept(%2d, %f)\n", y + sp_globals.y_band.band_min,(real)x/(real)sp_globals.onepix);    }if (y < 0)       /* Y value below bottom of current band? */    {    printf(" Intecerpt less than 0!!!\007\n");    return;    }#endif/* Store new values */sp_intercepts.car[sp_globals.next_offset] = x;/* Find slot to insert new element (between from and to) */from = y; /* Start at list head */while( (to = sp_intercepts.cdr[from]) >= sp_globals.first_offset) /* Until to == end of list */    {    if (x <= sp_intercepts.car[to]) /* If next item is larger than or same as this one... */        goto insert_element; /* ... drop out and insert here */    from = to; /* move forward in list */    }insert_element: /* insert element "next_offset" between elements "from" */                /* and "to" */sp_intercepts.cdr[from] = sp_globals.next_offset;sp_intercepts.cdr[sp_globals.next_offset] = to;if (++sp_globals.next_offset >= MAX_INTERCEPTS) /* Intercept buffer full? */    {    sp_globals.intercept_oflo = TRUE;/* There may be a few more calls to "add_intercept" from the current line *//* To avoid problems, we set next_offset to a safe value. We don't care   *//* if the intercept table gets trashed at this point                      */    sp_globals.next_offset = sp_globals.first_offset;    }}#endif#if INCL_2DFUNCTION static  void sp_proc_intercepts_2d()GDECL/*  Called by sp_make_char to output accumulated intercept lists *  Clips output to xmin, xmax, sp_globals.ymin, ymax boundaries */{register fix15 i;register fix15 from, to;          /* Start and end of run in pixel units                               relative to left extent of character  */register fix15 y;register fix15 scan_line;         fix15 local_bmap_xmin;         fix15 local_bmap_xmax;         fix15 first_y, last_y;         fix15 j,k;         fix15 xmin, xmax;         boolean clipleft, clipright;#if INCL_CLIPPINGif ((sp_globals.specs.flags & CLIP_LEFT) != 0)    clipleft = TRUE;else    clipleft = FALSE;if ((sp_globals.specs.flags & CLIP_RIGHT) != 0)    clipright = TRUE;else    clipright = FALSE;if (clipleft || clipright)        {        xmax = sp_globals.clip_xmax << sp_globals.pixshift;        xmin = sp_globals.clip_xmin << sp_globals.pixshift;        }if (!clipright)        xmax = ((sp_globals.set_width.x+32768L) >> 16);#endifif (sp_globals.x_scan_active)      /* If xscanning, we need to make sure we don't miss any important pixels */    {    first_y = sp_globals.x_band.band_floor;        /* start of x lists */    last_y = sp_globals.x_band.band_ceiling;                          /* end of x lists   */    for (y = first_y; y != last_y; y++)             /* scan all xlists  */        {        i = sp_intercepts.cdr[y];                            /* Index head of intercept list */        while (i != 0)         /* Link to next intercept if present */            {            from = sp_intercepts.car[i];            j = i;            i = sp_intercepts.cdr[i];                   /* Link to next intercept */            if (i == 0)                   /* End of list? */                {#if DEBUG                printf("****** proc_intercepts: odd number of intercepts in x list\n");#endif                break;                }            to = sp_intercepts.car[i];            k = sp_intercepts.cdr[i];            if (((to >> sp_globals.pixshift) >=  (from >> sp_globals.pixshift)) &&                 ((to - from) < (sp_globals.onepix + 1)))                {                from = ((fix31)to + (fix31)from - (fix31)sp_globals.onepix) >> (sp_globals.pixshift + 1);                if (from > sp_globals.y_band.band_max) 					from = sp_globals.y_band.band_max;                if ((from -= sp_globals.y_band.band_min) < 0) 					from = 0;                to = ((y - sp_globals.x_band.band_floor + sp_globals.x_band.band_min)                            << sp_globals.pixshift)                            + sp_globals.pixrnd;                sp_intercepts.car[j] = to;                sp_intercepts.car[i] = to + sp_globals.onepix;                sp_intercepts.cdr[i] = sp_intercepts.cdr[from];                sp_intercepts.cdr[from] = j;                }skip_xint:  i = k;            }        }    }#if DEBUGprintf("\nIntercept lists:\n");#endifif ((first_y = sp_globals.y_band.band_max) >= sp_globals.ymax)        first_y = sp_globals.ymax - 1;               /* Clip to ymax boundary */if ((last_y = sp_globals.y_band.band_min) < sp_globals.ymin)          last_y = sp_globals.ymin;                    /* Clip to sp_globals.ymin boundary */last_y  -= sp_globals.y_band.band_array_offset;local_bmap_xmin = sp_globals.xmin << sp_globals.pixshift;local_bmap_xmax = (sp_globals.xmax << sp_globals.pixshift) + sp_globals.pixrnd;#if DEBUG/* Print out all of the intercept info */scan_line = sp_globals.ymax - first_y - 1;for (y = first_y - sp_globals.y_band.band_min; y >= last_y; y--, scan_line++)    {    i = y;                            /* Index head of intercept list */    while ((i = sp_intercepts.cdr[i]) != 0)         /* Link to next intercept if present */        {        if ((from = sp_intercepts.car[i] - local_bmap_xmin) < 0)            from = 0;                 /* Clip to xmin boundary */        i = sp_intercepts.cdr[i];                   /* Link to next intercept */        if (i == 0)                   /* End of list? */            {            printf("****** proc_intercepts: odd number of intercepts\n");            break;            }        if ((to = sp_intercepts.car[i]) > sp_globals.bmap_xmax)            to = sp_globals.bmap_xmax - local_bmap_xmin;         /* Clip to xmax boundary */        else            to -= local_bmap_xmin;        printf("    Y = %2d (scanline %2d): %3.4f %3.4f:\n",             y + sp_globals.y_band.band_min,             scan_line,             (real)from / (real)sp_globals.onepix,             (real)to / (real)sp_globals.onepix);        }    }#endif/* Draw the image */scan_line = sp_globals.ymax - first_y - 1;for (y = first_y - sp_globals.y_band.band_min; y >= last_y; y--, scan_line++)    {    i = y;                            /* Index head of intercept list */    while ((i = sp_intercepts.cdr[i]) != 0)         /* Link to next intercept if present */        {        if ((from = sp_intercepts.car[i] - local_bmap_xmin) < 0)            from = 0;                 /* Clip to xmin boundary */        i = sp_intercepts.cdr[i];                   /* Link to next intercept */        if ((to = sp_intercepts.car[i]) > local_bmap_xmax)            to = sp_globals.bmap_xmax - local_bmap_xmin;         /* Clip to xmax boundary */        else            to -= local_bmap_xmin;#if INCL_CLIPPING                if (clipleft)                        {                        if (to <= xmin)                                continue;                        if (from < xmin)                                from = xmin;                        }        if (clipright)                        {                        if (from >= xmax)                                continue;                        if (to > xmax)                                to = xmax;                        }#endif        if ( (to - from) <= sp_globals.onepix)            {            from = (to + from - sp_globals.onepix) >> (sp_globals.pixshift + 1);            set_bitmap_bits(scan_line, from, from + 1);            }            else            {            set_bitmap_bits(scan_line, from >> sp_globals.pixshift, to >> sp_globals.pixshift);            }        }    }}#endif

⌨️ 快捷键说明

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