( ctx context.Context, features *clientfeatures.Features, )
| 143 | } |
| 144 | |
| 145 | func (p *Parser) defaultProcessingOptions( |
| 146 | ctx context.Context, |
| 147 | features *clientfeatures.Features, |
| 148 | ) (*options.Options, error) { |
| 149 | o := options.New() |
| 150 | |
| 151 | if features != nil { |
| 152 | if features.PreferWebP || features.EnforceWebP { |
| 153 | o.Set(keys.PreferWebP, true) |
| 154 | } |
| 155 | |
| 156 | if features.EnforceWebP { |
| 157 | o.Set(keys.EnforceWebP, true) |
| 158 | } |
| 159 | |
| 160 | if features.PreferAvif || features.EnforceAvif { |
| 161 | o.Set(keys.PreferAvif, true) |
| 162 | } |
| 163 | |
| 164 | if features.EnforceAvif { |
| 165 | o.Set(keys.EnforceAvif, true) |
| 166 | } |
| 167 | |
| 168 | if features.PreferJxl || features.EnforceJxl { |
| 169 | o.Set(keys.PreferJxl, true) |
| 170 | } |
| 171 | |
| 172 | if features.EnforceJxl { |
| 173 | o.Set(keys.EnforceJxl, true) |
| 174 | } |
| 175 | |
| 176 | dpr := 1.0 |
| 177 | |
| 178 | if features.ClientHintsDPR > 0 { |
| 179 | o.Set(keys.Dpr, features.ClientHintsDPR) |
| 180 | dpr = features.ClientHintsDPR |
| 181 | } |
| 182 | |
| 183 | if features.ClientHintsWidth > 0 { |
| 184 | o.Set(keys.Width, imath.Shrink(features.ClientHintsWidth, dpr)) |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if _, ok := p.presets["default"]; ok { |
| 189 | if err := p.applyPresetOption(ctx, o, []string{"default"}); err != nil { |
| 190 | return o, err |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return o, nil |
| 195 | } |
| 196 | |
| 197 | // ParsePath parses the given request path and returns the processing options and image URL |
| 198 | func (p *Parser) ParsePath( |
no test coverage detected