gecko/image/BMPHeaders.h
Nicholas Nethercote 8ef8ffb5d0 Bug 1215334 (part 1) - Avoid creating a fake header for BMP files in ICO files. r=seth.
The FileHeader and V5InfoHeader structs are shared by the BMP decoder and
encoder. But most of the fields within those structs are actually unused by the
decoder. It makes things clearer if we create a decoder-only struct that
contains the used fields, and then make FileHeader and V5InfoHeader only used
by the encoder. This patch does that.

This patch also renames BMPFileHeaders.h as BMPHeaders.h, which is now a better
name for it.
2015-10-15 15:43:25 -07:00

37 lines
934 B
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_image_BMPHeaders_h
#define mozilla_image_BMPHeaders_h
#include <stddef.h>
#include <stdint.h>
namespace mozilla {
namespace image {
namespace bmp {
// The length of the file header as defined in the BMP spec.
static const size_t FILE_HEADER_LENGTH = 14;
// This lengths of the info header for the different BMP versions.
struct InfoHeaderLength {
enum {
WIN_V2 = 12,
WIN_V3 = 40,
WIN_V4 = 108,
WIN_V5 = 124,
// OS2_V1 is omitted; it's the same as WIN_V2.
OS2_V2_MIN = 16, // Minimum allowed value for OS2v2.
OS2_V2_MAX = 64, // Maximum allowed value for OS2v2.
};
};
} // namespace bmp
} // namespace image
} // namespace mozilla
#endif // mozilla_image_BMPHeaders_h