Ignore:
Timestamp:
Dec 17, 2003, 12:25:54 AM (16 years ago)
Author:
Sam Hocevar
Message:
  • examples/view.c: + Fixed a bug in the loading of 1bpp BMPs. + Commented stuff.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/examples/view.c

    r254 r255  
    524524                        bits = freadint(fp);
    525525                    pixels[w * i * depth + j] =
    526                         (bits >> ((k & ~0xf) + 0xf - (k & 0xf))) & 0xf;
     526                        (bits >> ((k & ~0xf) + 0xf - (k & 0xf))) & 0x1;
    527527                }
    528528                break;
     
    538538                break;
    539539            default:
     540                /* Works for 8bpp, but also for 16, 24 etc. */
    540541                fread(pixels + w * i * depth, w * depth, 1, fp);
    541542                /* Pad reads to 4 bytes */
    542                 tmp = (4 - (w * depth) % 4) % 4;
     543                tmp = (w * depth) % 4;
     544                tmp = (4 - tmp) % 4;
    543545                while(tmp--)
    544546                    freadchar(fp);
Note: See TracChangeset for help on using the changeset viewer.