diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-30 04:41:26 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-03-30 04:41:26 +0400 |
commit | 08e022da3700eb7c3b2a7c64ddbbdf0a8c9594f9 (patch) | |
tree | dd0db56487e37f7ba8424b931ec62cddd98505a1 /source/blender | |
parent | a090f169994d0832a603ad871b3147e7ca938656 (diff) |
Second attempt to fix the border option. At the moment, accessing
diffuse and Z depth information through style modules won't work
correctly with the border option. Another fix will follow.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | 2 | ||||
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp | 29 |
2 files changed, 12 insertions, 19 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index e85a685de98..a03b7eb4c58 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -326,6 +326,8 @@ Render* BlenderStrokeRenderer::RenderScene( Render *re ) { freestyle_scene->r.scemode &= ~( R_SINGLE_LAYER ); freestyle_scene->r.planes = R_PLANES32; freestyle_scene->r.imtype = R_PNG; + if (freestyle_scene->r.mode & R_BORDER) + freestyle_scene->r.mode |= R_CROP; Render *freestyle_render = RE_NewRender(freestyle_scene->id.name); diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp index 30e43018e25..8ea66d7350f 100644 --- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp +++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp @@ -189,7 +189,7 @@ extern "C" { { RenderLayer *rl; float *src, *dest, *pixSrc, *pixDest; - int x, y, src_rectx, src_recty, dest_rectx, dest_recty, x_offset, y_offset; + int x, y, rectx, recty; if( freestyle_render == NULL || freestyle_render->result == NULL ) return; @@ -197,29 +197,20 @@ 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; - src_rectx = rl->rectx; - src_recty = rl->recty; - //cout << "src: " << src_rectx << " x " << src_recty << endl; + //cout << "src: " << rl->rectx << " x " << rl->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; - 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)); + //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); if( pixSrc[3] > 0.0) { - pixDest = dest + 4 * (dest_rectx * y + x); + pixDest = dest + 4 * (rectx * y + x); addAlphaOverFloat(pixDest, pixSrc); } } |