Fix BI viewport render crash happening with zero render border area

This is better to be backported to the 2.72.
This commit is contained in:
Sergey Sharybin 2014-09-29 20:51:00 +06:00
parent 873954108a
commit 89c834143e
1 changed files with 19 additions and 17 deletions

View File

@ -699,25 +699,27 @@ static void render_result_rescale(Render *re)
RR_USE_MEM,
RR_ALL_LAYERS);
dst_rectf = re->result->rectf;
if (dst_rectf == NULL) {
RenderLayer *rl;
rl = render_get_active_layer(re, re->result);
if (rl != NULL) {
dst_rectf = rl->rectf;
if (re->result != NULL) {
dst_rectf = re->result->rectf;
if (dst_rectf == NULL) {
RenderLayer *rl;
rl = render_get_active_layer(re, re->result);
if (rl != NULL) {
dst_rectf = rl->rectf;
}
}
}
scale_x = (float) result->rectx / re->result->rectx;
scale_y = (float) result->recty / re->result->recty;
for (x = 0; x < re->result->rectx; ++x) {
for (y = 0; y < re->result->recty; ++y) {
int src_x = x * scale_x,
src_y = y * scale_y;
int dst_index = y * re->result->rectx + x,
src_index = src_y * result->rectx + src_x;
copy_v4_v4(dst_rectf + dst_index * 4,
src_rectf + src_index * 4);
scale_x = (float) result->rectx / re->result->rectx;
scale_y = (float) result->recty / re->result->recty;
for (x = 0; x < re->result->rectx; ++x) {
for (y = 0; y < re->result->recty; ++y) {
int src_x = x * scale_x,
src_y = y * scale_y;
int dst_index = y * re->result->rectx + x,
src_index = src_y * result->rectx + src_x;
copy_v4_v4(dst_rectf + dst_index * 4,
src_rectf + src_index * 4);
}
}
}
}