private static function getSuperSampleRanges(&$scanline, $width) 
    {
        $superSampleRanges = array();

        $rangeIndex = 0;
        $scanlineCount = count($scanline);

        while ($rangeIndex < $scanlineCount) {
            $range = $scanline[$rangeIndex];
            
            if ($range->fromX >= $width) {
                break;
            }
            
            $superSampleRange = new SuperSampleRange(
                $range->fromX,
                $range->fromX + $range->width
            );
            $superSampleRange->edges[] = $range->edge;
            
            $rangeIndex++;

            for ($i = $rangeIndex; $i < $scanlineCount; $i++) {
                $range = $scanline[$i];
                
                if ($range->fromX < $superSampleRange->toXExcl) {
                    $superSampleRange->toXExcl = max(
                        $superSampleRange->toXExcl, 
                        $range->fromX + $range->width);
                    $superSampleRange->edges[] = $range->edge;
                    $rangeIndex++;
                } else {
                    break;
                }
            }

            $superSampleRange->toXExcl = min($superSampleRange->toXExcl, $width);
            $superSampleRange->width = 
                $superSampleRange->toXExcl - $superSampleRange->fromX;
            
            $superSampleRanges[] = $superSampleRange;
        }

        return $superSampleRanges;
    }
private static function getSuperSampleRanges(&$scanline, $width) 
    {
        $superSampleRanges = array();

        $rangeIndex = 0;
        $scanlineCount = count($scanline);

        while ($rangeIndex < $scanlineCount) {
            $range = $scanline[$rangeIndex];
            
            if ($range->fromX >= $width) {
                break;
            }
            
            $superSampleRange = new SuperSampleRange(
                $range->fromX,
                $range->fromX + $range->width
            );
            $superSampleRange->edges[] = $range->edge;
            
            $rangeIndex++;

            for ($i = $rangeIndex; $i < $scanlineCount; $i++) {
                $range = $scanline[$i];
                
                if ($range->fromX < $superSampleRange->toXExcl) {
                    $superSampleRange->toXExcl = max(
                        $superSampleRange->toXExcl, 
                        $range->fromX + $range->width);
                    $superSampleRange->edges[] = $range->edge;
                    $rangeIndex++;
                } else {
                    break;
                }
            }

            $superSampleRange->toXExcl = min($superSampleRange->toXExcl, $width);
            $superSampleRange->width = 
                $superSampleRange->toXExcl - $superSampleRange->fromX;
            
            $superSampleRanges[] = $superSampleRange;
        }

        return $superSampleRanges;
    }
private static function getSuperSampleRanges ( & $ scanline , $ width ) { $ superSampleRanges = array ( ) ; $ rangeIndex = 0 ; $ scanlineCount = count ( $ scanline ) ; while ( $ rangeIndex < $ scanlineCount ) { $ range = $ scanline [ $ rangeIndex ] ; if ( $ range -> fromX >= $ width ) { break ; } $ superSampleRange = new SuperSampleRange ( $ range -> fromX , $ range -> fromX + $ range -> width ) ; $ superSampleRange -> edges [ ] = $ range -> edge ; $ rangeIndex ++ ; for ( $ i = $ rangeIndex ; $ i < $ scanlineCount ; $ i ++ ) { $ range = $ scanline [ $ i ] ; if ( $ range -> fromX < $ superSampleRange -> toXExcl ) { $ superSampleRange -> toXExcl = max ( $ superSampleRange -> toXExcl , $ range -> fromX + $ range -> width ) ; $ superSampleRange -> edges [ ] = $ range -> edge ; $ rangeIndex ++ ; } else { break ; } } $ superSampleRange -> toXExcl = min ( $ superSampleRange -> toXExcl , $ width ) ; $ superSampleRange -> width = $ superSampleRange -> toXExcl - $ superSampleRange -> fromX ; $ superSampleRanges [ ] = $ superSampleRange ; } return $ superSampleRanges ; }
Determines what ranges of a scanline that needs to be supersampled.

@param array $scanline  Array of edges in the current scanline.
@return array  Array of SuperSampleRange.
Determines what ranges of a scanline that needs to be supersampled .