Mercurial > hg > dmlib
comparison tools/lib64gfx.c @ 2121:f12ac487954b
Rename the "shift" variable/function argument used for bitshift of c64 bitmap/char pixels.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 27 May 2019 00:04:02 +0300 |
parents | 88d37ec1b4d6 |
children | 59bde9a7220d |
comparison
equal
deleted
inserted
replaced
2120:88d37ec1b4d6 | 2121:f12ac487954b |
---|---|
1313 if ((src->fmt->type & D64_FMT_MASK) == D64_FMT_HIRES) | 1313 if ((src->fmt->type & D64_FMT_MASK) == D64_FMT_HIRES) |
1314 { | 1314 { |
1315 // Hi-res charmap | 1315 // Hi-res charmap |
1316 const int x = xc / 8; | 1316 const int x = xc / 8; |
1317 const int scroffs = scroffsy + x; | 1317 const int scroffs = scroffsy + x; |
1318 const int vshift = 7 - (xc & 7); | 1318 const int xshift = 7 - (xc & 7); |
1319 const int chr = src->screen[0].data[scroffs]; | 1319 const int chr = src->screen[0].data[scroffs]; |
1320 | 1320 |
1321 if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1) | 1321 if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> xshift) & 1) |
1322 *dp++ = src->color[0].data[scroffs]; | 1322 *dp++ = src->color[0].data[scroffs]; |
1323 else | 1323 else |
1324 *dp++ = src->bgcolor; | 1324 *dp++ = src->bgcolor; |
1325 } | 1325 } |
1326 else | 1326 else |
1327 if ((src->fmt->type & D64_FMT_MASK) == D64_FMT_ECM) | 1327 if ((src->fmt->type & D64_FMT_MASK) == D64_FMT_ECM) |
1328 { | 1328 { |
1329 // Hi-res ECM charmap | 1329 // Hi-res ECM charmap |
1330 const int x = xc / 8; | 1330 const int x = xc / 8; |
1331 const int scroffs = scroffsy + x; | 1331 const int scroffs = scroffsy + x; |
1332 const int vshift = 7 - (xc & 7); | 1332 const int xshift = 7 - (xc & 7); |
1333 const int chr = src->screen[0].data[scroffs]; | 1333 const int chr = src->screen[0].data[scroffs]; |
1334 | 1334 |
1335 if ((src->charData[0].data[(chr & 0x3f) * C64_CHR_SIZE + yb] >> vshift) & 1) | 1335 if ((src->charData[0].data[(chr & 0x3f) * C64_CHR_SIZE + yb] >> xshift) & 1) |
1336 *dp++ = src->color[0].data[scroffs] & 15; | 1336 *dp++ = src->color[0].data[scroffs] & 15; |
1337 else | 1337 else |
1338 switch ((chr >> 6) & 3) | 1338 switch ((chr >> 6) & 3) |
1339 { | 1339 { |
1340 case 0: *dp++ = src->bgcolor; break; | 1340 case 0: *dp++ = src->bgcolor; break; |
1352 const int chr = src->screen[0].data[scroffs]; | 1352 const int chr = src->screen[0].data[scroffs]; |
1353 const int col = src->color[0].data[scroffs]; | 1353 const int col = src->color[0].data[scroffs]; |
1354 | 1354 |
1355 if (col & 8) | 1355 if (col & 8) |
1356 { | 1356 { |
1357 const int vshift = 6 - ((xc * 2) & 6); | 1357 const int xshift = 6 - ((xc * 2) & 6); |
1358 switch ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 3) | 1358 switch ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> xshift) & 3) |
1359 { | 1359 { |
1360 case 0: *dp++ = src->bgcolor; break; | 1360 case 0: *dp++ = src->bgcolor; break; |
1361 case 1: *dp++ = src->d022; break; | 1361 case 1: *dp++ = src->d022; break; |
1362 case 2: *dp++ = src->d023; break; | 1362 case 2: *dp++ = src->d023; break; |
1363 case 3: *dp++ = col & 15; | 1363 case 3: *dp++ = col & 15; |
1364 } | 1364 } |
1365 } | 1365 } |
1366 else | 1366 else |
1367 { | 1367 { |
1368 const int vshift = 7 - (xc & 7); | 1368 const int xshift = 7 - (xc & 7); |
1369 if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1) | 1369 if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> xshift) & 1) |
1370 *dp++ = col & 7; | 1370 *dp++ = col & 7; |
1371 else | 1371 else |
1372 *dp++ = src->bgcolor; | 1372 *dp++ = src->bgcolor; |
1373 } | 1373 } |
1374 } | 1374 } |
1380 { | 1380 { |
1381 // Hi-res bitmap | 1381 // Hi-res bitmap |
1382 const int x = xc / 8; | 1382 const int x = xc / 8; |
1383 const int scroffs = scroffsy + x; | 1383 const int scroffs = scroffsy + x; |
1384 const int bmoffs = bmoffsy + (x * 8); | 1384 const int bmoffs = bmoffsy + (x * 8); |
1385 const int vshift = 7 - (xc & 7); | 1385 const int xshift = 7 - (xc & 7); |
1386 | 1386 |
1387 *dp++ = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc); | 1387 *dp++ = getPixel(src, bmoffs, scroffs, xshift, 0, xc, yc); |
1388 } | 1388 } |
1389 else | 1389 else |
1390 { | 1390 { |
1391 // Multicolor bitmap and variants | 1391 // Multicolor bitmap and variants |
1392 const int x = xc / 4; | 1392 const int x = xc / 4; |
1393 const int scroffs = scroffsy + x; | 1393 const int scroffs = scroffsy + x; |
1394 const int bmoffs = bmoffsy + (x * 8); | 1394 const int bmoffs = bmoffsy + (x * 8); |
1395 const int vshift = 6 - ((xc * 2) & 6); | 1395 const int xshift = 6 - ((xc * 2) & 6); |
1396 | 1396 |
1397 if (src->fmt->type & D64_FMT_ILACE) | 1397 if (src->fmt->type & D64_FMT_ILACE) |
1398 { | 1398 { |
1399 switch (src->laceType) | 1399 switch (src->laceType) |
1400 { | 1400 { |
1401 case D64_ILACE_RES: | 1401 case D64_ILACE_RES: |
1402 *dp++ = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc); | 1402 *dp++ = getPixel(src, bmoffs, scroffs, xshift, 0, xc, yc); |
1403 *dp++ = getPixel(src, bmoffs, scroffs, vshift, 1, xc, yc); | 1403 *dp++ = getPixel(src, bmoffs, scroffs, xshift, 1, xc, yc); |
1404 break; | 1404 break; |
1405 | 1405 |
1406 default: | 1406 default: |
1407 return DMERR_NOT_SUPPORTED; | 1407 return DMERR_NOT_SUPPORTED; |
1408 } | 1408 } |
1409 } | 1409 } |
1410 else | 1410 else |
1411 { | 1411 { |
1412 const Uint8 col = getPixel(src, bmoffs, scroffs, vshift, 0, xc, yc); | 1412 const Uint8 col = getPixel(src, bmoffs, scroffs, xshift, 0, xc, yc); |
1413 *dp++ = col; | 1413 *dp++ = col; |
1414 if (spec->aspect) | 1414 if (spec->aspect) |
1415 *dp++ = col; | 1415 *dp++ = col; |
1416 } | 1416 } |
1417 } | 1417 } |