Fix redundant glTexEnv calls
[neverball] / share / fs_png.c
1 /*
2  * Copyright (C) 2003-2010 Neverball authors
3  *
4  * NEVERBALL is  free software; you can redistribute  it and/or modify
5  * it under the  terms of the GNU General  Public License as published
6  * by the Free  Software Foundation; either version 2  of the License,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
11  * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
12  * General Public License for more details.
13  */
14
15 #include <png.h>
16 #include <string.h>
17 #include "fs_png.h"
18 #include "fs.h"
19
20 /*---------------------------------------------------------------------------*/
21
22 void fs_png_read(png_structp readp, png_bytep data, png_size_t length)
23 {
24     int read = fs_read(data, 1, length, png_get_io_ptr(readp));
25
26     if (read < length)
27         memset(data + read, 0, length - read);
28 }
29
30 void fs_png_write(png_structp writep, png_bytep data, png_size_t length)
31 {
32     fs_write(data, 1, length, png_get_io_ptr(writep));
33 }
34
35 void fs_png_flush(png_structp writep)
36 {
37     fs_flush(png_get_io_ptr(writep));
38 }
39
40 /*---------------------------------------------------------------------------*/