TempleOSCD_150216.ISO
This commit is contained in:
1 parent
64f679eeb9
commit
401601816c
531 files changed
+23341
-22071
No files matched your search
+154
-65
@@ -19,37 +19,6 @@ U0 GrInit1()
|
||||
GrInit1;
|
||||
|
||||
#help_index "Graphics/Sprite"
|
||||
#define SPT_END 0
|
||||
#define SPT_COLOR 1
|
||||
#define SPT_DITHER_COLOR 2
|
||||
#define SPT_WIDTH 3
|
||||
#define SPT_PLANAR_SYMMETRY 4
|
||||
#define SPT_TRANSFORM_ON 5
|
||||
#define SPT_TRANSFORM_OFF 6
|
||||
#define SPT_SHIFT 7
|
||||
#define SPT_PT 8
|
||||
#define SPT_POLYPT 9
|
||||
#define SPT_LINE 10
|
||||
#define SPT_POLYLINE 11
|
||||
#define SPT_RECT 12
|
||||
#define SPT_ROTATED_RECT 13
|
||||
#define SPT_CIRCLE 14
|
||||
#define SPT_ELLIPSE 15
|
||||
#define SPT_POLYGON 16
|
||||
#define SPT_BSPLINE2 17
|
||||
#define SPT_BSPLINE2_CLOSED 18
|
||||
#define SPT_BSPLINE3 19
|
||||
#define SPT_BSPLINE3_CLOSED 20
|
||||
#define SPT_FLOOD_FILL 21
|
||||
#define SPT_FLOOD_FILL_NOT 22
|
||||
#define SPT_BITMAP 23
|
||||
#define SPT_MESH 24
|
||||
#define SPT_SHIFTABLE_MESH 25
|
||||
#define SPT_ARROW 26
|
||||
#define SPT_TEXT 27
|
||||
#define SPT_TEXT_BOX 28
|
||||
#define SPT_TEXT_DIAMOND 29
|
||||
#define SPT_NUM_TYPES 30
|
||||
|
||||
class CMeshTri
|
||||
{
|
||||
@@ -65,43 +34,163 @@ class CQueMeshTri
|
||||
I32 nums[3];
|
||||
};
|
||||
|
||||
public class CSprite
|
||||
{//See $LK,"Graphics/Sprite",A="HI:Graphics/Sprite"$
|
||||
//See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ for how CSprite are stored.
|
||||
CSprite *next,*last;
|
||||
|
||||
U0 start;
|
||||
public class CSpriteBase
|
||||
{
|
||||
U8 type;
|
||||
union {
|
||||
U8 color;
|
||||
U16 dither_color;
|
||||
I32 x1;
|
||||
I32 num;
|
||||
I32 width;
|
||||
I32 vertex_cnt; //Mesh
|
||||
}
|
||||
union {
|
||||
I32 y1;
|
||||
I32 height;
|
||||
I32 tri_cnt; //Mesh
|
||||
}
|
||||
union {
|
||||
I32 z1;
|
||||
I32 x2;
|
||||
U8 st[4];
|
||||
}
|
||||
union {
|
||||
I32 y2;
|
||||
I32 shiftable_vertex_cnt //Shiftable Mesh
|
||||
}
|
||||
union {
|
||||
F64 linespeed;
|
||||
F64 rot_angle;
|
||||
I32 shiftable_tri_cnt //Shiftable Mesh
|
||||
}
|
||||
};
|
||||
|
||||
public class CSpriteColor : CSpriteBase
|
||||
{
|
||||
U8 color;
|
||||
};
|
||||
|
||||
public class CSpriteDitherColor : CSpriteBase
|
||||
{
|
||||
U16 dither_color;
|
||||
};
|
||||
|
||||
public class CSpriteWidth : CSpriteBase
|
||||
{
|
||||
I32 width;
|
||||
};
|
||||
|
||||
public class CSpritePt : CSpriteBase
|
||||
{
|
||||
I32 x1;
|
||||
I32 y1;
|
||||
};
|
||||
|
||||
public class CSpritePtRad : CSpritePt
|
||||
{
|
||||
I32 radius;
|
||||
};
|
||||
|
||||
public class CSpritePtPt : CSpritePt
|
||||
{
|
||||
I32 x2;
|
||||
I32 y2;
|
||||
};
|
||||
|
||||
public class CSpritePtPtAng : CSpritePtPt
|
||||
{
|
||||
F64 angle;
|
||||
};
|
||||
|
||||
public class CSpritePtWH : CSpritePt
|
||||
{
|
||||
I32 width;
|
||||
I32 height;
|
||||
};
|
||||
|
||||
public class CSpritePtWHU8s : CSpritePtWH
|
||||
{
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtWHAng : CSpritePtWH
|
||||
{
|
||||
F64 angle;
|
||||
};
|
||||
|
||||
public class CSpritePtWHAngSides : CSpritePtWHAng
|
||||
{
|
||||
I32 sides;
|
||||
};
|
||||
|
||||
public class CSpriteNumU8s : CSpriteBase
|
||||
{
|
||||
I32 num;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpriteNumPtU8s : CSpriteBase
|
||||
{
|
||||
I32 num;
|
||||
I32 x;
|
||||
I32 y;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtStr : CSpritePt
|
||||
{
|
||||
U8 st[0];
|
||||
};
|
||||
|
||||
public class CSpriteMeshU8s : CSpriteBase
|
||||
{
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
public class CSpritePtMeshU8s : CSpriteBase
|
||||
{
|
||||
I32 x;
|
||||
I32 y;
|
||||
I32 z;
|
||||
I32 vertex_cnt;
|
||||
I32 tri_cnt;
|
||||
U8 u[0];
|
||||
};
|
||||
|
||||
#define SPT_END 0 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_COLOR 1 //$LK,"CSpriteColor",A="MN:CSpriteColor"$
|
||||
#define SPT_DITHER_COLOR 2 //$LK,"CSpriteDitherColor",A="MN:CSpriteDitherColor"$
|
||||
#define SPT_WIDTH 3 //$LK,"CSpriteWidth",A="MN:CSpriteWidth"$
|
||||
#define SPT_PLANAR_SYMMETRY 4 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TRANSFORM_ON 5 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_TRANSFORM_OFF 6 //$LK,"CSpriteBase",A="MN:CSpriteBase"$
|
||||
#define SPT_SHIFT 7 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_PT 8 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_POLYPT 9 //$LK,"CSpriteNumPtU8s",A="MN:CSpriteNumPtU8s"$
|
||||
#define SPT_LINE 10 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_POLYLINE 11 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_RECT 12 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_ROTATED_RECT 13 //$LK,"CSpritePtPtAng",A="MN:CSpritePtPtAng"$
|
||||
#define SPT_CIRCLE 14 //$LK,"CSpritePtRad",A="MN:CSpritePtRad"$
|
||||
#define SPT_ELLIPSE 15 //$LK,"CSpritePtWHAng",A="MN:CSpritePtWHAng"$
|
||||
#define SPT_POLYGON 16 //$LK,"CSpritePtWHAngSides",A="MN:CSpritePtWHAngSides"$
|
||||
#define SPT_BSPLINE2 17 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE2_CLOSED 18 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE3 19 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_BSPLINE3_CLOSED 20 //$LK,"CSpriteNumU8s",A="MN:CSpriteNumU8s"$
|
||||
#define SPT_FLOOD_FILL 21 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_FLOOD_FILL_NOT 22 //$LK,"CSpritePt",A="MN:CSpritePt"$
|
||||
#define SPT_BITMAP 23 //$LK,"CSpritePtWHU8s",A="MN:CSpritePtWHU8s"$
|
||||
#define SPT_MESH 24 //$LK,"CSpriteMeshU8s",A="MN:CSpriteMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_SHIFTABLE_MESH 25 //$LK,"CSpritePtMeshU8s",A="MN:CSpritePtMeshU8s"$ See $MA-X+PU,"::/Apps/GrModels",LM="Cd(\"::/Apps/GrModels\");Dir;View;\n"$.
|
||||
#define SPT_ARROW 26 //$LK,"CSpritePtPt",A="MN:CSpritePtPt"$
|
||||
#define SPT_TEXT 27 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_BOX 28 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_TEXT_DIAMOND 29 //$LK,"CSpritePtStr",A="MN:CSpritePtStr"$
|
||||
#define SPT_NUM_TYPES 30
|
||||
//See $LK,"Graphics/Sprite",A="HI:Graphics/Sprite"$. See $LK,"::/Adam/Gr/GrSpritePlot.CPP",A="FL:::/Adam/Gr/GrSpritePlot.CPP,1"$ and
|
||||
//$LK,"::/Demo/Graphics/SpriteRaw.CPP"$ for how CSprite are stored.
|
||||
public class CSprite
|
||||
{
|
||||
CSprite *next,*last;
|
||||
U0 start;
|
||||
union {
|
||||
U8 type;
|
||||
CSpriteBase b;
|
||||
CSpriteColor c;
|
||||
CSpriteDitherColor d;
|
||||
CSpriteWidth w;
|
||||
CSpritePt p;
|
||||
CSpritePtPt pp;
|
||||
CSpritePtPtAng ppa;
|
||||
CSpritePtRad pr;
|
||||
CSpritePtWHU8s pwhu;
|
||||
CSpritePtWHAng pwha;
|
||||
CSpritePtWHAngSides pwhas;
|
||||
CSpriteNumU8s nu;
|
||||
CSpriteNumPtU8s npu;
|
||||
CSpriteMeshU8s mu;
|
||||
CSpritePtMeshU8s pmu;
|
||||
CSpritePtStr ps;
|
||||
}
|
||||
};
|
||||
|
||||
#help_index "Graphics"
|
||||
|
||||
extern I64 GrBlot3(CDC *dc,I64 x1,I64 y1,I64 z1,CDC *img);
|
||||
@@ -114,7 +203,7 @@ extern U8 *SpriteQue2Sprite(CSprite *root,I64 *_size=NULL);
|
||||
#include "GrDC"
|
||||
#include "GrPalette"
|
||||
#include "GrInit"
|
||||
#include "MathGr"
|
||||
#include "GrMath"
|
||||
#include "GrScreen"
|
||||
#include "GrBitMap"
|
||||
#include "GrPrimatives"
|
||||
|
||||
+207
-207
@@ -51,7 +51,7 @@ public Bool GrPlot0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
break;
|
||||
case ROPB_COLLISION:
|
||||
c=*dst;
|
||||
if (c!=TRANSPARENT&&c!=bkcolor.c0.color)
|
||||
if (c!=TRANSPARENT && c!=bkcolor.c0.color)
|
||||
dc->collision_cnt++;
|
||||
break;
|
||||
case ROPB_XOR:
|
||||
@@ -71,7 +71,7 @@ public I64 GrPeek0(CDC *dc=gr.dc,I64 x,I64 y)
|
||||
public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
{//2D. Clipping but not transformation..
|
||||
I64 i,j,k,k1,kk,kk1,w1,h1,w2,h2,
|
||||
leading_bits,leading_bit_mask,whole_bytes,trailing_bits,trailing_bit_mask,
|
||||
leading_pixels,leading_pixel_mask,whole_I64s,trailing_pixels,trailing_pixel_mask,
|
||||
reg bit_shift,dist,win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,
|
||||
color_mask;
|
||||
U8 reg *dst,*src;
|
||||
@@ -133,16 +133,16 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dc->depth_buf=NULL;
|
||||
dc->color&=~ROPF_DITHER;
|
||||
color=dc->color;
|
||||
leading_bits=-(w1+x)&7;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
leading_pixels=-(w1+x)&7;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
bit_shift=-x&7;
|
||||
whole_bytes=(w2-w1-leading_bits)>>3;
|
||||
if (whole_bytes<0) whole_bytes=0;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
trailing_bits=0;
|
||||
whole_I64s=(w2-w1-leading_pixels)>>3;
|
||||
if (whole_I64s<0) whole_I64s=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
trailing_pixels=0;
|
||||
}
|
||||
switch (color.c0.rop) {
|
||||
case ROPB_COLLISION: //TODO: Might want to check win_z_buf
|
||||
@@ -167,10 +167,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -183,21 +183,21 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else {
|
||||
@@ -205,20 +205,20 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -231,28 +231,28 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask&color_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask&color_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&color_mask;
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++&color_mask;
|
||||
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask&color_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask&color_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask&color_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -269,10 +269,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -308,10 +308,10 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -324,21 +324,21 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
@@ -346,20 +346,20 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -372,28 +372,28 @@ public I64 GrBlot(CDC *dc=gr.dc,I64 x,I64 y,CDC *img)
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
*src(I64 *)++&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
*src(I64 *)++&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++=*src(I64 *)++;
|
||||
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
*src(I64 *)++&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
*src(I64 *)++&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -415,10 +415,10 @@ here1a:
|
||||
} else {
|
||||
win_z_num =win_task->win_z_num;
|
||||
win_z_buf_ptr =gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -459,10 +459,10 @@ here1a:
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -475,21 +475,21 @@ here1a:
|
||||
for (j=h1;j<h2;j++) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
} else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else {
|
||||
@@ -497,20 +497,20 @@ here1a:
|
||||
dst(I64 *)++;
|
||||
}
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
if (win_z_num>=*win_z_buf_ptr++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
else {
|
||||
src(I64 *)++;
|
||||
dst(I64 *)++;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -523,27 +523,27 @@ here1a:
|
||||
for (j=h2-h1;j;j--) {
|
||||
src=img->body+kk&~7;
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~leading_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_bit_mask;
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~leading_pixel_mask;
|
||||
}
|
||||
if (bit_shift)
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift);
|
||||
else
|
||||
for (i=0;i<whole_bytes;i++)
|
||||
for (i=0;i<whole_I64s;i++)
|
||||
*dst(I64 *)++^=*src(I64 *)++;
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
if (bit_shift)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^(*src(U64 *)++>>bit_shift|*src(I64 *)<<(64-bit_shift)))&~trailing_pixel_mask;
|
||||
else
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|
|
||||
(*dst(I64 *)^*src(I64 *)++)&~trailing_pixel_mask;
|
||||
}
|
||||
kk +=img->width_internal;
|
||||
kk1+=dc->width_internal;
|
||||
@@ -612,7 +612,7 @@ public CDC *DCExtract(CDC *dc=gr.dc,I64 x1,I64 y1,I64 x2,I64 y2,CTask *task=NULL
|
||||
public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
{//2D. Clipping but not transformation.
|
||||
U8 reg *src,reg *dst,*font_ptr;
|
||||
I64 i,m,leading_bits,trailing_bits,leading_bit_mask,trailing_bit_mask,
|
||||
I64 i,m,leading_pixels,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
j,k1,kk1,w1,h1,w2,h2,reg bit_shift,dist,reg color_mask;
|
||||
CColorROPU32 color,c;
|
||||
CTask *win_task;
|
||||
@@ -668,17 +668,17 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (dc->flags & DCF_DONT_DRAW)
|
||||
return 1;
|
||||
color=dc->color;
|
||||
leading_bits=-(w1+x)&7;
|
||||
if (!leading_bits) leading_bits=8;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
leading_pixels=-(w1+x)&7;
|
||||
if (!leading_pixels) leading_pixels=8;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
bit_shift=-x&7;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
trailing_bits=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
trailing_pixels=0;
|
||||
}
|
||||
font_ptr=&text.font[(FONT_WIDTH*(FONT_HEIGHT*ch+h1))>>3];
|
||||
font_ptr=&text.font(U8 *)[FONT_HEIGHT*ch+h1];
|
||||
if (color.c0.rop==ROPB_COLLISION) {
|
||||
m=w1&(FONT_WIDTH-1);
|
||||
#assert FONT_WIDTH==8
|
||||
@@ -699,7 +699,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
k1=x+w1;
|
||||
kk1=(h1+y)*dc->width_internal+k1;
|
||||
if (!(dc->flags & DCF_SCREEN_BITMAP) || dc->flags&DCF_ON_TOP) {
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr;
|
||||
if (bit_shift)
|
||||
@@ -709,7 +709,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -717,7 +717,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
}
|
||||
kk1+=8;
|
||||
}
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr+1;
|
||||
if (bit_shift)
|
||||
@@ -736,7 +736,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_MONO:
|
||||
for (j=h2-h1;j;j--) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -744,7 +744,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
case ROPB_XOR:
|
||||
if (color_mask) {
|
||||
for (j=h2-h1;j;j--) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -753,7 +753,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr;
|
||||
if (bit_shift)
|
||||
@@ -764,7 +764,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~leading_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
@@ -774,7 +774,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (color_mask) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~leading_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -784,7 +784,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
k1+=8;
|
||||
kk1+=8;
|
||||
}
|
||||
if (trailing_bits) {
|
||||
if (trailing_pixels) {
|
||||
dst=dc->body+kk1&~7;
|
||||
src=font_ptr+1;
|
||||
if (bit_shift)
|
||||
@@ -795,7 +795,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j)) {
|
||||
m=gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF];
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(color_mask&m|*dst(I64 *)&~m)&~trailing_pixel_mask;
|
||||
}
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
@@ -805,7 +805,7 @@ public I64 GrPutChar(CDC *dc=gr.dc,I64 x,I64 y,U8 ch)
|
||||
if (color_mask) {
|
||||
for (j=h1;j<h2;j++) {
|
||||
if (!IsPixCovered0(win_task,k1,y+j))
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_bit_mask;
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|(*dst(I64 *)^gr.to_8_bits[*src(U16 *)>>bit_shift&0xFF])&~trailing_pixel_mask;
|
||||
src++;
|
||||
dst+=dc->width_internal;
|
||||
}
|
||||
@@ -886,7 +886,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
{//2D. Width Height. Clipping but not transformation.
|
||||
//Returns cnt of pixs changed.
|
||||
I64 i,result=0,j,k1,kk1,w1,h1,w2,h2,dist,
|
||||
leading_bits,original_leading_bits,whole_bytes,trailing_bits,leading_bit_mask,trailing_bit_mask,
|
||||
leading_pixels,original_leading_pixels,whole_I64s,trailing_pixels,leading_pixel_mask,trailing_pixel_mask,
|
||||
win_z_buf_line_inc,win_z_buf_line_dec,win_z_num,color_mask;
|
||||
U8 reg *dst;
|
||||
U16 reg *win_z_buf_ptr;
|
||||
@@ -963,16 +963,16 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
}
|
||||
} else
|
||||
dither=FALSE;
|
||||
original_leading_bits=leading_bits=-(w1+x)&7;
|
||||
leading_bit_mask=gr.to_8_bits[0xFF>>leading_bits];
|
||||
whole_bytes=(w2-w1-leading_bits)>>3;
|
||||
if (whole_bytes<0) whole_bytes=0;
|
||||
trailing_bits=(x+w2)&7;
|
||||
trailing_bit_mask=gr.to_8_bits[0xFF<<trailing_bits&0xFF];
|
||||
if (leading_bits+trailing_bits>w2-w1) {
|
||||
leading_bit_mask|=trailing_bit_mask;
|
||||
leading_bits=w2-w1; //Correct so it's right for result.
|
||||
trailing_bits=0;
|
||||
original_leading_pixels=leading_pixels=-(w1+x)&7;
|
||||
leading_pixel_mask=gr.to_8_bits[0xFF>>leading_pixels];
|
||||
whole_I64s=(w2-w1-leading_pixels)>>3;
|
||||
if (whole_I64s<0) whole_I64s=0;
|
||||
trailing_pixels=(x+w2)&7;
|
||||
trailing_pixel_mask=gr.to_8_bits[0xFF<<trailing_pixels&0xFF];
|
||||
if (leading_pixels+trailing_pixels>w2-w1) {
|
||||
leading_pixel_mask|=trailing_pixel_mask;
|
||||
leading_pixels=w2-w1; //Correct so it's right for result.
|
||||
trailing_pixels=0;
|
||||
}
|
||||
if (color.c0.rop==ROPB_COLLISION) {//TODO: Might want to check win_z_buf
|
||||
color =dc->bkcolor.c0.color;
|
||||
@@ -993,10 +993,10 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
else {
|
||||
win_z_num=win_task->win_z_num;
|
||||
win_z_buf_ptr=gr.win_z_buf(U8 *)+((h1+y)/FONT_HEIGHT*TEXT_COLS+(w1+x)/FONT_WIDTH)*sizeof(U16);
|
||||
win_z_buf_line_dec=whole_bytes;
|
||||
if (leading_bits)
|
||||
win_z_buf_line_dec=whole_I64s;
|
||||
if (leading_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
if (trailing_bits)
|
||||
if (trailing_pixels)
|
||||
win_z_buf_line_dec++;
|
||||
win_z_buf_line_dec*=sizeof(U16);
|
||||
win_z_buf_line_inc=TEXT_COLS*sizeof(U16)-win_z_buf_line_dec;
|
||||
@@ -1016,21 +1016,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1046,12 +1046,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1067,21 +1067,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h1;j<h2;j++) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1097,12 +1097,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
for (j=h2-h1;j;j--) {
|
||||
color_mask=gr.to_8_colors[color.c0.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
if (RandU16<dc->dither_probability_u16)
|
||||
color.c0=dither_colors.c1;
|
||||
@@ -1114,7 +1114,7 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (((x+w1-original_leading_bits)^(y+h1))&1)
|
||||
if (((x+w1-original_leading_pixels)^(y+h1))&1)
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
nobound_switch (color.c0.rop) {
|
||||
case ROPB_EQU:
|
||||
@@ -1125,21 +1125,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1153,12 +1153,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1172,21 +1172,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1200,12 +1200,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
color_mask=gr.to_8_bits[0x55]&gr.to_8_colors[color.c0.color]|
|
||||
gr.to_8_bits[0xAA]&gr.to_8_colors[color.c1.color];
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
SwapU16(&color.c0,&color.c1);
|
||||
}
|
||||
@@ -1223,21 +1223,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1248,12 +1248,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
} else {
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst(I64 *)=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
@@ -1264,21 +1264,21 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
result=0;
|
||||
for (j=h1;j<h2;j++) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits) {
|
||||
if (leading_pixels) {
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
result+=leading_bits;
|
||||
*dst(I64 *)=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
result+=leading_pixels;
|
||||
}
|
||||
dst(I64 *)++;
|
||||
}
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
if (win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)^=color_mask;
|
||||
result+=8;
|
||||
}
|
||||
if (trailing_bits && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
result+=trailing_bits;
|
||||
if (trailing_pixels && win_z_num>=*win_z_buf_ptr++) {
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
result+=trailing_pixels;
|
||||
}
|
||||
if ((j+y)&7==7)
|
||||
win_z_buf_ptr(U8 *)+=win_z_buf_line_inc;
|
||||
@@ -1289,12 +1289,12 @@ public I64 GrRect(CDC *dc=gr.dc,I64 x,I64 y,I64 w,I64 h)
|
||||
} else {
|
||||
for (j=h2-h1;j;j--) {
|
||||
dst=dc->body+kk1&~7;
|
||||
if (leading_bits)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_bit_mask|*dst(I64 *)^color_mask&~leading_bit_mask;
|
||||
for (i=0;i<whole_bytes;i++,dst(I64 *)++)
|
||||
if (leading_pixels)
|
||||
*dst(I64 *)++=*dst(I64 *)&leading_pixel_mask|*dst(I64 *)^color_mask&~leading_pixel_mask;
|
||||
for (i=0;i<whole_I64s;i++,dst(I64 *)++)
|
||||
*dst(I64 *)^=color_mask;
|
||||
if (trailing_bits)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_bit_mask|*dst(I64 *)^color_mask&~trailing_bit_mask;
|
||||
if (trailing_pixels)
|
||||
*dst(I64 *)=*dst(I64 *)&trailing_pixel_mask|*dst(I64 *)^color_mask&~trailing_pixel_mask;
|
||||
kk1+=dc->width_internal;
|
||||
}
|
||||
result=(h2-h1)*(w2-w1);
|
||||
|
||||
+41
-35
@@ -41,17 +41,21 @@ public I64 *GrIdentEqu(I64 r[4][4])
|
||||
return r;
|
||||
}
|
||||
|
||||
public I64 GrRotNormSqr65536(I64 r[4][4])
|
||||
{//Norm Squared of r.
|
||||
//(1.0/Sqrt(3))*65536=37837.22
|
||||
return SqrI64((r[0][0]*37838+r[0][1]*37838+r[0][2]*37838)>>32)+
|
||||
SqrI64((r[1][0]*37837+r[1][1]*37837+r[1][2]*37837)>>32)+
|
||||
SqrI64((r[2][0]*37837+r[2][1]*37837+r[2][2]*37837)>>32);
|
||||
}
|
||||
|
||||
public U0 GrSetRotMat(CDC *dc=NULL,I64 r[4][4])
|
||||
{//Set device context's rot matrix. Will be $LK,"Free",A="MN:Free"$d() in $LK,"DCDel",A="MN:DCDel"$(). Uses $LK,"fixed-point",A="FI:::/Demo/Lectures/FixedPoint.CPP"$.
|
||||
//The main purpose is to set matrix norm for pen width scaling.
|
||||
//NULL as dc means gr.dc
|
||||
//Note: (1.0/Sqrt(3))*65536=37837.22
|
||||
I64 xx=37838,yy=37837,zz=37837;
|
||||
if (!dc) dc=gr.dc;
|
||||
dc->r=r;
|
||||
GrRot(r,&xx,&yy,&zz);
|
||||
//scaled 32 bits
|
||||
dc->r_norm=Sqrt(xx*xx+yy*yy+zz*zz)*65536;
|
||||
dc->r_norm=Sqrt(GrRotNormSqr65536(r))*65536; //scaled 32 bits
|
||||
}
|
||||
|
||||
#help_index "Graphics/Mesh"
|
||||
@@ -171,7 +175,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
if (!dc) dc=gr.dc;
|
||||
if (!task) task=Fs;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
result=MAlloc(sizeof(CDC),task);
|
||||
MemCpy(result,dc,sizeof(CDC));
|
||||
result->win_task=result->mem_task=task;
|
||||
@@ -185,7 +189,7 @@ public CDC *DCAlias(CDC *dc=NULL,CTask *task=NULL)
|
||||
public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
{//Create new width x height device context.
|
||||
//Internally only allows widths which are divisible by 8.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Grep(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
//Don't forget these $MA-X+PU,"sizeof(CDC)",LM="Find(\"sizeof(CDC)\",\"/*\");View;"$.
|
||||
CDC *result;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
@@ -194,11 +198,10 @@ public CDC *DCNew(I64 width,I64 height,CTask *task=NULL,Bool null_bitmap=FALSE)
|
||||
result->width=width;
|
||||
result->width_internal=(width+7)&~7;
|
||||
result->height=height;
|
||||
result->body_size=result->width_internal*result->height;
|
||||
if (null_bitmap)
|
||||
result->flags|=DCF_DONT_DRAW;
|
||||
else
|
||||
result->body=CAlloc(result->body_size,task);
|
||||
result->body=CAlloc(result->width_internal*result->height,task);
|
||||
result->r=MAlloc(16*sizeof(I64),task);
|
||||
DCRst(result);
|
||||
result->dc_signature=DCS_SIGNATURE_VAL;
|
||||
@@ -209,7 +212,7 @@ public U0 DCDel(CDC *dc)
|
||||
{//Free dc, image body, rot mat and depth buf.
|
||||
if (!dc) return;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
dc->dc_signature=0;
|
||||
Free(dc->r);
|
||||
if (!(dc->flags & DCF_ALIAS))
|
||||
@@ -233,7 +236,7 @@ public U0 DCDepthBufRst(CDC *dc)
|
||||
}
|
||||
|
||||
public U0 DCAllocDepthBuf(CDC *dc)
|
||||
{//Allocate a 32-bit depth buffer for device context.
|
||||
{//Alloc a 32-bit depth buffer for device context.
|
||||
Free(dc->depth_buf);
|
||||
dc->depth_buf=MAlloc(dc->width_internal*dc->height*sizeof(I32),dc->mem_task);
|
||||
DCDepthBufRst(dc);
|
||||
@@ -244,7 +247,7 @@ public CDC *DCCopy(CDC *dc,CTask *task=NULL)
|
||||
CDC *result;
|
||||
if (!dc) return NULL;
|
||||
if (dc->dc_signature!=DCS_SIGNATURE_VAL)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
result=MAllocIdentical(dc,task);
|
||||
GrSetRotMat(result,MAllocIdentical(dc->r,task));
|
||||
result->mem_task=task;
|
||||
@@ -287,32 +290,27 @@ public U8 *DCSave(CDC *dc,I64 *_size=NULL,Bool compressed=TRUE)
|
||||
U8 *result,*ptr,*body;
|
||||
Bool old_preempt;
|
||||
CArcCompress *ac;
|
||||
I64 i,old_flags=dc->flags;
|
||||
I64 i=dc->width_internal*dc->height,old_flags=dc->flags;
|
||||
|
||||
if (compressed) {
|
||||
ac=CompressBuf(dc->body,dc->body_size);
|
||||
ac=CompressBuf(dc->body,i);
|
||||
i=ac->compressed_size;
|
||||
body=ac;
|
||||
} else {
|
||||
ac=NULL;
|
||||
i=dc->body_size;
|
||||
body=dc->body;
|
||||
}
|
||||
|
||||
ptr=result=MAlloc(offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area)+i);
|
||||
ptr=result=MAlloc(offset(CDC.end)-offset(CDC.start)+i);
|
||||
|
||||
old_preempt=Preempt(OFF); //in case it is a screen bitmap
|
||||
if (compressed) dc->flags|=DCF_COMPRESSED;
|
||||
dc->flags&=DCF_COMPRESSED;
|
||||
MemCpy(result,&dc->start_saved_area,
|
||||
offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area));
|
||||
MemCpy(result,&dc->start,offset(CDC.end)-offset(CDC.start));
|
||||
dc->flags=old_flags;
|
||||
Preempt(old_preempt);
|
||||
|
||||
ptr+=offset(CDC.end_saved_area)-
|
||||
offset(CDC.start_saved_area);
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
MemCpy(ptr,body,i);
|
||||
ptr+=i;
|
||||
|
||||
@@ -326,22 +324,24 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
CDC *result;
|
||||
U8 *ptr=src;
|
||||
CArcCompress *ac;
|
||||
I64 body_size;
|
||||
if (!task) task=Fs;
|
||||
result=CAlloc(sizeof(CDC),task);
|
||||
result->win_task=task;
|
||||
result->mem_task=task;
|
||||
MemCpy(&result->start_saved_area,src,
|
||||
offset(CDC.end_saved_area)-offset(CDC.start_saved_area));
|
||||
ptr+=offset(CDC.end_saved_area)-offset(CDC.start_saved_area);
|
||||
MemCpy(&result->start,src,
|
||||
offset(CDC.end)-offset(CDC.start));
|
||||
ptr+=offset(CDC.end)-offset(CDC.start);
|
||||
body_size=result->width_internal*result->height;
|
||||
if (result->flags&DCF_COMPRESSED) {
|
||||
result->flags&=~DCF_COMPRESSED;
|
||||
ac=ptr;
|
||||
result->body=ExpandBuf(ac,task);
|
||||
ptr+=ac->compressed_size;
|
||||
} else {
|
||||
result->body=MAlloc(result->body_size,task);
|
||||
MemCpy(result->body,ptr,result->body_size);
|
||||
ptr+=result->body_size;
|
||||
result->body=MAlloc(body_size,task);
|
||||
MemCpy(result->body,ptr,body_size);
|
||||
ptr+=body_size;
|
||||
}
|
||||
result->pen_width=1;
|
||||
result->r=GrIdentNew(task);
|
||||
@@ -351,6 +351,8 @@ public CDC *DCLoad(U8 *src,I64 *_size=NULL,CTask *task=NULL)
|
||||
return result;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files"
|
||||
#help_file "::/Doc/GRAFiles"
|
||||
#help_index "Graphics/Device Contexts;Graphics/GRA Files"
|
||||
public I64 GRAWrite(U8 *filename,CDC *dc)
|
||||
{//TempleOS GRA File.
|
||||
@@ -376,7 +378,7 @@ public CDC *GRARead(U8 *filename,CTask *task=NULL)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Sprite;Graphics/GRA Files;DolDoc/Output"
|
||||
public U0 DocGRAFile(CDoc *doc=NULL,U8 *filename)
|
||||
public U0 DocGRA(CDoc *doc=NULL,U8 *filename)
|
||||
{//Put a GRA file into a document as a sprite.
|
||||
CDC *dc=GRARead(filename);
|
||||
CSprite *elems=DC2Sprite(dc);
|
||||
@@ -386,25 +388,29 @@ public U0 DocGRAFile(CDoc *doc=NULL,U8 *filename)
|
||||
}
|
||||
|
||||
#help_index "Graphics/Device Contexts;Graphics/Screen"
|
||||
public CDC *DCCaptureScreen(CTask *task=NULL)
|
||||
public CDC *DCCaptureScreen(Bool include_zoom=TRUE,CTask *task=NULL)
|
||||
{//Capture screen to a device context.
|
||||
CDC *dc;
|
||||
U8 *dst;
|
||||
WinMgrSync(2,TRUE);
|
||||
dc=DCCopy(gr.screen_image,task);
|
||||
dst=MAlloc(dc->body_size,task);
|
||||
if (include_zoom)
|
||||
dc=DCCopy(gr.screen_image,task);
|
||||
else
|
||||
dc=DCCopy(gr.dc1,task);
|
||||
dc->flags&=~DCF_SCREEN_BITMAP;
|
||||
dst=MAlloc(dc->width_internal*dc->height,task);
|
||||
//Pick background color that never occurs. COLOR_INVALID
|
||||
GrBitMap4ToBitMap8(dst,dc->body,dc->body_size/2,COLOR_INVALID);
|
||||
GrBitMap4ToBitMap8(dst,dc->body,(dc->width_internal*dc->height)>>1,COLOR_INVALID);
|
||||
Free(dc->body);
|
||||
dc->body=dst;
|
||||
return dc;
|
||||
}
|
||||
|
||||
#help_index "Graphics/GRA Files;Graphics/Screen"
|
||||
public I64 GRACaptureScreen(U8 *filename)
|
||||
public I64 GRACaptureScreen(U8 *filename,Bool include_zoom=TRUE)
|
||||
{//Capture screen to a TempleOS GRA File.
|
||||
I64 size;
|
||||
CDC *dc=DCCaptureScreen;
|
||||
CDC *dc=DCCaptureScreen(include_zoom);
|
||||
size=GRAWrite(filename,dc);
|
||||
DCDel(dc);
|
||||
return size;
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ U0 CtrlAltZ(I64 sc)
|
||||
else
|
||||
GrScaleZoom(2.0);
|
||||
}
|
||||
SetCtrlAltLetCB('Z',&CtrlAltZ,"Sys/Zoom In or Out");
|
||||
CtrlAltLetCBSet('Z',&CtrlAltZ,"Sys/Zoom In or Out");
|
||||
|
||||
U0 Screen2Clipboard(I64)
|
||||
{
|
||||
@@ -25,4 +25,4 @@ U0 CtrlAltS(I64)
|
||||
{
|
||||
Spawn(&Screen2Clipboard);
|
||||
}
|
||||
SetCtrlAltLetCB('S',&CtrlAltS,"Sys/Screen Shot to Clipboard");
|
||||
CtrlAltLetCBSet('S',&CtrlAltS,"Sys/Screen Shot to Clipboard");
|
||||
+3
-7
@@ -9,7 +9,7 @@ public class CGrGlbls
|
||||
*dc2, //Updated every refresh
|
||||
*dc_cache,
|
||||
*zoomed_dc;
|
||||
U32 *text_base; //See $LK,"TextBase Layer",A="HI:TextBase Layer"$.
|
||||
U32 *text_base; //See $LK,"TextBase Layer",A="HI:TextBase Layer"$. (Similar to 0xB8000 but 32 bits)
|
||||
U16 *win_z_buf;
|
||||
|
||||
#define SPHT_ELEM_CODE 1
|
||||
@@ -19,7 +19,7 @@ public class CGrGlbls
|
||||
I64 highest_uncovered;
|
||||
U16 *vga_text_cache;
|
||||
I64 pan_text_x,pan_text_y; //[-7,7]
|
||||
U0 (*fp_final_screen_update)(CDC *dc);
|
||||
U0 (*fp_final_screen_update)(CDC *dc);//Mouse cursor is handled here.
|
||||
U0 (*fp_wall_paper)(CTask *task);
|
||||
U0 (*fp_draw_input_ptr)(CDC *dc,I64 x,I64 y);
|
||||
U0 (*fp_draw_grab_input_ptr)(CDC *dc,I64 x,I64 y,Bool closed);
|
||||
@@ -31,10 +31,6 @@ public class CGrGlbls
|
||||
*even_pen_brushes[GR_NUM_PEN_BRUSHES],
|
||||
*odd_pen_brushes[GR_NUM_PEN_BRUSHES];
|
||||
|
||||
#define GR_REFRESH_LOG_CNT 16
|
||||
F64 refresh_time_stamps[GR_REFRESH_LOG_CNT];
|
||||
I64 refresh_ts_ptr;
|
||||
|
||||
#define GR_MAX_SCREEN_ZOOM 8
|
||||
U8 *screen_zoom_tables[GR_MAX_SCREEN_ZOOM+1];
|
||||
I64 screen_zoom,sx,sy;
|
||||
@@ -43,7 +39,7 @@ public class CGrGlbls
|
||||
Bool continuous_scroll;
|
||||
} gr;
|
||||
|
||||
//See $LK,"SYS_BIOS_GR_MODE",A="FF:D:/Kernel/KStart.CPP,SYS_BIOS_GR_MODE:2"$
|
||||
//See $LK,"RLf_VGA",A="FF:::/Kernel/KStart.CPP,RLf_VGA"$
|
||||
//See $LK,"SysGrInit",A="MN:SysGrInit"$()
|
||||
//Allows consts to be used instead of vars.
|
||||
HashPublic("GR_WIDTH",HTT_DEFINE_STR);;
|
||||
|
||||
+5
-7
@@ -55,14 +55,14 @@ U0 GrSetUpTables()
|
||||
if (((x-1)^(y-1))&1 && SqrI64(y*2-k)+SqrI64(x*2-k)<rr)
|
||||
GrPlot0(dc,x-1,y-1);
|
||||
}
|
||||
if (!sys_bios_gr_mode) { //if text mode
|
||||
MemSet(VGA_TEXT_MEM_BASE,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) { //if text mode
|
||||
MemSet(VGAM_TEXT,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
MemSet(gr.vga_text_cache,0,TEXT_ROWS*TEXT_COLS*sizeof(U16));
|
||||
} else {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,0x0F);
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,0x0F);
|
||||
//Virtual Box crashes on the following for some reason.
|
||||
// MemSet(VGA_GRAPHIC_MEM_BASE,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
// MemSet(VGAM_GRAPHICS,0,GR_HEIGHT*GR_WIDTH>>3);
|
||||
MemSet(gr.screen_image->body,0,GR_WIDTH*GR_HEIGHT>>1);
|
||||
}
|
||||
for (i=1;i<=GR_MAX_SCREEN_ZOOM;i++) {
|
||||
@@ -79,8 +79,6 @@ U0 GrSetUpTables()
|
||||
dst[j+l*256]=m.u8[l];
|
||||
}
|
||||
}
|
||||
for (i=0;i<GR_REFRESH_LOG_CNT;i++)
|
||||
gr.refresh_time_stamps[i]=tS;
|
||||
}
|
||||
|
||||
#help_index "Graphics/Screen;Windows"
|
||||
|
||||
File renamed without changes.
+19
-19
@@ -18,35 +18,35 @@ we never need to worry about indexes,
|
||||
just DAC palette settings.
|
||||
*/
|
||||
I64 i;
|
||||
if (!sys_bios_gr_mode) return;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
InU8(VGA_INPUT_STAT); //Rsts attr index/data
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
for (i=0;i<16;i++) {
|
||||
OutU8(VGA_ATTR_INDEX,i);
|
||||
OutU8(VGA_ATTR_DATA_WRITE,i);
|
||||
OutU8(VGAP_ATTR_INDEX,i);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,i);
|
||||
}
|
||||
OutU8(VGA_ATTR_INDEX,0x20);
|
||||
OutU8(VGA_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGA_INPUT_STAT); //Rsts attr index/data
|
||||
OutU8(VGAP_ATTR_INDEX,0x20);
|
||||
OutU8(VGAP_ATTR_DATA_WRITE,0); //Dummy write
|
||||
InU8(VGAP_INPUT_STAT); //Rsts attr index/data
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
|
||||
public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
{//6-bits per b, g and r.
|
||||
if (!sys_bios_gr_mode) return;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGA_PALETTE_MASK,0xFF);
|
||||
OutU8(VGA_REG_WRITE,color_num);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.r>>2);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.g>>2);
|
||||
OutU8(VGA_PALETTE_DATA,bgr.b>>2);
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_WRITE,color_num);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.r>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.g>>2);
|
||||
OutU8(VGAP_PALETTE_DATA,bgr.b>>2);
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
}
|
||||
@@ -54,16 +54,16 @@ public U0 SetVGAPaletteColor(I64 color_num,CBGR bgr)
|
||||
public CBGR GetVGAPaletteColor(I64 color_num)
|
||||
{//6-bits per b, g and r.
|
||||
CBGR result=0;
|
||||
if (!sys_bios_gr_mode) return 0;
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) return 0;
|
||||
PUSHFD
|
||||
CLI
|
||||
while (LBts(&sys_semas[SYS_SEMA_VGA],0))
|
||||
Yield;
|
||||
OutU8(VGA_PALETTE_MASK,0xFF);
|
||||
OutU8(VGA_REG_READ,color_num);
|
||||
result.r=InU8(VGA_PALETTE_DATA)<<2;
|
||||
result.g=InU8(VGA_PALETTE_DATA)<<2;
|
||||
result.b=InU8(VGA_PALETTE_DATA)<<2;
|
||||
OutU8(VGAP_PALETTE_MASK,0xFF);
|
||||
OutU8(VGAP_REG_READ,color_num);
|
||||
result.r=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.g=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
result.b=InU8(VGAP_PALETTE_DATA)<<2;
|
||||
LBtr(&sys_semas[SYS_SEMA_VGA],0);
|
||||
POPFD
|
||||
return result;
|
||||
|
||||
@@ -235,7 +235,7 @@ I64 GrFloodFillRay(CDC *dc,I64 x,I64 y,I64 z,I32 *db)
|
||||
}
|
||||
|
||||
public I64 GrFloodFill(CDC *dc=gr.dc,I64 x,I64 y,Bool not_color=FALSE,I64 z=0,I32 *db=NULL)
|
||||
{//3D. Ignore z and db.
|
||||
{//2D. Ignore z and db.
|
||||
//not_color=TRUE means fill up to everything which is not the current color.
|
||||
//not_color=FALSE means fill all parts equal to the color under the point.
|
||||
//Returns cnt of pixs changed
|
||||
|
||||
+11
-17
@@ -89,16 +89,10 @@ U0 GrUpdateWins()
|
||||
PutExcept(FALSE);
|
||||
Dbg("Exception in WinMgr");
|
||||
}
|
||||
|
||||
winmgr.last_ode_time=winmgr.ode_time;
|
||||
ode_allocated_factor=LowPass1(0.1,ode_allocated_factor,
|
||||
ode_alloced_factor=LowPass1(0.1,ode_alloced_factor,
|
||||
Clamp(Gs->idle_factor-0.1,0.2,0.8),1/winmgr.fps);
|
||||
|
||||
sys_task_being_screen_updated=NULL;
|
||||
gr.refresh_time_stamps[gr.refresh_ts_ptr++&(GR_REFRESH_LOG_CNT-1)]=tS;
|
||||
winmgr.fps=(GR_REFRESH_LOG_CNT-1)/
|
||||
(gr.refresh_time_stamps[(gr.refresh_ts_ptr-1)&(GR_REFRESH_LOG_CNT-1)]-
|
||||
gr.refresh_time_stamps[gr.refresh_ts_ptr&(GR_REFRESH_LOG_CNT-1)]);
|
||||
}
|
||||
|
||||
U0 GrFixZoomScale()
|
||||
@@ -339,7 +333,7 @@ U0 GrUpdateTextModeText()
|
||||
{
|
||||
U32 *src=gr.text_base;
|
||||
I64 cur_ch,i,d0=TEXT_COLS*TEXT_ROWS;
|
||||
U16 *dst=VGA_TEXT_MEM_BASE,*dst2=gr.vga_text_cache;
|
||||
U16 *dst=VGAM_TEXT,*dst2=gr.vga_text_cache;
|
||||
Bool blink_flag=Blink;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
i=d0;
|
||||
@@ -390,18 +384,18 @@ U0 GrUpdateVGAGraphics()
|
||||
dst=gr.screen_image->body;
|
||||
if (LBtr(&sys_semas[SYS_SEMA_FLUSH_VGA_IMAGE],0)) {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,plane);
|
||||
vga=VGA_GRAPHIC_MEM_BASE;
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64FlushCache(&vga,&src,d,&dst);
|
||||
}
|
||||
} else {
|
||||
for (plane=1;plane<0x10;plane<<=1) {
|
||||
OutU8(VGA_SC_INDEX,VGA_MAP_MASK);
|
||||
OutU8(VGA_SC_DATA,plane);
|
||||
vga=VGA_GRAPHIC_MEM_BASE;
|
||||
OutU8(VGAP_INDEX,VGAR_MAP_MASK);
|
||||
OutU8(VGAP_DATA,plane);
|
||||
vga=VGAM_GRAPHICS;
|
||||
row=gr.zoomed_dc->height;
|
||||
while (row--)
|
||||
GrUpdateLine64(&vga,&src,d,&dst);
|
||||
@@ -410,10 +404,10 @@ U0 GrUpdateVGAGraphics()
|
||||
}
|
||||
|
||||
U0 GrUpdateScreen()
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/Win2b.CPP,GrUpdateScreen"$, 60 times a second.
|
||||
{//Called by the Window Manager $LK,"HERE",A="FF:::/Adam/WinB.CPP,GrUpdateScreen"$, 60 times a second.
|
||||
CDC *dc;
|
||||
Preempt(ON);
|
||||
if (!sys_bios_gr_mode) //if text mode
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateWins;
|
||||
else {
|
||||
GrUpdateTextBG;
|
||||
@@ -429,7 +423,7 @@ U0 GrUpdateScreen()
|
||||
(*gr.fp_final_screen_update)(dc);
|
||||
DCDel(dc);
|
||||
|
||||
if (!sys_bios_gr_mode) //if text mode
|
||||
if (!Bt(&sys_run_level,RLf_VGA)) //if text mode
|
||||
GrUpdateTextModeText;
|
||||
else {
|
||||
DCBlotColor4(gr.dc1->body,gr.dc2->body,gr.dc_cache->body,
|
||||
|
||||
+97
-99
@@ -39,15 +39,15 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
dc->cur_sprite_elem_num=cur_sprite_elem_num++;
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->color;
|
||||
dc->color=dc->color&~(COLORROP_COLORS_MASK|ROPF_DITHER)|tempg->c.color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=dc->color&~COLORROP_COLORS_MASK|
|
||||
tempg->dither_color.u8[0]|
|
||||
tempg->dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=tempg->width;
|
||||
dc->pen_width=tempg->w.width;
|
||||
GrScalePenWidth(dc);
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
@@ -67,86 +67,87 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
dc->flags&=~DCF_TRANSFORMATION;
|
||||
break;
|
||||
case SPT_PT:
|
||||
GrPlot3(dc,tempg->x1+x,tempg->y1+y,z);
|
||||
GrPlot3(dc,tempg->p.x1+x,tempg->p.y1+y,z);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
GrPrint3(dc,tempg->x1+x,tempg->y1+y,z,"%s",tempg->st);
|
||||
GrPrint3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,"%s",tempg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_BOX:
|
||||
GrTextBox3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrTextBox3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
break;
|
||||
case SPT_TEXT_DIAMOND:
|
||||
GrTextDiamond3(dc,tempg->x1+x,tempg->y1+y,z,tempg->st);
|
||||
GrTextDiamond3(dc,tempg->ps.x1+x,tempg->ps.y1+y,z,tempg->ps.st);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
GrFloodFill3(dc,tempg->x1+x,tempg->y1+y,z,FALSE);
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,FALSE);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
i=dc->color;
|
||||
dc->color=dc->color.c0;
|
||||
GrFloodFill3(dc,tempg->x1+x,tempg->y1+y,z,TRUE);
|
||||
GrFloodFill3(dc,tempg->p.x1+x,tempg->p.y1+y,z,TRUE);
|
||||
dc->color=i;
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
x+=tempg->x1;
|
||||
y+=tempg->y1;
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_LINE:
|
||||
GrLine3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z);
|
||||
GrLine3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
GrArrow3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z);
|
||||
GrArrow3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z);
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2+x,tempg->y2+y,z,tempg->x2+x,tempg->y2+y,z+1))
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z,tempg->pp.x2+x,tempg->pp.y2+y,z+1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
img=CAlloc(sizeof(CDC));
|
||||
img->width=tempg->width;
|
||||
img->width_internal=(tempg->width+7)&~7;
|
||||
img->height=tempg->height;
|
||||
img->body_size=img->width_internal*img->height;
|
||||
img->body=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
img->width=tempg->pwhu.width;
|
||||
img->width_internal=(tempg->pwhu.width+7)&~7;
|
||||
img->height=tempg->pwhu.height;
|
||||
img->body=&tempg->pwhu.u;
|
||||
img->dc_signature=DCS_SIGNATURE_VAL;
|
||||
GrBlot3(dc,tempg->x2+x,tempg->y2+y,z,img);
|
||||
GrBlot3(dc,tempg->pwhu.x1+x,tempg->pwhu.y1+y,z,img);
|
||||
Free(img);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
GrRect3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
GrRect3(dc,tempg->pp.x1+x,tempg->pp.y1+y,z,tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
x1=tempg->x1+x;
|
||||
y1=tempg->y1+y;
|
||||
x1=tempg->ppa.x1+x;
|
||||
y1=tempg->ppa.y1+y;
|
||||
z1=z;
|
||||
GrRot(dc->r,&x1,&y1,&z1);
|
||||
old_r=dc->r;
|
||||
dc->flags|=DCF_TRANSFORMATION;
|
||||
r2=GrRotZNew(-tempg->rot_angle);
|
||||
r2=GrRotZNew(-tempg->ppa.angle);
|
||||
GrSetTranslation(r2,x1,y1,z1);
|
||||
GrSetRotMat(dc,GrMulMat(old_r,r2));
|
||||
GrRect3(dc,0,0,0,tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
GrRect3(dc,0,0,0,tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1);
|
||||
Free(dc->r);
|
||||
Free(r2);
|
||||
GrSetRotMat(dc,old_r);
|
||||
dc->flags=dc->flags&~DCF_TRANSFORMATION|old_flags;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
GrCircle3(dc,tempg->x1+x,tempg->y1+y,z,tempg->x2);
|
||||
GrCircle3(dc,tempg->pr.x1+x,tempg->pr.y1+y,z,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,z,tempg->pwha.width,
|
||||
tempg->pwha.height,tempg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,z,tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,z,tempg->pwhas.width,
|
||||
tempg->pwhas.height,tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
ptr=&tempg->nu.u;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
for (i=1;i<tempg->nu.num;i++) {
|
||||
x2=ptr[i<<1];
|
||||
y2=ptr[i<<1+1];
|
||||
GrLine3(dc,x1+x,y1+y,z,x2+x,y2+y,z);
|
||||
@@ -154,11 +155,10 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
x1=ptr[0];
|
||||
y1=ptr[1];
|
||||
ptr+=2;
|
||||
k=tempg->num*3;
|
||||
x1=tempg->npu.x;
|
||||
y1=tempg->npu.y;
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
GrPlot3(dc,x1+x,y1+y,z);
|
||||
for (i=0;i<k;i+=3) {
|
||||
j=BFieldExtU32(ptr,i,3);
|
||||
@@ -168,42 +168,43 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
}
|
||||
break;
|
||||
sub_switch_start:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x+=x;
|
||||
p->y+=y;
|
||||
p->z+=z;
|
||||
}
|
||||
case SPT_BSPLINE2:
|
||||
Gr2BSpline3(dc,&tempg->y1,tempg->num,FALSE);
|
||||
Gr2BSpline3(dc,&tempg->nu.u,tempg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE3:
|
||||
Gr3BSpline3(dc,&tempg->y1,tempg->num,FALSE);
|
||||
Gr3BSpline3(dc,&tempg->nu.u,tempg->nu.num,FALSE);
|
||||
break;
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
Gr2BSpline3(dc,&tempg->y1,tempg->num,TRUE);
|
||||
Gr2BSpline3(dc,&tempg->nu.u,tempg->nu.num,TRUE);
|
||||
break;
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
Gr3BSpline3(dc,&tempg->y1,tempg->num,TRUE);
|
||||
Gr3BSpline3(dc,&tempg->nu.u,tempg->nu.num,TRUE);
|
||||
break;
|
||||
sub_switch_end:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x-=x;
|
||||
p->y-=y;
|
||||
p->z-=z;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=x;
|
||||
p->y+=y;
|
||||
p->z+=z;
|
||||
}
|
||||
Gr3Mesh(dc,tempg->vertex_cnt,&tempg->x2,tempg->tri_cnt,(&tempg->x2)(U8 *)+sizeof(CD3I32)*tempg->vertex_cnt);
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
Gr3Mesh(dc,tempg->mu.vertex_cnt,&tempg->mu.u,tempg->mu.tri_cnt,
|
||||
(&tempg->mu.u)(U8 *)+sizeof(CD3I32)*tempg->mu.vertex_cnt);
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x;
|
||||
p->y-=y;
|
||||
p->z-=z;
|
||||
@@ -211,35 +212,35 @@ public U0 Sprite3(CDC *dc=gr.dc,I64 x,I64 y,I64 z,U8 *elems,Bool just_one=FALSE)
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x+=tempg->x1;
|
||||
dc->y+=tempg->y1;
|
||||
dc->z+=tempg->z1;
|
||||
dc->x+=tempg->pmu.x;
|
||||
dc->y+=tempg->pmu.y;
|
||||
dc->z+=tempg->pmu.z;
|
||||
x1=x;
|
||||
y1=y;
|
||||
z1=z;
|
||||
} else {
|
||||
x1=tempg->x1+x;
|
||||
y1=tempg->y1+y;
|
||||
z1=tempg->z1+z;
|
||||
x1=tempg->pmu.x+x;
|
||||
y1=tempg->pmu.y+y;
|
||||
z1=tempg->pmu.z+z;
|
||||
}
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
Gr3Mesh(dc,tempg->shiftable_vertex_cnt,p,tempg->shiftable_tri_cnt,p(U8 *)+sizeof(CD3I32)*tempg->shiftable_vertex_cnt);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
Gr3Mesh(dc,tempg->pmu.vertex_cnt,&tempg->pmu.u,tempg->pmu.tri_cnt,
|
||||
(&tempg->pmu.u)(U8 *)+sizeof(CD3I32)*tempg->pmu.vertex_cnt);
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
}
|
||||
if (dc->flags&DCF_TRANSFORMATION) {
|
||||
dc->x-=tempg->x1;
|
||||
dc->y-=tempg->y1;
|
||||
dc->z-=tempg->z1;
|
||||
dc->x-=tempg->pmu.x;
|
||||
dc->y-=tempg->pmu.y;
|
||||
dc->z-=tempg->pmu.z;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -355,13 +356,13 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
throw('Graphics');
|
||||
switch (tempg0->type) {
|
||||
case SPT_ROTATED_RECT:
|
||||
tempgr->rot_angle=(tempg0->rot_angle*t0+tempg1->rot_angle*t1)/GR_SCALE;
|
||||
tempgr->ppa.angle=(tempg0->ppa.angle*t0+tempg1->ppa.angle*t1)/GR_SCALE;
|
||||
case SPT_RECT:
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->pp.x2=(tempg0->pp.x2*t0+tempg1->pp.x2*t1)>>32;
|
||||
tempgr->pp.y2=(tempg0->pp.y2*t0+tempg1->pp.y2*t1)>>32;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
@@ -369,69 +370,66 @@ public U8 *SpriteInterpolate(U8 *elems0,U8 *elems1,F64 t)
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
tempgr->x1=(tempg0->x1*t0+tempg1->x1*t1)>>32;
|
||||
tempgr->y1=(tempg0->y1*t0+tempg1->y1*t1)>>32;
|
||||
tempgr->p.x1=(tempg0->p.x1*t0+tempg1->p.x1*t1)>>32;
|
||||
tempgr->p.y1=(tempg0->p.y1*t0+tempg1->p.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->x1=(tempg0->x1*t0+tempg1->x1*t1)>>32;
|
||||
tempgr->y1=(tempg0->y1*t0+tempg1->y1*t1)>>32;
|
||||
tempgr->pr.radius=(tempg0->pr.radius*t0+tempg1->pr.radius*t1)>>32;
|
||||
tempgr->pr.x1=(tempg0->pr.x1*t0+tempg1->pr.x1*t1)>>32;
|
||||
tempgr->pr.y1=(tempg0->pr.y1*t0+tempg1->pr.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->width=(tempg0->width*t0+tempg1->width*t1)>>32;
|
||||
tempgr->height=(tempg0->height*t0+tempg1->height*t1)>>32;
|
||||
tempgr->pwha.x1=(tempg0->pwha.x1*t0+tempg1->pwha.x1*t1)>>32;
|
||||
tempgr->pwha.y1=(tempg0->pwha.y1*t0+tempg1->pwha.y1*t1)>>32;
|
||||
tempgr->pwha.width =(tempg0->pwha.width *t0+tempg1->pwha.width*t1)>>32;
|
||||
tempgr->pwha.height=(tempg0->pwha.height*t0+tempg1->pwha.height*t1)>>32;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
tempgr->x2=(tempg0->x2*t0+tempg1->x2*t1)>>32;
|
||||
tempgr->y2=(tempg0->y2*t0+tempg1->y2*t1)>>32;
|
||||
tempgr->pwhu.x1=(tempg0->pwhu.x1*t0+tempg1->pwhu.x1*t1)>>32;
|
||||
tempgr->pwhu.y1=(tempg0->pwhu.y1*t0+tempg1->pwhu.y1*t1)>>32;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr0=&tempg0->y1;
|
||||
ptr1=&tempg1->y1;
|
||||
ptrr=&tempgr->y1;
|
||||
for (i=0;i<tempg0->num;i++) {
|
||||
ptr0=&tempg0->nu.u;
|
||||
ptr1=&tempg1->nu.u;
|
||||
ptrr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
ptrr[i<<1]=(ptr0[i<<1]*t0+ptr1[i<<1]*t1)>>32;
|
||||
ptrr[i<<1+1]=(ptr0[i<<1+1]*t0+ptr1[i<<1+1]*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr0=&tempg0->y1;
|
||||
ptr1=&tempg1->y1;
|
||||
ptrr=&tempgr->y1;
|
||||
ptrr[0]=(ptr0[0]*t0+ptr1[0]*t1)>>32;
|
||||
ptrr[1]=(ptr0[1]*t0+ptr1[1]*t1)>>32;
|
||||
tempgr->npu.x=(tempg0->npu.x*t0+tempg1->npu.x*t1)>>32;
|
||||
tempgr->npu.y=(tempg0->npu.y*t0+tempg1->npu.y*t1)>>32;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p0=&tempg0->y1;
|
||||
p1=&tempg1->y1;
|
||||
pr=&tempgr->y1;
|
||||
for (i=0;i<tempg0->num;i++) {
|
||||
p0=&tempg0->nu.u;
|
||||
p1=&tempg1->nu.u;
|
||||
pr=&tempgr->nu.u;
|
||||
for (i=0;i<tempg0->nu.num;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p0=&tempg0->x2;
|
||||
p1=&tempg1->x2;
|
||||
pr=&tempgr->x2;
|
||||
for (i=0;i<tempg0->vertex_cnt;i++) {
|
||||
p0=&tempg0->mu.u;
|
||||
p1=&tempg1->mu.u;
|
||||
pr=&tempgr->mu.u;
|
||||
for (i=0;i<tempg0->mu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
p0=(&tempg0->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
p1=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
pr=(&tempgr->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg0->shiftable_vertex_cnt;i++) {
|
||||
p0=&tempg0->pmu.u;
|
||||
p1=&tempg1->pmu.u;
|
||||
pr=&tempgr->pmu.u;
|
||||
for (i=0;i<tempg0->pmu.vertex_cnt;i++) {
|
||||
pr[i].x=(p0[i].x*t0+p1[i].x*t1)>>32;
|
||||
pr[i].y=(p0[i].y*t0+p1[i].y*t1)>>32;
|
||||
pr[i].z=(p0[i].z*t0+p1[i].z*t1)>>32;
|
||||
|
||||
+12
-11
@@ -5,7 +5,7 @@ asm {
|
||||
USE64
|
||||
//************************************
|
||||
_TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d);
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
MOV RCX,U64 SF_ARG1[RBP]
|
||||
@@ -82,7 +82,7 @@ _TEXT_CHAR:://Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64
|
||||
RET1 40
|
||||
//************************************
|
||||
_TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -157,7 +157,7 @@ _TEXT_LEN_STR:://Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s)
|
||||
RET1 48
|
||||
//************************************
|
||||
_TEXT_LEN_ATTR_STR:://Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -232,7 +232,7 @@ _TEXT_LEN_ATTR_STR:://Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_
|
||||
RET1 40
|
||||
//************************************
|
||||
_TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
|
||||
//Must be called 60fps in Fs->draw_it() callback.
|
||||
//Must be called 30fps in Fs->draw_it() callback.
|
||||
PUSH RBP
|
||||
MOV RBP,RSP
|
||||
PUSH RSI
|
||||
@@ -307,13 +307,13 @@ _TEXT_LEN_ATTR:://Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr)
|
||||
POP RBP
|
||||
RET1 40
|
||||
}
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d); //Plot char. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s); //Plot str with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr); //Plot attr str with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr); //Plot attrs with len. Must be called 60fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_CHAR Bool TextChar(CTask *task,Bool allow_border=FALSE,I64 x,I64 y,I64 d); //Plot char. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_STR Bool TextLenStr(CTask *task,I64 x,I64 y,I64 len,I64 attr,U8 *s); //Plot str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR_STR Bool TextLenAttrStr(CTask *task,I64 x,I64 y,I64 len,U32 *_attr); //Plot attr str with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
public _extern _TEXT_LEN_ATTR Bool TextLenAttr(CTask *task,I64 x,I64 y,I64 len,I64 attr); //Plot attrs with len. Must be called 30fps in Fs->draw_it() callback.
|
||||
|
||||
public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
{//Plot chars. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Plot chars. Must be called 30fps in Fs->draw_it() callback.
|
||||
//You probably want $LK,"GrPrint",A="MN:GrPrint"$() or just $LK,"Print",A="MN:Print"$().
|
||||
U8 *buf=StrPrintJoin(NULL,fmt,argc,argv);
|
||||
TextLenStr(task,x,y,StrLen(buf),attr<<8,buf);
|
||||
@@ -321,7 +321,7 @@ public U0 TextPrint(CTask *task,I64 x,I64 y,I64 attr,U8 *fmt,...)
|
||||
}
|
||||
|
||||
public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool solid)
|
||||
{//Plot border square. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Plot border square. Must be called 30fps in Fs->draw_it() callback.
|
||||
//Draws window borders or DolDoc text button borders.
|
||||
//Set task=sys_winmgr_task for no clipping.
|
||||
I64 i;
|
||||
@@ -357,7 +357,7 @@ public U0 TextBorder(CTask *task=NULL,I64 l,I64 r,I64 t,I64 b,I64 attr,Bool soli
|
||||
}
|
||||
|
||||
public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
|
||||
{//Fill text rect. Must be called 60fps in Fs->draw_it() callback.
|
||||
{//Fill text rect. Must be called 30fps in Fs->draw_it() callback.
|
||||
I64 y,w;
|
||||
if (l>r || t>b) return;
|
||||
if (t<0) t=0;
|
||||
@@ -368,3 +368,4 @@ public U0 TextRect(I64 l,I64 r,I64 t,I64 b,I64 d)
|
||||
for (y=t;y<=b;y++)
|
||||
MemSetU32(gr.text_base(U8 *)+(y*TEXT_COLS+l)*sizeof(U32),d,w);
|
||||
}
|
||||
|
||||
+38
-35
@@ -85,8 +85,8 @@ I64 PopUpSpriteBitMap(CColorROPU32 color,I64 width)
|
||||
"\n$$MU-UL,\"Undo\",LE=GBM_UNDO$$\n"
|
||||
"\n$$PURPLE$$$$MU-UL,\"+] Sprite Main Menu\",LE=GBM_MAIN_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=GBM_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n",st1,st2,width);
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n"
|
||||
"\nRight-Click to get back to this menu.",st1,st2,width);
|
||||
i=PopUpMenu(doc);
|
||||
DocDel(doc);
|
||||
return i;
|
||||
@@ -224,12 +224,21 @@ I64 SpriteBitMapEd(CDoc *,CDocEntry *doc_e,CDC *dc,I64 *_xx1,I64 *_yy1,I64 *_xx2
|
||||
1<<MSG_IP_MOVE|1<<MSG_KEY_DOWN)) {
|
||||
switch (msg_code) {
|
||||
case MSG_KEY_DOWN:
|
||||
if (a1==CH_SHIFT_ESC) {
|
||||
result=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
} else if (a1==CH_ESC) {
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
switch (a1) {
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
goto bm_key_up_done;
|
||||
case CH_ESC:
|
||||
result=GE_CONT;
|
||||
goto bm_key_up_done;
|
||||
case 'c': //eye-dropper
|
||||
dc2=DCCaptureScreen(FALSE);
|
||||
color=GrPeek(dc2,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc2);
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
color=TRANSPARENT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -291,7 +300,7 @@ bm_menu:
|
||||
case GBM_SAVE_BMP:
|
||||
*filename.name=0;
|
||||
if (DocFormDo(&filename) && *filename.name)
|
||||
BMPFileWrite(filename.name,img);
|
||||
BMPWrite(filename.name,img);
|
||||
goto bm_menu;
|
||||
|
||||
case GBM_SAVE_GRA:
|
||||
@@ -363,38 +372,32 @@ bm_menu:
|
||||
GrPlot3(img,a1-xx1,a2-yy1,0);
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
break;
|
||||
case GBM_LINE:
|
||||
case GBM_ARROW:
|
||||
case GBM_RECT:
|
||||
case GBM_CIRCLE:
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
sub_switch_start:
|
||||
if (down)
|
||||
GrBitMapEdPrepPersistentDC(dc,xx1,yy1,img);
|
||||
x1=a1; y1=a2;
|
||||
down=TRUE;
|
||||
dc->color=color;
|
||||
dc->pen_width=width;
|
||||
switch (mode) {
|
||||
case GBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
}
|
||||
case GBM_LINE:
|
||||
GrLine3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_ARROW:
|
||||
GrArrow3(dc,x1,y1,0,a1,a2,0);
|
||||
break;
|
||||
case GBM_RECT:
|
||||
GrRect(dc,x1,y1,1,1);
|
||||
break;
|
||||
case GBM_CIRCLE:
|
||||
GrCircle3(dc,x1,y1,0,1);
|
||||
break;
|
||||
case GBM_COPY:
|
||||
case GBM_DELETE:
|
||||
dc->color=ROPF_DITHER+WHITE<<16+BLACK;
|
||||
dc->pen_width=1;
|
||||
GrBorder(dc,x1,y1,x1,y1);
|
||||
break;
|
||||
sub_switch_end:
|
||||
break;
|
||||
case GBM_PASTE:
|
||||
case GBM_PASTE_TRANSPARENT:
|
||||
|
||||
+92
-100
@@ -12,11 +12,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf1,tempg->color));
|
||||
Color2Str(buf1,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
DocPrint(doc,"{%s}",
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->dither_color.u8[0]|tempg->dither_color.u8[1]<<COLORROP_BITS));
|
||||
Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_TRANSFORM_ON:
|
||||
DocPrint(doc,"{ON}");
|
||||
@@ -27,55 +27,53 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
DocPrint(doc,"{(%d,%d),(%d,%d)}",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->x1,tempg->y1,
|
||||
tempg->x2-tempg->x1,tempg->y2-tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d)}",tempg->pp.x1,tempg->pp.y1,
|
||||
tempg->pp.x2-tempg->pp.x1,tempg->pp.y2-tempg->pp.y1);
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->x1,tempg->y1,
|
||||
tempg->x2-tempg->x1,tempg->y2-tempg->y1,
|
||||
180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->ppa.x1,tempg->ppa.y1,
|
||||
tempg->ppa.x2-tempg->ppa.x1,tempg->ppa.y2-tempg->ppa.y1,
|
||||
180/ã*Wrap(tempg->ppa.angle));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_SHIFT:
|
||||
DocPrint(doc,"{(%d,%d)}",tempg->x1,tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d)}",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tempg->x1,tempg->y1);
|
||||
DocPrint(doc,"{(%d,%d),TRUE}",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
DocPrint(doc,"{(%d,%d):%d}",tempg->x1,tempg->y1,tempg->x2);
|
||||
DocPrint(doc,"{(%d,%d):%d}",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
DocPrint(doc,"{%d}",tempg->width);
|
||||
DocPrint(doc,"{%d}",tempg->w.width);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->x2,tempg->y2,
|
||||
tempg->width,tempg->height,180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),%0.4f}",tempg->pwha.x1,tempg->pwha.y1,
|
||||
tempg->pwha.width,tempg->pwha.height,180/ã*Wrap(tempg->pwha.angle));
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->sides,tempg->x2,tempg->y2,
|
||||
tempg->width,tempg->height,180/ã*Wrap(tempg->rot_angle));
|
||||
DocPrint(doc,"{%d,(%d,%d):(%d,%d),%0.4f}",tempg->pwhas.sides,
|
||||
tempg->pwhas.x1,tempg->pwhas.y1,tempg->pwhas.width,tempg->pwhas.height,
|
||||
180/ã*Wrap(tempg->pwhas.angle));
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tempg->x1,tempg->y1,tempg->st);
|
||||
DocPrint(doc,"{(%d,%d),\"%Q\"}",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d)",ptr[0],ptr[1]);
|
||||
if (tempg->num>1) DocPrint(doc,",");
|
||||
ptr+=2;
|
||||
for (i=1;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=2) {
|
||||
DocPrint(doc,"(%d,%d)",ptr[0],ptr[1]);
|
||||
if (i+1<tempg->num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->num)
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
ptr+=2;
|
||||
}
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
@@ -83,14 +81,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d,%d)",ptr[0],ptr[1],ptr[2]);
|
||||
ptr+=3;
|
||||
if (tempg->num>1) DocPrint(doc,",");
|
||||
for (i=1;i<tempg->num;i++,ptr+=3) {
|
||||
ptr=&tempg->nu.u;
|
||||
DocPrint(doc,"{");
|
||||
for (i=0;i<tempg->nu.num;i++,ptr+=3) {
|
||||
DocPrint(doc,"(%d,%d,%d)",ptr[0],ptr[1],ptr[2]);
|
||||
if (i+1<tempg->num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->num)
|
||||
if (i+1<tempg->nu.num) DocPrint(doc,",");
|
||||
if (i&3==3 && i+1<tempg->nu.num)
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
if (tempg->type==SPT_BSPLINE2||tempg->type==SPT_BSPLINE3)
|
||||
@@ -99,13 +95,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,",TRUE}");
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
DocPrint(doc,"{(%d,%d),",ptr[0],ptr[1]);
|
||||
ptr+=2;
|
||||
DocPrint(doc,"{(%d,%d),",tempg->npu.x,tempg->npu.y);
|
||||
ptr=&tempg->npu.u;
|
||||
col=16;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
for (i=0;i<tempg->npu.num;i++) {
|
||||
DocPrint(doc,"%d",BFieldExtU32(ptr,i*3,3));
|
||||
if (++col>=64 && i+1<tempg->num) {
|
||||
if (++col>=64 && i+1<tempg->npu.num) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -113,23 +108,24 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->x2,tempg->y2,tempg->width,tempg->height);
|
||||
width_internal=(tempg->width+7)&~7;
|
||||
DocPrint(doc,"{(%d,%d):(%d,%d),\n",tempg->pwhu.x1,tempg->pwhu.y1,
|
||||
tempg->pwhu.width,tempg->pwhu.height);
|
||||
width_internal=(tempg->pwhu.width+7)&~7;
|
||||
if (width_internal<80)
|
||||
k=width_internal;
|
||||
else
|
||||
k=64;
|
||||
ptr=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
ptr=&tempg->pwhu.u;
|
||||
col=0;
|
||||
for (j=0;j<tempg->height;j++)
|
||||
for (j=0;j<tempg->pwhu.height;j++)
|
||||
for (i=0;i<width_internal;i++,ptr(U8 *)++) {
|
||||
if (i>=tempg->width)
|
||||
if (i>=tempg->pwhu.width)
|
||||
DocPrint(doc,"_");
|
||||
else if (*ptr(U8 *)<16)
|
||||
DocPrint(doc,"%X",*ptr(U8 *));
|
||||
else
|
||||
DocPrint(doc,"%c",CH_SHIFT_SPACE);
|
||||
if (++col>=k && (i+1<width_internal||j+1<tempg->height)) {
|
||||
if (++col>=k && (i+1<width_internal||j+1<tempg->pwhu.height)) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -138,11 +134,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
break;
|
||||
case SPT_MESH:
|
||||
DocPrint(doc,"{FALSE,");
|
||||
p=(&tempg->tri_cnt)(U8 *)+sizeof(I32);
|
||||
p=&tempg->mu.u;
|
||||
col=0;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tempg->mu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -150,11 +146,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tempg->mu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->tri_cnt) {
|
||||
if (i+1<tempg->mu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->mu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -162,12 +158,12 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
DocPrint(doc,"}");
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tempg->x1,tempg->y1,tempg->z1);
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
DocPrint(doc,"{TRUE,(%d,%d,%d):",tempg->pmu.x,tempg->pmu.y,tempg->pmu.z);
|
||||
p=&tempg->pmu.u;
|
||||
col=1;
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
DocPrint(doc,"(%d,%d,%d)",p->x,p->y,p->z);
|
||||
if (i+1<tempg->shiftable_vertex_cnt) DocPrint(doc,",");
|
||||
if (i+1<tempg->pmu.vertex_cnt) DocPrint(doc,",");
|
||||
if (++col==4) {
|
||||
DocPrint(doc,"\t//%d\n",i);
|
||||
col=0;
|
||||
@@ -175,11 +171,11 @@ U0 SpriteElem2Code(CDoc *doc,CSprite *tempg)
|
||||
}
|
||||
DocPrint(doc,":");
|
||||
tri=p;
|
||||
for (i=0;i<tempg->shiftable_tri_cnt;i++,tri++) {
|
||||
for (i=0;i<tempg->pmu.tri_cnt;i++,tri++) {
|
||||
DocPrint(doc,"(%s,%d,%d,%d)",Color2Str(buf1,tri->color),
|
||||
tri->nums[0],tri->nums[1],tri->nums[2]);
|
||||
if (i+1<tempg->shiftable_tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->shiftable_tri_cnt) {
|
||||
if (i+1<tempg->pmu.tri_cnt) DocPrint(doc,",");
|
||||
if (++col>=3 && i+1<tempg->pmu.tri_cnt) {
|
||||
DocPrint(doc,"\n");
|
||||
col=0;
|
||||
}
|
||||
@@ -217,9 +213,9 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
color=Str2ColorU32(st);
|
||||
Free(st);
|
||||
Lex(lx); //Skip color
|
||||
g.color=color.c0.color;
|
||||
g.c.color=color.c0.color;
|
||||
if (color&ROPF_DITHER) {
|
||||
g.dither_color.u8[1]=color.c1.color;
|
||||
g.d.dither_color.u8[1]=color.c1.color;
|
||||
g.type=SPT_DITHER_COLOR;
|
||||
} else
|
||||
g.type=SPT_COLOR;
|
||||
@@ -237,25 +233,25 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
break;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pp.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.x2);
|
||||
g.x2+=g.x1;
|
||||
g.y2+=g.y1;
|
||||
LexD2I32(lx,&g.pp.x2);
|
||||
g.ppa.x2+=g.pp.x1;
|
||||
g.ppa.y2+=g.pp.y1;
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
g.rot_angle=ã/180*LexExpressionF64(lx);
|
||||
g.ppa.angle=ã/180*LexExpressionF64(lx);
|
||||
g.type=SPT_ROTATED_RECT;
|
||||
} else
|
||||
g.type=SPT_RECT;
|
||||
@@ -264,12 +260,12 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_SHIFT:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
break;
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.p.x1);
|
||||
if (lx->token==',') {
|
||||
Lex(lx); //Skip ,
|
||||
i=LexExpressionI64(lx);
|
||||
@@ -282,36 +278,35 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
Lex(lx); //Skip {
|
||||
g.width=LexExpressionI64(lx);
|
||||
g.w.width=LexExpressionI64(lx);
|
||||
g.type=SPT_WIDTH;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
Lex(lx); //Skip {
|
||||
g.type=SPT_CIRCLE;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.pr.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
g.x2=LexExpressionI64(lx);
|
||||
g.pr.radius=LexExpressionI64(lx);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
Lex(lx); //Skip {
|
||||
g.sides=LexExpressionI64(lx);
|
||||
g.pwhas.sides=LexExpressionI64(lx);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
case SPT_ELLIPSE:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pwha.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.width);
|
||||
LexD2I32(lx,&g.pwha.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
g.rot_angle=ã/180*LexExpressionF64(lx);
|
||||
g.pwha.angle=ã/180*LexExpressionF64(lx);
|
||||
break;
|
||||
sub_switch_end:
|
||||
size=SpriteElemSize(&g)+offset(CSprite.start);
|
||||
@@ -323,7 +318,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
case SPT_TEXT_DIAMOND:
|
||||
Lex(lx); //Skip {
|
||||
g.type=type;
|
||||
LexD2I32(lx,&g.x1);
|
||||
LexD2I32(lx,&g.ps.x1);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
if (Lex(lx)==TK_STR) //Skip ,
|
||||
@@ -345,17 +340,16 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD2I32(lx,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.num++;
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (!g.num)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYLINE);
|
||||
i=g.num*sizeof(CD2I32);
|
||||
result=MAlloc(size+i);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD2I32));
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y1;
|
||||
ptr=&result->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -375,15 +369,14 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
tempp=CAlloc(sizeof(CQueD3I32));
|
||||
LexD3I32(lx,&tempp->p);
|
||||
QueIns(tempp,rootp.last);
|
||||
g.num++;
|
||||
g.nu.num++;
|
||||
if (lx->token==',')
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (!g.num)
|
||||
if (g.nu.num<2)
|
||||
LexExcept(lx,"expecting point at ");
|
||||
size=SpriteElemQuedBaseSize(type);
|
||||
i=g.num*sizeof(CD3I32);
|
||||
result=MAlloc(size+i);
|
||||
result=MAlloc(size+g.nu.num*sizeof(CD3I32));
|
||||
if (LexExpressionI64(lx)) {
|
||||
if (type==SPT_BSPLINE2||type==SPT_BSPLINE2_CLOSED)
|
||||
g.type=SPT_BSPLINE2_CLOSED;
|
||||
@@ -396,7 +389,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
g.type=SPT_BSPLINE3;
|
||||
}
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y1;
|
||||
ptr=&result->nu.u;
|
||||
tempp=rootp.next;
|
||||
while (tempp!=&rootp) {
|
||||
tempa1=tempp->next;
|
||||
@@ -408,7 +401,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.y1);
|
||||
LexD2I32(lx,&g.npu.x);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
@@ -418,27 +411,26 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
if (i=='}')
|
||||
break;
|
||||
if ('0'<=i<='7')
|
||||
QueVectU8Put(tempv,g.num++,i-'0');
|
||||
QueVectU8Put(tempv,g.npu.num++,i-'0');
|
||||
}
|
||||
Bts(&lx->flags,Lf_USE_LAST_U16);
|
||||
Lex(lx); //Load '}'
|
||||
g.type=SPT_POLYPT;
|
||||
size=SpriteElemQuedBaseSize(SPT_POLYPT);
|
||||
i=(g.num*3+7)>>3;
|
||||
result=CAlloc(size+i);
|
||||
result=CAlloc(size+(g.npu.num*3+7)>>3);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->y2;
|
||||
for (i=0;i<g.num;i++)
|
||||
ptr=&result->npu.u;
|
||||
for (i=0;i<g.npu.num;i++)
|
||||
BFieldOrU32(ptr,i*3,QueVectU8Get(tempv,i));
|
||||
QueVectU8Del(tempv);
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
Lex(lx); //Skip {
|
||||
LexD2I32(lx,&g.x2);
|
||||
LexD2I32(lx,&g.pwhu.x1);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
LexD2I32(lx,&g.width);
|
||||
LexD2I32(lx,&g.pwhu.width);
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
tempv=QueVectU8New;
|
||||
@@ -463,7 +455,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
size=SpriteElemQuedBaseSize(SPT_BITMAP);
|
||||
result=CAlloc(size+num1);
|
||||
MemCpy(result,&g,size);
|
||||
ptr=&result->linespeed;
|
||||
ptr=&result->pwhu.u;
|
||||
for (i=0;i<num1;i++)
|
||||
*ptr++=QueVectU8Get(tempv,i);
|
||||
QueVectU8Del(tempv);
|
||||
@@ -476,7 +468,7 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
if (lx->token!=',')
|
||||
LexExcept(lx,"expecting ',' at ");
|
||||
Lex(lx); //Skip ,
|
||||
LexD3I32(lx,&g.x1);
|
||||
LexD3I32(lx,&g.pmu.x);
|
||||
if (lx->token!=':')
|
||||
LexExcept(lx,"expecting ':' at ");
|
||||
Lex(lx); //Skip :
|
||||
@@ -528,12 +520,12 @@ CSprite *Code2SpriteElem(CLex *lx,I64 type)
|
||||
Lex(lx); //Skip ,
|
||||
}
|
||||
if (g.type==SPT_MESH) {
|
||||
g.vertex_cnt=num1;
|
||||
g.tri_cnt=num2;
|
||||
g.mu.vertex_cnt=num1;
|
||||
g.mu.tri_cnt=num2;
|
||||
size=SpriteElemQuedBaseSize(SPT_MESH);
|
||||
} else {
|
||||
g.shiftable_vertex_cnt=num1;
|
||||
g.shiftable_tri_cnt=num2;
|
||||
g.pmu.vertex_cnt=num1;
|
||||
g.pmu.tri_cnt=num2;
|
||||
}
|
||||
size=SpriteElemQuedBaseSize(g.type);
|
||||
result=MAlloc(size+num1*sizeof(CD3I32)+num2*sizeof(CMeshTri));
|
||||
|
||||
+150
-190
@@ -4,8 +4,8 @@ Bool SpritePolyPtPlot(CSprite *root,I64 x,I64 y,I64)
|
||||
{
|
||||
CSprite *tempg=CAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
tempg->type=SPT_PT;
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->p.x1=x;
|
||||
tempg->p.y1=y;
|
||||
QueIns(tempg,root->last);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -16,8 +16,8 @@ CSprite *SpriteElemNum2QueEntry(CSprite *root,I64 elem_num,I64 *_x=NULL,I64 *_y=
|
||||
CSprite *result=root->next;
|
||||
while (result!=root && elem_num--) {
|
||||
if (result->type==SPT_SHIFT) {
|
||||
xx+=result->x1;
|
||||
yy+=result->y1;
|
||||
xx+=result->p.x1;
|
||||
yy+=result->p.y1;
|
||||
}
|
||||
result=result->next;
|
||||
}
|
||||
@@ -83,75 +83,60 @@ U0 SpriteSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
CSprite *tempg=root->next;
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
break;
|
||||
case SPT_ARROW:
|
||||
case SPT_LINE:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->x2+=dx;
|
||||
tempg->y2+=dy;
|
||||
break;
|
||||
tempg->pp.x2+=dx;
|
||||
tempg->pp.y2+=dy;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
case SPT_CIRCLE:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
case SPT_BITMAP:
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
tempg->p.x1+=dx;
|
||||
tempg->p.y1+=dy;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
ptr[i<<1]+=dx;
|
||||
ptr[i<<1+1]+=dy;
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]+=dx;
|
||||
ptr[1]+=dy;
|
||||
tempg->npu.x+=dx;
|
||||
tempg->npu.y+=dy;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
p->x+=dx;
|
||||
p->y+=dy;
|
||||
p->z+=dz;
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=dx;
|
||||
p->y+=dy;
|
||||
p->z+=dz;
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
tempg->x1+=dx;
|
||||
tempg->y1+=dy;
|
||||
tempg->z1+=dz;
|
||||
tempg->pmu.x+=dx;
|
||||
tempg->pmu.y+=dy;
|
||||
tempg->pmu.z+=dz;
|
||||
break;
|
||||
}
|
||||
tempg=tempg->next;
|
||||
@@ -161,14 +146,14 @@ U0 SpriteSetOrigin(CSprite *root,I64 dx,I64 dy,I64 dz)
|
||||
CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,radius=tempg->x2<<16;
|
||||
F64 m1,a1,m2,radius=tempg->pr.radius<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
tempg1->type=SPT_ELLIPSE;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pr.x1; y=tempg->pr.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
x=radius; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
@@ -178,9 +163,9 @@ CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
GrRot(r,&x,&y,&z);
|
||||
m2=Sqrt(x*x+y*y);
|
||||
|
||||
tempg1->width =ToI64(m1)/0x10000;
|
||||
tempg1->height=ToI64(m2)/0x10000;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->pwha.width =ToI64(m1)/0x10000;
|
||||
tempg1->pwha.height=ToI64(m2)/0x10000;
|
||||
tempg1->pwha.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -188,19 +173,20 @@ CSprite *SpriteTransformCircle(I64 r[4][4],CSprite *tempg)
|
||||
CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
{
|
||||
I64 x,y,z;
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tempg->width<<16,y_radius=tempg->height<<16;
|
||||
F64 m1,a1,m2,a2,s,c,x_radius=tempg->pwha.width<<16,
|
||||
y_radius=tempg->pwha.height<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(tempg->type));
|
||||
tempg1->type=tempg->type;
|
||||
if (tempg->type==SPT_POLYGON)
|
||||
tempg1->sides=tempg->sides;
|
||||
tempg1->pwhas.sides=tempg->pwhas.sides;
|
||||
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
x=tempg->pwha.x1; y=tempg->pwha.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwha.x1=x;
|
||||
tempg1->pwha.y1=y;
|
||||
|
||||
c=Cos(-tempg->rot_angle);
|
||||
s=Sin(-tempg->rot_angle);
|
||||
c=Cos(-tempg->pwha.angle);
|
||||
s=Sin(-tempg->pwha.angle);
|
||||
|
||||
x=x_radius*c;
|
||||
y=x_radius*s;
|
||||
@@ -215,11 +201,11 @@ CSprite *SpriteTransformEllipse(I64 r[4][4],CSprite *tempg)
|
||||
R2P(&m2,&a2,x,y);
|
||||
m2*=Abs(Sin(a2-a1));
|
||||
|
||||
tempg1->width=ToI64(m1)/0x10000;
|
||||
if (tempg1->width<1) tempg1->width=1;
|
||||
tempg1->height=ToI64(m2)/0x10000;
|
||||
if (tempg1->height<1) tempg1->height=1;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->pwha.width=ToI64(m1)/0x10000;
|
||||
if (tempg1->pwha.width<1) tempg1->pwha.width=1;
|
||||
tempg1->pwha.height=ToI64(m2)/0x10000;
|
||||
if (tempg1->pwha.height<1) tempg1->pwha.height=1;
|
||||
tempg1->pwha.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -228,15 +214,15 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
{
|
||||
I64 x,y,z,w,h;
|
||||
F64 m1,a1,m2,a2,s,c,
|
||||
x_radius=(tempg->x2-tempg->x1)<<16,
|
||||
y_radius=(tempg->y2-tempg->y1)<<16;
|
||||
x_radius=(tempg->pp.x2-tempg->pp.x1)<<16,
|
||||
y_radius=(tempg->pp.y2-tempg->pp.y1)<<16;
|
||||
CSprite *tempg1=CAlloc(SpriteElemQuedBaseSize(SPT_ROTATED_RECT));
|
||||
tempg1->type=SPT_ROTATED_RECT;
|
||||
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pp.x1; y=tempg->pp.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x1=x;
|
||||
tempg1->y1=y;
|
||||
tempg1->ppa.x1=x;
|
||||
tempg1->ppa.y1=y;
|
||||
|
||||
c=Cos(-é);
|
||||
s=Sin(-é);
|
||||
@@ -258,9 +244,9 @@ CSprite *SpriteTransformRect(I64 r[4][4],CSprite *tempg,F64
|
||||
if (w<1) w=1;
|
||||
h=ToI64(m2)/0x10000;
|
||||
if (h<1) h=1;
|
||||
tempg1->x2=tempg1->x1+w;
|
||||
tempg1->y2=tempg1->y1+h;
|
||||
tempg1->rot_angle=-a1;
|
||||
tempg1->ppa.x2=tempg1->ppa.x1+w;
|
||||
tempg1->ppa.y2=tempg1->ppa.y1+h;
|
||||
tempg1->ppa.angle=-a1;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -278,7 +264,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
miny=maxy=y;
|
||||
minz=maxz=z;
|
||||
|
||||
x=0; y=tempg->height; z=0;
|
||||
x=0; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -287,7 +273,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z<minx) minz=z;
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->width; y=0; z=0;
|
||||
x=tempg->pwhu.width; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -296,7 +282,7 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
if (z<minx) minz=z;
|
||||
if (z>maxx) maxz=z;
|
||||
|
||||
x=tempg->width; y=tempg->height; z=0;
|
||||
x=tempg->pwhu.width; y=tempg->pwhu.height; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
if (x<minx) minx=x;
|
||||
if (x>maxx) maxx=x;
|
||||
@@ -308,11 +294,10 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
tempb=DCNew(maxx-minx+1,maxy-miny+1);
|
||||
|
||||
img=CAlloc(sizeof(CDC));
|
||||
img->width=tempg->width;
|
||||
img->width_internal=(tempg->width+7)&~7;
|
||||
img->height=tempg->height;
|
||||
img->body_size=img->width_internal*img->height;
|
||||
img->body=tempg(U8 *)+offset(CSprite.linespeed);
|
||||
img->width=tempg->pwhu.width;
|
||||
img->width_internal=(tempg->pwhu.width+7)&~7;
|
||||
img->height=tempg->pwhu.height;
|
||||
img->body=&tempg->pwhu.u;
|
||||
img->dc_signature=DCS_SIGNATURE_VAL;
|
||||
|
||||
tempb->color=TRANSPARENT;
|
||||
@@ -335,15 +320,15 @@ CSprite *SpriteTransformBitmap(I64 r[4][4],CSprite *tempg)
|
||||
MemCpy(tempg1(U8 *)+offset(CSprite.start),elems,MSize(elems));
|
||||
tempg1->type=tempg->type;
|
||||
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
x=tempg->pwhu.x1; y=tempg->pwhu.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2=x;
|
||||
tempg1->y2=y;
|
||||
tempg1->pwhu.x1=x;
|
||||
tempg1->pwhu.y1=y;
|
||||
|
||||
x=0; y=0; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg1->x2+=minx-x;
|
||||
tempg1->y2+=miny-y;
|
||||
tempg1->pwhu.x1+=minx-x;
|
||||
tempg1->pwhu.y1+=miny-y;
|
||||
|
||||
return tempg1;
|
||||
}
|
||||
@@ -358,32 +343,26 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
while (tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_WIDTH:
|
||||
// (1.0/Sqrt(3))*65536=37837.22
|
||||
x=37838;y=37838;z=37838;
|
||||
GrRot(r,&x,&y,&z);
|
||||
//scaled 32 bits
|
||||
tempg->width*=Sqrt(x*x+y*y+z*z)/65536;
|
||||
if (tempg->width<0) tempg->width=0;
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->w.width*=Sqrt(GrRotNormSqr65536(r))/65536;
|
||||
if (tempg->w.width<0) tempg->w.width=0;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_ARROW:
|
||||
case SPT_LINE:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
x=tempg->pp.x2; y=tempg->pp.y2; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
x=tempg->x2; y=tempg->y2; z=0;
|
||||
tempg->pp.x2=x;
|
||||
tempg->pp.y2=y;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
x=tempg->p.x1; y=tempg->p.y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x2=x;
|
||||
tempg->y2=y;
|
||||
tempg->p.x1=x;
|
||||
tempg->p.y1=y;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
tempg1=SpriteTransformBitmap(r,tempg);
|
||||
@@ -393,7 +372,7 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_ROTATED_RECT:
|
||||
tempg1=SpriteTransformRect(r,tempg,tempg->rot_angle);
|
||||
tempg1=SpriteTransformRect(r,tempg,tempg->ppa.angle);
|
||||
QueIns(tempg1,tempg);
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
@@ -406,14 +385,6 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
Free(tempg);
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
x=tempg->x1; y=tempg->y1; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
tempg1=SpriteTransformCircle(r,tempg);
|
||||
QueIns(tempg1,tempg);
|
||||
@@ -430,8 +401,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
tempg=tempg1;
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
x=ptr[i<<1]; y=ptr[i<<1+1]; z=0;
|
||||
GrRot(r,&x,&y,&z);
|
||||
ptr[i<<1]=x;
|
||||
@@ -440,12 +411,11 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
QueInit(&root2);
|
||||
ptr=&tempg->y1;
|
||||
x=ptr[0]; y=ptr[1]; z=0;
|
||||
x=tempg->npu.x; y=tempg->npu.y; z=0;
|
||||
x1=x; y1=y; z1=z; //unrotated cur coordinates
|
||||
GrRot(r,&x,&y,&z);
|
||||
ptr+=2;
|
||||
k=tempg->num*3;
|
||||
ptr=&tempg->npu.u;
|
||||
k=tempg->npu.num*3;
|
||||
x2=x; y2=y; z2=z; //rotated start coordinates
|
||||
x3=x; y3=y; z3=z; //lag 1 rotated coordinates
|
||||
for (i=0;i<k;i+=3) {
|
||||
@@ -463,38 +433,37 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
x3=0; y3=0; z3=0;
|
||||
while (tempg1!=&root2) {
|
||||
tempg2=tempg1->next;
|
||||
if (tempg1->x1==x3 && tempg1->y1==y3) {
|
||||
if (tempg1->p.x1==x3 && tempg1->p.y1==y3) {
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
} else {
|
||||
num++;
|
||||
x3=tempg1->x1;
|
||||
y3=tempg1->y1;
|
||||
x3=tempg1->p.x1;
|
||||
y3=tempg1->p.y1;
|
||||
}
|
||||
tempg1=tempg2;
|
||||
}
|
||||
|
||||
tempg3=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
ptr=&tempg3->y1;
|
||||
ptr[0]=x2;
|
||||
ptr[1]=y2;
|
||||
ptr+=2;
|
||||
tempg3->npu.x=x2;
|
||||
tempg3->npu.y=y2;
|
||||
ptr=&tempg3->npu.u;
|
||||
x3=0;y3=0; z3=0;
|
||||
i=0;
|
||||
tempg1=root2.next;
|
||||
while (tempg1!=&root2) {
|
||||
tempg2=tempg1->next;
|
||||
BFieldOrU32(ptr,i,
|
||||
polypt_map[SignI64(tempg1->x1-x3)+1+
|
||||
3*(SignI64(tempg1->y1-y3)+1)]);
|
||||
polypt_map[SignI64(tempg1->p.x1-x3)+1+
|
||||
3*(SignI64(tempg1->p.y1-y3)+1)]);
|
||||
i+=3;
|
||||
x3=tempg1->x1;y3=tempg1->y1;
|
||||
x3=tempg1->p.x1;y3=tempg1->p.y1;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
tempg1=tempg2;
|
||||
}
|
||||
tempg3->type=SPT_POLYPT;
|
||||
tempg3->num=num;
|
||||
tempg3->npu.num=num;
|
||||
QueIns(tempg3,tempg);
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
@@ -504,8 +473,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++,p++) {
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -514,13 +483,13 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
}
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
x=tempg->x1; y=tempg->y1; z=tempg->z1;
|
||||
x=tempg->pmu.x; y=tempg->pmu.y; z=tempg->pmu.z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
tempg->x1=x;
|
||||
tempg->y1=y;
|
||||
tempg->z1=z;
|
||||
p=(&tempg->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg->shiftable_vertex_cnt;i++,p++) {
|
||||
tempg->pmu.x=x;
|
||||
tempg->pmu.y=y;
|
||||
tempg->pmu.z=z;
|
||||
p=&tempg->pmu.u;
|
||||
for (i=0;i<tempg->pmu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -529,8 +498,8 @@ U0 SpriteTransform(I64 r[4][4],CSprite *root)
|
||||
}
|
||||
break;
|
||||
case SPT_MESH:
|
||||
p=&tempg->x2;
|
||||
for (i=0;i<tempg->vertex_cnt;i++,p++) {
|
||||
p=&tempg->mu.u;
|
||||
for (i=0;i<tempg->mu.vertex_cnt;i++,p++) {
|
||||
x=p->x; y=p->y; z=p->z;
|
||||
GrRot(r,&x,&y,&z);
|
||||
p->x=x;
|
||||
@@ -614,9 +583,9 @@ U0 SpriteSideBarTask2(CTask *grand_parent)
|
||||
pu_task=grand_parent->popup_task;
|
||||
if (TaskValidate(pu_task)) {
|
||||
w=parent->win_right-parent->win_left;
|
||||
SetWinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
|
||||
WinHorz(pu_task->win_right+2,pu_task->win_right+2+w,parent);
|
||||
h=parent->win_bottom-parent->win_top;
|
||||
SetWinVert(pu_task->win_top,pu_task->win_top+h,parent);
|
||||
WinVert(pu_task->win_top,pu_task->win_top+h,parent);
|
||||
}
|
||||
WinMgrSync;
|
||||
}
|
||||
@@ -651,7 +620,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
Sprite2Code(doc,elems);
|
||||
Free(elems);
|
||||
while (TRUE) {
|
||||
if (result=SrvUser("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
if (result=PopUpPrint("DocDo(0x%X,0x%X);",doc,0)) {
|
||||
Fs->put_doc=doc2=DocNew;
|
||||
"$$WW,1$$";
|
||||
if (elems=Code2Sprite(doc)) {
|
||||
@@ -664,7 +633,7 @@ Bool SpriteEdText(CSprite **_root,I64 *_cur_elem_num)
|
||||
*_cur_elem_num=QueCnt(root); //TODO: Might want to improve this.
|
||||
break;
|
||||
} else {
|
||||
SrvUser("DocDo(0x%X,0x%X);",doc2,0);
|
||||
PopUpPrint("DocDo(0x%X,0x%X);",doc2,0);
|
||||
DocDel(doc2);
|
||||
Fs->put_doc=old_put;
|
||||
}
|
||||
@@ -730,24 +699,24 @@ I64 PopUpSpriteEd(CSprite **_root,I64 *_cur_elem_num)
|
||||
return i;
|
||||
}
|
||||
|
||||
#define GSPT_SIMPLE_PT 0
|
||||
#define GSPT_SIMPLE_PT 0
|
||||
#define GSPT_WIDTH_HEIGHT 1
|
||||
|
||||
#define GSPF_SELECTED 1
|
||||
|
||||
class CSpritePt
|
||||
class CEdSprite
|
||||
{
|
||||
CSpritePt *next,*last;
|
||||
CEdSprite *next,*last;
|
||||
I32 type,num,flags,xx,yy,zz;
|
||||
I32 *x,*y,*z,*w,*h;
|
||||
};
|
||||
|
||||
U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CEdSprite *root)
|
||||
{
|
||||
I64 i,num=0;
|
||||
I32 *ptr;
|
||||
CD3I32 *p;
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
CSprite *tempg=elems-offset(CSprite.start);
|
||||
QueInit(root);
|
||||
while (tempg->type) {
|
||||
@@ -757,60 +726,52 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->x=&tempg->pp.x2;
|
||||
temppe->y=&tempg->pp.y2;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
case SPT_PT:
|
||||
case SPT_BITMAP:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_CIRCLE:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->x=&tempg->p.x1;
|
||||
temppe->y=&tempg->p.y1;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case SPT_SHIFT:
|
||||
x+=tempg->x1;
|
||||
y+=tempg->y1;
|
||||
x+=tempg->p.x1;
|
||||
y+=tempg->p.y1;
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_WIDTH_HEIGHT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->w=&tempg->width;
|
||||
temppe->h=&tempg->height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
case SPT_BITMAP:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x2;
|
||||
temppe->y=&tempg->y2;
|
||||
temppe->x=&tempg->pwha.x1;
|
||||
temppe->y=&tempg->pwha.y1;
|
||||
temppe->w=&tempg->pwha.width;
|
||||
temppe->h=&tempg->pwha.height;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
ptr=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
ptr=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
@@ -821,13 +782,12 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
}
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&ptr[0];
|
||||
temppe->y=&ptr[1];
|
||||
temppe->x=&tempg->npu.x;
|
||||
temppe->y=&tempg->npu.y;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
@@ -835,9 +795,9 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
p=&tempg->y1;
|
||||
for (i=0;i<tempg->num;i++) {
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
p=&tempg->nu.u;
|
||||
for (i=0;i<tempg->nu.num;i++) {
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
@@ -851,13 +811,13 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
case SPT_MESH:
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
temppe=CAlloc(sizeof(CSpritePt));
|
||||
temppe=CAlloc(sizeof(CEdSprite));
|
||||
temppe->type=GSPT_SIMPLE_PT;
|
||||
temppe->xx=x;
|
||||
temppe->yy=y;
|
||||
temppe->x=&tempg->x1;
|
||||
temppe->y=&tempg->y1;
|
||||
temppe->z=&tempg->z1;
|
||||
temppe->x=&tempg->pmu.x;
|
||||
temppe->y=&tempg->pmu.y;
|
||||
temppe->z=&tempg->pmu.z;
|
||||
temppe->num=num;
|
||||
QueIns(temppe,root->last);
|
||||
break;
|
||||
@@ -867,10 +827,10 @@ U0 SpritePtQueNew(U8 *elems,I64 x,I64 y,CSpritePt *root)
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpriteCtrlPtsDraw(CDC *dc,CSpritePt *root)
|
||||
U0 SpriteCtrlPtsDraw(CDC *dc,CEdSprite *root)
|
||||
{
|
||||
I64 x,y;
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
WinMgrSync;
|
||||
DCFill(dc);
|
||||
if (Blink(20)) {
|
||||
@@ -898,9 +858,9 @@ U0 SpriteCtrlPtsDraw(CDC *dc,CSpritePt *root)
|
||||
}
|
||||
}
|
||||
|
||||
U0 SpriteCtrlPtsMove(CSpritePt *root,I64 dx,I64 dy)
|
||||
U0 SpriteCtrlPtsMove(CEdSprite *root,I64 dx,I64 dy)
|
||||
{
|
||||
CSpritePt *temppe;
|
||||
CEdSprite *temppe;
|
||||
temppe=root->next;
|
||||
while (temppe!=root) {
|
||||
if (temppe->flags&GSPF_SELECTED)
|
||||
@@ -923,7 +883,7 @@ Bool SpriteShiftPts(U8 *elems,I64 x,I64 y,I64 *_cur_elem_num,I64 mode)
|
||||
I64 msg_code,a1,a2,xx,yy,xx2,yy2,dd,best_dd,cur_elem_num;
|
||||
Bool old_preempt,result=TRUE;
|
||||
CDC *dc=DCAlias;
|
||||
CSpritePt root,*temppe,*best_pe;
|
||||
CEdSprite root,*temppe,*best_pe;
|
||||
|
||||
SpritePtQueNew(elems,x,y,&root);
|
||||
cur_elem_num=0;
|
||||
@@ -1140,16 +1100,16 @@ I64 SpriteEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y,CSprite **_root,I64 *_cur_el
|
||||
insert_pt=SpriteElemNum2QueEntry(*_root,*_cur_elem_num);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFT));
|
||||
tempg->type=SPT_SHIFT;
|
||||
tempg->x1=0;
|
||||
tempg->y1=0;
|
||||
tempg->p.x1=0;
|
||||
tempg->p.y1=0;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
GetMsg(&a1,&a2,1<<MSG_IP_L_DOWN);
|
||||
xx=a1; yy=a2;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
tempg->x1=a1-xx;
|
||||
tempg->y1=a2-yy;
|
||||
tempg->p.x1=a1-xx;
|
||||
tempg->p.y1=a2-yy;
|
||||
SpriteEdUpdate(doc,tempb,*_root);
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
*_cur_elem_num+=1;
|
||||
|
||||
+217
-186
@@ -46,8 +46,8 @@ I64 PopUpSpriteMain(CSprite **_root,I64 *_cur_elem_num)
|
||||
"\n"
|
||||
"$$PURPLE$$$$MU-UL,\"+] Sprite Edit Menu\",LE=SPT_ED_MENU$$$$LTBLUE$$\n"
|
||||
"$$MU-UL,\"Exit Sprite\",LE=SPT_EXIT$$\n"
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n");
|
||||
DocPrint(doc,"\nRight-Click to get back to this menu.");
|
||||
"$$MU-UL,\"Abort Sprite\",LE=DOCM_CANCEL$$\n"
|
||||
"\nRight-Click to get back to this menu.");
|
||||
st=MStrPrint("SpriteSideBarTask(0x%X,0x%X,0x%X);",Fs,_root,_cur_elem_num);
|
||||
PopUp(st,NULL,&pu_task);
|
||||
Free(st);
|
||||
@@ -97,18 +97,18 @@ U0 SpriteSetSettings(CDC *dc,CSprite *root,I64 cur_elem_num,CColorROPU32 *_color
|
||||
while (cur_elem_num>0 && tempg!=root) {
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
dc->color=*_color=tempg->color;
|
||||
dc->color=*_color=tempg->c.color;
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
dc->color=*_color=
|
||||
tempg->dither_color.u8[0]|
|
||||
tempg->dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
tempg->d.dither_color.u8[0]|
|
||||
tempg->d.dither_color.u8[1]<<COLORROP_BITS|ROPF_DITHER;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
dc->pen_width=*_width=tempg->width;
|
||||
dc->pen_width=*_width=tempg->w.width;
|
||||
break;
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
if (GrSetSymmetry3(dc,tempg->x1+x,tempg->y1+y,0,tempg->x2+x,tempg->y2+y,0,tempg->x2+x,tempg->y2+y,1))
|
||||
if (GrSetSymmetry3(dc,tempg->pp.x1+x,tempg->pp.y1+y,0,tempg->pp.x2+x,tempg->pp.y2+y,0,tempg->pp.x2+x,tempg->pp.y2+y,1))
|
||||
dc->flags|=DCF_SYMMETRY;
|
||||
else
|
||||
dc->flags&=~DCF_SYMMETRY;
|
||||
@@ -166,7 +166,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
U8 *st,*old_task_title=StrNew(Fs->task_title);
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
WinMgrSync(2,TRUE);
|
||||
dc2->flags|=DCF_ON_TOP;
|
||||
root=Sprite2SpriteQue(tempb->data);
|
||||
@@ -229,7 +229,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
color=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->color=color;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -244,7 +244,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
color=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_DITHER_COLOR));
|
||||
tempg->type=SPT_DITHER_COLOR;
|
||||
tempg->dither_color=color.c0.color|color.c1.color<<8;
|
||||
tempg->d.dither_color=color.c0.color|color.c1.color<<8;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -270,24 +270,24 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
|
||||
tempg1=insert_pt;
|
||||
if (tempg1!=root && tempg1->type==SPT_MESH)
|
||||
old_mesh=&tempg1->vertex_cnt;
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
else if (tempg1!=root && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1;
|
||||
y1=tempg1->y1;
|
||||
z1=tempg1->z1;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
} else
|
||||
old_mesh=NULL;
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_MESH;
|
||||
MemCpy(&tempg->vertex_cnt,mesh,size);
|
||||
MemCpy(&tempg->mu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
@@ -299,11 +299,11 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} else
|
||||
cur_elem_num++;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1;
|
||||
y1=tempg1->y1;
|
||||
z1=tempg1->z1;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x;
|
||||
y1=tempg1->pmu.y;
|
||||
z1=tempg1->pmu.z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -328,7 +328,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
"bitmap.\n");
|
||||
doc_e->de_flags=old_de_flags;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
doc_e->de_flags|=DOCEF_DONT_DRAW;
|
||||
@@ -363,7 +363,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
}
|
||||
doc_e->de_flags=old_de_flags;
|
||||
Fs->win_inhibit=WIG_TASK_DFT|WIF_FOCUS_TASK_IP_L|WIF_FOCUS_TASK_IP_R|
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
WIF_FOCUS_TASK_BORDER-WIF_SELF_FOCUS-WIF_SELF_GRAB_SCROLL;
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
doc_e->de_flags|=DOCEF_DONT_DRAW;
|
||||
@@ -372,7 +372,7 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
width=i;
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_WIDTH));
|
||||
tempg->type=SPT_WIDTH;
|
||||
tempg->width=width;
|
||||
tempg->w.width=width;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -415,9 +415,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -441,9 +441,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT_BOX)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT_BOX;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -467,9 +467,9 @@ I64 SpriteMainEd(CDoc *doc,CDocEntry *doc_e,I64 x,I64 y)
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_TEXT_DIAMOND)+StrLen(st)+1);
|
||||
tempg->type=SPT_TEXT_DIAMOND;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
StrCpy(tempg->st,st);
|
||||
tempg->ps.x1=x1-x;
|
||||
tempg->ps.y1=y1-y;
|
||||
StrCpy(tempg->ps.st,st);
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
@@ -502,14 +502,34 @@ ei_restart:
|
||||
eletype=SPT_MENU;
|
||||
}
|
||||
if (msg_code==MSG_KEY_DOWN) {
|
||||
if (a1==CH_ESC) {
|
||||
result=GE_EXIT;
|
||||
goto ei_done;
|
||||
} else if (a1==CH_SHIFT_ESC) {
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
} else
|
||||
goto ei_restart;
|
||||
switch (a1) {
|
||||
case CH_ESC:
|
||||
result=GE_EXIT;
|
||||
goto ei_done;
|
||||
case CH_SHIFT_ESC:
|
||||
result=GE_ABORT;
|
||||
goto ei_done;
|
||||
case 'c': //eye-dropper
|
||||
dc3=DCCaptureScreen(FALSE);
|
||||
color=GrPeek(dc3,ip.pos.x,ip.pos.y)^15;//Mouse cursor is XORed.
|
||||
DCDel(dc3);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=color;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
case 't': //Set to transparent color
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_COLOR));
|
||||
tempg->type=SPT_COLOR;
|
||||
tempg->c.color=TRANSPARENT;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
cur_elem_num++;
|
||||
break;
|
||||
}
|
||||
goto ei_restart;
|
||||
} else {
|
||||
x1=a1; y1=a2;
|
||||
x2=a1; y2=a2;
|
||||
@@ -564,10 +584,10 @@ ei_restart:
|
||||
tempg->type=SPT_PLANAR_SYMMETRY;
|
||||
break;
|
||||
sub_switch_end:
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->x2=x2-x;
|
||||
tempg->y2=y2-y;
|
||||
tempg->pp.x1=x1-x;
|
||||
tempg->pp.y1=y1-y;
|
||||
tempg->pp.x2=x2-x;
|
||||
tempg->pp.y2=y2-y;
|
||||
break;
|
||||
case SPT_RECT:
|
||||
xx1=a1; yy1=a2;
|
||||
@@ -594,10 +614,10 @@ ei_restart:
|
||||
GrRect3(dc,xx1,yy1,0,xx2-xx1,yy2-yy1);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_RECT));
|
||||
tempg->type=SPT_RECT;
|
||||
tempg->x1=xx1-x;
|
||||
tempg->y1=yy1-y;
|
||||
tempg->x2=xx2-x;
|
||||
tempg->y2=yy2-y;
|
||||
tempg->pp.x1=xx1-x;
|
||||
tempg->pp.y1=yy1-y;
|
||||
tempg->pp.x2=xx2-x;
|
||||
tempg->pp.y2=yy2-y;
|
||||
break;
|
||||
case SPT_INS_SCREEN_BITMAP:
|
||||
case SPT_INS_TRANSPARENT_SCREEN_BITMAP:
|
||||
@@ -628,10 +648,10 @@ ei_restart:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=0;
|
||||
tempg->y2=0;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=0;
|
||||
tempg->pwhu.y1=0;
|
||||
SpriteScreenInit(dc,x,y);
|
||||
i=gr.screen_zoom;
|
||||
GrScaleZoom(1.0/i);
|
||||
@@ -644,7 +664,7 @@ ei_restart:
|
||||
if (eletype==SPT_INS_TRANSPARENT_SCREEN_BITMAP)
|
||||
DCColorChg(img,bm_bkcolor);
|
||||
GrScaleZoom(i);
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
DCDel(img);
|
||||
DCDel(dc3);
|
||||
dc2->pen_width=old_width;
|
||||
@@ -664,9 +684,9 @@ ei_restart:
|
||||
GrCircle3(dc,x1,y1,0,Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2)));
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_CIRCLE));
|
||||
tempg->type=SPT_CIRCLE;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->x2=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
tempg->pr.x1=x1-x;
|
||||
tempg->pr.y1=y1-y;
|
||||
tempg->pr.radius=Sqrt(SqrI64(x1-x2)+SqrI64(y1-y2));
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
do {
|
||||
@@ -680,37 +700,37 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_ELLIPSE));
|
||||
tempg->type=SPT_ELLIPSE;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
tempg->width =AbsI64(x1-x2)>>1;
|
||||
tempg->height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width<tempg->height)
|
||||
tempg->pwha.x1=(x1+x2)>>1-x;
|
||||
tempg->pwha.y1=(y1+y2)>>1-y;
|
||||
tempg->pwha.width =AbsI64(x1-x2)>>1;
|
||||
tempg->pwha.height=AbsI64(y1-y2)>>1;
|
||||
angle2=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width<tempg->pwha.height)
|
||||
angle2-=ã/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width>=tempg->pwha.height)
|
||||
tempg->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,0,
|
||||
tempg->pwha.width,tempg->pwha.height,tempg->pwha.angle);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwha.x1+x),y2-(tempg->pwha.y1+y));
|
||||
if (tempg->pwha.width>=tempg->pwha.height)
|
||||
tempg->pwha.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwha.angle=-(angle1-angle2)+ã/2.0;
|
||||
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrEllipse3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->rot_angle);
|
||||
GrEllipse3(dc,tempg->pwha.x1+x,tempg->pwha.y1+y,0,
|
||||
tempg->pwha.width,tempg->pwha.height,tempg->pwha.angle);
|
||||
break;
|
||||
case SPT_POLYGON:
|
||||
eletype=SPT_MENU;
|
||||
@@ -729,115 +749,128 @@ ei_restart:
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_POLYGON));
|
||||
tempg->type=SPT_POLYGON;
|
||||
tempg->x2=(x1+x2)>>1-x;
|
||||
tempg->y2=(y1+y2)>>1-y;
|
||||
tempg->width =AbsI64(x1-x2)>>1;
|
||||
tempg->height=AbsI64(y1-y2)>>1;
|
||||
tempg->sides=i;
|
||||
angle2=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width<tempg->height)
|
||||
tempg->pwhas.x1=(x1+x2)>>1-x;
|
||||
tempg->pwhas.y1=(y1+y2)>>1-y;
|
||||
tempg->pwhas.width =AbsI64(x1-x2)>>1;
|
||||
tempg->pwhas.height=AbsI64(y1-y2)>>1;
|
||||
tempg->pwhas.sides=i;
|
||||
angle2=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width<tempg->pwhas.height)
|
||||
angle2-=ã/2.0;
|
||||
do {
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width>=tempg->pwhas.height)
|
||||
tempg->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,0,
|
||||
tempg->pwhas.width,tempg->pwhas.height,
|
||||
tempg->pwhas.sides,tempg->pwhas.angle);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
SpriteScreenInit(dc,x,y);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP);
|
||||
|
||||
angle1=Arg(x2-(tempg->x2+x),y2-(tempg->y2+y));
|
||||
if (tempg->width>=tempg->height)
|
||||
tempg->rot_angle=-(angle1-angle2);
|
||||
angle1=Arg(x2-(tempg->pwhas.x1+x),y2-(tempg->pwhas.y1+y));
|
||||
if (tempg->pwhas.width>=tempg->pwhas.height)
|
||||
tempg->pwhas.angle=-(angle1-angle2);
|
||||
else
|
||||
tempg->rot_angle=-(angle1-angle2)+ã/2.0;
|
||||
tempg->pwhas.angle=-(angle1-angle2)+ã/2.0;
|
||||
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrRegPoly3(dc,tempg->x2+x,tempg->y2+y,0,
|
||||
tempg->width,tempg->height,tempg->sides,tempg->rot_angle);
|
||||
GrRegPoly3(dc,tempg->pwhas.x1+x,tempg->pwhas.y1+y,0,
|
||||
tempg->pwhas.width,tempg->pwhas.height,tempg->pwhas.sides,
|
||||
tempg->pwhas.angle);
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(eletype));
|
||||
tempg->type=eletype;
|
||||
tempg->x1=x1-x;
|
||||
tempg->y1=y1-y;
|
||||
tempg->p.x1=x1-x;
|
||||
tempg->p.y1=y1-y;
|
||||
break;
|
||||
sub_switch_start:
|
||||
QueInit(&root2);
|
||||
num=0;
|
||||
x3=a1-x; y3=a2-y;
|
||||
do {
|
||||
do {
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE+
|
||||
1<<MSG_IP_R_UP);
|
||||
dc->color=TRANSPARENT;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
x2=a1; y2=a2;
|
||||
} while (msg_code!=MSG_IP_L_UP && msg_code!=MSG_IP_R_UP);
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
if (msg_code==MSG_IP_L_UP) {
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
if (num)
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_PT));
|
||||
tempg->type=SPT_PT;
|
||||
tempg->x1=x2-x;
|
||||
tempg->y1=y2-y;
|
||||
tempg->p.x1=x2-x;
|
||||
tempg->p.y1=y2-y;
|
||||
QueIns(tempg,root2.last);
|
||||
x1=x2;y1=y2;
|
||||
num++;
|
||||
}
|
||||
} while (msg_code!=MSG_IP_R_UP);
|
||||
if (!num) {
|
||||
tempg=NULL;
|
||||
break;
|
||||
}
|
||||
case SPT_POLYLINE:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+
|
||||
(num+1)<<1*sizeof(I32));
|
||||
ptr=&tempg->y1;
|
||||
tempg2=root2.next;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=2;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
ptr[i<<1]=tempg2->x1;
|
||||
ptr[i<<1+1]=tempg2->y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
if (num>1) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+num*sizeof(CD2I32));
|
||||
ptr=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
ptr[i<<1]=tempg2->p.x1;
|
||||
ptr[i<<1+1]=tempg2->p.y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=SPT_POLYLINE;
|
||||
tempg->nu.num=num;
|
||||
} else {
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg=NULL;
|
||||
}
|
||||
tempg->type=SPT_POLYLINE;
|
||||
tempg->num=num+1;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYLINE)+
|
||||
(num+1)*sizeof(CD3I32));
|
||||
p=&tempg->y1;
|
||||
tempg2=root2.next;
|
||||
p[0].x=x3;
|
||||
p[0].y=y3;
|
||||
for (i=1;i<=num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
p[i].x=tempg2->x1;
|
||||
p[i].y=tempg2->y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
if (num>2) {
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(eletype)+num*sizeof(CD3I32));
|
||||
p=&tempg->nu.u;
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
p[i].x=tempg2->p.x1;
|
||||
p[i].y=tempg2->p.y1;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=eletype;
|
||||
tempg->nu.num=num;
|
||||
} else {
|
||||
tempg2=root2.next;
|
||||
for (i=0;i<num;i++) {
|
||||
tempg1=tempg2->next;
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg=NULL;
|
||||
}
|
||||
tempg->type=eletype;
|
||||
tempg->num=num+1;
|
||||
break;
|
||||
sub_switch_end:
|
||||
break;
|
||||
@@ -846,8 +879,7 @@ ei_restart:
|
||||
x3=a1-x; y3=a2-y;
|
||||
dc->color=color&COLORROP_NO_ROP0_MASK;
|
||||
do {
|
||||
msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
msg_code=GetMsg(&a1,&a2,1<<MSG_IP_L_UP+1<<MSG_IP_MOVE);
|
||||
x2=a1; y2=a2;
|
||||
GrLine3(dc,x1,y1,0,x2,y2,0);
|
||||
Line(&root2,x1-x,y1-y,0,x2-x,y2-y,0,&SpritePolyPtPlot);
|
||||
@@ -859,38 +891,37 @@ ei_restart:
|
||||
x1=x3;y1=y3;
|
||||
while (tempg!=&root2) {
|
||||
tempg1=tempg->next;
|
||||
if (tempg->x1==x1 && tempg->y1==y1) {
|
||||
if (tempg->p.x1==x1 && tempg->p.y1==y1) {
|
||||
QueRem(tempg);
|
||||
Free(tempg);
|
||||
} else {
|
||||
num++;
|
||||
x1=tempg->x1;
|
||||
y1=tempg->y1;
|
||||
x1=tempg->p.x1;
|
||||
y1=tempg->p.y1;
|
||||
}
|
||||
tempg=tempg1;
|
||||
}
|
||||
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_POLYPT)+(num*3+7)>>3);
|
||||
ptr=&tempg->y1;
|
||||
ptr[0]=x3;
|
||||
ptr[1]=y3;
|
||||
ptr+=2;
|
||||
tempg->npu.x=x3;
|
||||
tempg->npu.y=y3;
|
||||
ptr=&tempg->npu.u;
|
||||
x1=x3;y1=y3;
|
||||
i=0;
|
||||
tempg2=root2.next;
|
||||
while (tempg2!=&root2) {
|
||||
tempg1=tempg2->next;
|
||||
BFieldOrU32(ptr,i,
|
||||
polypt_map[SignI64(tempg2->x1-x1)+1+
|
||||
3*(SignI64(tempg2->y1-y1)+1)]);
|
||||
polypt_map[SignI64(tempg2->p.x1-x1)+1+
|
||||
3*(SignI64(tempg2->p.y1-y1)+1)]);
|
||||
i+=3;
|
||||
x1=tempg2->x1;y1=tempg2->y1;
|
||||
x1=tempg2->p.x1;y1=tempg2->p.y1;
|
||||
QueRem(tempg2);
|
||||
Free(tempg2);
|
||||
tempg2=tempg1;
|
||||
}
|
||||
tempg->type=SPT_POLYPT;
|
||||
tempg->num=num;
|
||||
tempg->npu.num=num;
|
||||
break;
|
||||
sub_switch_end:
|
||||
if (tempg) {
|
||||
@@ -926,14 +957,14 @@ ei_bitmap:
|
||||
xx2++; yy2++;
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=xx1-x;
|
||||
tempg->y2=yy1-y;
|
||||
img=DCNew(tempg->width,tempg->height,Fs);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
img=DCNew(tempg->pwhu.width,tempg->pwhu.height,Fs);
|
||||
img->color=bm_bkcolor;
|
||||
GrRect(img,0,0,tempg->width,tempg->height);
|
||||
GrRect(img,0,0,tempg->pwhu.width,tempg->pwhu.height);
|
||||
tempg1=insert_pt;
|
||||
if (tempg1==root || tempg1->type!=SPT_BITMAP) {
|
||||
SpriteSetSettings(img,root,0,&color,&width,-(xx1-x),-(yy1-y));
|
||||
@@ -943,12 +974,12 @@ ei_bitmap:
|
||||
cur_elem_num=1;
|
||||
} else {
|
||||
SpriteSetSettings(img,root,cur_elem_num,&color,&width,-(xx1-x),-(yy1-y));
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,tempg1(U8 *)+offset(CSprite.start),TRUE);
|
||||
Sprite3(img,-(xx1-x),-(yy1-y),0,&tempg1->start,TRUE);
|
||||
insert_pt=tempg1->next;
|
||||
QueRem(tempg1);
|
||||
Free(tempg1);
|
||||
}
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
|
||||
switch (i=SpriteBitMapEd(doc,doc_e,dc,&xx1,&yy1,&xx2,&yy2,&img,bm_bkcolor)) {
|
||||
case GE_EXIT:
|
||||
@@ -957,11 +988,11 @@ ei_bitmap:
|
||||
tempg=CAlloc(SpriteElemQuedBaseSize(SPT_BITMAP)+
|
||||
((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->type=eletype;
|
||||
tempg->width=xx2-xx1;
|
||||
tempg->height=yy2-yy1;
|
||||
tempg->x2=xx1-x;
|
||||
tempg->y2=yy1-y;
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
tempg->pwhu.width=xx2-xx1;
|
||||
tempg->pwhu.height=yy2-yy1;
|
||||
tempg->pwhu.x1=xx1-x;
|
||||
tempg->pwhu.y1=yy1-y;
|
||||
MemCpy(&tempg->pwhu.u,img->body,((xx2-xx1+7)&~7)*(yy2-yy1));
|
||||
break;
|
||||
}
|
||||
doc_e->de_flags=old_de_flags;
|
||||
@@ -987,25 +1018,25 @@ ei_shiftable_mesh:
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1=z;
|
||||
p=&tempg1->x2;
|
||||
for (i=0;i<tempg1->vertex_cnt;i++,p++) {
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->vertex_cnt;
|
||||
old_mesh=&tempg1->mu.vertex_cnt;
|
||||
} else if (tempg1!=root && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
z=-tempg1->z1;
|
||||
x1=tempg1->x1-(a1-x);
|
||||
y1=tempg1->y1-(a2-y);
|
||||
z1=tempg1->z1+z;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
z=-tempg1->pmu.z;
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x+=x1;
|
||||
p->y+=y1;
|
||||
p->z+=z1;
|
||||
}
|
||||
old_mesh=&tempg1->shiftable_vertex_cnt;
|
||||
old_mesh=&tempg1->pmu.vertex_cnt;
|
||||
} else {
|
||||
z=0;
|
||||
old_mesh=NULL;
|
||||
@@ -1013,11 +1044,11 @@ ei_shiftable_mesh:
|
||||
if (mesh=SpriteMeshEd(old_mesh,&size,TRUE)) {
|
||||
tempg=MAlloc(SpriteElemQuedBaseSize(SPT_SHIFTABLE_MESH)-sizeof(I32)*2+size);
|
||||
tempg->type=SPT_SHIFTABLE_MESH;
|
||||
MemCpy(&tempg->shiftable_vertex_cnt,mesh,size);
|
||||
MemCpy(&tempg->pmu.vertex_cnt,mesh,size);
|
||||
Free(mesh);
|
||||
tempg->x1=a1-x;
|
||||
tempg->y1=a2-y;
|
||||
tempg->z1=-z;
|
||||
tempg->pmu.x=a1-x;
|
||||
tempg->pmu.y=a2-y;
|
||||
tempg->pmu.z=-z;
|
||||
QueIns(tempg,insert_pt->last);
|
||||
SpriteEdUpdate(doc,tempb,root);
|
||||
if (old_mesh) {
|
||||
@@ -1028,11 +1059,11 @@ ei_shiftable_mesh:
|
||||
} else
|
||||
cur_elem_num++;
|
||||
} else if (old_mesh && tempg1->type==SPT_SHIFTABLE_MESH) {
|
||||
x1=tempg1->x1-(a1-x);
|
||||
y1=tempg1->y1-(a2-y);
|
||||
z1=tempg1->z1+z;
|
||||
p=(&tempg1->shiftable_tri_cnt)(U8 *)+sizeof(I32);
|
||||
for (i=0;i<tempg1->shiftable_vertex_cnt;i++,p++) {
|
||||
x1=tempg1->pmu.x-(a1-x);
|
||||
y1=tempg1->pmu.y-(a2-y);
|
||||
z1=tempg1->pmu.z+z;
|
||||
p=&tempg1->pmu.u;
|
||||
for (i=0;i<tempg1->pmu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -1041,8 +1072,8 @@ ei_shiftable_mesh:
|
||||
x1=-(a1-x);
|
||||
y1=-(a2-y);
|
||||
z1= z;
|
||||
p=&tempg1->x2;
|
||||
for (i=0;i<tempg1->vertex_cnt;i++,p++) {
|
||||
p=&tempg1->mu.u;
|
||||
for (i=0;i<tempg1->mu.vertex_cnt;i++,p++) {
|
||||
p->x-=x1;
|
||||
p->y-=y1;
|
||||
p->z-=z1;
|
||||
@@ -1077,7 +1108,7 @@ U0 EdSpriteIns(CDoc *doc,I64 x,I64 y)
|
||||
CDocEntry *doc_e;
|
||||
CDocBin *tempb;
|
||||
if (Fs!=doc->mem_task)
|
||||
Dbg;
|
||||
throw('Graphics');
|
||||
if (st=EdSprite(doc->cur_bin_num)) {
|
||||
unlock=DocLock(doc);
|
||||
tempb=CAlloc(sizeof(CDocBin),doc->mem_task);
|
||||
|
||||
@@ -384,7 +384,7 @@ U0 MPDrawIt(CMeshFrame *e)
|
||||
CMeshEdTri *tempt=e->tri_root.next;
|
||||
I64 i,*old_r=dc->r;
|
||||
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() allocates a new identity rotation matrix.
|
||||
//$LK,"DCAlias",A="MN:DCAlias"$() alllocs a new identity rotation matrix.
|
||||
//We want e->dc's rotation matrix.
|
||||
dc->r=e->dc->r;
|
||||
|
||||
@@ -955,7 +955,7 @@ $WW,0$*/
|
||||
"}");
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
WordStat;
|
||||
AutoComplete;
|
||||
Preempt(OFF); //We don't really want window update while modifying links
|
||||
AcctOneTimePopUp(ARf_MESH_ED,
|
||||
"$$GREEN$$Right Mouse$$FG$$: Hold and move to shift cursor z\n"
|
||||
|
||||
+55
-56
@@ -5,36 +5,36 @@ U8 polypt_map[9]={0,1,2,3,0,4,5,6,7};
|
||||
|
||||
I64 sprite_elem_base_sizes[SPT_NUM_TYPES]=
|
||||
{
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_END
|
||||
1+offset(CSprite.color)-offset(CSprite.start), //SPT_COLOR
|
||||
2+offset(CSprite.dither_color)-offset(CSprite.start), //SPT_DITHER_COLOR
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_WIDTH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_PLANAR_SYMMETRY
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_TRANSFORM_ON
|
||||
offset(CSprite.x1)-offset(CSprite.start), //SPT_TRANSFORM_OFF
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_SHIFT
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_PT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //SPT_POLYPT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_LINE
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_POLYLINE
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_RECT
|
||||
offset(CSprite.sides)-offset(CSprite.start), //SPT_ROTATED_RECT
|
||||
offset(CSprite.y2)-offset(CSprite.start), //SPT_CIRCLE
|
||||
offset(CSprite.sides)-offset(CSprite.start), //SPT_ELLIPSE
|
||||
sizeof(CSprite)-offset(CSprite.start), //SPT_POLYGON
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE2
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE2_CLOSED
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE3
|
||||
offset(CSprite.y1)-offset(CSprite.start), //SPT_BSPLINE3_CLOSED
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_FLOOD_FILL
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_FLOOD_FILL_NOT
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_BITMAP
|
||||
offset(CSprite.x2)-offset(CSprite.start), //SPT_MESH
|
||||
offset(CSprite.shiftable_tri_cnt)+sizeof(I32)-offset(CSprite.start), //SPT_SHIFTABLE_MESH
|
||||
offset(CSprite.linespeed)-offset(CSprite.start), //SPT_ARROW
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT_BOX
|
||||
offset(CSprite.st)-offset(CSprite.start), //SPT_TEXT_DIAMOND
|
||||
sizeof(CSpriteBase), //SPT_END
|
||||
sizeof(CSpriteColor), //SPT_COLOR
|
||||
sizeof(CSpriteDitherColor), //SPT_DITHER_COLOR
|
||||
sizeof(CSpriteWidth), //SPT_WIDTH
|
||||
sizeof(CSpritePtPt), //SPT_PLANAR_SYMMETRY
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_ON
|
||||
sizeof(CSpriteBase), //SPT_TRANSFORM_OFF
|
||||
sizeof(CSpritePt), //SPT_SHIFT
|
||||
sizeof(CSpritePt), //SPT_PT
|
||||
sizeof(CSpriteNumPtU8s), //SPT_POLYPT
|
||||
sizeof(CSpritePtPt), //SPT_LINE
|
||||
sizeof(CSpriteNumU8s), //SPT_POLYLINE
|
||||
sizeof(CSpritePtPt), //SPT_RECT
|
||||
sizeof(CSpritePtPtAng), //SPT_ROTATED_RECT
|
||||
sizeof(CSpritePtRad), //SPT_CIRCLE
|
||||
sizeof(CSpritePtWHAng), //SPT_ELLIPSE
|
||||
sizeof(CSpritePtWHAngSides), //SPT_POLYGON
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE2_CLOSED
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3
|
||||
sizeof(CSpriteNumU8s), //SPT_BSPLINE3_CLOSED
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL
|
||||
sizeof(CSpritePt), //SPT_FLOOD_FILL_NOT
|
||||
sizeof(CSpritePtWHU8s), //SPT_BITMAP
|
||||
sizeof(CSpriteMeshU8s), //SPT_MESH
|
||||
sizeof(CSpritePtMeshU8s), //SPT_SHIFTABLE_MESH
|
||||
sizeof(CSpritePtPt), //SPT_ARROW
|
||||
sizeof(CSpritePtStr), //SPT_TEXT
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_BOX
|
||||
sizeof(CSpritePtStr), //SPT_TEXT_DIAMOND
|
||||
};
|
||||
|
||||
I64 SpriteElemQuedBaseSize(I64 type)
|
||||
@@ -47,30 +47,30 @@ I64 SpriteElemSize(CSprite *tempg)
|
||||
I64 i=sprite_elem_base_sizes[tempg->type];
|
||||
switch (tempg->type) {
|
||||
case SPT_POLYLINE:
|
||||
i+=tempg->num*sizeof(CD2I32);
|
||||
i+=tempg->nu.num*sizeof(CD2I32);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
i+=StrLen(tempg->st)+1;
|
||||
i+=StrLen(tempg->ps.st)+1;
|
||||
break;
|
||||
case SPT_BITMAP:
|
||||
i+=((tempg->width+7)&~7)*tempg->height;
|
||||
i+=((tempg->pwhu.width+7)&~7)*tempg->pwhu.height;
|
||||
break;
|
||||
case SPT_POLYPT:
|
||||
i+=(tempg->num*3+7)>>3;
|
||||
i+=(tempg->npu.num*3+7)>>3;
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
i+=tempg->num*sizeof(CD3I32);
|
||||
i+=tempg->nu.num*sizeof(CD3I32);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
i+=tempg->vertex_cnt*sizeof(CD3I32)+tempg->tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->mu.vertex_cnt*sizeof(CD3I32)+tempg->mu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
i+=tempg->shiftable_vertex_cnt*sizeof(CD3I32)+tempg->shiftable_tri_cnt*sizeof(CMeshTri);
|
||||
i+=tempg->pmu.vertex_cnt*sizeof(CD3I32)+tempg->pmu.tri_cnt*sizeof(CMeshTri);
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
@@ -105,12 +105,11 @@ public U8 *DC2Sprite(CDC *tempb)
|
||||
sprite_elem_base_sizes[SPT_END])
|
||||
(U8 *)-offset(CSprite.start);
|
||||
tempg->type=SPT_BITMAP;
|
||||
tempg->width=tempb->width;
|
||||
tempg->height=tempb->height;
|
||||
tempg->x2=0;
|
||||
tempg->y2=0;
|
||||
MemCpy(tempg(U8 *)+offset(CSprite.linespeed),tempb->body,
|
||||
tempb->width_internal*tempb->height);
|
||||
tempg->pwhu.width=tempb->width;
|
||||
tempg->pwhu.height=tempb->height;
|
||||
tempg->pwhu.x1=0;
|
||||
tempg->pwhu.y1=0;
|
||||
MemCpy(&tempg->pwhu.u,tempb->body,tempb->width_internal*tempb->height);
|
||||
return tempg(U8 *)+offset(CSprite.start);
|
||||
}
|
||||
|
||||
@@ -121,56 +120,56 @@ public U8 *SpriteElem2OneLineSummary(CSprite *tempg)
|
||||
StrPrint(buf,"%Z",tempg->type,"ST_SPRITE_ELEM_TYPES");
|
||||
switch (tempg->type) {
|
||||
case SPT_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->color));
|
||||
CatPrint(buf," %s",Color2Str(buf2,tempg->c.color));
|
||||
break;
|
||||
case SPT_DITHER_COLOR:
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->dither_color.u8[0]|tempg->dither_color.u8[1]<<COLORROP_BITS));
|
||||
CatPrint(buf," %s",Color2Str(buf2,ROPF_DITHER|tempg->d.dither_color.u8[0]|tempg->d.dither_color.u8[1]<<COLORROP_BITS));
|
||||
break;
|
||||
case SPT_PT:
|
||||
case SPT_FLOOD_FILL:
|
||||
case SPT_FLOOD_FILL_NOT:
|
||||
case SPT_SHIFT:
|
||||
CatPrint(buf," (%d,%d)",tempg->x1,tempg->y1);
|
||||
CatPrint(buf," (%d,%d)",tempg->p.x1,tempg->p.y1);
|
||||
break;
|
||||
case SPT_LINE:
|
||||
case SPT_ARROW:
|
||||
case SPT_PLANAR_SYMMETRY:
|
||||
case SPT_RECT:
|
||||
case SPT_ROTATED_RECT:
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->x1,tempg->y1,tempg->x2,tempg->y2);
|
||||
CatPrint(buf," (%d,%d),(%d,%d)",tempg->pp.x1,tempg->pp.y1,tempg->pp.x2,tempg->pp.y2);
|
||||
break;
|
||||
case SPT_CIRCLE:
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->x1,tempg->y1,tempg->x2);
|
||||
CatPrint(buf," (%d,%d):%dR",tempg->pr.x1,tempg->pr.y1,tempg->pr.radius);
|
||||
break;
|
||||
case SPT_WIDTH:
|
||||
CatPrint(buf," %d",tempg->width);
|
||||
CatPrint(buf," %d",tempg->w.width);
|
||||
break;
|
||||
case SPT_TEXT:
|
||||
case SPT_TEXT_BOX:
|
||||
case SPT_TEXT_DIAMOND:
|
||||
CatPrint(buf," %d,%d:%-16tQ",tempg->x1,tempg->y1,tempg->st);
|
||||
CatPrint(buf," %d,%d:%-16tQ",tempg->ps.x1,tempg->ps.y1,tempg->ps.st);
|
||||
break;
|
||||
case SPT_POLYLINE:
|
||||
case SPT_POLYPT:
|
||||
ptr=&tempg->y1;
|
||||
CatPrint(buf," %d (%d,%d)",tempg->num,ptr[0],ptr[1]);
|
||||
ptr=&tempg->npu.x;
|
||||
CatPrint(buf," %d (%d,%d)",tempg->npu.num,ptr[0],ptr[1]);
|
||||
break;
|
||||
case SPT_ELLIPSE:
|
||||
case SPT_POLYGON:
|
||||
case SPT_BITMAP:
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->x2,tempg->y2,tempg->width,tempg->height);
|
||||
CatPrint(buf," (%d,%d):%dW,%dH",tempg->pwhu.x1,tempg->pwhu.y1,tempg->pwhu.width,tempg->pwhu.height);
|
||||
break;
|
||||
case SPT_BSPLINE2:
|
||||
case SPT_BSPLINE3:
|
||||
case SPT_BSPLINE2_CLOSED:
|
||||
case SPT_BSPLINE3_CLOSED:
|
||||
CatPrint(buf," %d",tempg->num);
|
||||
CatPrint(buf," %d",tempg->nu.num);
|
||||
break;
|
||||
case SPT_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->vertex_cnt,tempg->tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tempg->mu.vertex_cnt,tempg->mu.tri_cnt);
|
||||
break;
|
||||
case SPT_SHIFTABLE_MESH:
|
||||
CatPrint(buf," %dV,%dT",tempg->shiftable_vertex_cnt,tempg->shiftable_tri_cnt);
|
||||
CatPrint(buf," %dV,%dT",tempg->pmu.vertex_cnt,tempg->pmu.tri_cnt);
|
||||
break;
|
||||
}
|
||||
return StrNew(buf);
|
||||
|
||||
Reference in new issue
Block a user