res_tmpl.format = index_format;
if (destination_rect) {
- res_tmpl.width0 = abs(destination_rect->x0-destination_rect->x1);
- res_tmpl.height0 = abs(destination_rect->y0-destination_rect->y1);
+ if (destination_rect->x1 > destination_rect->x0 &&
+ destination_rect->y1 > destination_rect->y0) {
+ res_tmpl.width0 = destination_rect->x1 - destination_rect->x0;
+ res_tmpl.height0 = destination_rect->y1 - destination_rect->y0;
+ }
} else {
res_tmpl.width0 = vlsurface->surface->texture->width0;
res_tmpl.height0 = vlsurface->surface->texture->height0;
vtmpl.buffer_format = format;
if (destination_rect) {
- vtmpl.width = abs(destination_rect->x0-destination_rect->x1);
- vtmpl.height = abs(destination_rect->y0-destination_rect->y1);
+ if (destination_rect->x1 > destination_rect->x0 &&
+ destination_rect->y1 > destination_rect->y0) {
+ vtmpl.width = destination_rect->x1 - destination_rect->x0;
+ vtmpl.height = destination_rect->y1 - destination_rect->y0;
+ }
} else {
vtmpl.width = vlsurface->surface->texture->width0;
vtmpl.height = vlsurface->surface->texture->height0;
box.depth = 1;
if (rect) {
- box.x = MIN2(rect->x0, rect->x1);
- box.y = MIN2(rect->y0, rect->y1);
- box.width = abs(rect->x1 - rect->x0);
- box.height = abs(rect->y1 - rect->y0);
+ if (rect->x1 > rect->x0 &&
+ rect->y1 > rect->y0) {
+ box.x = rect->x0;
+ box.y = rect->y0;
+ box.width = rect->x1 - box.x;
+ box.height = rect->y1 - box.y;
+ } else {
+ box.width = 0;
+ box.height = 0;
+ }
}
return box;