X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplanar.c;h=3fd1c5ed2b25b85ac5a5849bf9d282ea2d010cf2;hb=aeae19c142c9aedc32400c30ea027ee8ca8948bd;hp=4eda45155878659bbaf5ed57309013eb37fe6a09;hpb=74929b07c8b45a20eb5079444f4df21c9898e605;p=16.git diff --git a/src/lib/planar.c b/src/lib/planar.c index 4eda4515..3fd1c5ed 100755 --- a/src/lib/planar.c +++ b/src/lib/planar.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -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. @@ -84,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; @@ -104,41 +107,3 @@ planar_buf_free(planar_buf_t *p) { /* free the structure */ free(p); } - -/* non pointer version */ -planar_buf_t planar_buf_from_bitmap0(bitmap_t *b) { - planar_buf_t p; - int plane, bi, pi, x, y; - word q=0; - - /* allocate the buffer */ - p = *planar_buf_alloc(b->width, b->height); - - /* copy the bitmap data into the planar format */ - bi=0; - pi=0; - for(y=0; y < b->height; y++) { - /* start on the first plane */ - plane=0; - for(x=0; x < b->width; x++) { - /* copy to each plane */ - p.plane[plane++][pi]=b->data[bi++]; - - /* handle the completion of 4 planes. */ - if(plane==4) { - plane=0; - pi++; - } - } - - /* correct for images not divisible by 4 */ - if(plane) pi++; - } - p.palette = modexNewPal(); - for(;qpalette[q]; - } - - return p; -}