Browse Source

* examples/view.c:

+ Fixed a bug in the loading of 1bpp BMPs.
    + Commented stuff.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
db18eb504d
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      examples/view.c

+ 4
- 2
examples/view.c View File

@@ -523,7 +523,7 @@ static void load_image(const char *name)
if(k == 0)
bits = freadint(fp);
pixels[w * i * depth + j] =
(bits >> ((k & ~0xf) + 0xf - (k & 0xf))) & 0xf;
(bits >> ((k & ~0xf) + 0xf - (k & 0xf))) & 0x1;
}
break;
case 4:
@@ -537,9 +537,11 @@ static void load_image(const char *name)
}
break;
default:
/* Works for 8bpp, but also for 16, 24 etc. */
fread(pixels + w * i * depth, w * depth, 1, fp);
/* Pad reads to 4 bytes */
tmp = (4 - (w * depth) % 4) % 4;
tmp = (w * depth) % 4;
tmp = (4 - tmp) % 4;
while(tmp--)
freadchar(fp);
break;


Loading…
Cancel
Save