private static void RenderNonRetinaCss(HtmlHelper helper, ContentReference image, string mediaQuery, StringBuilder stringBuilder, string className, PictureSize allowedSize, ResizedImageFormat format) { if (!string.IsNullOrEmpty(mediaQuery)) { stringBuilder.Append($"@media ({mediaQuery}) {{"); } RenderBackgroundCssClass(helper, image, stringBuilder, className, Math.Min(allowedSize.ImageWidth, MaxResizedImageWidth), format); if (!string.IsNullOrEmpty(mediaQuery)) { stringBuilder.Append("}"); // media query close } }
private static void RenderRetinaCss(HtmlHelper helper, ContentReference image, string mediaQuery, StringBuilder stringBuilder, string className, PictureSize allowedSize, ResizedImageFormat format) { var mediaQuerySelector = string.IsNullOrEmpty(mediaQuery) ? "" : $"and ({mediaQuery})"; stringBuilder.Append($@"@media (-webkit-min-device-pixel-ratio: 2) {mediaQuerySelector}, (min--moz-device-pixel-ratio: 2) {mediaQuerySelector}, (-o-min-device-pixel-ratio: 2/1) {mediaQuerySelector}, ( min-device-pixel-ratio: 2) {mediaQuerySelector} {{"); RenderBackgroundCssClass(helper, image, stringBuilder, className, Math.Min(allowedSize.ImageWidth * 2, MaxResizedImageWidth), format); stringBuilder.Append("}"); }