Rev 3499 | Rev 6733 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3499 | Rev 3503 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;================================================================================================;; |
1 | ;;================================================================================================;; |
2 | ;;//// libimg.asm //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2012 ///////;; |
2 | ;;//// libimg.asm //// (c) mike.dld, 2007-2008, (c) diamond, 2009, (c) dunkaist, 2011-2013 ///////;; |
3 | ;;================================================================================================;; |
3 | ;;================================================================================================;; |
4 | ;; ;; |
4 | ;; ;; |
5 | ;; This file is part of Common development libraries (Libs-Dev). ;; |
5 | ;; This file is part of Common development libraries (Libs-Dev). ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;; |
7 | ;; Libs-Dev is free software: you can redistribute it and/or modify it under the terms of the GNU ;; |
Line 542... | Line 542... | ||
542 | @@: |
542 | @@: |
543 | ret |
543 | ret |
Line 544... | Line 544... | ||
544 | 544 | ||
545 | align 16 |
545 | align 16 |
546 | .bpp1: |
546 | .bpp1: |
- | 547 | push ebx ebp |
|
- | 548 | mov ebp, [esi + Image.Width] |
|
547 | push ebx edx |
549 | mov edx, [esi + Image.Height] |
548 | mov ebx, esi |
550 | shl edx, 16 |
549 | mov esi, [ebx + Image.Data] |
551 | mov ebx, [esi + Image.Palette] |
550 | mov ecx, [ebx + Image.Height] |
552 | mov esi, [esi + Image.Data] |
551 | .bpp1.pre: |
553 | .bpp1.pre: |
552 | mov edx, [ebx + Image.Width] |
554 | mov dx, bp |
553 | mov eax, 7 |
555 | mov ecx, 7 |
554 | .bpp1.begin: |
- | |
555 | push ecx esi |
556 | .bpp1.begin: |
556 | xor cx, cx |
557 | xor eax, eax |
557 | bt [esi], eax |
558 | bt [esi], ecx |
558 | setc cl |
559 | adc eax, 0 |
559 | mov esi, [ebx + Image.Palette] |
560 | mov eax, [ebx + eax*4] |
560 | jcxz @f |
561 | mov [edi], ax |
561 | add esi, 4 |
- | |
562 | @@: |
562 | shr eax, 16 |
563 | mov ecx, 3 |
- | |
564 | cld |
- | |
565 | rep movsb |
563 | mov [edi + 2], al |
566 | pop esi ecx |
564 | add edi, 3 |
567 | dec edx |
565 | dec dx |
568 | jz .bpp1.end_line |
566 | jz .bpp1.end_line |
569 | dec eax |
567 | dec ecx |
570 | jns .bpp1.begin |
568 | jns .bpp1.begin |
571 | mov eax, 7 |
569 | mov ecx, 7 |
572 | inc esi |
570 | inc esi |
573 | jmp .bpp1.begin |
- | |
574 | 571 | jmp .bpp1.begin |
|
575 | .bpp1.end_line: |
572 | .bpp1.end_line: |
576 | dec ecx |
573 | sub edx, 0x10000 |
577 | jz .bpp1.quit |
574 | jz .bpp1.quit |
578 | inc esi |
575 | inc esi |
579 | jmp .bpp1.pre |
- | |
580 | 576 | jmp .bpp1.pre |
|
- | 577 | .bpp1.quit: |
|
- | 578 | pop ebp ebx |
|
- | 579 | ret |
|
- | 580 | ||
- | 581 | align 16 |
|
- | 582 | .bpp2i: |
|
- | 583 | push ebx ebp |
|
- | 584 | mov ebp, [esi + Image.Width] |
|
- | 585 | mov edx, [esi + Image.Height] |
|
- | 586 | shl edx, 16 |
|
- | 587 | mov ebx, [esi + Image.Palette] |
|
- | 588 | mov esi, [esi + Image.Data] |
|
- | 589 | .bpp2i.pre: |
|
- | 590 | mov dx, bp |
|
- | 591 | mov ecx, 3 |
|
- | 592 | .bpp2i.begin: |
|
- | 593 | mov eax, 3 |
|
- | 594 | shl ecx, 1 |
|
- | 595 | shl eax, cl |
|
- | 596 | and al, [esi] |
|
- | 597 | shr eax, cl |
|
- | 598 | shr ecx, 1 |
|
- | 599 | mov eax, [ebx + eax*4] |
|
- | 600 | mov [edi], ax |
|
- | 601 | shr eax, 16 |
|
- | 602 | mov [edi + 2], al |
|
- | 603 | add edi, 3 |
|
- | 604 | dec dx |
|
- | 605 | jz .bpp2i.end_line |
|
- | 606 | dec ecx |
|
- | 607 | jns .bpp2i.begin |
|
- | 608 | mov ecx, 3 |
|
- | 609 | inc esi |
|
- | 610 | jmp .bpp2i.begin |
|
- | 611 | .bpp2i.end_line: |
|
- | 612 | sub edx, 0x10000 |
|
- | 613 | jz .bpp2i.quit |
|
- | 614 | inc esi |
|
- | 615 | jmp .bpp2i.pre |
|
- | 616 | .bpp2i.quit: |
|
- | 617 | pop ebp ebx |
|
- | 618 | ret |
|
- | 619 | ||
- | 620 | align 16 |
|
- | 621 | .bpp4i: |
|
- | 622 | push ebx ebp |
|
- | 623 | mov ebp, [esi + Image.Width] |
|
- | 624 | mov edx, [esi + Image.Height] |
|
- | 625 | shl edx, 16 |
|
- | 626 | mov ebx, [esi + Image.Palette] |
|
- | 627 | mov esi, [esi + Image.Data] |
|
- | 628 | .bpp4i.pre: |
|
- | 629 | mov dx, bp |
|
- | 630 | mov ecx, 1 |
|
- | 631 | .bpp4i.begin: |
|
- | 632 | mov eax, 15 |
|
- | 633 | shl ecx, 2 |
|
- | 634 | shl eax, cl |
|
- | 635 | and al, [esi] |
|
- | 636 | shr eax, cl |
|
- | 637 | shr ecx, 2 |
|
- | 638 | mov eax, [ebx + eax*4] |
|
- | 639 | mov [edi], ax |
|
- | 640 | shr eax, 16 |
|
- | 641 | mov [edi + 2], al |
|
- | 642 | add edi, 3 |
|
- | 643 | dec dx |
|
- | 644 | jz .bpp4i.end_line |
|
- | 645 | dec ecx |
|
- | 646 | jns .bpp4i.begin |
|
- | 647 | mov ecx, 1 |
|
- | 648 | inc esi |
|
- | 649 | jmp .bpp4i.begin |
|
- | 650 | .bpp4i.end_line: |
|
- | 651 | sub edx, 0x10000 |
|
- | 652 | jz .bpp4i.quit |
|
- | 653 | inc esi |
|
- | 654 | jmp .bpp4i.pre |
|
581 | .bpp1.quit: |
655 | .bpp4i.quit: |
582 | pop edx ebx |
656 | pop ebp ebx |
Line 583... | Line 657... | ||
583 | ret |
657 | ret |
Line 584... | Line 658... | ||
584 | 658 | ||
Line 1057... | Line 1131... | ||
1057 | dec ecx |
1131 | dec ecx |
1058 | jnz .next_line_horz24 |
1132 | jnz .next_line_horz24 |
1059 | jmp .exit |
1133 | jmp .exit |
Line 1060... | Line 1134... | ||
1060 | 1134 | ||
1061 | .bpp1_horz: |
- | |
1062 | push eax edx |
1135 | .bpp1_horz: |
1063 | mov edi, [scanline_len] |
1136 | mov edi, [scanline_len] |
1064 | mov edx, [ebx+Image.Width] |
1137 | mov edx, [ebx + Image.Width] |
1065 | and edx, 0x07 |
1138 | and edx, 7 |
1066 | neg dl |
1139 | neg edx |
1067 | add dl, 8 |
1140 | add edx, 8 |
1068 | and dl, 0x07 ; clear if cl=8 |
1141 | and edx, 7 |
1069 | .bpp1_horz.begin: |
1142 | .bpp1_horz.begin: |
1070 | push ebx ecx edx esi |
1143 | push ebx edx esi |
1071 | mov eax, 7 |
1144 | mov eax, 7 |
1072 | add edi, esi |
1145 | add edi, esi |
1073 | sub edi, 1 |
1146 | sub edi, 1 |
1074 | mov ebx, [ebx+Image.Width] |
1147 | mov ebx, [ebx + Image.Width] |
1075 | shr ebx, 1 |
1148 | shr ebx, 1 |
1076 | .bpp1_horz.flip_line: |
- | |
1077 | xor ecx, ecx |
- | |
1078 | bt [esi], eax |
- | |
1079 | setc cl |
1149 | .bpp1_horz.bit: |
1080 | bt [edi], edx |
1150 | bt [edi], edx |
1081 | jc .bpp1_horz.one |
- | |
1082 | .bpp1_horz.zero: |
1151 | jc @f |
1083 | btr [esi], eax |
- | |
1084 | jmp @f |
1152 | btr [esi], eax |
1085 | .bpp1_horz.one: |
- | |
1086 | bts [esi], eax |
1153 | jmp .bpp1_horz.right |
1087 | @@: |
1154 | @@: |
1088 | jecxz .bpp1_horz.reset |
1155 | bts [esi], eax |
- | 1156 | .bpp1_horz.right: |
|
1089 | .bpp1_horz.set: |
1157 | jnc @f |
1090 | bts [edi], edx |
- | |
1091 | jmp @f |
1158 | bts [edi], edx |
1092 | .bpp1_horz.reset: |
- | |
1093 | btr [edi], edx |
1159 | jmp .bpp1_horz.bit_done |
- | 1160 | @@: |
|
- | 1161 | btr [edi], edx |
|
1094 | @@: |
1162 | .bpp1_horz.bit_done: |
1095 | inc edx |
1163 | inc edx |
1096 | and edx, 0x07 |
1164 | and edx, 7 |
1097 | jnz @f |
1165 | jnz @f |
1098 | dec edi |
1166 | dec edi |
1099 | @@: |
1167 | @@: |
1100 | dec eax |
1168 | dec eax |
1101 | jns @f |
1169 | jns @f |
1102 | mov eax, 7 |
1170 | mov eax, 7 |
1103 | inc esi |
1171 | inc esi |
1104 | @@: |
1172 | @@: |
1105 | dec ebx |
1173 | dec ebx |
Line 1106... | Line 1174... | ||
1106 | jnz .bpp1_horz.flip_line |
1174 | jnz .bpp1_horz.bit |
1107 | 1175 | ||
1108 | pop esi edx ecx ebx |
1176 | pop esi edx ebx |
1109 | add esi, [scanline_len] |
1177 | add esi, [scanline_len] |
1110 | mov edi, [scanline_len] |
1178 | mov edi, [scanline_len] |
- | 1179 | dec ecx |
|
- | 1180 | jnz .bpp1_horz.begin |
|
- | 1181 | jmp .exit |
|
- | 1182 | ||
- | 1183 | ||
- | 1184 | .bpp2i_horz: |
|
- | 1185 | mov edi, [scanline_len] |
|
- | 1186 | mov edx, [ebx + Image.Width] |
|
- | 1187 | and edx, 3 |
|
- | 1188 | neg edx |
|
- | 1189 | add edx, 4 |
|
- | 1190 | and edx, 3 |
|
- | 1191 | .bpp2i_horz.begin: |
|
- | 1192 | push ebx edx esi |
|
- | 1193 | mov eax, 3 |
|
- | 1194 | add edi, esi |
|
- | 1195 | sub edi, 1 |
|
- | 1196 | mov ebx, [ebx + Image.Width] |
|
- | 1197 | shr ebx, 1 |
|
- | 1198 | .bpp2i_horz.pixel: |
|
- | 1199 | push ebx ecx |
|
- | 1200 | mov ebx, 3 |
|
- | 1201 | mov ecx, edx |
|
- | 1202 | shl ebx, cl |
|
- | 1203 | shl ebx, cl |
|
- | 1204 | and bl, [edi] |
|
- | 1205 | shr ebx, cl |
|
- | 1206 | shr ebx, cl |
|
- | 1207 | mov bh, 3 |
|
- | 1208 | mov ecx, eax |
|
- | 1209 | shl ebx, cl |
|
- | 1210 | shl ebx, cl |
|
- | 1211 | not bh |
|
- | 1212 | and bh, [esi] |
|
- | 1213 | or bl, bh |
|
- | 1214 | mov bh, [esi] |
|
- | 1215 | mov [esi], bl |
|
- | 1216 | shr ebx, 8 |
|
- | 1217 | shr ebx, cl |
|
- | 1218 | shr ebx, cl |
|
- | 1219 | and ebx, 3 |
|
- | 1220 | mov bh, 3 |
|
- | 1221 | mov ecx, edx |
|
- | 1222 | shl ebx, cl |
|
- | 1223 | shl ebx, cl |
|
- | 1224 | not bh |
|
- | 1225 | and bh, [edi] |
|
- | 1226 | or bl, bh |
|
- | 1227 | mov [edi], bl |
|
- | 1228 | pop ecx ebx |
|
- | 1229 | .bpp2i_horz.pixel_done: |
|
- | 1230 | inc edx |
|
- | 1231 | and edx, 3 |
|
- | 1232 | jnz @f |
|
- | 1233 | dec edi |
|
- | 1234 | @@: |
|
- | 1235 | dec eax |
|
- | 1236 | jns @f |
|
- | 1237 | mov eax, 3 |
|
- | 1238 | inc esi |
|
- | 1239 | @@: |
|
- | 1240 | dec ebx |
|
- | 1241 | jnz .bpp2i_horz.pixel |
|
- | 1242 | ||
- | 1243 | pop esi edx ebx |
|
- | 1244 | add esi, [scanline_len] |
|
- | 1245 | mov edi, [scanline_len] |
|
- | 1246 | dec ecx |
|
- | 1247 | jnz .bpp2i_horz.begin |
|
- | 1248 | jmp .exit |
|
- | 1249 | ||
- | 1250 | ||
- | 1251 | .bpp4i_horz: |
|
- | 1252 | mov edi, [scanline_len] |
|
- | 1253 | mov edx, [ebx + Image.Width] |
|
- | 1254 | and edx, 1 |
|
- | 1255 | neg edx |
|
- | 1256 | add edx, 2 |
|
- | 1257 | and edx, 1 |
|
- | 1258 | .bpp4i_horz.begin: |
|
- | 1259 | push ebx edx esi |
|
- | 1260 | mov eax, 1 |
|
- | 1261 | add edi, esi |
|
- | 1262 | sub edi, 1 |
|
- | 1263 | mov ebx, [ebx + Image.Width] |
|
- | 1264 | shr ebx, 1 |
|
- | 1265 | .bpp4i_horz.pixel: |
|
- | 1266 | push ebx ecx |
|
- | 1267 | mov ebx, 15 |
|
- | 1268 | mov ecx, edx |
|
- | 1269 | shl ecx, 2 |
|
- | 1270 | shl ebx, cl |
|
- | 1271 | and bl, [edi] |
|
- | 1272 | shr ebx, cl |
|
- | 1273 | mov bh, 15 |
|
- | 1274 | mov ecx, eax |
|
- | 1275 | shl ecx, 2 |
|
- | 1276 | shl ebx, cl |
|
- | 1277 | not bh |
|
- | 1278 | and bh, [esi] |
|
- | 1279 | or bl, bh |
|
- | 1280 | mov bh, [esi] |
|
- | 1281 | mov [esi], bl |
|
- | 1282 | shr ebx, 8 |
|
- | 1283 | shr ebx, cl |
|
- | 1284 | and ebx, 15 |
|
- | 1285 | mov bh, 15 |
|
- | 1286 | mov ecx, edx |
|
- | 1287 | shl ecx, 2 |
|
- | 1288 | shl ebx, cl |
|
- | 1289 | not bh |
|
- | 1290 | and bh, [edi] |
|
1111 | dec ecx |
1291 | or bl, bh |
- | 1292 | mov [edi], bl |
|
- | 1293 | pop ecx ebx |
|
- | 1294 | .bpp4i_horz.pixel_done: |
|
- | 1295 | inc edx |
|
- | 1296 | and edx, 1 |
|
- | 1297 | jnz @f |
|
- | 1298 | dec edi |
|
- | 1299 | @@: |
|
- | 1300 | dec eax |
|
- | 1301 | jns @f |
|
- | 1302 | mov eax, 1 |
|
- | 1303 | inc esi |
|
- | 1304 | @@: |
|
- | 1305 | dec ebx |
|
- | 1306 | jnz .bpp4i_horz.pixel |
|
- | 1307 | ||
- | 1308 | pop esi edx ebx |
|
- | 1309 | add esi, [scanline_len] |
|
- | 1310 | mov edi, [scanline_len] |
|
- | 1311 | dec ecx |
|
- | 1312 | jnz .bpp4i_horz.begin |
|
Line 1112... | Line 1313... | ||
1112 | jnz .bpp1_horz.begin |
1313 | jmp .exit |
1113 | pop edx eax |
1314 | |
1114 | 1315 | ||
1115 | .exit: |
1316 | .exit: |
Line 1210... | Line 1411... | ||
1210 | add eax, [ebx + Image.Data] |
1411 | add eax, [ebx + Image.Data] |
1211 | mov [pixels_ptr], eax |
1412 | mov [pixels_ptr], eax |
Line 1212... | Line 1413... | ||
1212 | 1413 | ||
1213 | cmp [ebx + Image.Type], Image.bpp1 |
1414 | cmp [ebx + Image.Type], Image.bpp1 |
- | 1415 | jz .rotate_ccw1 |
|
- | 1416 | cmp [ebx + Image.Type], Image.bpp2i |
|
- | 1417 | jz .rotate_ccw2i |
|
- | 1418 | cmp [ebx + Image.Type], Image.bpp4i |
|
1214 | jz .rotate_ccw1 |
1419 | jz .rotate_ccw4i |
1215 | cmp [ebx + Image.Type], Image.bpp8i |
1420 | cmp [ebx + Image.Type], Image.bpp8i |
1216 | jz .rotate_ccw8ig |
1421 | jz .rotate_ccw8ig |
1217 | cmp [ebx + Image.Type], Image.bpp8g |
1422 | cmp [ebx + Image.Type], Image.bpp8g |
1218 | jz .rotate_ccw8ig |
1423 | jz .rotate_ccw8ig |
Line 1410... | Line 1615... | ||
1410 | push ecx edx |
1615 | push ecx edx |
Line 1411... | Line 1616... | ||
1411 | 1616 | ||
1412 | mov eax, [ebx+Image.Height] |
1617 | mov eax, [ebx + Image.Height] |
1413 | add eax, 7 |
1618 | add eax, 7 |
1414 | shr eax, 3 |
1619 | shr eax, 3 |
1415 | mul word[ebx+Image.Width] |
- | |
1416 | shl eax, 16 |
- | |
1417 | shrd eax, edx, 16 |
1620 | imul eax, [ebx + Image.Width] |
Line 1418... | Line 1621... | ||
1418 | push eax ; save new data size |
1621 | push eax ; save new data size |
1419 | 1622 | ||
1420 | invoke mem.alloc, eax |
1623 | invoke mem.alloc, eax |
1421 | or eax, eax |
1624 | or eax, eax |
Line 1422... | Line 1625... | ||
1422 | jz .error |
1625 | jz .error |
1423 | push eax ; save pointer to new data |
1626 | push eax ; save pointer to new data |
1424 | 1627 | ||
1425 | mov ecx, [ebx+Image.Width] |
1628 | mov ecx, [ebx + Image.Width] |
1426 | and ecx, 0x07 |
1629 | and ecx, 7 |
Line 1427... | Line 1630... | ||
1427 | neg cl |
1630 | neg ecx |
1428 | add cl, 8 |
1631 | add ecx, 8 |
1429 | and cl, 0x07 ; clear if cl=8 |
1632 | and ecx, 7 |
1430 | 1633 | ||
1431 | mov esi, eax |
1634 | mov edi, eax |
1432 | mov edi, [ebx+Image.Data] |
1635 | mov esi, [ebx + Image.Data] |
Line 1433... | Line 1636... | ||
1433 | mov eax, 7 |
1636 | mov eax, 7 |
1434 | mov edx, [scanline_len_old] |
1637 | mov edx, [scanline_len_old] |
1435 | dec edx |
1638 | dec edx |
1436 | add edi, edx |
1639 | add esi, edx |
1437 | 1640 | ||
1438 | .rotate_ccw1.begin: |
1641 | .rotate_ccw1.begin: |
1439 | bt [edi], ecx |
1642 | bt [esi], ecx |
1440 | jc .rotate_ccw1.one |
1643 | jc .rotate_ccw1.one |
1441 | .rotate_ccw1.zero: |
1644 | .rotate_ccw1.zero: |
1442 | btr [esi], eax |
1645 | btr [edi], eax |
1443 | jmp @f |
1646 | jmp @f |
1444 | .rotate_ccw1.one: |
1647 | .rotate_ccw1.one: |
1445 | bts [esi], eax |
1648 | bts [edi], eax |
1446 | @@: |
- | |
1447 | add edi, [scanline_len_old] |
1649 | @@: |
1448 | dec [scanline_pixels_new] |
1650 | add esi, [scanline_len_old] |
1449 | jz .rotate_ccw1.end_of_line |
1651 | dec [scanline_pixels_new] |
1450 | dec eax |
- | |
1451 | jns .rotate_ccw1.begin |
1652 | jz .rotate_ccw1.end_of_line |
1452 | mov eax, 7 |
1653 | sub eax, 1 |
- | 1654 | adc edi, 0 |
|
- | 1655 | and eax, 7 |
|
1453 | inc esi |
1656 | jmp .rotate_ccw1.begin |
1454 | jmp .rotate_ccw1.begin |
- | |
1455 | - | ||
1456 | .rotate_ccw1.end_of_line: |
1657 | .rotate_ccw1.end_of_line: |
1457 | inc esi |
1658 | inc edi |
1458 | mov eax, 7 |
1659 | mov eax, [ebx + Image.Height] |
1459 | mov edi, [ebx+Image.Height] |
1660 | mov [scanline_pixels_new], eax |
1460 | mov [scanline_pixels_new], edi |
1661 | mov eax, 7 |
1461 | inc ecx |
1662 | inc ecx |
1462 | and cl, 0x07 |
1663 | and ecx, 7 |
1463 | jz @f |
1664 | jz @f |
1464 | mov edi, [ebx+Image.Data] |
1665 | mov esi, [ebx + Image.Data] |
1465 | add edi, edx |
1666 | add esi, edx |
1466 | jmp .rotate_ccw1.begin |
1667 | jmp .rotate_ccw1.begin |
1467 | @@: |
1668 | @@: |
1468 | dec edx |
- | |
1469 | js .rotate_ccw1.quit |
1669 | dec edx |
1470 | mov edi, [ebx+Image.Data] |
1670 | js .rotate_ccw1.quit |
1471 | add edi, edx |
- | |
1472 | jmp .rotate_ccw1.begin |
1671 | mov esi, [ebx + Image.Data] |
1473 | 1672 | add esi, edx |
|
1474 | .rotate_ccw1.quit: |
1673 | jmp .rotate_ccw1.begin |
- | 1674 | .rotate_ccw1.quit: |
|
- | 1675 | pop esi ; get pointer to new data |
|
- | 1676 | mov edi, [ebx + Image.Data] |
|
Line 1475... | Line -... | ||
1475 | pop eax ; get pointer to new data |
- | |
Line -... | Line 1677... | ||
- | 1677 | pop ecx ; get new data size |
|
- | 1678 | rep movsb |
|
- | 1679 | invoke mem.free, esi |
|
- | 1680 | pop edx ecx |
|
- | 1681 | jmp .exchange_dims |
|
- | 1682 | ||
- | 1683 | ||
- | 1684 | .rotate_ccw2i: |
|
- | 1685 | push ecx edx |
|
- | 1686 | ||
- | 1687 | mov eax, [ebx + Image.Height] |
|
- | 1688 | add eax, 3 |
|
- | 1689 | shr eax, 2 |
|
- | 1690 | imul eax, [ebx + Image.Width] |
|
- | 1691 | push eax ; save new data size |
|
- | 1692 | ||
- | 1693 | invoke mem.alloc, eax |
|
- | 1694 | or eax, eax |
|
- | 1695 | jz .error |
|
- | 1696 | push eax ; save pointer to new data |
|
- | 1697 | ||
- | 1698 | mov ecx, [ebx + Image.Width] |
|
- | 1699 | and ecx, 3 |
|
- | 1700 | neg ecx |
|
- | 1701 | add ecx, 4 |
|
- | 1702 | and ecx, 3 |
|
- | 1703 | ||
- | 1704 | mov edi, eax |
|
- | 1705 | mov esi, [ebx + Image.Data] |
|
- | 1706 | mov eax, 3 |
|
- | 1707 | mov edx, [scanline_len_old] |
|
- | 1708 | dec edx |
|
- | 1709 | add esi, edx |
|
- | 1710 | ||
- | 1711 | .rotate_ccw2i.begin: |
|
- | 1712 | push ebx ecx |
|
- | 1713 | mov ebx, 3 |
|
- | 1714 | shl ebx, cl |
|
- | 1715 | shl ebx, cl |
|
- | 1716 | and bl, [esi] |
|
- | 1717 | shr ebx, cl |
|
- | 1718 | shr ebx, cl |
|
- | 1719 | mov bh, 3 |
|
- | 1720 | mov ecx, eax |
|
- | 1721 | shl ebx, cl |
|
- | 1722 | shl ebx, cl |
|
- | 1723 | not bh |
|
- | 1724 | and bh, [edi] |
|
- | 1725 | or bl, bh |
|
- | 1726 | mov [edi], bl |
|
- | 1727 | pop ecx ebx |
|
- | 1728 | ||
- | 1729 | add esi, [scanline_len_old] |
|
- | 1730 | dec [scanline_pixels_new] |
|
- | 1731 | jz .rotate_ccw2i.end_of_line |
|
- | 1732 | sub eax, 1 |
|
- | 1733 | adc edi, 0 |
|
- | 1734 | and eax, 3 |
|
- | 1735 | jmp .rotate_ccw2i.begin |
|
- | 1736 | .rotate_ccw2i.end_of_line: |
|
- | 1737 | inc edi |
|
- | 1738 | mov eax, 3 |
|
- | 1739 | mov esi, [ebx + Image.Height] |
|
- | 1740 | mov [scanline_pixels_new], esi |
|
- | 1741 | inc ecx |
|
- | 1742 | and ecx, 3 |
|
- | 1743 | jz @f |
|
- | 1744 | mov esi, [ebx + Image.Data] |
|
- | 1745 | add esi, edx |
|
- | 1746 | jmp .rotate_ccw2i.begin |
|
- | 1747 | @@: |
|
- | 1748 | dec edx |
|
- | 1749 | js .rotate_ccw2i.quit |
|
- | 1750 | mov esi, [ebx + Image.Data] |
|
- | 1751 | add esi, edx |
|
- | 1752 | jmp .rotate_ccw2i.begin |
|
- | 1753 | .rotate_ccw2i.quit: |
|
- | 1754 | pop esi ; get pointer to new data |
|
- | 1755 | mov edi, [ebx + Image.Data] |
|
- | 1756 | pop ecx ; get new data size |
|
- | 1757 | rep movsb |
|
- | 1758 | invoke mem.free, esi |
|
- | 1759 | pop edx ecx |
|
- | 1760 | jmp .exchange_dims |
|
- | 1761 | ||
- | 1762 | ||
- | 1763 | .rotate_ccw4i: |
|
- | 1764 | push ecx edx |
|
- | 1765 | ||
- | 1766 | mov eax, [ebx + Image.Height] |
|
- | 1767 | add eax, 1 |
|
- | 1768 | shr eax, 1 |
|
- | 1769 | imul eax, [ebx + Image.Width] |
|
- | 1770 | push eax ; save new data size |
|
- | 1771 | ||
- | 1772 | invoke mem.alloc, eax |
|
- | 1773 | or eax, eax |
|
- | 1774 | jz .error |
|
- | 1775 | push eax ; save pointer to new data |
|
- | 1776 | ||
- | 1777 | mov ecx, [ebx + Image.Width] |
|
- | 1778 | and ecx, 1 |
|
- | 1779 | neg ecx |
|
- | 1780 | add ecx, 2 |
|
- | 1781 | and ecx, 1 |
|
- | 1782 | ||
- | 1783 | mov edi, eax |
|
- | 1784 | mov esi, [ebx + Image.Data] |
|
- | 1785 | mov eax, 1 |
|
- | 1786 | mov edx, [scanline_len_old] |
|
- | 1787 | dec edx |
|
- | 1788 | add esi, edx |
|
- | 1789 | ||
- | 1790 | .rotate_ccw4i.begin: |
|
- | 1791 | push ebx ecx |
|
- | 1792 | mov ebx, 15 |
|
- | 1793 | shl ecx, 2 |
|
- | 1794 | shl ebx, cl |
|
- | 1795 | and bl, [esi] |
|
- | 1796 | shr ebx, cl |
|
- | 1797 | mov bh, 15 |
|
- | 1798 | mov ecx, eax |
|
- | 1799 | shl ecx, 2 |
|
- | 1800 | shl ebx, cl |
|
- | 1801 | not bh |
|
- | 1802 | and bh, [edi] |
|
- | 1803 | or bl, bh |
|
- | 1804 | mov [edi], bl |
|
- | 1805 | pop ecx ebx |
|
- | 1806 | ||
- | 1807 | add esi, [scanline_len_old] |
|
- | 1808 | dec [scanline_pixels_new] |
|
- | 1809 | jz .rotate_ccw4i.end_of_line |
|
- | 1810 | sub eax, 1 |
|
- | 1811 | adc edi, 0 |
|
- | 1812 | and eax, 1 |
|
- | 1813 | jmp .rotate_ccw4i.begin |
|
- | 1814 | .rotate_ccw4i.end_of_line: |
|
- | 1815 | inc edi |
|
- | 1816 | mov eax, 1 |
|
- | 1817 | mov esi, [ebx + Image.Height] |
|
- | 1818 | mov [scanline_pixels_new], esi |
|
- | 1819 | inc ecx |
|
- | 1820 | and ecx, 1 |
|
- | 1821 | jz @f |
|
- | 1822 | mov esi, [ebx + Image.Data] |
|
- | 1823 | add esi, edx |
|
- | 1824 | jmp .rotate_ccw4i.begin |
|
- | 1825 | @@: |
|
- | 1826 | dec edx |
|
- | 1827 | js .rotate_ccw4i.quit |
|
- | 1828 | mov esi, [ebx + Image.Data] |
|
- | 1829 | add esi, edx |
|
1476 | mov esi, eax |
1830 | jmp .rotate_ccw4i.begin |
1477 | mov edi, [ebx + Image.Data] |
1831 | .rotate_ccw4i.quit: |
Line -... | Line 1832... | ||
- | 1832 | pop esi ; get pointer to new data |
|
- | 1833 | mov edi, [ebx + Image.Data] |
|
1478 | pop ecx ; get new data size |
1834 | pop ecx ; get new data size |
1479 | rep movsb |
1835 | rep movsb |
1480 | 1836 | invoke mem.free, esi |
|
1481 | invoke mem.free, eax |
1837 | pop edx ecx |
1482 | 1838 | jmp .exchange_dims |
|
Line 1504... | Line 1860... | ||
1504 | add eax, [ebx + Image.Data] |
1860 | add eax, [ebx + Image.Data] |
1505 | mov [pixels_ptr], eax |
1861 | mov [pixels_ptr], eax |
Line 1506... | Line 1862... | ||
1506 | 1862 | ||
1507 | cmp [ebx + Image.Type], Image.bpp1 |
1863 | cmp [ebx + Image.Type], Image.bpp1 |
- | 1864 | jz .rotate_cw1 |
|
- | 1865 | cmp [ebx + Image.Type], Image.bpp2i |
|
- | 1866 | jz .rotate_cw2i |
|
- | 1867 | cmp [ebx + Image.Type], Image.bpp4i |
|
1508 | jz .rotate_cw1 |
1868 | jz .rotate_cw4i |
1509 | cmp [ebx + Image.Type], Image.bpp8i |
1869 | cmp [ebx + Image.Type], Image.bpp8i |
1510 | jz .rotate_cw8ig |
1870 | jz .rotate_cw8ig |
1511 | cmp [ebx + Image.Type], Image.bpp8g |
1871 | cmp [ebx + Image.Type], Image.bpp8g |
1512 | jz .rotate_cw8ig |
1872 | jz .rotate_cw8ig |
Line 1708... | Line 2068... | ||
1708 | rep movsb |
2068 | rep movsb |
Line 1709... | Line 2069... | ||
1709 | 2069 | ||
1710 | pop ecx |
2070 | pop ecx |
Line -... | Line 2071... | ||
- | 2071 | jmp .next_column_cw_low24 |
|
1711 | jmp .next_column_cw_low24 |
2072 | |
1712 | 2073 | ||
Line 1713... | Line 2074... | ||
1713 | .rotate_cw1: |
2074 | .rotate_cw1: |
1714 | push ecx edx |
2075 | push ecx edx |
1715 | 2076 | ||
1716 | mov eax, [ebx+Image.Height] |
2077 | mov eax, [ebx + Image.Height] |
1717 | add eax, 7 |
- | |
1718 | shr eax, 3 |
- | |
1719 | mul word[ebx+Image.Width] |
- | |
1720 | shl eax, 16 |
2078 | add eax, 7 |
Line 1721... | Line 2079... | ||
1721 | shrd eax, edx, 16 |
2079 | shr eax, 3 |
1722 | 2080 | imul [ebx + Image.Width] |
|
1723 | push eax ; save new data size |
2081 | push eax ; save new data size |
1724 | 2082 | ||
Line 1725... | Line -... | ||
1725 | invoke mem.alloc, eax |
- | |
1726 | or eax, eax |
- | |
1727 | jz .error |
- | |
1728 | push eax ; save pointer to new data |
- | |
1729 | 2083 | invoke mem.alloc, eax |
|
1730 | mov ecx, 7 |
2084 | or eax, eax |
1731 | 2085 | jz .error |
|
1732 | mov edx, [ebx+Image.Width] |
2086 | push eax ; save pointer to new data |
1733 | mov [pixels_ptr], edx ; we don't use pixels_ptr as it do other procedures, we save there [ebx+Image.Width] |
2087 | |
1734 | mov esi, eax |
2088 | mov edi, eax |
1735 | mov edi, [ebx+Image.Data] |
2089 | mov esi, [ebx + Image.Data] |
- | 2090 | mov eax, [ebx + Image.Height] |
|
1736 | mov eax, [ebx+Image.Height] |
2091 | dec eax |
Line 1737... | Line 2092... | ||
1737 | dec eax |
2092 | imul eax, [scanline_len_old] |
1738 | mul [scanline_len_old] |
2093 | add esi, eax |
1739 | add edi, eax |
2094 | mov eax, 7 |
1740 | mov eax, 7 |
2095 | mov ecx, 7 |
1741 | mov edx, 0 |
2096 | mov edx, 0 |
1742 | 2097 | ||
1743 | .rotate_cw1.begin: |
2098 | .rotate_cw1.begin: |
1744 | bt [edi], ecx |
2099 | bt [esi], ecx |
1745 | jc .rotate_cw1.one |
2100 | jc .rotate_cw1.one |
1746 | .rotate_cw1.zero: |
2101 | .rotate_cw1.zero: |
1747 | btr [esi], eax |
2102 | btr [edi], eax |
1748 | jmp @f |
2103 | jmp @f |
1749 | .rotate_cw1.one: |
2104 | .rotate_cw1.one: |
1750 | bts [esi], eax |
- | |
1751 | @@: |
2105 | bts [edi], eax |
1752 | sub edi, [scanline_len_old] |
2106 | @@: |
1753 | dec [scanline_pixels_new] |
2107 | sub esi, [scanline_len_old] |
1754 | jz .rotate_cw1.end_of_line |
- | |
1755 | dec eax |
2108 | dec [scanline_pixels_new] |
1756 | jns .rotate_cw1.begin |
- | |
1757 | mov eax, 7 |
- | |
1758 | inc esi |
2109 | jz .rotate_cw1.end_of_line |
1759 | jmp .rotate_cw1.begin |
2110 | sub eax, 1 |
1760 | 2111 | adc edi, 0 |
|
1761 | .rotate_cw1.end_of_line: |
2112 | and eax, 7 |
1762 | dec [pixels_ptr] |
2113 | jmp .rotate_cw1.begin |
1763 | jz .rotate_cw1.quit |
2114 | .rotate_cw1.end_of_line: |
1764 | inc esi |
- | |
1765 | mov eax, [ebx+Image.Height] |
- | |
1766 | mov [scanline_pixels_new], eax |
- | |
1767 | mov eax, 7 |
- | |
1768 | dec ecx |
- | |
1769 | js @f |
- | |
1770 | mov edi, [ebx+Image.Height] |
- | |
1771 | dec edi |
2115 | inc edi |
1772 | imul edi, [scanline_len_old] |
2116 | mov eax, [ebx + Image.Height] |
1773 | add edi, [ebx+Image.Data] |
2117 | mov [scanline_pixels_new], eax |
1774 | add edi, edx |
2118 | mov eax, 7 |
- | 2119 | dec ecx |
|
1775 | jmp .rotate_cw1.begin |
2120 | jns @f |
1776 | @@: |
2121 | mov ecx, 7 |
1777 | mov ecx, 7 |
2122 | inc edx |
1778 | inc edx |
2123 | cmp edx, [scanline_len_old] |
1779 | cmp edx, [scanline_len_old] |
2124 | je .rotate_cw1.quit |
1780 | je .rotate_cw1.quit |
2125 | @@: |
1781 | mov edi, [ebx+Image.Height] |
- | |
1782 | dec edi |
2126 | mov esi, [ebx + Image.Height] |
1783 | imul edi, [scanline_len_old] |
2127 | dec esi |
1784 | add edi, [ebx+Image.Data] |
2128 | imul esi, [scanline_len_old] |
1785 | add edi, edx |
2129 | add esi, [ebx + Image.Data] |
1786 | jmp .rotate_cw1.begin |
2130 | add esi, edx |
1787 | 2131 | jmp .rotate_cw1.begin |
|
- | 2132 | .rotate_cw1.quit: |
|
- | 2133 | pop eax ; get pointer to new data |
|
- | 2134 | mov esi, eax |
|
- | 2135 | mov edi, [ebx + Image.Data] |
|
- | 2136 | pop ecx ; get new data size |
|
- | 2137 | rep movsb |
|
- | 2138 | invoke mem.free, eax |
|
- | 2139 | pop edx ecx |
|
- | 2140 | jmp .exchange_dims |
|
- | 2141 | ||
- | 2142 | ||
- | 2143 | .rotate_cw2i: |
|
- | 2144 | push ecx edx |
|
- | 2145 | ||
- | 2146 | mov eax, [ebx + Image.Height] |
|
- | 2147 | add eax, 3 |
|
- | 2148 | shr eax, 2 |
|
- | 2149 | imul [ebx + Image.Width] |
|
- | 2150 | push eax ; save new data size |
|
- | 2151 | ||
- | 2152 | invoke mem.alloc, eax |
|
- | 2153 | or eax, eax |
|
- | 2154 | jz .error |
|
- | 2155 | push eax ; save pointer to new data |
|
- | 2156 | ||
- | 2157 | mov edi, eax |
|
- | 2158 | mov esi, [ebx + Image.Data] |
|
- | 2159 | mov eax, [ebx + Image.Height] |
|
Line -... | Line 2160... | ||
- | 2160 | dec eax |
|
- | 2161 | imul eax, [scanline_len_old] |
|
- | 2162 | add esi, eax |
|
- | 2163 | mov eax, 3 |
|
- | 2164 | mov ecx, 3 |
|
- | 2165 | mov edx, 0 |
|
- | 2166 | ||
- | 2167 | .rotate_cw2i.begin: |
|
- | 2168 | push ebx ecx |
|
- | 2169 | mov ebx, 3 |
|
- | 2170 | shl ebx, cl |
|
- | 2171 | shl ebx, cl |
|
- | 2172 | and bl, [esi] |
|
- | 2173 | shr ebx, cl |
|
- | 2174 | shr ebx, cl |
|
- | 2175 | mov bh, 3 |
|
- | 2176 | mov ecx, eax |
|
- | 2177 | shl ebx, cl |
|
- | 2178 | shl ebx, cl |
|
- | 2179 | not bh |
|
- | 2180 | and bh, [edi] |
|
- | 2181 | or bl, bh |
|
- | 2182 | mov [edi], bl |
|
- | 2183 | pop ecx ebx |
|
- | 2184 | ||
- | 2185 | sub esi, [scanline_len_old] |
|
- | 2186 | dec [scanline_pixels_new] |
|
- | 2187 | jz .rotate_cw2i.end_of_line |
|
- | 2188 | sub eax, 1 |
|
- | 2189 | adc edi, 0 |
|
- | 2190 | and eax, 3 |
|
- | 2191 | jmp .rotate_cw2i.begin |
|
- | 2192 | .rotate_cw2i.end_of_line: |
|
- | 2193 | inc edi |
|
- | 2194 | mov eax, [ebx + Image.Height] |
|
- | 2195 | mov [scanline_pixels_new], eax |
|
- | 2196 | mov eax, 3 |
|
- | 2197 | dec ecx |
|
- | 2198 | jns @f |
|
- | 2199 | mov ecx, 3 |
|
- | 2200 | inc edx |
|
- | 2201 | cmp edx, [scanline_len_old] |
|
- | 2202 | je .rotate_cw2i.quit |
|
- | 2203 | @@: |
|
- | 2204 | mov esi, [ebx + Image.Height] |
|
- | 2205 | dec esi |
|
- | 2206 | imul esi, [scanline_len_old] |
|
- | 2207 | add esi, [ebx + Image.Data] |
|
- | 2208 | add esi, edx |
|
1788 | .rotate_cw1.quit: |
2209 | jmp .rotate_cw2i.begin |
- | 2210 | .rotate_cw2i.quit: |
|
- | 2211 | pop eax ; get pointer to new data |
|
- | 2212 | mov esi, eax |
|
- | 2213 | mov edi, [ebx + Image.Data] |
|
- | 2214 | pop ecx ; get new data size |
|
- | 2215 | rep movsb |
|
Line -... | Line 2216... | ||
- | 2216 | invoke mem.free, eax |
|
- | 2217 | pop edx ecx |
|
- | 2218 | jmp .exchange_dims |
|
- | 2219 | ||
- | 2220 | ||
- | 2221 | .rotate_cw4i: |
|
- | 2222 | push ecx edx |
|
- | 2223 | ||
- | 2224 | mov eax, [ebx + Image.Height] |
|
- | 2225 | add eax, 1 |
|
- | 2226 | shr eax, 1 |
|
- | 2227 | imul [ebx + Image.Width] |
|
- | 2228 | push eax ; save new data size |
|
- | 2229 | ||
- | 2230 | invoke mem.alloc, eax |
|
- | 2231 | or eax, eax |
|
- | 2232 | jz .error |
|
- | 2233 | push eax ; save pointer to new data |
|
- | 2234 | ||
- | 2235 | mov edi, eax |
|
- | 2236 | mov esi, [ebx + Image.Data] |
|
- | 2237 | mov eax, [ebx + Image.Height] |
|
- | 2238 | dec eax |
|
- | 2239 | imul eax, [scanline_len_old] |
|
- | 2240 | add esi, eax |
|
- | 2241 | mov eax, 1 |
|
- | 2242 | mov ecx, 1 |
|
- | 2243 | mov edx, 0 |
|
- | 2244 | ||
- | 2245 | .rotate_cw4i.begin: |
|
- | 2246 | push ebx ecx |
|
- | 2247 | mov ebx, 15 |
|
- | 2248 | shl ecx, 2 |
|
- | 2249 | shl ebx, cl |
|
- | 2250 | and bl, [esi] |
|
- | 2251 | shr ebx, cl |
|
- | 2252 | mov bh, 15 |
|
- | 2253 | mov ecx, eax |
|
- | 2254 | shl ecx, 2 |
|
- | 2255 | shl ebx, cl |
|
- | 2256 | not bh |
|
- | 2257 | and bh, [edi] |
|
- | 2258 | or bl, bh |
|
- | 2259 | mov [edi], bl |
|
- | 2260 | pop ecx ebx |
|
- | 2261 | ||
- | 2262 | sub esi, [scanline_len_old] |
|
- | 2263 | dec [scanline_pixels_new] |
|
- | 2264 | jz .rotate_cw4i.end_of_line |
|
- | 2265 | sub eax, 1 |
|
- | 2266 | adc edi, 0 |
|
- | 2267 | and eax, 1 |
|
- | 2268 | jmp .rotate_cw4i.begin |
|
- | 2269 | .rotate_cw4i.end_of_line: |
|
- | 2270 | inc edi |
|
- | 2271 | mov eax, [ebx + Image.Height] |
|
- | 2272 | mov [scanline_pixels_new], eax |
|
- | 2273 | mov eax, 1 |
|
- | 2274 | dec ecx |
|
- | 2275 | jns @f |
|
- | 2276 | mov ecx, 1 |
|
- | 2277 | inc edx |
|
- | 2278 | cmp edx, [scanline_len_old] |
|
- | 2279 | je .rotate_cw4i.quit |
|
- | 2280 | @@: |
|
- | 2281 | mov esi, [ebx + Image.Height] |
|
- | 2282 | dec esi |
|
- | 2283 | imul esi, [scanline_len_old] |
|
- | 2284 | add esi, [ebx + Image.Data] |
|
- | 2285 | add esi, edx |
|
1789 | pop eax ; get pointer to new data |
2286 | jmp .rotate_cw4i.begin |
1790 | mov esi, eax |
2287 | .rotate_cw4i.quit: |
Line -... | Line 2288... | ||
- | 2288 | pop eax ; get pointer to new data |
|
1791 | mov edi, [ebx + Image.Data] |
2289 | mov esi, eax |
1792 | pop ecx ; get new data size |
2290 | mov edi, [ebx + Image.Data] |
Line 1793... | Line 2291... | ||
1793 | rep movsb |
2291 | pop ecx ; get new data size |
1794 | 2292 | rep movsb |
|
Line 2031... | Line 2529... | ||
2031 | cmp word [_height+2], 0 |
2529 | cmp word [_height+2], 0 |
2032 | jnz .error |
2530 | jnz .error |
2033 | imul eax, [_width] |
2531 | imul eax, [_width] |
2034 | test eax, eax |
2532 | test eax, eax |
2035 | jz .error |
2533 | jz .error |
2036 | ; do not allow images which require too many memory |
- | |
2037 | cmp eax, 4000000h |
- | |
2038 | jae .error |
- | |
2039 | cmp [ebx + Image.Type], Image.bpp1 |
2534 | cmp [ebx + Image.Type], Image.bpp1 |
2040 | jz .bpp1 |
2535 | jz .bpp1 |
- | 2536 | cmp [ebx + Image.Type], Image.bpp2i |
|
- | 2537 | jz .bpp2i |
|
- | 2538 | cmp [ebx + Image.Type], Image.bpp4i |
|
- | 2539 | jz .bpp4i |
|
2041 | cmp [ebx + Image.Type], Image.bpp8i |
2540 | cmp [ebx + Image.Type], Image.bpp8i |
2042 | jz .bpp8i |
2541 | jz .bpp8i |
2043 | cmp [ebx + Image.Type], Image.bpp8g |
2542 | cmp [ebx + Image.Type], Image.bpp8g |
2044 | jz .bpp8g |
2543 | jz .bpp8g |
2045 | cmp [ebx + Image.Type], Image.bpp8a |
2544 | cmp [ebx + Image.Type], Image.bpp8a |
Line 2057... | Line 2556... | ||
2057 | .bpp8g: |
2556 | .bpp8g: |
2058 | jmp @f |
2557 | jmp @f |
2059 | .bpp8a: |
2558 | .bpp8a: |
2060 | shl eax, 1 |
2559 | shl eax, 1 |
2061 | jmp @f |
2560 | jmp @f |
- | 2561 | .bpp4i: |
|
- | 2562 | mov eax, [_width] |
|
- | 2563 | add eax, 1 |
|
- | 2564 | shr eax, 1 |
|
- | 2565 | imul eax, [_height] |
|
- | 2566 | mov ecx, eax |
|
- | 2567 | mov eax, [_height] |
|
- | 2568 | add eax, 1 |
|
- | 2569 | shr eax, 1 |
|
- | 2570 | imul eax, [_width] |
|
- | 2571 | cmp eax, ecx |
|
- | 2572 | jge .bpp4i.skip |
|
- | 2573 | mov eax, ecx |
|
- | 2574 | .bpp4i.skip: |
|
- | 2575 | add eax, 16*4 ; for palette |
|
- | 2576 | jmp @f |
|
- | 2577 | .bpp2i: |
|
- | 2578 | mov eax, [_width] |
|
- | 2579 | add eax, 3 |
|
- | 2580 | shr eax, 2 |
|
- | 2581 | imul eax, [_height] |
|
- | 2582 | mov ecx, eax |
|
- | 2583 | mov eax, [_height] |
|
- | 2584 | add eax, 3 |
|
- | 2585 | shr eax, 2 |
|
- | 2586 | imul eax, [_width] |
|
- | 2587 | cmp eax, ecx |
|
- | 2588 | jge .bpp2i.skip |
|
- | 2589 | mov eax, ecx |
|
- | 2590 | .bpp2i.skip: |
|
- | 2591 | add eax, 4*4 ; for palette |
|
- | 2592 | jmp @f |
|
2062 | .bpp1: |
2593 | .bpp1: |
2063 | mov eax, [_width] |
2594 | mov eax, [_width] |
2064 | add eax, 7 |
2595 | add eax, 7 |
2065 | shr eax, 3 |
2596 | shr eax, 3 |
2066 | mul word[_height] |
2597 | imul eax, [_height] |
2067 | shl eax, 16 |
- | |
2068 | mov ax, dx |
- | |
2069 | ror eax, 16 |
- | |
2070 | - | ||
2071 | push ebx |
- | |
2072 | mov ebx, eax |
2598 | mov ecx, eax |
2073 | - | ||
2074 | mov eax, [_height] |
2599 | mov eax, [_height] |
2075 | add eax, 7 |
2600 | add eax, 7 |
2076 | shr eax, 3 |
2601 | shr eax, 3 |
2077 | mul word[_width] |
2602 | imul eax, [_width] |
2078 | shl eax, 16 |
- | |
2079 | mov ax, dx |
- | |
2080 | ror eax, 16 |
- | |
2081 | - | ||
2082 | cmp eax, ebx |
2603 | cmp eax, ecx |
2083 | jge .bpp1.skip |
2604 | jge .bpp1.skip |
2084 | mov eax, ebx |
2605 | mov eax, ecx |
2085 | .bpp1.skip: |
2606 | .bpp1.skip: |
2086 | pop ebx |
- | |
Line 2087... | Line 2607... | ||
2087 | 2607 | ||
2088 | add eax, 2*4 ; for palette |
2608 | add eax, 2*4 ; for palette |
2089 | @@: |
2609 | @@: |
2090 | mov esi, eax |
2610 | mov esi, eax |
Line 2102... | Line 2622... | ||
2102 | lea esi, [eax + esi - 256*4] |
2622 | lea esi, [eax + esi - 256*4] |
2103 | mov [ebx + Image.Palette], esi |
2623 | mov [ebx + Image.Palette], esi |
2104 | jmp .ret |
2624 | jmp .ret |
2105 | @@: |
2625 | @@: |
2106 | cmp [ebx + Image.Type], Image.bpp1 |
2626 | cmp [ebx + Image.Type], Image.bpp1 |
2107 | jnz .ret |
2627 | jnz @f |
2108 | lea esi, [eax + esi - 2*4] |
2628 | lea esi, [eax + esi - 2*4] |
2109 | mov [ebx + Image.Palette], esi |
2629 | mov [ebx + Image.Palette], esi |
2110 | jmp .ret |
2630 | jmp .ret |
- | 2631 | @@: |
|
- | 2632 | cmp [ebx + Image.Type], Image.bpp2i |
|
- | 2633 | jnz @f |
|
- | 2634 | lea esi, [eax + esi - 4*4] |
|
- | 2635 | mov [ebx + Image.Palette], esi |
|
- | 2636 | jmp .ret |
|
- | 2637 | @@: |
|
- | 2638 | cmp [ebx + Image.Type], Image.bpp4i |
|
- | 2639 | jnz .ret |
|
- | 2640 | lea esi, [eax + esi - 16*4] |
|
- | 2641 | mov [ebx + Image.Palette], esi |
|
- | 2642 | jmp .ret |
|
Line 2111... | Line 2643... | ||
2111 | 2643 | ||
2112 | .error: |
2644 | .error: |
2113 | xor eax, eax |
2645 | xor eax, eax |
2114 | .ret: |
2646 | .ret: |
Line 2125... | Line 2657... | ||
2125 | ;;------------------------------------------------------------------------------------------------;; |
2657 | ;;------------------------------------------------------------------------------------------------;; |
2126 | ;< --- TBD --- ;; |
2658 | ;< --- TBD --- ;; |
2127 | ;;================================================================================================;; |
2659 | ;;================================================================================================;; |
2128 | cmp [ebx + Image.Type], Image.bpp1 |
2660 | cmp [ebx + Image.Type], Image.bpp1 |
2129 | jz .bpp1.1 |
2661 | jz .bpp1.1 |
- | 2662 | cmp [ebx + Image.Type], Image.bpp2i |
|
- | 2663 | jz .bpp2i.1 |
|
- | 2664 | cmp [ebx + Image.Type], Image.bpp4i |
|
- | 2665 | jz .bpp4i.1 |
|
2130 | cmp [ebx + Image.Type], Image.bpp8i |
2666 | cmp [ebx + Image.Type], Image.bpp8i |
2131 | jz .bpp8.1 |
2667 | jz .bpp8.1 |
2132 | cmp [ebx + Image.Type], Image.bpp8g |
2668 | cmp [ebx + Image.Type], Image.bpp8g |
2133 | jz .bpp8.1 |
2669 | jz .bpp8.1 |
2134 | cmp [ebx + Image.Type], Image.bpp8a |
2670 | cmp [ebx + Image.Type], Image.bpp8a |
Line 2145... | Line 2681... | ||
2145 | jmp .quit |
2681 | jmp .quit |
2146 | .bpp1.1: |
2682 | .bpp1.1: |
2147 | add eax, 7 |
2683 | add eax, 7 |
2148 | shr eax, 3 |
2684 | shr eax, 3 |
2149 | jmp .quit |
2685 | jmp .quit |
- | 2686 | .bpp2i.1: |
|
- | 2687 | add eax, 3 |
|
- | 2688 | shr eax, 2 |
|
- | 2689 | jmp .quit |
|
- | 2690 | .bpp4i.1: |
|
- | 2691 | add eax, 1 |
|
- | 2692 | shr eax, 1 |
|
- | 2693 | jmp .quit |
|
2150 | .bpp8a.1: |
2694 | .bpp8a.1: |
2151 | shl eax, 1 |
2695 | shl eax, 1 |
2152 | .bpp8.1: |
2696 | .bpp8.1: |
2153 | .quit: |
2697 | .quit: |
2154 | ret |
2698 | ret |
Line 2161... | Line 2705... | ||
2161 | ;;================================================================================================;; |
2705 | ;;================================================================================================;; |
2162 | ;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
2706 | ;;////////////////////////////////////////////////////////////////////////////////////////////////;; |
2163 | ;;================================================================================================;; |
2707 | ;;================================================================================================;; |
Line 2164... | Line 2708... | ||
2164 | 2708 | ||
2165 | align 4 |
2709 | align 4 |
2166 | type2bpp dd 8, 24, 32, 15, 16, 1, 9;, 2, 4 |
2710 | type2bpp dd 8, 24, 32, 15, 16, 1, 9, 2, 4 |
2167 | img._.do_rgb.handlers: |
2711 | img._.do_rgb.handlers: |
2168 | dd img._.do_rgb.bpp8i |
2712 | dd img._.do_rgb.bpp8i |
2169 | dd img._.do_rgb.bpp24 |
2713 | dd img._.do_rgb.bpp24 |
2170 | dd img._.do_rgb.bpp32 |
2714 | dd img._.do_rgb.bpp32 |
2171 | dd img._.do_rgb.bpp15.amd ; can be overwritten in lib_init |
2715 | dd img._.do_rgb.bpp15.amd ; can be overwritten in lib_init |
2172 | dd img._.do_rgb.bpp16.amd ; can be overwritten in lib_init |
2716 | dd img._.do_rgb.bpp16.amd ; can be overwritten in lib_init |
2173 | dd img._.do_rgb.bpp1 |
2717 | dd img._.do_rgb.bpp1 |
- | 2718 | dd img._.do_rgb.bpp8g |
|
2174 | dd img._.do_rgb.bpp8g |
2719 | dd img._.do_rgb.bpp2i |
Line 2175... | Line 2720... | ||
2175 | ; dd img._.do_rgb.bpp8a |
2720 | dd img._.do_rgb.bpp4i |
2176 | 2721 | ||
2177 | img.flip.layer.handlers_horz: |
2722 | img.flip.layer.handlers_horz: |
2178 | dd img.flip.layer.bpp8ig_horz |
2723 | dd img.flip.layer.bpp8ig_horz |
2179 | dd img.flip.layer.bpp24_horz |
2724 | dd img.flip.layer.bpp24_horz |
2180 | dd img.flip.layer.bpp32_horz |
2725 | dd img.flip.layer.bpp32_horz |
2181 | dd img.flip.layer.bpp1x_horz |
2726 | dd img.flip.layer.bpp1x_horz |
2182 | dd img.flip.layer.bpp1x_horz |
2727 | dd img.flip.layer.bpp1x_horz |
- | 2728 | dd img.flip.layer.bpp1_horz |
|
2183 | dd img.flip.layer.bpp1_horz |
2729 | dd img.flip.layer.bpp8ig_horz |
Line 2184... | Line 2730... | ||
2184 | dd img.flip.layer.bpp8ig_horz |
2730 | dd img.flip.layer.bpp2i_horz |
2185 | ; dd img.flip.layer.bpp8a_horz |
2731 | dd img.flip.layer.bpp4i_horz |
2186 | 2732 | ||
2187 | ;;================================================================================================;; |
2733 | ;;================================================================================================;; |