diff options
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 001da72771b..30e43018e25 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -187,10 +187,9 @@ extern "C" { void FRS_composite_result(Render* re, SceneRenderLayer* srl, Render* freestyle_render) { - RenderLayer *rl; float *src, *dest, *pixSrc, *pixDest; - int x, y, rectx, recty; + int x, y, src_rectx, src_recty, dest_rectx, dest_recty, x_offset, y_offset; if( freestyle_render == NULL || freestyle_render->result == NULL ) return; @@ -198,27 +197,33 @@ extern "C" { rl = render_get_active_layer( freestyle_render, freestyle_render->result ); if( !rl || rl->rectf == NULL) { cout << "Cannot find Freestyle result image" << endl; return; } src = rl->rectf; - //cout << "src: " << rl->rectx << " x " << rl->recty << endl; + src_rectx = rl->rectx; + src_recty = rl->recty; + //cout << "src: " << src_rectx << " x " << src_recty << endl; rl = RE_GetRenderLayer(re->result, srl->name); if( !rl || rl->rectf == NULL) { cout << "No layer to composite to" << endl; return; } dest = rl->rectf; - //cout << "dest: " << rl->rectx << " x " << rl->recty << endl; - - rectx = re->rectx; - recty = re->recty; - - for( y = 0; y < recty; y++) { - for( x = 0; x < rectx; x++) { - - pixSrc = src + 4 * (rectx * y + x); + dest_rectx = rl->rectx; + dest_recty = rl->recty; + //cout << "dest: " << dest_rectx << " x " << dest_recty << endl; + + if (re->r.mode & R_BORDER && !(re->r.mode & R_CROP)) { + x_offset = re->disprect.xmin; + y_offset = re->disprect.ymin; + } else { + x_offset = 0; + y_offset = 0; + } + for( y = 0; y < dest_recty; y++) { + for( x = 0; x < dest_rectx; x++) { + pixSrc = src + 4 * (src_rectx * (y + y_offset) + (x + x_offset)); if( pixSrc[3] > 0.0) { - pixDest = dest + 4 * (rectx * y + x); + pixDest = dest + 4 * (dest_rectx * y + x); addAlphaOverFloat(pixDest, pixSrc); - } - } + } + } } - } int displayed_layer_count( SceneRenderLayer* srl ) { |