Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-16 10:48:57 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-16 10:48:57 +0400
commit0635f8101c98d74da729d464472a4d9efa09337f (patch)
tree2588585adbcd09b0e14497d12a8403488bfe2efb /source/blender/blenlib/BLI_scanfill.h
parentfb1e60762f3a4c32b3ae57824f5bcbb984b33cbc (diff)
make scanfill threadsafe (wasnt threadsafe before BMesh merge but before the merge it didn't need to be) - now rendering uses its better if its threadsafe.
Diffstat (limited to 'source/blender/blenlib/BLI_scanfill.h')
-rw-r--r--source/blender/blenlib/BLI_scanfill.h41
1 files changed, 26 insertions, 15 deletions
diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h
index 6dcc1df41a3..67ff9a88700 100644
--- a/source/blender/blenlib/BLI_scanfill.h
+++ b/source/blender/blenlib/BLI_scanfill.h
@@ -35,19 +35,31 @@
* \brief Filling meshes.
*/
-/**
- * \attention Defined in scanfill.c
- */
-extern struct ListBase fillvertbase;
-extern struct ListBase filledgebase;
-extern struct ListBase fillfacebase;
-
struct ScanFillVert;
#ifdef __cplusplus
extern "C" {
#endif
+typedef struct ScanFillContext
+{
+ ListBase fillvertbase;
+ ListBase filledgebase;
+ ListBase fillfacebase;
+
+ /* simple optimization for allocating thousands of small memory blocks
+ * only to be used within loops, and not by one function at a time
+ * free in the end, with argument '-1'
+ */
+ #define MEM_ELEM_BLOCKSIZE 16384
+ struct mem_elements *melem__cur;
+ int melem__offs; /* the current free address */
+ ListBase melem__lb;
+
+ /* private */
+ struct ScanFillVertLink *_scdata;
+} ScanFillContext;
+
/* note; changing this also might affect the undo copy in editmesh.c */
typedef struct ScanFillVert
{
@@ -57,7 +69,8 @@ typedef struct ScanFillVert
void *p;
intptr_t l;
} tmp;
- float co[3]; /*vertex location */
+ float co[3]; /* vertex location */
+ float xy[2]; /* 2D copy of vertex location (using dominant axis) */
int keyindex; /* original index #, for restoring key information */
short poly_nr;
unsigned char f, h;
@@ -78,16 +91,16 @@ typedef struct ScanFillFace
} ScanFillFace;
/* scanfill.c: used in displist only... */
-struct ScanFillVert *BLI_addfillvert(const float vec[3]);
-struct ScanFillEdge *BLI_addfilledge(struct ScanFillVert *v1, struct ScanFillVert *v2);
+struct ScanFillVert *BLI_addfillvert(ScanFillContext *sf_ctx, const float vec[3]);
+struct ScanFillEdge *BLI_addfilledge(ScanFillContext *sf_ctx, struct ScanFillVert *v1, struct ScanFillVert *v2);
/* Optionally set ScanFillEdge f to this to mark original boundary edges.
* Only needed if there are internal diagonal edges passed to BLI_edgefill. */
#define FILLBOUNDARY 1
-int BLI_begin_edgefill(void);
-int BLI_edgefill(const short do_quad_tri_speedup);
-void BLI_end_edgefill(void);
+int BLI_begin_edgefill(ScanFillContext *sf_ctx);
+int BLI_edgefill(ScanFillContext *sf_ctx, const short do_quad_tri_speedup);
+void BLI_end_edgefill(ScanFillContext *sf_ctx);
/* These callbacks are needed to make the lib finction properly */
@@ -109,8 +122,6 @@ void BLI_setErrorCallBack(void (*f)(const char*));
*/
void BLI_setInterruptCallBack(int (*f)(void));
-void BLI_scanfill_free(void);
-
#ifdef __cplusplus
}
#endif