Rev 2230 | Rev 2359 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2230 | Rev 2358 | ||
---|---|---|---|
Line 80... | Line 80... | ||
80 | jge @f |
80 | jge @f |
81 | push esi |
81 | push esi |
82 | mov esi,buf2d_w ;size x |
82 | mov esi,buf2d_w ;size x |
83 | imul esi,ecx ;size_x*y |
83 | imul esi,ecx ;size_x*y |
84 | add esi,ebx ;size_x*y+x |
84 | add esi,ebx ;size_x*y+x |
- | 85 | cmp buf2d_bits,8 |
|
- | 86 | je .beg8 |
|
85 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
87 | lea esi,[esi+esi*2] ;(size_x*y+x)*3 |
86 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
88 | add esi,buf2d_data ;ptr+(size_x*y+x)*3 |
87 | - | ||
88 | mov word[esi],dx ;copy pixel color |
89 | mov word[esi],dx ;copy pixel color |
89 | ror edx,16 |
90 | ror edx,16 |
90 | mov byte[esi+2],dl |
91 | mov byte[esi+2],dl |
91 | ror edx,16 |
92 | ror edx,16 |
- | 93 | jmp .end_draw |
|
- | 94 | .beg8: ;à¨á®¢ ¨¥ â®çª¨ ¢ 8 ¡¨â®¬ ¡ãä¥à¥ |
|
- | 95 | add esi,buf2d_data ;ptr+(size_x*y+x) |
|
- | 96 | mov byte[esi],dl |
|
- | 97 | .end_draw: |
|
92 | pop esi |
98 | pop esi |
93 | @@: |
99 | @@: |
94 | ret |
100 | ret |
Line 95... | Line 101... | ||
95 | 101 | ||
Line 1065... | Line 1071... | ||
1065 | @@: |
1071 | @@: |
1066 | and edi,0x7fffffff ;deltay = abs(x1-x0) |
1072 | and edi,0x7fffffff ;deltay = abs(x1-x0) |
Line 1067... | Line 1073... | ||
1067 | 1073 | ||
1068 | mov eax,edi |
1074 | mov eax,edi |
- | 1075 | mov edi,[buf_struc] |
|
- | 1076 | cmp buf2d_bits,8 |
|
1069 | mov edi,[buf_struc] |
1077 | je @f |
- | 1078 | cmp buf2d_bits,24 |
|
1070 | cmp buf2d_bits,24 |
1079 | je @f |
- | 1080 | jmp .coord_end |
|
Line 1071... | Line 1081... | ||
1071 | jne .coord_end |
1081 | @@: |
1072 | 1082 | ||
1073 | cmp [napravl],0 |
1083 | cmp [napravl],0 |
1074 | jne .coord_yx |
1084 | jne .coord_yx |
Line 1249... | Line 1259... | ||
1249 | 1259 | ||
1250 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1260 | ;à¨á®¢ ¨¥ £®à¨§®â «ì®© «¨¨¨, ¯®â®¬ã ¥â ¯ à ¬¥âà coord_y1 |
1251 | align 4 |
1261 | align 4 |
1252 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
1262 | proc buf_line_h, buf_struc:dword, coord_x0:dword, coord_y0:dword, coord_x1:dword, color:dword |
- | 1263 | pushad |
|
1253 | pushad |
1264 | pushfd |
- | 1265 | mov edi,[buf_struc] |
|
- | 1266 | cmp buf2d_bits,8 |
|
1254 | mov edi,[buf_struc] |
1267 | je @f |
- | 1268 | cmp buf2d_bits,24 |
|
1255 | cmp buf2d_bits,24 |
1269 | je @f |
- | 1270 | jmp .end24 |
|
Line 1256... | Line 1271... | ||
1256 | jne .end24 |
1271 | @@: ;®¯à¥¤¥«¥¨¥ ª®®à¤¨ â «¨¨¨ ®â®á¨â¥«ì® ¡ãä¥à |
1257 | 1272 | ||
1258 | mov ecx,dword[coord_y0] |
1273 | mov ecx,dword[coord_y0] |
1259 | bt ecx,31 |
1274 | bt ecx,31 |
Line 1277... | Line 1292... | ||
1277 | ;¥á«¨ ª®®à¤¨ â x0 ¡®«ìè¥ è¨à¨ë ¡ãä¥à |
1292 | ;¥á«¨ ª®®à¤¨ â x0 ¡®«ìè¥ è¨à¨ë ¡ãä¥à |
1278 | mov esi,buf2d_w |
1293 | mov esi,buf2d_w |
1279 | ;dec esi |
1294 | ;dec esi |
1280 | @@: |
1295 | @@: |
1281 | cmp ebx,esi |
1296 | cmp ebx,esi |
1282 | jge .end24 ;¥á«¨ x0 >= x1 ¬®¦¥â ¢®§¨ªãâì ª®£¤ ®¡¥ ª®®à¤¨ âë x0, x1 室¨«¨áì § ®¤¨¬ ¨§ ¯à¥¤¥«®¢ ¡ãä¥à |
1297 | jg .end24 ;¥á«¨ x0 > x1 ¬®¦¥â ¢®§¨ªãâì ª®£¤ ®¡¥ ª®®à¤¨ âë x0, x1 室¨«¨áì § ®¤¨¬ ¨§ ¯à¥¤¥«®¢ ¡ãä¥à |
Line -... | Line 1298... | ||
- | 1298 | ||
- | 1299 | cmp buf2d_bits,24 |
|
- | 1300 | je .beg24 |
|
- | 1301 | ;à¨á®¢ ¨¥ ¢ 8 ¡¨â®¬ ¡ãä¥à¥ |
|
- | 1302 | ;¢ edx ¢ëç¨á«ï¥¬ ç «® 1-© â®çª¨ «¨¨¨ ¢ ¡ãä¥à¥ ¨§®¡à ¦¥¨ï |
|
- | 1303 | mov edx,buf2d_w ;size x |
|
- | 1304 | imul edx,ecx ;size_x*y |
|
- | 1305 | add edx,ebx ;size_x*y+x |
|
- | 1306 | add edx,buf2d_data ;ptr+(size_x*y+x) |
|
- | 1307 | mov edi,edx ;⥯¥àì ¬®¦¥¬ ¯®àâ¨âì 㪠§ â¥«ì ¡ãä¥à |
|
- | 1308 | ||
- | 1309 | mov ecx,esi |
|
- | 1310 | sub ecx,ebx ;¢ ecx ª®««¨ç¥á⢮ â®ç¥ª «¨¨¨ ¢ë¢®¤¨¬ëå ¢ ¡ãä¥à |
|
- | 1311 | inc ecx ;çâ®-¡ë ¯®á«¥¤ïï â®çª «¨¨¨ â ª¦¥ ®â®¡à ¦ « áì |
|
- | 1312 | mov eax,dword[color] ;¡ã¤¥¬ ¨á¯®«ì§®¢ âì ⮫쪮 § 票¥ ¢ al |
|
- | 1313 | cld |
|
- | 1314 | rep stosb ;横« ¯® ®á¨ x ®â x0 ¤® x1 (¢ª«îç ï x1) |
|
- | 1315 | jmp .end24 |
|
- | 1316 | ||
1283 | 1317 | .beg24: ;à¨á®¢ ¨¥ ¢ 24 ¡¨â®¬ ¡ãä¥à¥ |
|
1284 | ;¢ eax ¢ëç¨á«ï¥¬ ç «® 1-© â®çª¨ «¨¨¨ ¢ ¡ãä¥à¥ ¨§®¡à ¦¥¨ï |
1318 | ;¢ eax ¢ëç¨á«ï¥¬ ç «® 1-© â®çª¨ «¨¨¨ ¢ ¡ãä¥à¥ ¨§®¡à ¦¥¨ï |
1285 | mov eax,buf2d_w ;size x |
1319 | mov eax,buf2d_w ;size x |
1286 | imul eax,ecx ;size_x*y |
1320 | imul eax,ecx ;size_x*y |
1287 | add eax,ebx ;size_x*y+x |
1321 | add eax,ebx ;size_x*y+x |
1288 | lea eax,[eax+eax*2] ;(size_x*y+x)*3 |
1322 | lea eax,[eax+eax*2] ;(size_x*y+x)*3 |
Line 1289... | Line 1323... | ||
1289 | add eax,buf2d_data ;ptr+(size_x*y+x)*3 |
1323 | add eax,buf2d_data ;ptr+(size_x*y+x)*3 |
1290 | 1324 | ||
- | 1325 | mov ecx,esi |
|
1291 | mov ecx,esi |
1326 | sub ecx,ebx ;¢ ecx ª®««¨ç¥á⢮ â®ç¥ª «¨¨¨ ¢ë¢®¤¨¬ëå ¢ ¡ãä¥à |
1292 | sub ecx,ebx ;¢ ecx ª®««¨ç¥á⢮ â®ç¥ª «¨¨¨ ¢ë¢®¤¨¬ëå ¢ ¡ãä¥à |
1327 | inc ecx ;çâ®-¡ë ¯®á«¥¤ïï â®çª «¨¨¨ â ª¦¥ ®â®¡à ¦ « áì |
1293 | mov edx,dword[color] |
1328 | mov edx,dword[color] |
1294 | mov ebx,edx ;ª®®à¤¨ â x0 ¢ ebx 㦥 ¥ 㦠|
1329 | mov ebx,edx ;ª®®à¤¨ â x0 ¢ ebx 㦥 ¥ 㦠|
1295 | ror edx,16 ;¯®¢®à 稢 ¥¬ ॣ¨áâà çâ® ¡ë 3-© ¡ ©â ¯®¯ « ¢ dl |
1330 | ror edx,16 ;¯®¢®à 稢 ¥¬ ॣ¨áâà çâ® ¡ë 3-© ¡ ©â ¯®¯ « ¢ dl |
1296 | cld |
1331 | cld |
1297 | @@: ;横« ¯® ®á¨ x ®â x0 ¤® x1 |
1332 | @@: ;横« ¯® ®á¨ x ®â x0 ¤® x1 (¢ª«îç ï x1) |
1298 | mov word[eax],bx ;copy pixel color |
1333 | mov word[eax],bx ;copy pixel color |
1299 | mov byte[eax+2],dl |
1334 | mov byte[eax+2],dl |
1300 | add eax,3 |
1335 | add eax,3 |
- | 1336 | loop @b |
|
1301 | loop @b |
1337 | .end24: |
1302 | .end24: |
1338 | popfd |
1303 | popad |
1339 | popad |
Line 1304... | Line 1340... | ||
1304 | ret |
1340 | ret |
1305 | endp |
1341 | endp |
1306 | 1342 | ||
1307 | align 4 |
1343 | align 4 |
- | 1344 | proc buf_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
|
- | 1345 | pushad |
|
1308 | proc buf_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1346 | mov edi,[buf_struc] |
- | 1347 | cmp buf2d_bits,8 |
|
1309 | pushad |
1348 | je @f |
- | 1349 | cmp buf2d_bits,24 |
|
Line 1310... | Line 1350... | ||
1310 | mov edi,[buf_struc] |
1350 | je @f |
1311 | cmp buf2d_bits,24 |
1351 | jmp .coord_end |
1312 | jne .coord_end |
1352 | @@: |
1313 | 1353 | ||
1314 | mov eax,[coord_x] |
1354 | mov eax,[coord_x] |
- | 1355 | mov ebx,[coord_y] |
|
- | 1356 | mov ecx,[w] |
|
- | 1357 | ;cmp ecx,1 |
|
- | 1358 | ;jl .coord_end |
|
- | 1359 | cmp ecx,0 |
|
- | 1360 | je .coord_end |
|
- | 1361 | jg @f |
|
1315 | mov ebx,[coord_y] |
1362 | add eax,ecx |
1316 | mov ecx,[w] |
1363 | inc eax |
1317 | cmp ecx,1 |
1364 | neg ecx |
1318 | jl .coord_end |
1365 | @@: |
1319 | add ecx,eax |
1366 | add ecx,eax |
- | 1367 | dec ecx |
|
- | 1368 | mov edx,[h] |
|
- | 1369 | ;cmp edx,1 |
|
- | 1370 | ;jl .coord_end |
|
- | 1371 | cmp edx,0 |
|
- | 1372 | je .coord_end |
|
- | 1373 | jg @f |
|
Line 1320... | Line 1374... | ||
1320 | dec ecx |
1374 | add ebx,edx |
1321 | mov edx,[h] |
1375 | inc ebx |
1322 | cmp edx,1 |
1376 | neg edx |
1323 | jl .coord_end |
1377 | @@: |
Line 1336... | Line 1390... | ||
1336 | 1390 | ||
1337 | align 4 |
1391 | align 4 |
1338 | proc buf_filled_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1392 | proc buf_filled_rect_by_size, buf_struc:dword, coord_x:dword,coord_y:dword,w:dword,h:dword, color:dword |
1339 | pushad |
1393 | pushad |
- | 1394 | mov edi,[buf_struc] |
|
- | 1395 | cmp buf2d_bits,8 |
|
1340 | mov edi,[buf_struc] |
1396 | je @f |
- | 1397 | cmp buf2d_bits,24 |
|
1341 | cmp buf2d_bits,24 |
1398 | je @f |
- | 1399 | jmp .coord_end |
|
1342 | jne .coord_end |
1400 | @@: |
1343 | mov eax,[coord_x] |
1401 | mov eax,[coord_x] |
1344 | mov ebx,[coord_y] |
1402 | mov ebx,[coord_y] |
- | 1403 | mov edx,[w] |
|
- | 1404 | cmp edx,0 |
|
- | 1405 | je .coord_end ;¥á«¨ ¢ëá®â 0 ¯¨ªá¥«¥© |
|
- | 1406 | jg @f ;¥á«¨ ¢ëá®â ¯®«®¦¨â¥«ì ï |
|
- | 1407 | add eax,edx |
|
- | 1408 | inc eax |
|
- | 1409 | neg edx ;è¨à¨ã ¤¥« ¥¬ ¯®«®¦¨â¥«ì®© |
|
- | 1410 | ;inc edx ;¯®ç¥¬ã âãâ ¥ ¤®¡ ¢«ï¥¬ 1-æã ï ¥ § î, ® á ¥© à ¡®â ¥â ¥ ¯à ¢¨«ì® |
|
1345 | mov edx,[w] |
1411 | @@: |
- | 1412 | add edx,eax |
|
1346 | add edx,eax |
1413 | dec edx |
- | 1414 | mov ecx,[h] |
|
- | 1415 | cmp ecx,0 |
|
- | 1416 | je .coord_end ;¥á«¨ ¢ëá®â 0 ¯¨ªá¥«¥© |
|
1347 | mov ecx,[h] |
1417 | jg @f ;¥á«¨ ¢ëá®â ¯®«®¦¨â¥«ì ï |
- | 1418 | add ebx,ecx ;ᤢ¨£ ¥¬ ¢¥àåîî ª®®à¤¨ âã ¯àאַ㣮«ì¨ª |
|
1348 | cmp ecx,1 ;áà ¢¥¨¥ á ¬¨¨¬ «ì® ¢®§¬®¦®© ¢ëá®â®© |
1419 | inc ebx |
- | 1420 | neg ecx ;¢ëá®âã ¤¥« ¥¬ ¯®«®¦¨â¥«ì®© |
|
- | 1421 | ;inc ecx ;¯®ç¥¬ã âãâ ¥ ¤®¡ ¢«ï¥¬ 1-æã ï ¥ § î, ® á ¥© à ¡®â ¥â ¥ ¯à ¢¨«ì® |
|
1349 | jl .coord_end ;¥á«¨ ¢ëá®â ¬¥ìè¥ 1-£® ¯¨ªá¥«ï |
1422 | @@: |
1350 | mov esi,dword[color] |
1423 | mov esi,dword[color] |
1351 | cld |
1424 | cld |
1352 | @@: |
1425 | @@: |
1353 | stdcall buf_line_h, edi, eax, ebx, edx, esi ;«¨¨ï - |
1426 | stdcall buf_line_h, edi, eax, ebx, edx, esi ;«¨¨ï - |
Line 1364... | Line 1437... | ||
1364 | po_x dd ? |
1437 | po_x dd ? |
1365 | po_y dd ? |
1438 | po_y dd ? |
1366 | endl |
1439 | endl |
1367 | pushad |
1440 | pushad |
1368 | mov edi,dword[buf_struc] |
1441 | mov edi,dword[buf_struc] |
- | 1442 | cmp buf2d_bits,8 |
|
- | 1443 | je @f |
|
1369 | cmp buf2d_bits,24 |
1444 | cmp buf2d_bits,24 |
- | 1445 | je @f |
|
1370 | jne .error |
1446 | jmp .error |
- | 1447 | @@: |
|
1371 | mov edx,dword[color] |
1448 | mov edx,dword[color] |
Line 1372... | Line 1449... | ||
1372 | 1449 | ||
1373 | finit |
1450 | finit |
1374 | fild dword[coord_x] |
1451 | fild dword[coord_x] |
Line 1412... | Line 1489... | ||
1412 | dec esi |
1489 | dec esi |
1413 | cmp esi,0 |
1490 | cmp esi,0 |
1414 | jge @b |
1491 | jge @b |
1415 | jmp .exit_fun |
1492 | jmp .exit_fun |
1416 | .error: |
1493 | .error: |
1417 | stdcall print_err,sz_buf2d_circle,txt_err_n24b |
1494 | stdcall print_err,sz_buf2d_circle,txt_err_n8_24b |
1418 | .exit_fun: |
1495 | .exit_fun: |
Line 1419... | Line 1496... | ||
1419 | 1496 | ||
1420 | popad |
1497 | popad |
1421 | ret |
1498 | ret |
Line 1559... | Line 1636... | ||
1559 | ;äãªæ¨ï ¤«ï à¨á®¢ ¨ï â®çª¨ |
1636 | ;äãªæ¨ï ¤«ï à¨á®¢ ¨ï â®çª¨ |
1560 | align 4 |
1637 | align 4 |
1561 | proc buf_set_pixel, buf_struc:dword, coord_x:dword, coord_y:dword, color:dword |
1638 | proc buf_set_pixel, buf_struc:dword, coord_x:dword, coord_y:dword, color:dword |
1562 | pushad |
1639 | pushad |
1563 | mov edi,[buf_struc] |
1640 | mov edi,[buf_struc] |
- | 1641 | cmp buf2d_bits,8 |
|
- | 1642 | je @f |
|
1564 | cmp buf2d_bits,24 |
1643 | cmp buf2d_bits,24 |
- | 1644 | je @f |
|
1565 | jne .end24 |
1645 | jmp .end24 |
- | 1646 | @@: |
|
1566 | mov ebx,dword[coord_x] |
1647 | mov ebx,dword[coord_x] |
1567 | mov ecx,dword[coord_y] |
1648 | mov ecx,dword[coord_y] |
1568 | mov edx,dword[color] |
1649 | mov edx,dword[color] |
1569 | call draw_pixel |
1650 | call draw_pixel |
1570 | .end24: |
1651 | .end24: |
Line 2542... | Line 2623... | ||
2542 | ret |
2623 | ret |
2543 | endp |
2624 | endp |
Line 2544... | Line 2625... | ||
2544 | 2625 | ||
2545 | txt_err_n8b db 'need buffer 8 bit',13,10,0 |
2626 | txt_err_n8b db 'need buffer 8 bit',13,10,0 |
- | 2627 | txt_err_n24b db 'need buffer 24 bit',13,10,0 |
|
Line 2546... | Line 2628... | ||
2546 | txt_err_n24b db 'need buffer 24 bit',13,10,0 |
2628 | txt_err_n8_24b db 'need buffer 8 or 24 bit',13,10,0 |
2547 | 2629 | ||
2548 | align 16 |
2630 | align 16 |
2549 | EXPORTS: |
2631 | EXPORTS: |