private static function getSrcSetUrlCustom($size, $custom, $setWidthInUrl, UriInterface $uri)
    {
        // if custom is eg '2x', add options-dpr-
        if (preg_match('#^([0-9]+)x$#', $custom, $matches)) {
            $uri = self::addOptionsToUri($uri, 'options-dpr-'.$matches[1].
                ($setWidthInUrl ? '--resize-width-'.(int) ceil($size / $matches[1]) : ''));
        } else {
            $stack = new StackUri();
            $stack->addOverridingOptions($custom);
            // if dpr is given in custom option, but not width, calculate correct width
            $resizeOperations = $stack->getStackOperationsByName('resize');
            $widthIsNotSet = true;
            foreach ($resizeOperations as $resizeOperation) {
                if (isset($resizeOperation->options['width'])) {
                    $widthIsNotSet = false;
                }
            }
            $options = $stack->getStackOptions();
            if (isset($options['dpr']) && $widthIsNotSet && $setWidthInUrl) {
                $custom .= '--resize-width-'.(int) ceil($size / $options['dpr']);
            }

            $uri = self::addOptionsToUri($uri, $custom);
        }

        return $uri;
    }