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-07-13 00:10:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-13 00:10:41 +0400
commit8ce53a2a984238aa371b28b44bb2598473a64875 (patch)
treec49847742f540da5dc049fe8dc1e57343d07388c /source/blender/compositor
parent8809f23c8d1a035c574a75a3ee33da9f6bf04abd (diff)
new mask rasterizer written to take advantage of the compositors threading, mostly functional but disabled by default (still a little wip).
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.cpp73
-rw-r--r--source/blender/compositor/operations/COM_MaskOperation.h11
2 files changed, 83 insertions, 1 deletions
diff --git a/source/blender/compositor/operations/COM_MaskOperation.cpp b/source/blender/compositor/operations/COM_MaskOperation.cpp
index 2b45cd53fd5..682ccf712ad 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.cpp
+++ b/source/blender/compositor/operations/COM_MaskOperation.cpp
@@ -30,8 +30,10 @@
#include "DNA_scene_types.h"
+
+#ifdef USE_RASKTER
+
extern "C" {
- #include "BKE_mask.h"
#include "../../../../intern/raskter/raskter.h"
}
@@ -127,3 +129,72 @@ void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *input
color[0] = buffer[index];
}
}
+
+#else /* mask rasterizer by campbell wip */
+
+MaskOperation::MaskOperation() : NodeOperation()
+{
+ this->addOutputSocket(COM_DT_VALUE);
+ this->m_mask = NULL;
+ this->m_maskWidth = 0;
+ this->m_maskHeight = 0;
+ this->m_framenumber = 0;
+ this->m_rasterMaskHandle = NULL;
+ setComplex(true);
+}
+
+void MaskOperation::initExecution()
+{
+ initMutex();
+
+ if (this->m_rasterMaskHandle == NULL) {
+ const int width = this->getWidth();
+ const int height = this->getHeight();
+
+ this->m_rasterMaskHandle = BLI_maskrasterize_handle_new();
+
+ BLI_maskrasterize_handle_init(this->m_rasterMaskHandle, this->m_mask, width, height, TRUE, this->m_do_smooth, this->m_do_feather);
+ }
+}
+
+void MaskOperation::deinitExecution()
+{
+ if (this->m_rasterMaskHandle) {
+ BLI_maskrasterize_handle_free(this->m_rasterMaskHandle);
+ this->m_rasterMaskHandle = NULL;
+ }
+
+ deinitMutex();
+}
+
+void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
+{
+ /* pass */
+ return NULL;
+}
+
+void MaskOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
+{
+ if (this->m_maskWidth == 0 || this->m_maskHeight == 0) {
+ NodeOperation::determineResolution(resolution, preferredResolution);
+ }
+ else {
+ unsigned int nr[2];
+
+ nr[0] = this->m_maskWidth;
+ nr[1] = this->m_maskHeight;
+
+ NodeOperation::determineResolution(resolution, nr);
+
+ resolution[0] = this->m_maskWidth;
+ resolution[1] = this->m_maskHeight;
+ }
+}
+
+void MaskOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
+{
+ const float xy[2] = {x / (float)this->m_maskWidth, y / (float)this->m_maskHeight};
+ color[0] = BLI_maskrasterize_handle_sample(this->m_rasterMaskHandle, xy);
+}
+
+#endif /* USE_RASKTER */
diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h
index 74fd12277e8..8fb98481ec7 100644
--- a/source/blender/compositor/operations/COM_MaskOperation.h
+++ b/source/blender/compositor/operations/COM_MaskOperation.h
@@ -25,6 +25,11 @@
#ifndef _COM_MaskOperation_h
#define _COM_MaskOperation_h
+/* XXX, remove when the USE_RASKTER option is also removed */
+extern "C" {
+ #include "BKE_mask.h"
+}
+
#include "COM_NodeOperation.h"
#include "DNA_scene_types.h"
#include "DNA_mask_types.h"
@@ -46,10 +51,16 @@ protected:
int m_framenumber;
bool m_do_smooth;
bool m_do_feather;
+
+#ifdef USE_RASKTER
float *m_rasterizedMask;
ListBase m_maskLayers;
+#else /* USE_RASKTER */
+ struct MaskRasterHandle *m_rasterMaskHandle;
+#endif /* USE_RASKTER */
+
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/