TCP: Fixed RTO update and dup ACKs generation.
[haiku.git] / src / add-ons / translators / gif / LoadPalette.cpp
blob71f8734c140aec4ef0e62d83026052db04f83553
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: LoadPalette.cpp
4 //
5 // Date: December 1999
6 //
7 // Author: Daniel Switkin
8 //
9 // Copyright 2003 (c) by Daniel Switkin. This file is made publically available
10 // under the BSD license, with the stipulations that this complete header must
11 // remain at the top of the file indefinitely, and credit must be given to the
12 // original author in any about box using this software.
14 ////////////////////////////////////////////////////////////////////////////////
16 // Additional authors: John Scipione, <jscipione@gmail.com>
19 #include "LoadPalette.h"
21 #include <GraphicsDefs.h>
22 #include <ByteOrder.h>
25 LoadPalette::LoadPalette() {
26 backgroundindex = 0;
27 usetransparent = false;
28 transparentindex = 0;
29 size = size_in_bits = 0;
33 uint32
34 LoadPalette::ColorForIndex(int index)
36 // never index into pal directly - this function is safe
37 if (index >= 0 && index <= size) {
38 if (usetransparent && index == transparentindex)
39 return B_TRANSPARENT_MAGIC_RGBA32;
40 else
41 return data[index];
42 } else
43 return B_BENDIAN_TO_HOST_INT32(0x000000ff);
47 void
48 LoadPalette::SetColor(int index, uint8 red, uint8 green, uint8 blue)
50 if (index < 0 || index > 255)
51 return;
53 data[index] = (blue << 24) + (green << 16) + (red << 8) + 0xff;
54 data[index] = B_BENDIAN_TO_HOST_INT32(data[index]);