bool LLImageDimensionsInfo::getImageDimensionsBmp() { // Make sure the file is long enough. const S32 DATA_LEN = 26; // BMP header (14) + DIB header size (4) + width (4) + height (4) if (!checkFileLength(DATA_LEN)) { LL_WARNS() << "Premature end of file" << LL_ENDL; return false; } // Read BMP signature. U8 signature[2]; mInfile.read((void*)signature, sizeof(signature)/sizeof(signature[0])); // Make sure this is actually a BMP file. // We only support Windows bitmaps (BM), according to LLImageBMP::updateData(). if (signature[0] != 'B' || signature[1] != 'M') { LL_WARNS() << "Not a BMP" << LL_ENDL; return false; } // Read image dimensions. mInfile.seek(APR_CUR, 16); mWidth = read_reverse_s32(); mHeight = read_reverse_s32(); return true; }
bool LLImageDimensionsInfo::getImageDimensionsBmp() { const S32 BMP_FILE_HEADER_SIZE = 14; mInfile.seek(APR_CUR,BMP_FILE_HEADER_SIZE+4); mWidth = read_reverse_s32(); mHeight = read_reverse_s32(); return true; }