ARB
Macros | Functions | Variables
glpng.c File Reference
#include <GL/glew.h>
#include <GL/gl.h>
#include <GL/glpng.h>
#include <stdlib.h>
#include <math.h>
#include <png.h>
Include dependency graph for glpng.c:

Go to the source code of this file.

Macros

#define GLPNG_CHECK_SIG(header, size)   (png_sig_cmp(header,0,size)==0)
 
#define GET(o)   ((int)*(data + (o)))
 
#define FORSTART
 
#define FOREND
 
#define ALPHA   *q
 

Functions

static unsigned char DefaultAlphaCallback (unsigned char red, unsigned char green, unsigned char blue)
 
static void checkForGammaEnv ()
 
static int SafeSize (int i)
 
static void Resize (int components, const png_bytep d1, int w1, int h1, png_bytep d2, int w2, int h2)
 
static int HalfSize (GLint components, GLint width, GLint height, const unsigned char *data, unsigned char *d, int filter)
 
static void Build2DMipmaps (GLint components, GLint width, GLint height, GLenum format, const unsigned char *data, int filter)
 
static int APIENTRY pngLoadF (FILE *fp, int mipmap, int trans, pngInfo *pinfo)
 
static int APIENTRY pngLoad (const char *filename, int mipmap, int trans, pngInfo *pinfo)
 
static unsigned int SetParams (int wrapst, int magfilter, int minfilter)
 
unsigned int APIENTRY pngBind (const char *filename, int mipmap, int trans, pngInfo *info, int wrapst, int minfilter, int magfilter)
 

Variables

static unsigned char StencilRed = 0
 
static unsigned char StencilGreen = 0
 
static unsigned char StencilBlue = 0
 
static unsigned char(* AlphaCallback )(unsigned char red, unsigned char green, unsigned char blue) = DefaultAlphaCallback
 
static int StandardOrientation = 0
 
static int PalettedTextures = -1
 
static GLint MaxTextureSize = 0
 
static double screenGamma = 2.2 / 1.0
 
static char gammaExplicit = 0
 

Macro Definition Documentation

#define GLPNG_CHECK_SIG (   header,
  size 
)    (png_sig_cmp(header,0,size)==0)

Definition at line 43 of file glpng.c.

Referenced by pngLoadF().

#define GET (   o)    ((int)*(data + (o)))

Definition at line 148 of file glpng.c.

Referenced by HalfSize().

#define FORSTART
Value:
do { \
r = *p++; /* red */ \
g = *p++; /* green */ \
b = *p++; /* blue */ \
*q++ = r; \
*q++ = g; \
*q++ = b;

Referenced by pngLoadF().

#define FOREND
Value:
q++; \
} while (p != endp);

Referenced by pngLoadF().

#define ALPHA   *q

Referenced by pngLoadF().

Function Documentation

static unsigned char DefaultAlphaCallback ( unsigned char  red,
unsigned char  green,
unsigned char  blue 
)
static

Definition at line 52 of file glpng.c.

static void checkForGammaEnv ( )
static

Definition at line 83 of file glpng.c.

References screenGamma.

Referenced by pngLoadF().

static int SafeSize ( int  i)
static

Definition at line 96 of file glpng.c.

References MaxTextureSize.

Referenced by pngLoadF().

static void Resize ( int  components,
const png_bytep  d1,
int  w1,
int  h1,
png_bytep  d2,
int  w2,
int  h2 
)
static

Definition at line 109 of file glpng.c.

References y.

Referenced by pngLoadF().

static int HalfSize ( GLint  components,
GLint  width,
GLint  height,
const unsigned char data,
unsigned char d,
int  filter 
)
static

Definition at line 150 of file glpng.c.

References GET, line, and y.

Referenced by Build2DMipmaps().

static void Build2DMipmaps ( GLint  components,
GLint  width,
GLint  height,
GLenum  format,
const unsigned char data,
int  filter 
)
static

Definition at line 232 of file glpng.c.

References HalfSize().

Referenced by pngLoadF().

static int APIENTRY pngLoadF ( FILE *  fp,
int  mipmap,
int  trans,
pngInfo pinfo 
)
static
static int APIENTRY pngLoad ( const char filename,
int  mipmap,
int  trans,
pngInfo pinfo 
)
static

Definition at line 542 of file glpng.c.

References pngLoadF(), and result.

Referenced by pngBind().

static unsigned int SetParams ( int  wrapst,
int  magfilter,
int  minfilter 
)
static

Definition at line 554 of file glpng.c.

References id.

Referenced by pngBind().

unsigned int APIENTRY pngBind ( const char filename,
int  mipmap,
int  trans,
pngInfo info,
int  wrapst,
int  minfilter,
int  magfilter 
)

Definition at line 569 of file glpng.c.

References id, pngLoad(), and SetParams().

Variable Documentation

unsigned char StencilRed = 0
static

Definition at line 56 of file glpng.c.

Referenced by pngLoadF().

unsigned char StencilGreen = 0
static

Definition at line 56 of file glpng.c.

Referenced by pngLoadF().

unsigned char StencilBlue = 0
static

Definition at line 56 of file glpng.c.

Referenced by pngLoadF().

unsigned char(* AlphaCallback)(unsigned char red, unsigned char green, unsigned char blue) = DefaultAlphaCallback
static

Definition at line 57 of file glpng.c.

Referenced by pngLoadF().

int StandardOrientation = 0
static

Definition at line 58 of file glpng.c.

int PalettedTextures = -1
static

Definition at line 66 of file glpng.c.

GLint MaxTextureSize = 0
static

Definition at line 67 of file glpng.c.

Referenced by pngLoadF(), and SafeSize().

double screenGamma = 2.2 / 1.0
static

Definition at line 78 of file glpng.c.

Referenced by checkForGammaEnv(), and pngLoadF().

char gammaExplicit = 0
static

Definition at line 81 of file glpng.c.