]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/planar.c
reduce stack size. Watcom C makes STACK part of DGROUP and will error
[16.git] / src / lib / planar.c
index 4eda45155878659bbaf5ed57309013eb37fe6a09..3fd1c5ed2b25b85ac5a5849bf9d282ea2d010cf2 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
  *\r
  * This file is part of Project 16.\r
  *\r
 /*\r
  * Implimentation of the planar buffer files.\r
  */\r
+#include <stdio.h>\r
 #include <stdlib.h>\r
+#include <malloc.h>\r
+\r
 #include "src/lib/planar.h"\r
 \r
 /* creates a planar buffer from the bitmap data.\r
@@ -84,7 +87,7 @@ planar_buf_alloc(word width, word height) {
 \r
        /* allocate the planes */\r
        for(i=0; i<4; i++) {\r
-       p->plane[i] = malloc(p->height * p->pwidth);\r
+               p->plane[i] = malloc(p->height * p->pwidth);\r
        }\r
 \r
        return p;\r
@@ -104,41 +107,3 @@ planar_buf_free(planar_buf_t *p) {
        /* free the structure */\r
        free(p);\r
 }\r
-\r
-/*     non pointer version     */\r
-planar_buf_t planar_buf_from_bitmap0(bitmap_t *b) {\r
-       planar_buf_t p;\r
-       int plane, bi, pi, x, y;\r
-       word q=0;\r
-\r
-       /* allocate the buffer */\r
-       p = *planar_buf_alloc(b->width, b->height);\r
-\r
-       /* copy the bitmap data into the planar format */\r
-       bi=0;\r
-       pi=0;\r
-       for(y=0; y < b->height; y++) {\r
-       /* start on the first plane */\r
-       plane=0;\r
-       for(x=0; x < b->width; x++) {\r
-               /* copy to each plane */\r
-               p.plane[plane++][pi]=b->data[bi++];\r
-\r
-               /* handle the completion of 4 planes. */\r
-               if(plane==4) {\r
-                       plane=0;\r
-                       pi++;\r
-               }\r
-       }\r
-\r
-       /* correct for images not divisible by 4 */\r
-       if(plane) pi++;\r
-       }\r
-       p.palette = modexNewPal();\r
-       for(;q<PALSIZE;q++)\r
-       {\r
-               p.palette[q]=b->palette[q];\r
-       }\r
-\r
-       return p;\r
-}\r