BitMiracle.LibJpeg.Classic.jpeg_decompress_struct.jpeg_finish_output C# (CSharp) Method

jpeg_finish_output() public method

Finish up after an output pass in buffered-image mode.
public jpeg_finish_output ( ) : bool
return bool
        public bool jpeg_finish_output()
        {
            if ((m_global_state == JpegState.DSTATE_SCANNING || m_global_state == JpegState.DSTATE_RAW_OK) && m_buffered_image)
            {
                /* Terminate this pass. */
                /* We do not require the whole pass to have been completed. */
                m_master.finish_output_pass();
                m_global_state = JpegState.DSTATE_BUFPOST;
            }
            else if (m_global_state != JpegState.DSTATE_BUFPOST)
            {
                /* BUFPOST = repeat call after a suspension, anything else is error */
                ERREXIT(J_MESSAGE_CODE.JERR_BAD_STATE, (int)m_global_state);
            }

            /* Read markers looking for SOS or EOI */
            while (m_input_scan_number <= m_output_scan_number && !m_inputctl.EOIReached())
            {
                if (m_inputctl.consume_input() == ReadResult.JPEG_SUSPENDED)
                {
                    /* Suspend, come back later */
                    return false;
                }
            }

            m_global_state = JpegState.DSTATE_BUFIMAGE;
            return true;
        }