[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48889] branches/soc-2011-tomato: svn merge ^/trunk/blender -r48868:48888
Campbell Barton
ideasman42 at gmail.com
Fri Jul 13 14:06:34 CEST 2012
Revision: 48889
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48889
Author: campbellbarton
Date: 2012-07-13 12:06:31 +0000 (Fri, 13 Jul 2012)
Log Message:
-----------
svn merge ^/trunk/blender -r48868:48888
Revision Links:
--------------
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48868
Modified Paths:
--------------
branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt
branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
branches/soc-2011-tomato/source/blender/blenkernel/intern/particle_system.c
branches/soc-2011-tomato/source/blender/blenlib/BLI_math_geom.h
branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
branches/soc-2011-tomato/source/blender/compositor/intern/COM_MemoryBuffer.cpp
branches/soc-2011-tomato/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/nodes/COM_DefocusNode.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_DisplaceOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h
branches/soc-2011-tomato/source/blender/compositor/operations/COM_GaussianXBlurOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_GaussianYBlurOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_MaskOperation.h
branches/soc-2011-tomato/source/blender/compositor/operations/COM_MixBaseOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_MixBaseOperation.h
branches/soc-2011-tomato/source/blender/compositor/operations/COM_OpenCLKernels.cl
branches/soc-2011-tomato/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.cpp
branches/soc-2011-tomato/source/blender/compositor/operations/COM_VariableSizeBokehBlurOperation.h
branches/soc-2011-tomato/source/creator/CMakeLists.txt
Added Paths:
-----------
branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c
Property Changed:
----------------
branches/soc-2011-tomato/
branches/soc-2011-tomato/source/blender/editors/interface/interface.c
branches/soc-2011-tomato/source/blender/editors/space_outliner/
Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48868
+ /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-48888
Modified: branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h 2012-07-13 12:03:53 UTC (rev 48888)
+++ branches/soc-2011-tomato/source/blender/blenkernel/BKE_mask.h 2012-07-13 12:06:31 UTC (rev 48889)
@@ -64,6 +64,8 @@
/* splines */
struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay);
+int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const int resol);
+
float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2];
float (*BKE_mask_spline_feather_differentiated_points(struct MaskSpline *spline, int *tot_feather_point))[2];
@@ -203,4 +205,21 @@
#define MASKPOINT_SEL_HANDLE(p) { (p)->bezt.f1 |= SELECT; (p)->bezt.f3 |= SELECT; } (void)0
#define MASKPOINT_DESEL_HANDLE(p) { (p)->bezt.f1 &= ~SELECT; (p)->bezt.f3 &= ~SELECT; } (void)0
-#endif
+/* disable to test alternate rasterizer */
+#define USE_RASKTER
+
+/* mask_rasterize.c */
+#ifndef USE_RASKTER
+struct MaskRasterHandle;
+typedef struct MaskRasterHandle MaskRasterHandle;
+
+MaskRasterHandle *BLI_maskrasterize_handle_new(void);
+void BLI_maskrasterize_handle_free(MaskRasterHandle *mr_handle);
+void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+ const int width, const int height,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather);
+float BLI_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]);
+#endif /* USE_RASKTER */
+
+#endif /* __BKE_MASK_H__ */
Modified: branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt 2012-07-13 12:03:53 UTC (rev 48888)
+++ branches/soc-2011-tomato/source/blender/blenkernel/CMakeLists.txt 2012-07-13 12:06:31 UTC (rev 48889)
@@ -101,6 +101,7 @@
intern/lamp.c
intern/lattice.c
intern/library.c
+ intern/mask_rasterize.c
intern/mask.c
intern/material.c
intern/mball.c
Modified: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c 2012-07-13 12:03:53 UTC (rev 48888)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask.c 2012-07-13 12:06:31 UTC (rev 48889)
@@ -329,7 +329,7 @@
return resol;
}
-static int mask_spline_points_calc_tot(const MaskSpline *spline, const int resol)
+int BKE_mask_spline_differentiate_calc_total(const MaskSpline *spline, const int resol)
{
int len;
@@ -353,7 +353,7 @@
MaskSplinePoint *point, *prev;
float (*diff_points)[2], (*fp)[2];
- const int tot = mask_spline_points_calc_tot(spline, resol);
+ const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
int a;
if (spline->tot_point <= 1) {
@@ -427,7 +427,7 @@
MaskSplinePoint *point, *prev;
float (*feather)[2], (*fp)[2];
- const int tot = mask_spline_points_calc_tot(spline, resol);
+ const int tot = BKE_mask_spline_differentiate_calc_total(spline, resol);
int a;
/* tot+1 because of 'forward_diff_bezier' function */
Copied: branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c (from rev 48888, trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c)
===================================================================
--- branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c (rev 0)
+++ branches/soc-2011-tomato/source/blender/blenkernel/intern/mask_rasterize.c 2012-07-13 12:06:31 UTC (rev 48889)
@@ -0,0 +1,638 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2012 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation,
+ * Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/mask_rasterize.c
+ * \ingroup bke
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_vec_types.h"
+#include "DNA_mask_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_kdopbvh.h"
+#include "BLI_scanfill.h"
+
+#include "BLI_math.h"
+#include "BLI_rect.h"
+#include "BLI_listbase.h"
+#include "BLI_mempool.h"
+
+#include "BKE_mask.h"
+
+#ifndef USE_RASKTER
+
+#define RESOL 32
+
+/**
+ * A single #MaskRasterHandle contains multile #MaskRasterLayer's,
+ * each #MaskRasterLayer does its own lookup which contributes to
+ * the final pixel with its own blending mode and the final pixel is blended between these.
+ */
+
+/* internal use only */
+typedef struct MaskRasterLayer {
+ /* xy raytree */
+ BVHTree *bvhtree;
+
+ /* 2d bounds (to quickly skip raytree lookup) */
+ rctf bounds;
+
+ /* geometry */
+ unsigned int (*tri_array)[4]; /* access coords tri/quad */
+ float (*tri_coords)[3]; /* xy, z 0-1 (1.0 == filled) */
+
+
+ /* copied direct from #MaskLayer.--- */
+ /* blending options */
+ float alpha;
+ char blend;
+ char blend_flag;
+
+} MaskRasterLayer;
+
+
+/**
+ * opaque local struct for mask pixel lookup, each MaskLayer needs one of these
+ */
+struct MaskRasterHandle {
+ MaskRasterLayer *layers;
+ unsigned int layers_tot;
+
+ /* 2d bounds (to quickly skip raytree lookup) */
+ rctf bounds;
+};
+
+MaskRasterHandle *BLI_maskrasterize_handle_new(void)
+{
+ MaskRasterHandle *mr_handle;
+
+ mr_handle = MEM_callocN(sizeof(MaskRasterHandle), STRINGIFY(MaskRasterHandle));
+
+ return mr_handle;
+}
+
+void BLI_maskrasterize_handle_free(MaskRasterHandle *mr_handle)
+{
+ const unsigned int layers_tot = mr_handle->layers_tot;
+ unsigned int i;
+ MaskRasterLayer *raslayers = mr_handle->layers;
+
+ /* raycast vars */
+ for (i = 0; i < layers_tot; i++, raslayers++) {
+ BLI_bvhtree_free(raslayers->bvhtree);
+
+ if (raslayers->tri_array) {
+ MEM_freeN(raslayers->tri_array);
+ }
+
+ if (raslayers->tri_coords) {
+ MEM_freeN(raslayers->tri_coords);
+ }
+ }
+
+ MEM_freeN(mr_handle->layers);
+ MEM_freeN(mr_handle);
+}
+
+#define PRINT_MASK_DEBUG printf
+
+#define SF_EDGE_IS_BOUNDARY 0xff
+
+#define SF_KEYINDEX_TEMP_ID ((unsigned int) -1)
+
+
+void maskrasterize_spline_differentiate_point_inset(float (*diff_feather_points)[2], float (*diff_points)[2],
+ const int tot_diff_point, const float ofs, const int do_test)
+{
+ int k_prev = tot_diff_point - 2;
+ int k_curr = tot_diff_point - 1;
+ int k_next = 0;
+
+ int k;
+
+ float d_prev[2];
+ float d_next[2];
+ float d[2];
+
+ const float *co_prev;
+ const float *co_curr;
+ const float *co_next;
+
+ const float ofs_squared = ofs * ofs;
+
+ co_prev = diff_points[k_prev];
+ co_curr = diff_points[k_curr];
+ co_next = diff_points[k_next];
+
+ /* precalc */
+ sub_v2_v2v2(d_prev, co_prev, co_curr);
+ normalize_v2(d_prev);
+
+ /* TODO, speedup by only doing one normalize per iter */
+
+
+ for (k = 0; k < tot_diff_point; k++) {
+
+ co_prev = diff_points[k_prev];
+ co_curr = diff_points[k_curr];
+ co_next = diff_points[k_next];
+
+ /* sub_v2_v2v2(d_prev, co_prev, co_curr); */ /* precalc */
+ sub_v2_v2v2(d_next, co_curr, co_next);
+
+ /* normalize_v2(d_prev); */ /* precalc */
+ normalize_v2(d_next);
+
+ if ((do_test == FALSE) ||
+ (len_squared_v2v2(diff_feather_points[k], diff_points[k]) < ofs_squared))
+ {
+
+ add_v2_v2v2(d, d_prev, d_next);
+
+ normalize_v2(d);
+
+ diff_feather_points[k][0] = diff_points[k][0] + ( d[1] * ofs);
+ diff_feather_points[k][1] = diff_points[k][1] + (-d[0] * ofs);
+ }
+
+ /* use next iter */
+ copy_v2_v2(d_prev, d_next);
+
+ k_prev = k_curr;
+ k_curr = k_next;
+ k_next++;
+ }
+}
+
+#define TRI_VERT ((unsigned int) -1)
+
+void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask,
+ const int width, const int height,
+ const short do_aspect_correct, const short do_mask_aa,
+ const short do_feather)
+{
+ /* TODO: real size */
+ const int resol = RESOL;
+ const float aa_filter_size = 1.0f / MIN2(width, height);
+
+ const float zvec[3] = {0.0f, 0.0f, 1.0f};
+ MaskLayer *masklay;
+ int masklay_index;
+
+ mr_handle->layers_tot = BLI_countlist(&mask->masklayers);
+ mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, STRINGIFY(MaskRasterLayer));
+ BLI_rctf_init_minmax(&mr_handle->bounds);
+
+ for (masklay = mask->masklayers.first, masklay_index = 0; masklay; masklay = masklay->next, masklay_index++) {
+
+ MaskSpline *spline;
+
+ /* scanfill */
+ ScanFillContext sf_ctx;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list