diff --git a/src/add-ons/translators/gif/GIFLoad.cpp b/src/add-ons/translators/gif/GIFLoad.cpp index c78c557692..a70dae60fa 100644 --- a/src/add-ons/translators/gif/GIFLoad.cpp +++ b/src/add-ons/translators/gif/GIFLoad.cpp @@ -28,8 +28,8 @@ GIFLoad::GIFLoad(BPositionIO *input, BPositionIO *output) fatalerror(false), fInput(input), fOutput(output), - fHeadMemblock(NULL), fPalette(NULL), + fHeadMemblock(NULL), fScanLine(NULL) { fInput->Seek(0, SEEK_SET); @@ -114,7 +114,7 @@ GIFLoad::ReadGIFHeader() fPalette = new LoadPalette(); // Global palette - if (header[10] & 0x80) { + if (header[10] & GIF_LOCALCOLORMAP) { fPalette->size_in_bits = (header[10] & 0x07) + 1; if (debug) printf("GIFLoad::ReadGIFHeader() - Found %d bit global palette\n", fPalette->size_in_bits); @@ -248,7 +248,7 @@ GIFLoad::ReadGIFImageHeader() return false; // Has local palette - if (data[8] & 0x80) { + if (data[8] & GIF_LOCALCOLORMAP) { fPalette->size_in_bits = (data[8] & 0x07) + 1; int s = 1 << fPalette->size_in_bits; fPalette->size = s; @@ -264,13 +264,11 @@ GIFLoad::ReadGIFImageHeader() } } - if (data[8] & 0x40) { - fInterlaced = true; - if (debug) + fInterlaced = data[8] & GIF_INTERLACED; + if (debug) { + if (fInterlaced) printf("GIFLoad::ReadGIFImageHeader() - Image is interlaced\n"); - } else { - fInterlaced = false; - if (debug) + else printf("GIFLoad::ReadGIFImageHeader() - Image is not interlaced\n"); } return true; diff --git a/src/add-ons/translators/gif/GIFLoad.h b/src/add-ons/translators/gif/GIFLoad.h index 823deace63..885364d835 100644 --- a/src/add-ons/translators/gif/GIFLoad.h +++ b/src/add-ons/translators/gif/GIFLoad.h @@ -19,6 +19,10 @@ #include #include "LoadPalette.h" +#define GIF_INTERLACED 0x40 +#define GIF_LOCALCOLORMAP 0x80 + + class Memblock { public: uchar data[4096]; @@ -26,12 +30,14 @@ class Memblock { Memblock *next; }; + const int gl_pass_starts_at[] = {0, 4, 2, 1, 0}; const int gl_increment_pass_by[] = {8, 8, 4, 2, 0}; + class GIFLoad { public: - GIFLoad(BPositionIO *fInput, BPositionIO *fOutput); + GIFLoad(BPositionIO *input, BPositionIO *output); ~GIFLoad(); bool fatalerror;