X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplanar.c;h=c15c39c5d3e92d9106970d984233861a891ed890;hb=a33142857b39893e14f9fe4d657a01e215ecca2b;hp=55f4d99ea3ca30d11946484b35b7ba985dc2d116;hpb=a6438b2f886a103d5af0bfb304afa95033ad0396;p=16.git diff --git a/src/lib/planar.c b/src/lib/planar.c index 55f4d99e..c15c39c5 100755 --- a/src/lib/planar.c +++ b/src/lib/planar.c @@ -22,7 +22,10 @@ /* * Implimentation of the planar buffer files. */ +#include #include +#include + #include "src/lib/planar.h" /* creates a planar buffer from the bitmap data. @@ -30,10 +33,11 @@ be destroyed with the planar_buf_free function when no longer needed. */ -planar_buf_t * +planar_buf_t huge * planar_buf_from_bitmap(bitmap_t *b) { planar_buf_t *p; int plane, bi, pi, x, y; + word q; /* allocate the buffer */ p = planar_buf_alloc(b->width, b->height); @@ -46,7 +50,6 @@ planar_buf_from_bitmap(bitmap_t *b) { plane=0; for(x=0; x < b->width; x++) { /* copy to each plane */ - if(!(b->data[bi])) b->data[bi] = 1; p->plane[plane++][pi]=b->data[bi++]; /* handle the completion of 4 planes. */ @@ -60,12 +63,18 @@ planar_buf_from_bitmap(bitmap_t *b) { if(plane) pi++; } + p->palette = modexNewPal(); + for(;qpalette[q]=b->palette[q]; + } + return p; } /* allocates a planar buffer with specified dimensions */ -planar_buf_t * +planar_buf_t huge * planar_buf_alloc(word width, word height) { planar_buf_t *p; int i; @@ -78,7 +87,7 @@ planar_buf_alloc(word width, word height) { /* allocate the planes */ for(i=0; i<4; i++) { - p->plane[i] = malloc(p->height * p->pwidth); + p->plane[i] = malloc(p->height * p->pwidth); } return p;