Backed out changeset 177eae915693 (bug 1206581) for bustage
[gecko.git] / image / ICOFileHeaders.h
blobaae5c99e82fa46f7bf9feb419f036bd895e525fb
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_image_ICOFileHeaders_h
7 #define mozilla_image_ICOFileHeaders_h
9 namespace mozilla {
10 namespace image {
12 #define ICONFILEHEADERSIZE 6
13 #define ICODIRENTRYSIZE 16
14 #define PNGSIGNATURESIZE 8
15 #define BMPFILEHEADERSIZE 14
17 /**
18 * The header that comes right at the start of an icon file. (This
19 * corresponds to the Windows ICONDIR structure.)
21 struct IconFileHeader
23 /**
24 * Must be set to 0;
26 uint16_t mReserved;
27 /**
28 * 1 for icon (.ICO) image (or 2 for cursor (.CUR) image (icon with the
29 * addition of a hotspot), but we don't support cursor).
31 uint16_t mType;
32 /**
33 * The number of BMP/PNG images contained in the icon file.
35 uint16_t mCount;
38 /**
39 * For each BMP/PNG image that the icon file contains there must be a
40 * corresponding icon dir entry. (This corresponds to the Windows
41 * ICONDIRENTRY structure.) These entries are encoded directly after the
42 * IconFileHeader.
44 struct IconDirEntry
46 uint8_t mWidth;
47 uint8_t mHeight;
48 /**
49 * The number of colors in the color palette of the BMP/PNG that this dir
50 * entry corresponds to, or 0 if the image does not use a color palette.
52 uint8_t mColorCount;
53 /**
54 * Should be set to 0.
56 uint8_t mReserved;
57 union {
58 uint16_t mPlanes; // ICO
59 uint16_t mXHotspot; // CUR
61 union {
62 uint16_t mBitCount; // ICO (bits per pixel)
63 uint16_t mYHotspot; // CUR
65 /**
66 * "bytes in resource" is the length of the encoded BMP/PNG that this dir
67 * entry corresponds to.
69 uint32_t mBytesInRes;
70 /**
71 * The offset of the start of the encoded BMP/PNG that this dir entry
72 * corresponds to (from the start of the icon file).
74 uint32_t mImageOffset;
78 } // namespace image
79 } // namespace mozilla
81 #endif // mozilla_image_ICOFileHeaders_h