Rev 2185 | Rev 2358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2185 | Rev 2230 | ||
---|---|---|---|
Line 126... | Line 126... | ||
126 | ror eax,16 |
126 | ror eax,16 |
127 | pop esi |
127 | pop esi |
128 | @@: |
128 | @@: |
129 | ret |
129 | ret |
Line -... | Line 130... | ||
- | 130 | ||
- | 131 | ;input: |
|
- | 132 | ; ebx = coord x |
|
- | 133 | ; ecx = coord y |
|
- | 134 | ; edx = pixel color + transparent |
|
- | 135 | ; edi = pointer to buffer struct |
|
- | 136 | ; t_prop, m_prop - ª®íä¨æ¨¥âë ¥®¡å®¤¨¬ë¥ ¤«ï ¢ëç¨á«¥¨ï á⥯¥¨ ¯à®§à ç®á⨠|
|
- | 137 | align 4 |
|
- | 138 | transp_32 dd 0 ;梥â à¨á㥬®© â®çª¨ + ¯à®§à ç®áâì |
|
- | 139 | align 4 |
|
- | 140 | proc draw_pixel_transp, t_prop:dword, m_prop:dword |
|
- | 141 | ;cmp buf2d_bits,24 |
|
- | 142 | ;jne @f |
|
- | 143 | bt ebx,31 |
|
- | 144 | jc @f |
|
- | 145 | bt ecx,31 |
|
- | 146 | jc @f |
|
- | 147 | cmp ebx,buf2d_w |
|
- | 148 | jge @f |
|
- | 149 | cmp ecx,buf2d_h |
|
- | 150 | jge @f |
|
- | 151 | push eax ebx edx edi esi |
|
- | 152 | mov esi,buf2d_w ;size x |
|
- | 153 | imul esi,ecx ;size_x*y |
|
- | 154 | add esi,ebx ;size_x*y+x |
|
- | 155 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
|
- | 156 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
|
- | 157 | ||
- | 158 | mov edi,esi ;㪠§ ⥫ì 梥â ä® |
|
- | 159 | mov dword[transp_32],edx ;梥â à¨á㥬®© â®çª¨ |
|
- | 160 | ||
- | 161 | xor edx,edx |
|
- | 162 | mov eax,[t_prop] |
|
- | 163 | shl eax,8 ;*=256 |
|
- | 164 | mov ebx,[m_prop] |
|
- | 165 | div ebx ;¢ëç¨á«ï¥¬ ª®íä. ¯à®§à ç®á⨠(¤®«¦¥ ¡ëâì ®â 0 ¤® 255) |
|
- | 166 | bt ax,8 |
|
- | 167 | jnc .over_255 |
|
- | 168 | ;¥á«¨ ª®¥ä. ¯à®§à ç®á⨠>=256 ⮠㬥ìè ¥¬ ¥£® ¤® 255 |
|
- | 169 | mov al,0xff |
|
- | 170 | .over_255: |
|
- | 171 | ||
- | 172 | mov byte[transp_32+3],al ;¯à®§à ç®áâì à¨á㥬®© â®çª¨ |
|
- | 173 | mov esi,dword transp_32 ;㪠§ ⥫ì 梥â à¨á㥬®© â®çª¨ |
|
- | 174 | ||
- | 175 | call combine_colors |
|
- | 176 | pop esi edi edx ebx eax |
|
- | 177 | @@: |
|
- | 178 | ret |
|
Line 130... | Line 179... | ||
130 | 179 | endp |
|
131 | 180 | ||
132 | ;ᮧ¤ ¨¥ ¡ãä¥à |
181 | ;ᮧ¤ ¨¥ ¡ãä¥à |
133 | align 4 |
182 | align 4 |
Line 951... | Line 1000... | ||
951 | loc_1 dd ? |
1000 | loc_1 dd ? |
952 | loc_2 dd ? |
1001 | loc_2 dd ? |
953 | napravl db ? |
1002 | napravl db ? |
954 | endl |
1003 | endl |
955 | pushad |
1004 | pushad |
956 | mov edx,dword[color] |
- | |
957 | - | ||
958 | mov eax,dword[coord_x1] |
1005 | mov eax,dword[coord_x1] |
959 | sub eax,dword[coord_x0] |
1006 | sub eax,dword[coord_x0] |
960 | bt eax,31 |
1007 | bt eax,31 |
961 | jae @f |
1008 | jae @f |
962 | neg eax |
1009 | neg eax |
963 | inc eax |
1010 | inc eax |
964 | @@: |
1011 | @@: |
965 | mov ebx,dword[coord_y1] |
1012 | mov ebx,dword[coord_y1] |
966 | sub ebx,dword[coord_y0] |
1013 | sub ebx,dword[coord_y0] |
- | 1014 | jnz @f |
|
- | 1015 | ;¥á«¨ § ¤ £®à¨§®â «ì ï «¨¨ï y0=y1 |
|
- | 1016 | stdcall buf_line_h, [buf_struc], [coord_x0], [coord_y0], [coord_x1], [color] |
|
- | 1017 | jmp .coord_end |
|
- | 1018 | @@: |
|
967 | bt ebx,31 |
1019 | bt ebx,31 |
968 | jae @f |
1020 | jae @f |
969 | neg ebx |
1021 | neg ebx |
970 | inc ebx |
1022 | inc ebx |
971 | @@: |
1023 | @@: |
- | 1024 | mov edx,dword[color] |
|
Line 972... | Line 1025... | ||
972 | 1025 | ||
973 | mov [napravl],byte 0 ;bool steep=false |
1026 | mov [napravl],byte 0 ;bool steep=false |
974 | cmp eax,ebx |
1027 | cmp eax,ebx |
975 | jle @f |
1028 | jle @f |
Line 1058... | Line 1111... | ||
1058 | .coord_end: |
1111 | .coord_end: |
1059 | popad |
1112 | popad |
1060 | ret |
1113 | ret |
1061 | endp |
1114 | endp |
Line -... | Line 1115... | ||
- | 1115 | ||
- | 1116 | ;à¨á®¢ ¨¥ ᣫ ¦¥®© «¨¨¨ |
|
- | 1117 | align 4 |
|
- | 1118 | proc buf_line_brs_sm, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, coord_y1:dword, color:dword |
|
- | 1119 | locals |
|
- | 1120 | loc_1 dd ? |
|
- | 1121 | loc_2 dd ? |
|
- | 1122 | napravl db ? |
|
- | 1123 | endl |
|
- | 1124 | pushad |
|
- | 1125 | mov eax,dword[coord_x1] |
|
- | 1126 | sub eax,dword[coord_x0] |
|
- | 1127 | bt eax,31 |
|
- | 1128 | jae @f |
|
- | 1129 | neg eax |
|
- | 1130 | inc eax |
|
- | 1131 | @@: |
|
- | 1132 | mov ebx,dword[coord_y1] |
|
- | 1133 | sub ebx,dword[coord_y0] |
|
- | 1134 | jnz @f |
|
- | 1135 | ;¥á«¨ § ¤ £®à¨§®â «ì ï «¨¨ï y0=y1 |
|
- | 1136 | stdcall buf_line_h, [buf_struc], [coord_x0], [coord_y0], [coord_x1], [color] |
|
- | 1137 | jmp .coord_end |
|
- | 1138 | @@: |
|
- | 1139 | bt ebx,31 |
|
- | 1140 | jae @f |
|
- | 1141 | neg ebx |
|
- | 1142 | inc ebx |
|
- | 1143 | @@: |
|
- | 1144 | mov edx,dword[color] |
|
- | 1145 | ||
- | 1146 | mov [napravl],byte 0 ;bool steep=false |
|
- | 1147 | cmp eax,ebx |
|
- | 1148 | jle @f |
|
- | 1149 | mov [napravl],byte 1 ;bool steep=true |
|
- | 1150 | swap dword[coord_x0],dword[coord_y0] ;swap(x0, y0); |
|
- | 1151 | swap dword[coord_x1],dword[coord_y1] ;swap(x1, y1); |
|
- | 1152 | @@: |
|
- | 1153 | mov eax,dword[coord_y0] ;x0 |
|
- | 1154 | cmp eax,dword[coord_y1] ;if(x0>x1) |
|
- | 1155 | jle @f |
|
- | 1156 | swap dword[coord_y0],dword[coord_y1] ;swap(x0, x1); |
|
- | 1157 | swap dword[coord_x0],dword[coord_x1] ;swap(y0, y1); |
|
- | 1158 | @@: |
|
- | 1159 | ||
- | 1160 | ; int deltax esi |
|
- | 1161 | ; int deltay edi |
|
- | 1162 | ; int error ebp-6 |
|
- | 1163 | ; int ystep ebp-8 |
|
- | 1164 | ||
- | 1165 | mov eax,dword[coord_y0] |
|
- | 1166 | mov esi,dword[coord_y1] |
|
- | 1167 | sub esi,eax ;deltax = y1-y0 |
|
- | 1168 | mov ebx,esi |
|
- | 1169 | shr ebx,1 |
|
- | 1170 | mov [loc_1],ebx ;error = deltax/2 |
|
- | 1171 | ||
- | 1172 | mov eax,dword[coord_x0] |
|
- | 1173 | mov edi,dword[coord_x1] |
|
- | 1174 | mov [loc_2],dword -1 ;ystep = -1 |
|
- | 1175 | cmp eax,edi ;if (x0 |
|
- | 1176 | jge @f |
|
- | 1177 | mov [loc_2],dword 1 ;ystep = 1 |
|
- | 1178 | @@: |
|
- | 1179 | sub edi,eax ;x1-x0 |
|
- | 1180 | ||
- | 1181 | bts edi,31 |
|
- | 1182 | jae @f |
|
- | 1183 | neg edi |
|
- | 1184 | inc edi |
|
- | 1185 | @@: |
|
- | 1186 | and edi,0x7fffffff ;deltay = abs(x1-x0) |
|
- | 1187 | ||
- | 1188 | mov eax,edi |
|
- | 1189 | mov edi,[buf_struc] |
|
- | 1190 | cmp buf2d_bits,24 |
|
- | 1191 | jne .coord_end |
|
- | 1192 | ||
- | 1193 | cmp [napravl],0 |
|
- | 1194 | jne .coord_yx |
|
- | 1195 | mov ebx,dword[coord_x0] |
|
- | 1196 | mov ecx,dword[coord_y0] |
|
- | 1197 | ||
- | 1198 | @@: ;for (x=x0 ; x |
|
- | 1199 | cmp ecx,dword[coord_y1] |
|
- | 1200 | jg @f ;jge ??? |
|
- | 1201 | push eax |
|
- | 1202 | mov eax,esi |
|
- | 1203 | sub eax,[loc_1] |
|
- | 1204 | stdcall draw_pixel_transp, eax,esi |
|
- | 1205 | pop eax |
|
- | 1206 | add ebx,[loc_2] |
|
- | 1207 | stdcall draw_pixel_transp, [loc_1],esi |
|
- | 1208 | sub ebx,[loc_2] |
|
- | 1209 | ||
- | 1210 | sub dword[loc_1],eax ;error -= deltay |
|
- | 1211 | cmp dword[loc_1],0 ;if(error<0) |
|
- | 1212 | jge .if0 |
|
- | 1213 | add ebx,[loc_2] ;y += ystep |
|
- | 1214 | add [loc_1],esi ;error += deltax |
|
- | 1215 | .if0: |
|
- | 1216 | inc ecx |
|
- | 1217 | jmp @b |
|
- | 1218 | @@: |
|
- | 1219 | jmp .coord_end |
|
- | 1220 | .coord_yx: |
|
- | 1221 | mov ebx,dword[coord_y0] |
|
- | 1222 | mov ecx,dword[coord_x0] |
|
- | 1223 | ||
- | 1224 | @@: ;for (x=x0 ; x |
|
- | 1225 | cmp ebx,dword[coord_y1] |
|
- | 1226 | jg @f ;jge ??? |
|
- | 1227 | push eax |
|
- | 1228 | mov eax,esi |
|
- | 1229 | sub eax,[loc_1] |
|
- | 1230 | stdcall draw_pixel_transp, eax,esi |
|
- | 1231 | pop eax |
|
- | 1232 | add ecx,[loc_2] |
|
- | 1233 | stdcall draw_pixel_transp, [loc_1],esi |
|
- | 1234 | sub ecx,[loc_2] |
|
- | 1235 | ||
- | 1236 | sub dword[loc_1],eax ;error -= deltay |
|
- | 1237 | cmp dword[loc_1],0 ;if(error<0) |
|
- | 1238 | jge .if1 |
|
- | 1239 | add ecx,[loc_2] ;y += ystep |
|
- | 1240 | add [loc_1],esi ;error += deltax |
|
- | 1241 | .if1: |
|
- | 1242 | inc ebx |
|
- | 1243 | jmp @b |
|
- | 1244 | @@: |
|
- | 1245 | .coord_end: |
|
- | 1246 | popad |
|
- | 1247 | ret |
|
- | 1248 | endp |
|
1062 | 1249 | ||
1063 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1250 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1064 | align 4 |
1251 | align 4 |
1065 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
1252 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
1066 | pushad |
1253 | pushad |
Line 2366... | Line 2553... | ||
2366 | dd sz_buf2d_clear, buf_clear |
2553 | dd sz_buf2d_clear, buf_clear |
2367 | dd sz_buf2d_draw, buf_draw_buf |
2554 | dd sz_buf2d_draw, buf_draw_buf |
2368 | dd sz_buf2d_delete, buf_delete |
2555 | dd sz_buf2d_delete, buf_delete |
2369 | dd sz_buf2d_resize, buf_resize |
2556 | dd sz_buf2d_resize, buf_resize |
2370 | dd sz_buf2d_line, buf_line_brs |
2557 | dd sz_buf2d_line, buf_line_brs |
- | 2558 | dd sz_buf2d_line_sm, buf_line_brs_sm |
|
2371 | dd sz_buf2d_rect_by_size, buf_rect_by_size |
2559 | dd sz_buf2d_rect_by_size, buf_rect_by_size |
2372 | dd sz_buf2d_filled_rect_by_size, buf_filled_rect_by_size |
2560 | dd sz_buf2d_filled_rect_by_size, buf_filled_rect_by_size |
2373 | dd sz_buf2d_circle, buf_circle |
2561 | dd sz_buf2d_circle, buf_circle |
2374 | dd sz_buf2d_img_hdiv2, buf_img_hdiv2 |
2562 | dd sz_buf2d_img_hdiv2, buf_img_hdiv2 |
2375 | dd sz_buf2d_img_wdiv2, buf_img_wdiv2 |
2563 | dd sz_buf2d_img_wdiv2, buf_img_wdiv2 |
Line 2392... | Line 2580... | ||
2392 | sz_buf2d_clear db 'buf2d_clear',0 ;®ç¨á⪠¡ãä¥à 㪠§ ë¬ æ¢¥â®¬ |
2580 | sz_buf2d_clear db 'buf2d_clear',0 ;®ç¨á⪠¡ãä¥à 㪠§ ë¬ æ¢¥â®¬ |
2393 | sz_buf2d_draw db 'buf2d_draw',0 |
2581 | sz_buf2d_draw db 'buf2d_draw',0 |
2394 | sz_buf2d_delete db 'buf2d_delete',0 |
2582 | sz_buf2d_delete db 'buf2d_delete',0 |
2395 | sz_buf2d_resize db 'buf2d_resize',0 |
2583 | sz_buf2d_resize db 'buf2d_resize',0 |
2396 | sz_buf2d_line db 'buf2d_line',0 ;à¨á®¢ ¨¥ «¨¨¨ |
2584 | sz_buf2d_line db 'buf2d_line',0 ;à¨á®¢ ¨¥ «¨¨¨ |
- | 2585 | sz_buf2d_line_sm db 'buf2d_line_sm',0 ;à¨á®¢ ¨¥ ᣫ ¦¥®© «¨¨¨ |
|
2397 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 ;à¨á®¢ ¨¥ à ¬ª¨ ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2586 | sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0 ;à¨á®¢ ¨¥ à ¬ª¨ ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2398 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 ;à¨á®¢ ¨¥ § «¨â®£® ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2587 | sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 ;à¨á®¢ ¨¥ § «¨â®£® ¯àאַ㣮«ì¨ª , 2-ï ª®®à¤¨ â § ¤ ¯® à §¬¥àã |
2399 | sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮á⨠|
2588 | sz_buf2d_circle db 'buf2d_circle',0 ;à¨á®¢ ¨¥ ®ªà㦮á⨠|
2400 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® ¢ëá®â¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2589 | sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® ¢ëá®â¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2401 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® è¨à¨¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |
2590 | sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0 ;ᦠ⨥ ¨§®¡à ¦¥¨ï ¯® è¨à¨¥ ¢ 2 à § (à §¬¥à ¡ãä¥à ¥ ¬¥ï¥âáï) |