… | |
… | |
201 | x = y = 0; |
201 | x = y = 0; |
202 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
202 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
203 | } |
203 | } |
204 | else if (!strcasecmp (arr[i], "style=aspect-stretched")) |
204 | else if (!strcasecmp (arr[i], "style=aspect-stretched")) |
205 | { |
205 | { |
206 | new_flags = BG_PROP_SCALE; |
206 | new_flags = BG_KEEP_ASPECT; |
207 | w = h = windowScale; |
207 | w = h = windowScale; |
208 | x = y = centerAlign; |
208 | x = y = centerAlign; |
209 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
209 | geom_flags = WidthValue|HeightValue|XValue|YValue; |
210 | } |
210 | } |
211 | else if (!strcasecmp (arr[i], "style=stretched")) |
211 | else if (!strcasecmp (arr[i], "style=stretched")) |
… | |
… | |
227 | w = h = noScale; |
227 | w = h = noScale; |
228 | geom_flags = WidthValue|HeightValue; |
228 | geom_flags = WidthValue|HeightValue; |
229 | } |
229 | } |
230 | else if (!strcasecmp (arr[i], "op=tile")) |
230 | else if (!strcasecmp (arr[i], "op=tile")) |
231 | new_flags |= BG_TILE; |
231 | new_flags |= BG_TILE; |
232 | else if (!strcasecmp (arr[i], "op=pscale")) |
232 | else if (!strcasecmp (arr[i], "op=keep-aspect")) |
233 | new_flags |= BG_PROP_SCALE; |
233 | new_flags |= BG_KEEP_ASPECT; |
234 | else if (!strcasecmp (arr[i], "op=root")) |
234 | else if (!strcasecmp (arr[i], "op=root-align")) |
235 | new_flags |= BG_ROOT_ALIGN; |
235 | new_flags |= BG_ROOT_ALIGN; |
236 | |
236 | |
237 | // deprecated |
237 | // deprecated |
238 | else if (!strcasecmp (arr[i], "tile")) |
238 | else if (!strcasecmp (arr[i], "tile")) |
239 | { |
239 | { |
… | |
… | |
241 | w = h = noScale; |
241 | w = h = noScale; |
242 | geom_flags |= WidthValue|HeightValue; |
242 | geom_flags |= WidthValue|HeightValue; |
243 | } |
243 | } |
244 | else if (!strcasecmp (arr[i], "propscale")) |
244 | else if (!strcasecmp (arr[i], "propscale")) |
245 | { |
245 | { |
246 | new_flags |= BG_PROP_SCALE; |
246 | new_flags |= BG_KEEP_ASPECT; |
247 | } |
247 | } |
248 | else if (!strcasecmp (arr[i], "hscale")) |
248 | else if (!strcasecmp (arr[i], "hscale")) |
249 | { |
249 | { |
250 | new_flags |= BG_TILE; |
250 | new_flags |= BG_TILE; |
251 | w = windowScale; |
251 | w = windowScale; |
… | |
… | |
299 | w = h; |
299 | w = h; |
300 | |
300 | |
301 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
301 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
302 | } |
302 | } |
303 | |
303 | |
304 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w) |
304 | if (check_set_scale_value (geom_flags, WidthValue, h_scale, w)) changed = true; |
305 | || check_set_scale_value (geom_flags, HeightValue, v_scale, h) |
305 | if (check_set_scale_value (geom_flags, HeightValue, v_scale, h)) changed = true; |
306 | || check_set_align_value (geom_flags, XValue, h_align, x) |
306 | if (check_set_align_value (geom_flags, XValue, h_align, x)) changed = true; |
307 | || check_set_align_value (geom_flags, YValue, v_align, y)) |
307 | if (check_set_align_value (geom_flags, YValue, v_align, y)) changed = true; |
308 | changed = true; |
|
|
309 | |
308 | |
310 | if (new_flags != bg_flags) |
309 | if (new_flags != bg_flags) |
311 | { |
310 | { |
312 | bg_flags = new_flags; |
311 | bg_flags = new_flags; |
313 | changed = true; |
312 | changed = true; |
… | |
… | |
323 | int target_height = szHint.height; |
322 | int target_height = szHint.height; |
324 | |
323 | |
325 | w = h_scale * target_width / 100; |
324 | w = h_scale * target_width / 100; |
326 | h = v_scale * target_height / 100; |
325 | h = v_scale * target_height / 100; |
327 | |
326 | |
328 | if (bg_flags & BG_PROP_SCALE) |
327 | if (bg_flags & BG_KEEP_ASPECT) |
329 | { |
328 | { |
330 | float scale = (float)w / image_width; |
329 | float scale = (float)w / image_width; |
331 | min_it (scale, (float)h / image_height); |
330 | min_it (scale, (float)h / image_height); |
332 | w = image_width * scale + 0.5; |
331 | w = image_width * scale + 0.5; |
333 | h = image_height * scale + 0.5; |
332 | h = image_height * scale + 0.5; |