use defines for some gif flags, for clearer code. Reordered initializers to avoid warnings.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27633 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini
2008-09-19 09:39:19 +00:00
parent d3ae536bb9
commit b7ef02aac6
2 changed files with 14 additions and 10 deletions
+7 -9
View File
@@ -28,8 +28,8 @@ GIFLoad::GIFLoad(BPositionIO *input, BPositionIO *output)
fatalerror(false), fatalerror(false),
fInput(input), fInput(input),
fOutput(output), fOutput(output),
fHeadMemblock(NULL),
fPalette(NULL), fPalette(NULL),
fHeadMemblock(NULL),
fScanLine(NULL) fScanLine(NULL)
{ {
fInput->Seek(0, SEEK_SET); fInput->Seek(0, SEEK_SET);
@@ -114,7 +114,7 @@ GIFLoad::ReadGIFHeader()
fPalette = new LoadPalette(); fPalette = new LoadPalette();
// Global palette // Global palette
if (header[10] & 0x80) { if (header[10] & GIF_LOCALCOLORMAP) {
fPalette->size_in_bits = (header[10] & 0x07) + 1; fPalette->size_in_bits = (header[10] & 0x07) + 1;
if (debug) if (debug)
printf("GIFLoad::ReadGIFHeader() - Found %d bit global palette\n", fPalette->size_in_bits); printf("GIFLoad::ReadGIFHeader() - Found %d bit global palette\n", fPalette->size_in_bits);
@@ -248,7 +248,7 @@ GIFLoad::ReadGIFImageHeader()
return false; return false;
// Has local palette // Has local palette
if (data[8] & 0x80) { if (data[8] & GIF_LOCALCOLORMAP) {
fPalette->size_in_bits = (data[8] & 0x07) + 1; fPalette->size_in_bits = (data[8] & 0x07) + 1;
int s = 1 << fPalette->size_in_bits; int s = 1 << fPalette->size_in_bits;
fPalette->size = s; fPalette->size = s;
@@ -264,13 +264,11 @@ GIFLoad::ReadGIFImageHeader()
} }
} }
if (data[8] & 0x40) { fInterlaced = data[8] & GIF_INTERLACED;
fInterlaced = true; if (debug) {
if (debug) if (fInterlaced)
printf("GIFLoad::ReadGIFImageHeader() - Image is interlaced\n"); printf("GIFLoad::ReadGIFImageHeader() - Image is interlaced\n");
} else { else
fInterlaced = false;
if (debug)
printf("GIFLoad::ReadGIFImageHeader() - Image is not interlaced\n"); printf("GIFLoad::ReadGIFImageHeader() - Image is not interlaced\n");
} }
return true; return true;
+7 -1
View File
@@ -19,6 +19,10 @@
#include <DataIO.h> #include <DataIO.h>
#include "LoadPalette.h" #include "LoadPalette.h"
#define GIF_INTERLACED 0x40
#define GIF_LOCALCOLORMAP 0x80
class Memblock { class Memblock {
public: public:
uchar data[4096]; uchar data[4096];
@@ -26,12 +30,14 @@ class Memblock {
Memblock *next; Memblock *next;
}; };
const int gl_pass_starts_at[] = {0, 4, 2, 1, 0}; const int gl_pass_starts_at[] = {0, 4, 2, 1, 0};
const int gl_increment_pass_by[] = {8, 8, 4, 2, 0}; const int gl_increment_pass_by[] = {8, 8, 4, 2, 0};
class GIFLoad { class GIFLoad {
public: public:
GIFLoad(BPositionIO *fInput, BPositionIO *fOutput); GIFLoad(BPositionIO *input, BPositionIO *output);
~GIFLoad(); ~GIFLoad();
bool fatalerror; bool fatalerror;