mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
compile on Linux
This commit is contained in:
parent
83a138529d
commit
55181edef0
@ -179,12 +179,12 @@ BMPreadinfoheader(
|
||||
int *pclassv)
|
||||
{
|
||||
unsigned long cbFix;
|
||||
unsigned short cPlanes;
|
||||
unsigned short cPlanes = 0;
|
||||
|
||||
unsigned long cx;
|
||||
unsigned long cy;
|
||||
unsigned short cBitCount;
|
||||
int classv;
|
||||
unsigned long cx = 0;
|
||||
unsigned long cy = 0;
|
||||
unsigned short cBitCount = 0;
|
||||
int classv = 0;
|
||||
|
||||
cbFix = GetLong(fp);
|
||||
|
||||
@ -315,7 +315,7 @@ BMPreadrow(
|
||||
pixval *G,
|
||||
pixval *B)
|
||||
{
|
||||
BITSTREAM b;
|
||||
BITSTREAM b = NULL;
|
||||
unsigned nbyte = 0;
|
||||
int rc;
|
||||
unsigned x;
|
||||
|
@ -143,7 +143,7 @@ BMPwriteinfoheader(
|
||||
unsigned long x,
|
||||
unsigned long y)
|
||||
{
|
||||
long cbFix;
|
||||
long cbFix = 0;
|
||||
|
||||
/* cbFix */
|
||||
switch (classv)
|
||||
|
@ -31,6 +31,14 @@
|
||||
#include <windows.h> // we need to include this before jpeglib.
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
// If we are going to be including png.h (in the unrelated file
|
||||
// pnmFileTypePNG.h), be sure to include it before including setjmp.h.
|
||||
// Ugly hack due to png weirdness with setjmp.
|
||||
#include <png.h>
|
||||
#endif
|
||||
|
||||
|
||||
extern "C" {
|
||||
#include <stdio.h> // jpeglib requires this to be included first.
|
||||
#include <jpeglib.h>
|
||||
|
@ -351,7 +351,10 @@ read_data(xel *array, xelval *alpha_data) {
|
||||
for (yi = 0; yi < num_rows; yi++) {
|
||||
png_bytep source = rows[yi];
|
||||
for (int xi = 0; xi < _x_size; xi++) {
|
||||
int red, green, blue, alpha;
|
||||
int red = 0;
|
||||
int green = 0;
|
||||
int blue = 0;
|
||||
int alpha = 0;
|
||||
|
||||
if (_maxval > 255) {
|
||||
if (get_color) {
|
||||
@ -430,7 +433,7 @@ void PNMFileTypePNG::Reader::
|
||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
Reader *self = (Reader *)png_get_io_ptr(png_ptr);
|
||||
self->_file->read((char *)data, length);
|
||||
if (self->_file->gcount() != length) {
|
||||
if (length != (png_size_t)self->_file->gcount()) {
|
||||
pnmimage_png_cat.error()
|
||||
<< "Didn't read enough bytes.\n";
|
||||
// Is there no way to indicate a read failure to libpng?
|
||||
|
@ -346,7 +346,7 @@ read_channel(istream *ifp,
|
||||
TabEntry *table,
|
||||
ScanElem *channel_data, long table_start,
|
||||
int channel, int row) {
|
||||
ScanElem *temp;
|
||||
ScanElem *temp = NULL;
|
||||
int sgi_index, i;
|
||||
long offset, length;
|
||||
|
||||
|
@ -646,43 +646,44 @@ readtga( istream *ifp, struct ImageHeader *tgaP, const string &magic_number ) {
|
||||
|
||||
void PNMFileTypeTGA::Reader::
|
||||
get_map_entry( istream *ifp, pixel *Value, int Size, gray *Alpha ) {
|
||||
unsigned char j, k, r, g, b, a;
|
||||
unsigned char j, k;
|
||||
unsigned char r = 0, g = 0, b = 0, a = 0;
|
||||
|
||||
/* Read appropriate number of bytes, break into rgb & put in map. */
|
||||
switch ( Size )
|
||||
{
|
||||
case 8: /* Grey scale, read and triplicate. */
|
||||
{
|
||||
case 8: /* Grey scale, read and triplicate. */
|
||||
r = g = b = getbyte( ifp );
|
||||
a = 0;
|
||||
a = 0;
|
||||
break;
|
||||
|
||||
case 16: /* 5 bits each of red green and blue. */
|
||||
case 15: /* Watch for byte order. */
|
||||
|
||||
case 16: /* 5 bits each of red green and blue. */
|
||||
case 15: /* Watch for byte order. */
|
||||
j = getbyte( ifp );
|
||||
k = getbyte( ifp );
|
||||
r = ( k & 0x7C ) >> 2;
|
||||
g = ( ( k & 0x03 ) << 3 ) + ( ( j & 0xE0 ) >> 5 );
|
||||
b = j & 0x1F;
|
||||
a = 0;
|
||||
a = 0;
|
||||
break;
|
||||
|
||||
case 32: /* 8 bits each of blue, green, red, and alpha */
|
||||
case 24: /* 8 bits each of blue green and red. */
|
||||
case 32: /* 8 bits each of blue, green, red, and alpha */
|
||||
case 24: /* 8 bits each of blue green and red. */
|
||||
b = getbyte( ifp );
|
||||
g = getbyte( ifp );
|
||||
r = getbyte( ifp );
|
||||
if ( Size == 32 )
|
||||
a = getbyte( ifp );
|
||||
else
|
||||
a = 0;
|
||||
a = getbyte( ifp );
|
||||
else
|
||||
a = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
default:
|
||||
pm_error( "unknown colormap pixel size (#2) - %d", Size );
|
||||
}
|
||||
}
|
||||
PPM_ASSIGN( *Value, r, g, b );
|
||||
*Alpha = a;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user