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

View File

@ -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;

View File

@ -19,6 +19,10 @@
#include <DataIO.h>
#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;