|
|
DataMuseum.dkPresents historical artifacts from the history of: ICL Comet 32 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about ICL Comet 32 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3257 (0xcb9)
Types: TextFile
Notes: UNIX file
Names: »ctransform.c«
└─⟦26887b7e0⟧ Bits:30009717 Comet 32 harddisk image
└─⟦28c352965⟧ »/a« UNIX Filesystem
└─⟦this⟧ »usr/src/gks/comet/ctransform.c«
#include "../h/vdi.h"
#include "../h/vdii.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1win - SET WORKSTATION WINDOW.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1win(nr) /* SET WORKSTATION WINDOW */
Nrect *nr;
{ /* Set 'requested workstation window'.*/
ws->ws_reqw = *nr;
/* Set 'current workstation window' if appropriate.*/
if (ws->ws_wsd->wd_dywst == TRUE || ws->ws_emty == TRUE)
{ ws->ws_curw = ws->ws_reqw;
/* Update the current workstation transformation.*/
t1cwst();
}
else
ws->ws_waitr = TRUE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* dt1vie - SET WORKSTATION VIEWPORT.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
dt1vie(dr) /* SET WORKSTATION VIEWPORT */
Drect *dr;
{ /* Set 'requested workstation viewport'.*/
ws->ws_reqv = *dr;
/* Set 'current workstation viewport' if appropriate.*/
if (ws->ws_wsd->wd_dywst == TRUE || ws->ws_emty == TRUE)
{ ws->ws_curv = ws->ws_reqv;
/* Update the current workstation transformation.*/
t1cwst();
}
else
ws->ws_waitr = TRUE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* t1cwst - Update the current workstation transformation.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
t1cwst()
{ Real dwx, dwy; /* Width and height of current ws window.*/
Real dvx, dvy; /* Width and height of current ws viewport.*/
Real wr, vr; /* Aspect ratios of window and viewport.*/
Real v_ur_y, v_ur_x; /* Viewport upper right corner, modified to
preserve aspect ratio.*/
/* Compute intermediate values.*/
dwx = ws->ws_curw.n_ur.n_x - ws->ws_curw.n_ll.n_x;
dwy = ws->ws_curw.n_ur.n_y - ws->ws_curw.n_ll.n_y;
wr = dwy / dwx;
dvx = ws->ws_curv.d_ur.d_x - ws->ws_curv.d_ll.d_x;
dvy = ws->ws_curv.d_ur.d_y - ws->ws_curv.d_ll.d_y;
vr = dvy / dvx;
/* To maintain the same aspect ratio in NDC and AC, the viewport
upper right corner may have to be reduced in either x or y.*/
if (wr < vr)
{ /* Don't use all of the y dimension in the viewport.*/
v_ur_y = wr * dvx + ws->ws_curv.d_ll.d_y;
dvy = v_ur_y - ws->ws_curv.d_ll.d_y;
}
else if (wr > vr)
{ /* Don't use all of the x dimension in the viewport.*/
v_ur_x = dvy / wr + ws->ws_curv.d_ll.d_x;
dvx = v_ur_x - ws->ws_curv.d_ll.d_x;
}
/* Update workstation transformation.*/
ws->wtr.xm = dvx * ws->dtr.xm / dwx;
ws->wtr.xa = (ws->ws_curv.d_ll.d_x * ws->dtr.xm + ws->dtr.xa) -
ws->ws_curw.n_ll.n_x * ws->wtr.xm + 0.5;
ws->wtr.ym = dvy * ws->dtr.ym / dwy;
ws->wtr.ya = (ws->ws_curv.d_ll.d_y * ws->dtr.ym + ws->dtr.ya) -
ws->ws_curw.n_ll.n_y * ws->wtr.ym + 0.5;
/* Update clipping boundary for new workstation transformation.*/
t1cclp();
/* Update character spacing and height for new ws transformation.*/
/*dt1cht(ws->ncht);*/
ws->ws_waitr = FALSE;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* t1wstr - Perform the current workstation transformation.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
t1wstr(p, q)
Nc p;
Ac *q;
{ q->a_x = (Int)(p.n_x * ws->wtr.xm + ws->wtr.xa);
q->a_y = (Int)(p.n_y * ws->wtr.ym + ws->wtr.ya);
}