Esempio n. 1
0
static void _fastcall zmo_calcbf(bf_t bfdx, bf_t bfdy,
    bf_t bfnewx, bf_t bfnewy,bf_t bfplotmx1, bf_t bfplotmx2, bf_t bfplotmy1,
    bf_t bfplotmy2, bf_t bfftemp)
{
    bf_t btmp1, btmp2, btmp3, btmp4, btempx, btempy ;
    bf_t btmp2a, btmp4a;
    int saved; saved = save_stack();

    btmp1  = alloc_stack(rbflength+2);
    btmp2  = alloc_stack(rbflength+2);
    btmp3  = alloc_stack(rbflength+2);
    btmp4  = alloc_stack(rbflength+2);
    btmp2a = alloc_stack(rbflength+2);
    btmp4a = alloc_stack(rbflength+2);
    btempx = alloc_stack(rbflength+2);
    btempy = alloc_stack(rbflength+2);

    /* calc cur screen corner relative to zoombox, when zoombox co-ords
       are taken as (0,0) topleft thru (1,1) bottom right */

    /* tempx = dy * plotmx1 - dx * plotmx2; */
    mult_bf(btmp1,bfdy,bfplotmx1);
    mult_bf(btmp2,bfdx,bfplotmx2);
    sub_bf(btempx,btmp1,btmp2);

    /* tempy = dx * plotmy1 - dy * plotmy2; */
    mult_bf(btmp1,bfdx,bfplotmy1);
    mult_bf(btmp2,bfdy,bfplotmy2);
    sub_bf(btempy,btmp1,btmp2);

    /* calc new corner by extending from current screen corners */
    /* *newx = sxmin + tempx*(sxmax-sx3rd)/ftemp + tempy*(sx3rd-sxmin)/ftemp; */
    sub_bf(btmp1,bfsxmax,bfsx3rd);
    mult_bf(btmp2,btempx,btmp1);
    /* show_three_bf("fact1",btempx,"fact2",btmp1,"prod ",btmp2,70); */
    div_bf(btmp2a,btmp2,bfftemp);
    /* show_three_bf("num  ",btmp2,"denom",bfftemp,"quot ",btmp2a,70); */
    sub_bf(btmp3,bfsx3rd,bfsxmin);
    mult_bf(btmp4,btempy,btmp3);
    div_bf(btmp4a,btmp4,bfftemp);
    add_bf(bfnewx,bfsxmin,btmp2a);
    add_a_bf(bfnewx,btmp4a);

    /* *newy = symax + tempy*(sy3rd-symax)/ftemp + tempx*(symin-sy3rd)/ftemp; */
    sub_bf(btmp1,bfsy3rd,bfsymax);
    mult_bf(btmp2,btempy,btmp1);
    div_bf(btmp2a,btmp2,bfftemp);
    sub_bf(btmp3,bfsymin,bfsy3rd);
    mult_bf(btmp4,btempx,btmp3);
    div_bf(btmp4a,btmp4,bfftemp);
    add_bf(bfnewy,bfsymax,btmp2a);
    add_a_bf(bfnewy,btmp4a);
    restore_stack(saved);
}
Esempio n. 2
0
// for aspect ratio debugging
void showaspect(char *s)
{
    bf_t bt1, bt2, aspect;
    char msg[100], str[100];
    int saved;
    saved = save_stack();
    bt1    = alloc_stack(rbflength+2);
    bt2    = alloc_stack(rbflength+2);
    aspect = alloc_stack(rbflength+2);
    sub_bf(bt1, bfxmax, bfxmin);
    sub_bf(bt2, bfymax, bfymin);
    div_bf(aspect, bt2, bt1);
    bftostr(str, 10, aspect);
    sprintf(msg, "aspect %s\nfloat %13.10f\nbf    %s\n\n",
            s,
            (yymax-yymin)/(xxmax-xxmin),
            str);
    if (stopmsg(STOPMSG_NONE, msg) == -1)
        goodbye();
    restore_stack(saved);
}