X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fplanar.c;h=3fd1c5ed2b25b85ac5a5849bf9d282ea2d010cf2;hb=3d36f50834f46234bb598624e526e97d5bf9678f;hp=5541217fe4fa2ac2cc76f74caaf67dbd2b4e5a5c;hpb=a242b745afeb9f9bb3253b45503ff6022dd474c8;p=16.git diff --git a/src/lib/planar.c b/src/lib/planar.c index 5541217f..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. @@ -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); @@ -59,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; @@ -77,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;