BitMiracle.LibJpeg.Classic.Internal.jpeg_c_prep_controller.jpeg_c_prep_controller C# (CSharp) Method

jpeg_c_prep_controller() public method

public jpeg_c_prep_controller ( jpeg_compress_struct cinfo ) : System
cinfo jpeg_compress_struct
return System
        public jpeg_c_prep_controller(jpeg_compress_struct cinfo)
        {
            m_cinfo = cinfo;

            /* Allocate the color conversion buffer.
            * We make the buffer wide enough to allow the downsampler to edge-expand
            * horizontally within the buffer, if it so chooses.
            */
            if (cinfo.m_downsample.NeedContextRows())
            {
                /* Set up to provide context rows */
                create_context_buffer();
            }
            else
            {
                /* No context, just make it tall enough for one row group */
                for (int ci = 0; ci < cinfo.m_num_components; ci++)
                {
                    m_colorBufRowsOffset = 0;
                    m_color_buf[ci] = jpeg_compress_struct.AllocJpegSamples(
                        (cinfo.Component_info[ci].Width_in_blocks *
                        cinfo.min_DCT_h_scaled_size * cinfo.m_max_h_samp_factor) / 
                        cinfo.Component_info[ci].H_samp_factor,
                        cinfo.m_max_v_samp_factor);
                }
            }
        }