internal bool fillTile(int tile)
{
const string module = "fillTile";
if ((m_flags & TiffFlags.NOREADRAW) != TiffFlags.NOREADRAW)
{
int bytecount = (int)m_dir.td_stripbytecount[tile];
if (bytecount <= 0)
{
ErrorExt(this, m_clientdata, m_name,
"{0}: Invalid tile byte count, tile {1}", bytecount, tile);
return false;
}
/*
* Expand raw data buffer, if needed, to
* hold data tile coming from file
* (perhaps should set upper bound on
* the size of a buffer we'll use?).
*/
if (bytecount > m_rawdatasize)
{
m_curtile = NOTILE;
if ((m_flags & TiffFlags.MYBUFFER) != TiffFlags.MYBUFFER)
{
ErrorExt(this, m_clientdata, module,
"{0}: Data buffer too small to hold tile {1}", m_name, tile);
return false;
}
ReadBufferSetup(null, roundUp(bytecount, 1024));
}
if (readRawTile1(tile, m_rawdata, 0, bytecount, module) != bytecount)
return false;
if (!isFillOrder(m_dir.td_fillorder) && (m_flags & TiffFlags.NOBITREV) != TiffFlags.NOBITREV)
ReverseBits(m_rawdata, bytecount);
}
return startTile(tile);
}