[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27842] branches/soc-2008-mxcurioni/source /blender/freestyle/intern/blender_interface/FRS_freestyle.cpp: Fixed the border option that was not functional when the crop option

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Mon Mar 29 23:58:59 CEST 2010


Revision: 27842
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27842
Author:   kjym3
Date:     2010-03-29 23:58:58 +0200 (Mon, 29 Mar 2010)

Log Message:
-----------
Fixed the border option that was not functional when the crop option
was turned off.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-03-29 18:29:54 UTC (rev 27841)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp	2010-03-29 21:58:58 UTC (rev 27842)
@@ -187,10 +187,9 @@
 	
 	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 @@
 		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;
+		dest_rectx = rl->rectx;
+		dest_recty = rl->recty;
+		//cout << "dest: " << dest_rectx << " x " << dest_recty << endl;
 
-	    for( y = 0; y < recty; y++) {
-	        for( x = 0; x < rectx; x++) {
-
-	            pixSrc = src + 4 * (rectx * y + x);
+		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 ) {





More information about the Bf-blender-cvs mailing list