… | |
… | |
274 | h = w; |
274 | h = w; |
275 | else if (!(geom_flags & WidthValue)) |
275 | else if (!(geom_flags & WidthValue)) |
276 | w = h; |
276 | w = h; |
277 | } |
277 | } |
278 | |
278 | |
279 | min_it (w, 1000); |
|
|
280 | min_it (h, 1000); |
|
|
281 | clamp_it (x, -100, 200); |
279 | clamp_it (x, -100, 200); |
282 | clamp_it (y, -100, 200); |
280 | clamp_it (y, -100, 200); |
283 | |
281 | |
284 | if (flags != new_flags |
282 | if (flags != new_flags |
285 | || h_scale != w |
283 | || h_scale != w |
… | |
… | |
310 | { |
308 | { |
311 | int image_width = image.width (); |
309 | int image_width = image.width (); |
312 | int image_height = image.height (); |
310 | int image_height = image.height (); |
313 | int target_width = szHint.width; |
311 | int target_width = szHint.width; |
314 | int target_height = szHint.height; |
312 | int target_height = szHint.height; |
|
|
313 | int h_scale = min (image.h_scale, 32767 * 100 / target_width); |
|
|
314 | int v_scale = min (image.v_scale, 32767 * 100 / target_height); |
315 | |
315 | |
316 | w = image.h_scale * target_width / 100; |
316 | w = h_scale * target_width / 100; |
317 | h = image.v_scale * target_height / 100; |
317 | h = v_scale * target_height / 100; |
318 | |
318 | |
319 | if (image.flags & IM_KEEP_ASPECT) |
319 | if (image.flags & IM_KEEP_ASPECT) |
320 | { |
320 | { |
321 | float scale = (float)w / image_width; |
321 | float scale = (float)w / image_width; |
322 | min_it (scale, (float)h / image_height); |
322 | min_it (scale, (float)h / image_height); |