BitMiracle.LibTiff.Classic.Tiff.fillStrip C# (CSharp) Method

fillStrip() private method

Read the specified strip and setup for decoding. The data buffer is expanded, as necessary, to hold the strip's data.
private fillStrip ( int strip ) : bool
strip int
return bool
        internal bool fillStrip(int strip)
        {
            const string module = "fillStrip";

            if ((m_flags & TiffFlags.NOREADRAW) != TiffFlags.NOREADRAW)
            {
                int bytecount = (int)m_dir.td_stripbytecount[strip];
                if (bytecount <= 0)
                {
                    ErrorExt(this, m_clientdata, m_name,
                        "{0}: Invalid strip byte count, strip {1}", bytecount, strip);
                    return false;
                }

                /*
                 * Expand raw data buffer, if needed, to
                 * hold data strip coming from file
                 * (perhaps should set upper bound on
                 *  the size of a buffer we'll use?).
                 */
                if (bytecount > m_rawdatasize)
                {
                    m_curstrip = NOSTRIP;
                    if ((m_flags & TiffFlags.MYBUFFER) != TiffFlags.MYBUFFER)
                    {
                        ErrorExt(this, m_clientdata, module,
                            "{0}: Data buffer too small to hold strip {1}", m_name, strip);
                        return false;
                    }

                    ReadBufferSetup(null, roundUp(bytecount, 1024));
                }

                if (readRawStrip1(strip, 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 startStrip(strip);
        }
Tiff