comparison jag_video.c @ 1098:4a726e339d6f

Fix implementation of scaled objects. Implement transparency flag
author Michael Pavone <pavone@retrodev.com>
date Sat, 05 Nov 2016 17:16:16 -0700
parents faa3a4617f62
children 9c62edafcf74
comparison
equal deleted inserted replaced
1097:faa3a4617f62 1098:4a726e339d6f
431 //run at least one cycle of writes even if we didn't spend any time reading 431 //run at least one cycle of writes even if we didn't spend any time reading
432 proc_cycles = 1; 432 proc_cycles = 1;
433 } 433 }
434 while (proc_cycles) 434 while (proc_cycles)
435 { 435 {
436 if (context->op.type == OBJ_SCALED && context->op.hscale) {
437 while (context->op.hremainder <= 0 && context->op.im_bits) {
438 context->op.im_bits -= context->op.bpp;
439 context->op.hremainder += context->op.hscale;
440 }
441 }
442 if (context->op.im_bits) { 436 if (context->op.im_bits) {
443 uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp); 437 uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp);
444 val &= (1 << context->op.bpp) - 1; 438 val &= (1 << context->op.bpp) - 1;
445 context->op.im_bits -= context->op.bpp; 439 if (val || !context->op.transparent)
446 if (context->op.bpp < 16) { 440 {
447 val = context->clut[val + context->op.pal_offset]; 441 if (context->op.bpp < 16) {
442 val = context->clut[val + context->op.pal_offset];
443 }
444 if (context->op.bpp == 32) {
445 context->write_line_buffer[context->op.lb_offset++] = val >> 16;
446 }
447 context->write_line_buffer[context->op.lb_offset++] = val;
448 } else {
449 context->op.lb_offset += context->op.bpp == 32 ? 2 : 1;
448 } 450 }
449 if (context->op.bpp == 32) {
450 context->write_line_buffer[context->op.lb_offset++] = val >> 16;
451 }
452 context->write_line_buffer[context->op.lb_offset++] = val;
453 if (context->op.type == OBJ_SCALED) { 451 if (context->op.type == OBJ_SCALED) {
454 context->op.hremainder -= 0x20; 452 context->op.hremainder -= 0x20;
453 while (context->op.hremainder <= 0 && context->op.im_bits) {
454 context->op.im_bits -= context->op.bpp;
455 context->op.hremainder += context->op.hscale;
456 }
457 } else {
458 context->op.im_bits -= context->op.bpp;
455 } 459 }
456 } 460 }
457 if (context->op.im_bits && context->op.bpp < 32 && context->op.type == OBJ_BITMAP && context->op.lb_offset < LINEBUFFER_WORDS) { 461 if (context->op.im_bits && context->op.bpp < 32 && context->op.type == OBJ_BITMAP && context->op.lb_offset < LINEBUFFER_WORDS) {
458 uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp); 462 uint32_t val = context->op.im_data >> (context->op.im_bits - context->op.bpp);
459 val &= (1 << context->op.bpp) - 1; 463 val &= (1 << context->op.bpp) - 1;
464 if (val || !context->op.transparent)
465 {
466 val = context->clut[val + context->op.pal_offset];
467 context->write_line_buffer[context->op.lb_offset] = val;
468 }
469 context->op.lb_offset++;
460 context->op.im_bits -= context->op.bpp; 470 context->op.im_bits -= context->op.bpp;
461 val = context->clut[val + context->op.pal_offset];
462 context->write_line_buffer[context->op.lb_offset++] = val;
463 } 471 }
464 context->op_cycles++; 472 context->op_cycles++;
465 proc_cycles--; 473 proc_cycles--;
466 } 474 }
467 if (!context->op.im_bits && context->op.has_prefetch) { 475 if (!context->op.im_bits && context->op.has_prefetch) {