comparison tools/lib64fmts.c @ 2306:e798a41f27a5

Clean up some code duplication.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 08 Jul 2019 12:25:46 +0300
parents 7c26b5f86ff7
children 319fd953ba29
comparison
equal deleted inserted replaced
2305:3bcad61594b4 2306:e798a41f27a5
1280 1280
1281 1281
1282 static int fmtGetPixelFunPaint2(Uint8 *col, 1282 static int fmtGetPixelFunPaint2(Uint8 *col,
1283 const DMC64Image *img, const int rasterX, const int rasterY) 1283 const DMC64Image *img, const int rasterX, const int rasterY)
1284 { 1284 {
1285 const int 1285 DM_C64_GENERIC_SC_PIXEL_DEFS(img)
1286 x = rasterX / 8, 1286 const int bitmap = rasterX & 1;
1287 y = rasterY / 8,
1288 yb = rasterY & 7,
1289 yoffs = y * img->fmt->chWidth,
1290 bmoffs = yoffs * 8 + yb + (x * 8),
1291 scroffs = yoffs + x,
1292 bitmap = rasterX & 1,
1293 vbank = yb + (bitmap * 8),
1294 vshift = 6 - (rasterX & 6);
1295
1296 Uint8 bgcol = (unsigned) rasterY < img->extraData[0].size ? 1287 Uint8 bgcol = (unsigned) rasterY < img->extraData[0].size ?
1297 img->extraData[0].data[rasterY] : img->bgcolor; 1288 img->extraData[0].data[rasterY] : img->bgcolor;
1298 1289
1290 (void) vshift;
1291
1299 return dmC64GetGenericMCPixel(col, img, 1292 return dmC64GetGenericMCPixel(col, img,
1300 bmoffs, scroffs, 1293 bmoffs, scroffs,
1301 vshift, vbank, 1294 6 - (rasterX & 6),
1295 yb + (bitmap * 8),
1302 bitmap, 0, bgcol); 1296 bitmap, 0, bgcol);
1303 } 1297 }
1304 1298
1305 1299
1306 static int fmtGetPixelBFLI(Uint8 *col, 1300 static int fmtGetPixelBFLI(Uint8 *col,