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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-06-15 21:41:12 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-06-15 21:41:12 +0400
commit687b6e5447855311522cc42ed980c9df3400b1c4 (patch)
tree7fc44a92998f88d58aaae6bfc2a42ed43ab270d4 /source
parent5a9285a5c96914b61703634b69cc6ef040347683 (diff)
style cleanup: remaining nodes in intern/
Diffstat (limited to 'source')
-rw-r--r--source/blender/compositor/intern/COM_CPUDevice.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ChannelInfo.cpp4
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrder.cpp2
-rw-r--r--source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp6
-rw-r--r--source/blender/compositor/intern/COM_Converter.cpp572
-rw-r--r--source/blender/compositor/intern/COM_ExecutionGroup.cpp212
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystem.cpp95
-rw-r--r--source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp133
-rw-r--r--source/blender/compositor/intern/COM_InputSocket.cpp72
-rw-r--r--source/blender/compositor/intern/COM_MemoryBuffer.cpp190
-rw-r--r--source/blender/compositor/intern/COM_Node.cpp32
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.cpp61
-rw-r--r--source/blender/compositor/intern/COM_OpenCLDevice.cpp6
-rw-r--r--source/blender/compositor/intern/COM_OutputSocket.cpp17
-rw-r--r--source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp2
-rw-r--r--source/blender/compositor/intern/COM_Socket.cpp6
-rw-r--r--source/blender/compositor/intern/COM_SocketConnection.cpp12
-rw-r--r--source/blender/compositor/intern/COM_WorkScheduler.cpp52
18 files changed, 740 insertions, 738 deletions
diff --git a/source/blender/compositor/intern/COM_CPUDevice.cpp b/source/blender/compositor/intern/COM_CPUDevice.cpp
index f151afd75be..95462b3c384 100644
--- a/source/blender/compositor/intern/COM_CPUDevice.cpp
+++ b/source/blender/compositor/intern/COM_CPUDevice.cpp
@@ -25,11 +25,11 @@
void CPUDevice::execute(WorkPackage *work)
{
const unsigned int chunkNumber = work->getChunkNumber();
- ExecutionGroup * executionGroup = work->getExecutionGroup();
+ ExecutionGroup *executionGroup = work->getExecutionGroup();
rcti rect;
executionGroup->determineChunkRect(&rect, chunkNumber);
- MemoryBuffer ** inputBuffers = executionGroup->getInputBuffersCPU();
+ MemoryBuffer **inputBuffers = executionGroup->getInputBuffersCPU();
executionGroup->getOutputNodeOperation()->executeRegion(&rect, chunkNumber, inputBuffers);
diff --git a/source/blender/compositor/intern/COM_ChannelInfo.cpp b/source/blender/compositor/intern/COM_ChannelInfo.cpp
index 7dafee5f955..f2fa62006d5 100644
--- a/source/blender/compositor/intern/COM_ChannelInfo.cpp
+++ b/source/blender/compositor/intern/COM_ChannelInfo.cpp
@@ -25,8 +25,8 @@
#include <stdio.h>
/**
- * @brief create new ChannelInfo instance and sets the defaults.
- */
+ * @brief create new ChannelInfo instance and sets the defaults.
+ */
ChannelInfo::ChannelInfo()
{
this->number = 0;
diff --git a/source/blender/compositor/intern/COM_ChunkOrder.cpp b/source/blender/compositor/intern/COM_ChunkOrder.cpp
index 387e4a6ba70..02c28a1997a 100644
--- a/source/blender/compositor/intern/COM_ChunkOrder.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrder.cpp
@@ -35,7 +35,7 @@ void ChunkOrder::determineDistance(ChunkOrderHotspot **hotspots, unsigned int nu
{
unsigned int index;
double distance = MAXFLOAT;
- for (index = 0 ; index < numberOfHotspots ; index ++) {
+ for (index = 0; index < numberOfHotspots; index++) {
ChunkOrderHotspot *hotspot = hotspots[index];
double ndistance = hotspot->determineDistance(this->x, this->y);
if (ndistance < distance) {
diff --git a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
index 0ab08ec5810..96568092b72 100644
--- a/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
+++ b/source/blender/compositor/intern/COM_ChunkOrderHotspot.cpp
@@ -32,9 +32,9 @@ ChunkOrderHotspot::ChunkOrderHotspot(int x, int y, float addition)
double ChunkOrderHotspot::determineDistance(int x, int y)
{
- int dx = x-this->x;
- int dy = y-this->y;
- double result = sqrt((double)(dx*dx+dy*dy));
+ int dx = x - this->x;
+ int dy = y - this->y;
+ double result = sqrt((double)(dx * dx + dy * dy));
result += (double)this->addition;
return result;
}
diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp
index 9731555039c..fa30d965938 100644
--- a/source/blender/compositor/intern/COM_Converter.cpp
+++ b/source/blender/compositor/intern/COM_Converter.cpp
@@ -117,7 +117,7 @@
Node *Converter::convert(bNode *bNode)
{
- Node * node;
+ Node *node;
if (bNode->flag & NODE_MUTED) {
node = new MuteNode(bNode);
@@ -125,244 +125,244 @@ Node *Converter::convert(bNode *bNode)
}
switch (bNode->type) {
- case CMP_NODE_COMPOSITE:
- node = new CompositorNode(bNode);
- break;
- case CMP_NODE_R_LAYERS:
- node = new RenderLayersNode(bNode);
- break;
- case CMP_NODE_TEXTURE:
- node = new TextureNode(bNode);
- break;
- case CMP_NODE_RGBTOBW:
- node = new ColourToBWNode(bNode);
- break;
- case CMP_NODE_MIX_RGB:
- node = new MixNode(bNode);
- break;
- case CMP_NODE_TRANSLATE:
- node = new TranslateNode(bNode);
- break;
- case CMP_NODE_SCALE:
- node = new ScaleNode(bNode);
- break;
- case CMP_NODE_ROTATE:
- node = new RotateNode(bNode);
- break;
- case CMP_NODE_FLIP:
- node = new FlipNode(bNode);
- break;
- case CMP_NODE_FILTER:
- node = new FilterNode(bNode);
- break;
- case CMP_NODE_ID_MASK:
- node = new IDMaskNode(bNode);
- break;
- case CMP_NODE_BRIGHTCONTRAST:
- node = new BrightnessNode(bNode);
- break;
- case CMP_NODE_SEPRGBA:
- node = new SeparateRGBANode(bNode);
- break;
- case CMP_NODE_COMBRGBA:
- node = new CombineRGBANode(bNode);
- break;
- case CMP_NODE_SEPHSVA:
- node = new SeparateHSVANode(bNode);
- break;
- case CMP_NODE_COMBHSVA:
- node = new CombineHSVANode(bNode);
- break;
- case CMP_NODE_SEPYUVA:
- node = new SeparateYUVANode(bNode);
- break;
- case CMP_NODE_COMBYUVA:
- node = new CombineYUVANode(bNode);
- break;
- case CMP_NODE_SEPYCCA:
- node = new SeparateYCCANode(bNode);
- break;
- case CMP_NODE_COMBYCCA:
- node = new CombineYCCANode(bNode);
- break;
- case CMP_NODE_ALPHAOVER:
- node = new AlphaOverNode(bNode);
- break;
- case CMP_NODE_COLORBALANCE:
- node = new ColorBalanceNode(bNode);
- break;
- case CMP_NODE_VIEWER:
- node = new ViewerNode(bNode);
- break;
- case CMP_NODE_SPLITVIEWER:
- node = new SplitViewerNode(bNode);
- break;
- case CMP_NODE_INVERT:
- node = new InvertNode(bNode);
- break;
- case NODE_GROUP:
- node = new GroupNode(bNode);
- break;
- case CMP_NODE_NORMAL:
- node = new NormalNode(bNode);
- break;
- case CMP_NODE_NORMALIZE:
- node = new NormalizeNode(bNode);
- break;
- case CMP_NODE_IMAGE:
- node = new ImageNode(bNode);
- break;
- case CMP_NODE_SETALPHA:
- node = new SetAlphaNode(bNode);
- break;
- case CMP_NODE_PREMULKEY:
- node = new ConvertAlphaNode(bNode);
- break;
- case CMP_NODE_MATH:
- node = new MathNode(bNode);
- break;
- case CMP_NODE_HUE_SAT:
- node = new HueSaturationValueNode(bNode);
- break;
- case CMP_NODE_COLORCORRECTION:
- node = new ColorCorrectionNode(bNode);
- break;
- case CMP_NODE_MASK_BOX:
- node = new BoxMaskNode(bNode);
- break;
- case CMP_NODE_MASK_ELLIPSE:
- node = new EllipseMaskNode(bNode);
- break;
- case CMP_NODE_GAMMA:
- node = new GammaNode(bNode);
- break;
- case CMP_NODE_CURVE_RGB:
- node = new ColorCurveNode(bNode);
- break;
- case CMP_NODE_CURVE_VEC:
- node = new VectorCurveNode(bNode);
- break;
- case CMP_NODE_HUECORRECT:
- node = new HueSaturationValueCorrectNode(bNode);
- break;
- case CMP_NODE_MAP_UV:
- node = new MapUVNode(bNode);
- break;
- case CMP_NODE_DISPLACE:
- node = new DisplaceNode(bNode);
- break;
- case CMP_NODE_VALTORGB:
- node = new ColorRampNode(bNode);
- break;
- case CMP_NODE_DIFF_MATTE:
- node = new DifferenceMatteNode(bNode);
- break;
- case CMP_NODE_LUMA_MATTE:
- node = new LuminanceMatteNode(bNode);
- break;
- case CMP_NODE_DIST_MATTE:
- node = new DistanceMatteNode(bNode);
- break;
- case CMP_NODE_CHROMA_MATTE:
- node = new ChromaMatteNode(bNode);
- break;
- case CMP_NODE_COLOR_MATTE:
- node = new ColorMatteNode(bNode);
- break;
- case CMP_NODE_CHANNEL_MATTE:
- node = new ChannelMatteNode(bNode);
- break;
- case CMP_NODE_BLUR:
- node = new BlurNode(bNode);
- break;
- case CMP_NODE_BOKEHIMAGE:
- node = new BokehImageNode(bNode);
- break;
- case CMP_NODE_BOKEHBLUR:
- node = new BokehBlurNode(bNode);
- break;
- case CMP_NODE_DILATEERODE:
- node = new DilateErodeNode(bNode);
- break;
- case CMP_NODE_LENSDIST:
- node = new LensDistortionNode(bNode);
- break;
- case CMP_NODE_RGB:
- node = new ColorNode(bNode);
- break;
- case CMP_NODE_VALUE:
- node = new ValueNode(bNode);
- break;
- case CMP_NODE_TIME:
- node = new TimeNode(bNode);
- break;
- case CMP_NODE_DBLUR:
- node = new DirectionalBlurNode(bNode);
- break;
- case CMP_NODE_ZCOMBINE:
- node = new ZCombineNode(bNode);
- break;
- case CMP_NODE_TONEMAP:
- node = new TonemapNode(bNode);
- break;
- case CMP_NODE_SWITCH:
- node = new SwitchNode(bNode);
- break;
- case CMP_NODE_GLARE:
- node = new GlareNode(bNode);
- break;
- case CMP_NODE_MOVIECLIP:
- node = new MovieClipNode(bNode);
- break;
- case CMP_NODE_COLOR_SPILL:
- node = new ColorSpillNode(bNode);
- break;
-case CMP_NODE_OUTPUT_FILE:
- node = new OutputFileNode(bNode);
- break;
- case CMP_NODE_MAP_VALUE:
- node = new MapValueNode(bNode);
- break;
- case CMP_NODE_TRANSFORM:
- node = new TransformNode(bNode);
- break;
- case CMP_NODE_STABILIZE2D:
- node = new Stabilize2dNode(bNode);
- break;
- case CMP_NODE_BILATERALBLUR:
- node = new BilateralBlurNode(bNode);
- break;
- case CMP_NODE_VECBLUR:
- node = new VectorBlurNode(bNode);
- break;
- case CMP_NODE_MOVIEDISTORTION:
- node = new MovieDistortionNode(bNode);
- break;
- case CMP_NODE_VIEW_LEVELS:
- node = new ViewLevelsNode(bNode);
- break;
- case CMP_NODE_DEFOCUS:
- node = new DefocusNode(bNode);
- break;
- case CMP_NODE_DOUBLEEDGEMASK:
- node = new DoubleEdgeMaskNode(bNode);
- break;
- case CMP_NODE_CROP:
- node = new CropNode(bNode);
- break;
- case CMP_NODE_MASK:
- node = new MaskNode(bNode);
- break;
- case CMP_NODE_KEYINGSCREEN:
- node = new KeyingScreenNode(bNode);
- break;
- case CMP_NODE_KEYING:
- node = new KeyingNode(bNode);
- break;
- /* not inplemented yet */
- default:
- node = new MuteNode(bNode);
- break;
+ case CMP_NODE_COMPOSITE:
+ node = new CompositorNode(bNode);
+ break;
+ case CMP_NODE_R_LAYERS:
+ node = new RenderLayersNode(bNode);
+ break;
+ case CMP_NODE_TEXTURE:
+ node = new TextureNode(bNode);
+ break;
+ case CMP_NODE_RGBTOBW:
+ node = new ColourToBWNode(bNode);
+ break;
+ case CMP_NODE_MIX_RGB:
+ node = new MixNode(bNode);
+ break;
+ case CMP_NODE_TRANSLATE:
+ node = new TranslateNode(bNode);
+ break;
+ case CMP_NODE_SCALE:
+ node = new ScaleNode(bNode);
+ break;
+ case CMP_NODE_ROTATE:
+ node = new RotateNode(bNode);
+ break;
+ case CMP_NODE_FLIP:
+ node = new FlipNode(bNode);
+ break;
+ case CMP_NODE_FILTER:
+ node = new FilterNode(bNode);
+ break;
+ case CMP_NODE_ID_MASK:
+ node = new IDMaskNode(bNode);
+ break;
+ case CMP_NODE_BRIGHTCONTRAST:
+ node = new BrightnessNode(bNode);
+ break;
+ case CMP_NODE_SEPRGBA:
+ node = new SeparateRGBANode(bNode);
+ break;
+ case CMP_NODE_COMBRGBA:
+ node = new CombineRGBANode(bNode);
+ break;
+ case CMP_NODE_SEPHSVA:
+ node = new SeparateHSVANode(bNode);
+ break;
+ case CMP_NODE_COMBHSVA:
+ node = new CombineHSVANode(bNode);
+ break;
+ case CMP_NODE_SEPYUVA:
+ node = new SeparateYUVANode(bNode);
+ break;
+ case CMP_NODE_COMBYUVA:
+ node = new CombineYUVANode(bNode);
+ break;
+ case CMP_NODE_SEPYCCA:
+ node = new SeparateYCCANode(bNode);
+ break;
+ case CMP_NODE_COMBYCCA:
+ node = new CombineYCCANode(bNode);
+ break;
+ case CMP_NODE_ALPHAOVER:
+ node = new AlphaOverNode(bNode);
+ break;
+ case CMP_NODE_COLORBALANCE:
+ node = new ColorBalanceNode(bNode);
+ break;
+ case CMP_NODE_VIEWER:
+ node = new ViewerNode(bNode);
+ break;
+ case CMP_NODE_SPLITVIEWER:
+ node = new SplitViewerNode(bNode);
+ break;
+ case CMP_NODE_INVERT:
+ node = new InvertNode(bNode);
+ break;
+ case NODE_GROUP:
+ node = new GroupNode(bNode);
+ break;
+ case CMP_NODE_NORMAL:
+ node = new NormalNode(bNode);
+ break;
+ case CMP_NODE_NORMALIZE:
+ node = new NormalizeNode(bNode);
+ break;
+ case CMP_NODE_IMAGE:
+ node = new ImageNode(bNode);
+ break;
+ case CMP_NODE_SETALPHA:
+ node = new SetAlphaNode(bNode);
+ break;
+ case CMP_NODE_PREMULKEY:
+ node = new ConvertAlphaNode(bNode);
+ break;
+ case CMP_NODE_MATH:
+ node = new MathNode(bNode);
+ break;
+ case CMP_NODE_HUE_SAT:
+ node = new HueSaturationValueNode(bNode);
+ break;
+ case CMP_NODE_COLORCORRECTION:
+ node = new ColorCorrectionNode(bNode);
+ break;
+ case CMP_NODE_MASK_BOX:
+ node = new BoxMaskNode(bNode);
+ break;
+ case CMP_NODE_MASK_ELLIPSE:
+ node = new EllipseMaskNode(bNode);
+ break;
+ case CMP_NODE_GAMMA:
+ node = new GammaNode(bNode);
+ break;
+ case CMP_NODE_CURVE_RGB:
+ node = new ColorCurveNode(bNode);
+ break;
+ case CMP_NODE_CURVE_VEC:
+ node = new VectorCurveNode(bNode);
+ break;
+ case CMP_NODE_HUECORRECT:
+ node = new HueSaturationValueCorrectNode(bNode);
+ break;
+ case CMP_NODE_MAP_UV:
+ node = new MapUVNode(bNode);
+ break;
+ case CMP_NODE_DISPLACE:
+ node = new DisplaceNode(bNode);
+ break;
+ case CMP_NODE_VALTORGB:
+ node = new ColorRampNode(bNode);
+ break;
+ case CMP_NODE_DIFF_MATTE:
+ node = new DifferenceMatteNode(bNode);
+ break;
+ case CMP_NODE_LUMA_MATTE:
+ node = new LuminanceMatteNode(bNode);
+ break;
+ case CMP_NODE_DIST_MATTE:
+ node = new DistanceMatteNode(bNode);
+ break;
+ case CMP_NODE_CHROMA_MATTE:
+ node = new ChromaMatteNode(bNode);
+ break;
+ case CMP_NODE_COLOR_MATTE:
+ node = new ColorMatteNode(bNode);
+ break;
+ case CMP_NODE_CHANNEL_MATTE:
+ node = new ChannelMatteNode(bNode);
+ break;
+ case CMP_NODE_BLUR:
+ node = new BlurNode(bNode);
+ break;
+ case CMP_NODE_BOKEHIMAGE:
+ node = new BokehImageNode(bNode);
+ break;
+ case CMP_NODE_BOKEHBLUR:
+ node = new BokehBlurNode(bNode);
+ break;
+ case CMP_NODE_DILATEERODE:
+ node = new DilateErodeNode(bNode);
+ break;
+ case CMP_NODE_LENSDIST:
+ node = new LensDistortionNode(bNode);
+ break;
+ case CMP_NODE_RGB:
+ node = new ColorNode(bNode);
+ break;
+ case CMP_NODE_VALUE:
+ node = new ValueNode(bNode);
+ break;
+ case CMP_NODE_TIME:
+ node = new TimeNode(bNode);
+ break;
+ case CMP_NODE_DBLUR:
+ node = new DirectionalBlurNode(bNode);
+ break;
+ case CMP_NODE_ZCOMBINE:
+ node = new ZCombineNode(bNode);
+ break;
+ case CMP_NODE_TONEMAP:
+ node = new TonemapNode(bNode);
+ break;
+ case CMP_NODE_SWITCH:
+ node = new SwitchNode(bNode);
+ break;
+ case CMP_NODE_GLARE:
+ node = new GlareNode(bNode);
+ break;
+ case CMP_NODE_MOVIECLIP:
+ node = new MovieClipNode(bNode);
+ break;
+ case CMP_NODE_COLOR_SPILL:
+ node = new ColorSpillNode(bNode);
+ break;
+ case CMP_NODE_OUTPUT_FILE:
+ node = new OutputFileNode(bNode);
+ break;
+ case CMP_NODE_MAP_VALUE:
+ node = new MapValueNode(bNode);
+ break;
+ case CMP_NODE_TRANSFORM:
+ node = new TransformNode(bNode);
+ break;
+ case CMP_NODE_STABILIZE2D:
+ node = new Stabilize2dNode(bNode);
+ break;
+ case CMP_NODE_BILATERALBLUR:
+ node = new BilateralBlurNode(bNode);
+ break;
+ case CMP_NODE_VECBLUR:
+ node = new VectorBlurNode(bNode);
+ break;
+ case CMP_NODE_MOVIEDISTORTION:
+ node = new MovieDistortionNode(bNode);
+ break;
+ case CMP_NODE_VIEW_LEVELS:
+ node = new ViewLevelsNode(bNode);
+ break;
+ case CMP_NODE_DEFOCUS:
+ node = new DefocusNode(bNode);
+ break;
+ case CMP_NODE_DOUBLEEDGEMASK:
+ node = new DoubleEdgeMaskNode(bNode);
+ break;
+ case CMP_NODE_CROP:
+ node = new CropNode(bNode);
+ break;
+ case CMP_NODE_MASK:
+ node = new MaskNode(bNode);
+ break;
+ case CMP_NODE_KEYINGSCREEN:
+ node = new KeyingScreenNode(bNode);
+ break;
+ case CMP_NODE_KEYING:
+ node = new KeyingNode(bNode);
+ break;
+ /* not inplemented yet */
+ default:
+ node = new MuteNode(bNode);
+ break;
}
return node;
}
@@ -372,7 +372,7 @@ void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *s
InputSocket *inputSocket = connection->getToSocket();
DataType fromDatatype = outputSocket->getDataType();
DataType toDatatype = inputSocket->getDataType();
- NodeOperation * converter = NULL;
+ NodeOperation *converter = NULL;
if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) {
converter = new ConvertValueToColourProg();
}
@@ -402,68 +402,68 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
{
InputSocketResizeMode mode = connection->getToSocket()->getResizeMode();
- NodeOperation * toOperation = (NodeOperation*)connection->getToNode();
+ NodeOperation *toOperation = (NodeOperation *)connection->getToNode();
const float toWidth = toOperation->getWidth();
const float toHeight = toOperation->getHeight();
- NodeOperation * fromOperation = (NodeOperation*)connection->getFromNode();
+ NodeOperation *fromOperation = (NodeOperation *)connection->getFromNode();
const float fromWidth = fromOperation->getWidth();
const float fromHeight = fromOperation->getHeight();
bool doCenter = false;
bool doScale = false;
- float addX= (toWidth-fromWidth)/2.0f;
- float addY = (toHeight-fromHeight)/2.0f;
- float scaleX=0;
- float scaleY=0;
+ float addX = (toWidth - fromWidth) / 2.0f;
+ float addY = (toHeight - fromHeight) / 2.0f;
+ float scaleX = 0;
+ float scaleY = 0;
switch (mode) {
- case COM_SC_NO_RESIZE:
- break;
- case COM_SC_CENTER:
- doCenter = true;
- break;
- case COM_SC_FIT_WIDTH:
- doCenter = true;
- doScale = true;
- scaleX = scaleY = toWidth/fromWidth;
- break;
- case COM_SC_FIT_HEIGHT:
- doCenter = true;
- doScale = true;
- scaleX = scaleY = toHeight/fromHeight;
- break;
- case COM_SC_FIT:
- doCenter = true;
- doScale = true;
- scaleX = toWidth/fromWidth;
- scaleY = toHeight/fromHeight;
- if (scaleX < scaleY) {
- scaleX = scaleY;
- }
- else {
- scaleY = scaleX;
- }
- break;
- case COM_SC_STRETCH:
- doCenter = true;
- doScale = true;
- scaleX = toWidth/fromWidth;
- scaleY = toHeight/fromHeight;
- break;
+ case COM_SC_NO_RESIZE:
+ break;
+ case COM_SC_CENTER:
+ doCenter = true;
+ break;
+ case COM_SC_FIT_WIDTH:
+ doCenter = true;
+ doScale = true;
+ scaleX = scaleY = toWidth / fromWidth;
+ break;
+ case COM_SC_FIT_HEIGHT:
+ doCenter = true;
+ doScale = true;
+ scaleX = scaleY = toHeight / fromHeight;
+ break;
+ case COM_SC_FIT:
+ doCenter = true;
+ doScale = true;
+ scaleX = toWidth / fromWidth;
+ scaleY = toHeight / fromHeight;
+ if (scaleX < scaleY) {
+ scaleX = scaleY;
+ }
+ else {
+ scaleY = scaleX;
+ }
+ break;
+ case COM_SC_STRETCH:
+ doCenter = true;
+ doScale = true;
+ scaleX = toWidth / fromWidth;
+ scaleY = toHeight / fromHeight;
+ break;
}
if (doCenter) {
NodeOperation *first = NULL;
SocketConnection *c;
- ScaleOperation * scaleOperation = NULL;
+ ScaleOperation *scaleOperation = NULL;
if (doScale) {
scaleOperation = new ScaleOperation();
first = scaleOperation;
- SetValueOperation * sxop = new SetValueOperation();
+ SetValueOperation *sxop = new SetValueOperation();
sxop->setValue(scaleX);
c = ExecutionSystemHelper::addLink(system->getConnections(), sxop->getOutputSocket(), scaleOperation->getInputSocket(1));
c->setIgnoreResizeCheck(true);
- SetValueOperation * syop = new SetValueOperation();
+ SetValueOperation *syop = new SetValueOperation();
syop->setValue(scaleY);
c = ExecutionSystemHelper::addLink(system->getConnections(), syop->getOutputSocket(), scaleOperation->getInputSocket(2));
c->setIgnoreResizeCheck(true);
@@ -479,13 +479,13 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
c->setIgnoreResizeCheck(true);
}
- TranslateOperation * translateOperation = new TranslateOperation();
+ TranslateOperation *translateOperation = new TranslateOperation();
if (!first) first = translateOperation;
- SetValueOperation * xop = new SetValueOperation();
+ SetValueOperation *xop = new SetValueOperation();
xop->setValue(addX);
c = ExecutionSystemHelper::addLink(system->getConnections(), xop->getOutputSocket(), translateOperation->getInputSocket(1));
c->setIgnoreResizeCheck(true);
- SetValueOperation * yop = new SetValueOperation();
+ SetValueOperation *yop = new SetValueOperation();
yop->setValue(addY);
c = ExecutionSystemHelper::addLink(system->getConnections(), yop->getOutputSocket(), translateOperation->getInputSocket(2));
c->setIgnoreResizeCheck(true);
@@ -503,7 +503,7 @@ void Converter::convertResolution(SocketConnection *connection, ExecutionSystem
c->setIgnoreResizeCheck(true);
}
- InputSocket * inputSocket = connection->getToSocket();
+ InputSocket *inputSocket = connection->getToSocket();
inputSocket->relinkConnections(first->getInputSocket(0));
c = ExecutionSystemHelper::addLink(system->getConnections(), translateOperation->getOutputSocket(), inputSocket);
c->setIgnoreResizeCheck(true);
diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.cpp b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
index aaca97d8479..2a790da0354 100644
--- a/source/blender/compositor/intern/COM_ExecutionGroup.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionGroup.cpp
@@ -65,7 +65,7 @@ CompositorPriority ExecutionGroup::getRenderPriotrity()
bool ExecutionGroup::containsOperation(NodeOperation *operation)
{
- for (vector<NodeOperation*>::const_iterator iterator = this->operations.begin() ; iterator != this->operations.end() ; ++iterator) {
+ for (vector<NodeOperation *>::const_iterator iterator = this->operations.begin(); iterator != this->operations.end(); ++iterator) {
NodeOperation *inListOperation = *iterator;
if (inListOperation == operation) {
return true;
@@ -81,10 +81,10 @@ const bool ExecutionGroup::isComplex() const
bool ExecutionGroup::canContainOperation(NodeOperation *operation)
{
- if (!this->initialized) {return true;}
- if (operation->isReadBufferOperation()) {return true;}
- if (operation->isWriteBufferOperation()) {return false;}
- if (operation->isSetOperation()) {return true;}
+ if (!this->initialized) { return true; }
+ if (operation->isReadBufferOperation()) { return true; }
+ if (operation->isWriteBufferOperation()) { return false; }
+ if (operation->isSetOperation()) { return true; }
if (!this->isComplex()) {
return (!operation->isComplex());
@@ -106,16 +106,16 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
}
this->operations.push_back(operation);
if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
WriteBufferOperation *writeOperation = readOperation->getMemoryProxy()->getWriteBufferOperation();
this->addOperation(system, writeOperation);
}
else {
unsigned int index;
- for (index = 0 ; index < operation->getNumberOfInputSockets(); index ++) {
- InputSocket * inputSocket = operation->getInputSocket(index);
+ for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
+ InputSocket *inputSocket = operation->getInputSocket(index);
if (inputSocket->isConnected()) {
- NodeOperation *node = (NodeOperation*)inputSocket->getConnection()->getFromNode();
+ NodeOperation *node = (NodeOperation *)inputSocket->getConnection()->getFromNode();
this->addOperation(system, node);
}
}
@@ -123,7 +123,7 @@ void ExecutionGroup::addOperation(ExecutionSystem *system, NodeOperation *operat
}
else {
if (operation->isWriteBufferOperation()) {
- WriteBufferOperation * writeoperation = (WriteBufferOperation*)operation;
+ WriteBufferOperation *writeoperation = (WriteBufferOperation *)operation;
if (writeoperation->getMemoryProxy()->getExecutor() == NULL) {
ExecutionGroup *newGroup = new ExecutionGroup();
writeoperation->getMemoryProxy()->setExecutor(newGroup);
@@ -150,7 +150,7 @@ void ExecutionGroup::initExecution()
this->chunkExecutionStates = NULL;
if (this->numberOfChunks != 0) {
this->chunkExecutionStates = new ChunkExecutionState[numberOfChunks];
- for (index = 0 ; index < numberOfChunks ; index ++) {
+ for (index = 0; index < numberOfChunks; index++) {
this->chunkExecutionStates[index] = COM_ES_NOT_SCHEDULED;
}
}
@@ -158,10 +158,10 @@ void ExecutionGroup::initExecution()
unsigned int maxNumber = 0;
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isReadBufferOperation()) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
this->cachedReadOperations.push_back(readOperation);
maxNumber = max(maxNumber, readOperation->getOffset());
}
@@ -207,15 +207,15 @@ void ExecutionGroup::determineNumberOfChunks()
}
/**
- * this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
- */
+ * this method is called for the top execution groups. containing the compositor node or the preview node or the viewer node)
+ */
void ExecutionGroup::execute(ExecutionSystem *graph)
{
CompositorContext& context = graph->getContext();
const bNodeTree *bTree = context.getbNodeTree();
- if (this->width == 0 || this->height == 0) {return;} /// @note: break out... no pixels to calculate.
- if (bTree->test_break && bTree->test_break(bTree->tbh)) {return;} /// @note: early break out for blur and preview nodes
- if (this->numberOfChunks == 0) {return;} /// @note: early break out
+ if (this->width == 0 || this->height == 0) {return; } /// @note: break out... no pixels to calculate.
+ if (bTree->test_break && bTree->test_break(bTree->tbh)) {return; } /// @note: early break out for blur and preview nodes
+ if (this->numberOfChunks == 0) {return; } /// @note: early break out
unsigned int chunkNumber;
this->chunksFinished = 0;
@@ -223,7 +223,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
unsigned int index;
unsigned int *chunkOrder = new unsigned int[this->numberOfChunks];
- for (chunkNumber = 0 ; chunkNumber<this->numberOfChunks ; chunkNumber++) {
+ for (chunkNumber = 0; chunkNumber < this->numberOfChunks; chunkNumber++) {
chunkOrder[chunkNumber] = chunkNumber;
}
NodeOperation *operation = this->getOutputNodeOperation();
@@ -232,29 +232,29 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
OrderOfChunks chunkorder = COM_ORDER_OF_CHUNKS_DEFAULT;
if (operation->isViewerOperation()) {
- ViewerBaseOperation *viewer = (ViewerBaseOperation*)operation;
+ ViewerBaseOperation *viewer = (ViewerBaseOperation *)operation;
centerX = viewer->getCenterX();
centerY = viewer->getCenterY();
chunkorder = viewer->getChunkOrder();
}
switch (chunkorder) {
- case COM_TO_RANDOM:
- for (index = 0 ; index < 2 * numberOfChunks ; index ++) {
- int index1 = rand()%numberOfChunks;
- int index2 = rand()%numberOfChunks;
- int s = chunkOrder[index1];
- chunkOrder[index1] = chunkOrder[index2];
- chunkOrder[index2] = s;
- }
- break;
- case COM_TO_CENTER_OUT:
+ case COM_TO_RANDOM:
+ for (index = 0; index < 2 * numberOfChunks; index++) {
+ int index1 = rand() % numberOfChunks;
+ int index2 = rand() % numberOfChunks;
+ int s = chunkOrder[index1];
+ chunkOrder[index1] = chunkOrder[index2];
+ chunkOrder[index2] = s;
+ }
+ break;
+ case COM_TO_CENTER_OUT:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot*[1];
- hotspots[0] = new ChunkOrderHotspot(this->width*centerX, this->height*centerY, 0.0f);
+ ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[1];
+ hotspots[0] = new ChunkOrderHotspot(this->width * centerX, this->height * centerY, 0.0f);
rcti rect;
ChunkOrder *chunkOrders = new ChunkOrder[this->numberOfChunks];
- for (index = 0 ; index < this->numberOfChunks; index ++) {
+ for (index = 0; index < this->numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
chunkOrders[index].setX(rect.xmin);
@@ -262,8 +262,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
chunkOrders[index].determineDistance(hotspots, 1);
}
- sort(&chunkOrders[0], &chunkOrders[numberOfChunks-1]);
- for (index = 0 ; index < numberOfChunks; index ++) {
+ sort(&chunkOrders[0], &chunkOrders[numberOfChunks - 1]);
+ for (index = 0; index < numberOfChunks; index++) {
chunkOrder[index] = chunkOrders[index].getChunkNumber();
}
@@ -272,29 +272,29 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrders;
}
break;
- case COM_TO_RULE_OF_THIRDS:
+ case COM_TO_RULE_OF_THIRDS:
{
- ChunkOrderHotspot **hotspots = new ChunkOrderHotspot*[9];
- unsigned int tx = this->width/6;
- unsigned int ty = this->height/6;
- unsigned int mx = this->width/2;
- unsigned int my = this->height/2;
- unsigned int bx = mx+2*tx;
- unsigned int by = my+2*ty;
-
- float addition = numberOfChunks/COM_RULE_OF_THIRDS_DIVIDER;
- hotspots[0] = new ChunkOrderHotspot(mx, my, addition*0);
- hotspots[1] = new ChunkOrderHotspot(tx, my, addition*1);
- hotspots[2] = new ChunkOrderHotspot(bx, my, addition*2);
- hotspots[3] = new ChunkOrderHotspot(bx, by, addition*3);
- hotspots[4] = new ChunkOrderHotspot(tx, ty, addition*4);
- hotspots[5] = new ChunkOrderHotspot(bx, ty, addition*5);
- hotspots[6] = new ChunkOrderHotspot(tx, by, addition*6);
- hotspots[7] = new ChunkOrderHotspot(mx, ty, addition*7);
- hotspots[8] = new ChunkOrderHotspot(mx, by, addition*8);
+ ChunkOrderHotspot **hotspots = new ChunkOrderHotspot *[9];
+ unsigned int tx = this->width / 6;
+ unsigned int ty = this->height / 6;
+ unsigned int mx = this->width / 2;
+ unsigned int my = this->height / 2;
+ unsigned int bx = mx + 2 * tx;
+ unsigned int by = my + 2 * ty;
+
+ float addition = numberOfChunks / COM_RULE_OF_THIRDS_DIVIDER;
+ hotspots[0] = new ChunkOrderHotspot(mx, my, addition * 0);
+ hotspots[1] = new ChunkOrderHotspot(tx, my, addition * 1);
+ hotspots[2] = new ChunkOrderHotspot(bx, my, addition * 2);
+ hotspots[3] = new ChunkOrderHotspot(bx, by, addition * 3);
+ hotspots[4] = new ChunkOrderHotspot(tx, ty, addition * 4);
+ hotspots[5] = new ChunkOrderHotspot(bx, ty, addition * 5);
+ hotspots[6] = new ChunkOrderHotspot(tx, by, addition * 6);
+ hotspots[7] = new ChunkOrderHotspot(mx, ty, addition * 7);
+ hotspots[8] = new ChunkOrderHotspot(mx, by, addition * 8);
rcti rect;
ChunkOrder *chunkOrders = new ChunkOrder[this->numberOfChunks];
- for (index = 0 ; index < this->numberOfChunks; index ++) {
+ for (index = 0; index < this->numberOfChunks; index++) {
determineChunkRect(&rect, index);
chunkOrders[index].setChunkNumber(index);
chunkOrders[index].setX(rect.xmin);
@@ -304,7 +304,7 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
sort(&chunkOrders[0], &chunkOrders[numberOfChunks]);
- for (index = 0 ; index < numberOfChunks; index ++) {
+ for (index = 0; index < numberOfChunks; index++) {
chunkOrder[index] = chunkOrders[index].getChunkNumber();
}
@@ -321,40 +321,40 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrders;
}
break;
- case COM_TO_TOP_DOWN:
- default:
- break;
+ case COM_TO_TOP_DOWN:
+ default:
+ break;
}
bool breaked = false;
bool finished = false;
unsigned int startIndex = 0;
- const int maxNumberEvaluated = BLI_system_thread_count()*2;
+ const int maxNumberEvaluated = BLI_system_thread_count() * 2;
while (!finished && !breaked) {
- unsigned int index;
+ unsigned int index;
bool startEvaluated = false;
finished = true;
int numberEvaluated = 0;
- for (index = startIndex ; index < numberOfChunks && numberEvaluated < maxNumberEvaluated; index ++) {
+ for (index = startIndex; index < numberOfChunks && numberEvaluated < maxNumberEvaluated; index++) {
int chunkNumber = chunkOrder[index];
- int yChunk = chunkNumber/this->numberOfXChunks;
- int xChunk = chunkNumber - (yChunk*this->numberOfXChunks);
+ int yChunk = chunkNumber / this->numberOfXChunks;
+ int xChunk = chunkNumber - (yChunk * this->numberOfXChunks);
const ChunkExecutionState state = this->chunkExecutionStates[chunkNumber];
if (state == COM_ES_NOT_SCHEDULED) {
scheduleChunkWhenPossible(graph, xChunk, yChunk);
- finished=false;
+ finished = false;
startEvaluated = true;
numberEvaluated++;
}
else if (state == COM_ES_SCHEDULED) {
- finished=false;
+ finished = false;
startEvaluated = true;
numberEvaluated++;
}
else if (state == COM_ES_EXECUTED && !startEvaluated) {
- startIndex = index+1;
+ startIndex = index + 1;
}
}
@@ -368,39 +368,39 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
delete[] chunkOrder;
}
-MemoryBuffer** ExecutionGroup::getInputBuffersCPU()
+MemoryBuffer **ExecutionGroup::getInputBuffersCPU()
{
- vector<MemoryProxy*> memoryproxies;
+ vector<MemoryProxy *> memoryproxies;
unsigned int index;
this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
- for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
+ MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->cachedMaxReadBufferOffset];
+ for (index = 0; index < this->cachedMaxReadBufferOffset; index++) {
memoryBuffers[index] = NULL;
}
- for (index = 0 ; index < this->cachedReadOperations.size(); index ++) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)this->cachedReadOperations[index];
memoryBuffers[readOperation->getOffset()] = readOperation->getMemoryProxy()->getBuffer();
}
return memoryBuffers;
}
-MemoryBuffer** ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
+MemoryBuffer **ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
{
rcti rect;
- vector<MemoryProxy*> memoryproxies;
+ vector<MemoryProxy *> memoryproxies;
unsigned int index;
determineChunkRect(&rect, chunkNumber);
this->determineDependingMemoryProxies(&memoryproxies);
- MemoryBuffer **memoryBuffers = new MemoryBuffer*[this->cachedMaxReadBufferOffset];
- for (index = 0 ; index < this->cachedMaxReadBufferOffset ; index ++) {
+ MemoryBuffer **memoryBuffers = new MemoryBuffer *[this->cachedMaxReadBufferOffset];
+ for (index = 0; index < this->cachedMaxReadBufferOffset; index++) {
memoryBuffers[index] = NULL;
}
rcti output;
- for (index = 0 ; index < this->cachedReadOperations.size(); index ++) {
- ReadBufferOperation *readOperation = (ReadBufferOperation*)this->cachedReadOperations[index];
- MemoryProxy * memoryProxy = readOperation->getMemoryProxy();
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)this->cachedReadOperations[index];
+ MemoryProxy *memoryProxy = readOperation->getMemoryProxy();
this->determineDependingAreaOfInterest(&rect, readOperation, &output);
MemoryBuffer *memoryBuffer = memoryProxy->getExecutor()->constructConsolidatedMemoryBuffer(memoryProxy, &output);
memoryBuffers[readOperation->getOffset()] = memoryBuffer;
@@ -410,21 +410,21 @@ MemoryBuffer** ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
- MemoryBuffer* imageBuffer = memoryProxy->getBuffer();
- MemoryBuffer* result = new MemoryBuffer(memoryProxy, rect);
+ MemoryBuffer *imageBuffer = memoryProxy->getBuffer();
+ MemoryBuffer *result = new MemoryBuffer(memoryProxy, rect);
result->copyContentFrom(imageBuffer);
return result;
}
-void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memoryBuffers)
+void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer **memoryBuffers)
{
if (this->chunkExecutionStates[chunkNumber] == COM_ES_SCHEDULED)
this->chunkExecutionStates[chunkNumber] = COM_ES_EXECUTED;
this->chunksFinished++;
if (memoryBuffers) {
- for (unsigned int index = 0 ; index < this->cachedMaxReadBufferOffset; index ++) {
- MemoryBuffer * buffer = memoryBuffers[index];
+ for (unsigned int index = 0; index < this->cachedMaxReadBufferOffset; index++) {
+ MemoryBuffer *buffer = memoryBuffers[index];
if (buffer) {
if (buffer->isTemporarily()) {
memoryBuffers[index] = NULL;
@@ -437,12 +437,12 @@ void ExecutionGroup::finalizeChunkExecution(int chunkNumber, MemoryBuffer** memo
if (bTree) {
// status report is only performed for top level Execution Groups.
float progress = chunksFinished;
- progress/=numberOfChunks;
+ progress /= numberOfChunks;
bTree->progress(bTree->prh, progress);
}
}
-inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk ) const
+inline void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int xChunk, const unsigned int yChunk) const
{
if (singleThreaded) {
BLI_init_rcti(rect, 0, this->width, 0, this->height);
@@ -464,9 +464,9 @@ void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumb
MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
{
// we asume that this method is only called from complex execution groups.
- NodeOperation * operation = this->getOutputNodeOperation();
+ NodeOperation *operation = this->getOutputNodeOperation();
if (operation->isWriteBufferOperation()) {
- WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;
+ WriteBufferOperation *writeOperation = (WriteBufferOperation *)operation;
MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
return buffer;
}
@@ -474,7 +474,7 @@ MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
}
-bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *area)
+bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area)
{
if (singleThreaded) {
return scheduleChunkWhenPossible(graph, 0, 0);
@@ -485,14 +485,14 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem * graph, rcti *are
float chunkSizef = this->chunkSize;
int indexx, indexy;
- const int minxchunk = floor(area->xmin/chunkSizef);
- const int maxxchunk = ceil((area->xmax-1)/chunkSizef);
- const int minychunk = floor(area->ymin/chunkSizef);
- const int maxychunk = ceil((area->ymax-1)/chunkSizef);
+ const int minxchunk = floor(area->xmin / chunkSizef);
+ const int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
+ const int minychunk = floor(area->ymin / chunkSizef);
+ const int maxychunk = ceil((area->ymax - 1) / chunkSizef);
bool result = true;
- for (indexx = max(minxchunk, 0); indexx<maxxchunk ; indexx++) {
- for (indexy = max(minychunk, 0); indexy<maxychunk ; indexy++) {
+ for (indexx = max(minxchunk, 0); indexx < maxxchunk; indexx++) {
+ for (indexy = max(minychunk, 0); indexy < maxychunk; indexy++) {
if (!scheduleChunkWhenPossible(graph, indexx, indexy)) {
result = false;
}
@@ -512,7 +512,7 @@ bool ExecutionGroup::scheduleChunk(unsigned int chunkNumber)
return false;
}
-bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChunk, int yChunk)
+bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem *graph, int xChunk, int yChunk)
{
if (xChunk < 0 || xChunk >= (int)this->numberOfXChunks) {
return true;
@@ -520,7 +520,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
if (yChunk < 0 || yChunk >= (int)this->numberOfYChunks) {
return true;
}
- int chunkNumber = yChunk*this->numberOfXChunks + xChunk;
+ int chunkNumber = yChunk * this->numberOfXChunks + xChunk;
// chunk is already executed
if (this->chunkExecutionStates[chunkNumber] == COM_ES_EXECUTED) {
return true;
@@ -532,7 +532,7 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
}
// chunk is nor executed nor scheduled.
- vector<MemoryProxy*> memoryProxies;
+ vector<MemoryProxy *> memoryProxies;
this->determineDependingMemoryProxies(&memoryProxies);
rcti rect;
@@ -541,10 +541,10 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
bool canBeExecuted = true;
rcti area;
- for (index = 0 ; index < cachedReadOperations.size() ; index ++) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*)cachedReadOperations[index];
+ for (index = 0; index < cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)cachedReadOperations[index];
BLI_init_rcti(&area, 0, 0, 0, 0);
- MemoryProxy * memoryProxy = memoryProxies[index];
+ MemoryProxy *memoryProxy = memoryProxies[index];
determineDependingAreaOfInterest(&rect, readOperation, &area);
ExecutionGroup *group = memoryProxy->getExecutor();
@@ -565,16 +565,16 @@ bool ExecutionGroup::scheduleChunkWhenPossible(ExecutionSystem * graph, int xChu
return false;
}
-void ExecutionGroup::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
+void ExecutionGroup::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
this->getOutputNodeOperation()->determineDependingAreaOfInterest(input, readOperation, output);
}
-void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memoryProxies)
+void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy *> *memoryProxies)
{
unsigned int index;
- for (index = 0 ; index < this->cachedReadOperations.size() ; index ++) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*) this->cachedReadOperations[index];
+ for (index = 0; index < this->cachedReadOperations.size(); index++) {
+ ReadBufferOperation *readOperation = (ReadBufferOperation *) this->cachedReadOperations[index];
memoryProxies->push_back(readOperation->getMemoryProxy());
}
}
diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
index 7ea97b3fa39..7250a851f7b 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp
@@ -42,8 +42,8 @@
ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
{
context.setbNodeTree(editingtree);
- bNode* gnode;
- for (gnode = (bNode*)editingtree->nodes.first ; gnode ; gnode = (bNode*)gnode->next) {
+ bNode *gnode;
+ for (gnode = (bNode *)editingtree->nodes.first; gnode; gnode = (bNode *)gnode->next) {
if (gnode->type == NODE_GROUP && gnode->typeinfo->group_edit_get(gnode)) {
context.setActivegNode(gnode);
break;
@@ -60,19 +60,19 @@ ExecutionSystem::ExecutionSystem(bNodeTree *editingtree, bool rendering)
context.setRendering(rendering);
context.setHasActiveOpenCLDevices(WorkScheduler::hasGPUDevices() && (editingtree->flag & NTREE_COM_OPENCL));
- Node *mainOutputNode=NULL;
+ Node *mainOutputNode = NULL;
mainOutputNode = ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL);
if (mainOutputNode) {
- context.setScene((Scene*)mainOutputNode->getbNode()->id);
+ context.setScene((Scene *)mainOutputNode->getbNode()->id);
this->convertToOperations();
this->groupOperations(); /* group operations in ExecutionGroups */
unsigned int index;
unsigned int resolution[2];
- for (index = 0 ; index < this->groups.size(); index ++) {
- resolution[0]=0;
- resolution[1]=0;
+ for (index = 0; index < this->groups.size(); index++) {
+ resolution[0] = 0;
+ resolution[1] = 0;
ExecutionGroup *executionGroup = groups[index];
executionGroup->determineResolution(resolution);
}
@@ -111,24 +111,24 @@ ExecutionSystem::~ExecutionSystem()
void ExecutionSystem::execute()
{
unsigned int order = 0;
- for (vector<NodeOperation*>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter) {
+ for (vector<NodeOperation *>::iterator iter = this->operations.begin(); iter != operations.end(); ++iter) {
NodeBase *node = *iter;
- NodeOperation *operation = (NodeOperation*) node;
+ NodeOperation *operation = (NodeOperation *) node;
if (operation->isReadBufferOperation()) {
- ReadBufferOperation * readOperation = (ReadBufferOperation*)operation;
+ ReadBufferOperation *readOperation = (ReadBufferOperation *)operation;
readOperation->setOffset(order);
- order ++;
+ order++;
}
}
unsigned int index;
- for (index = 0 ; index < this->operations.size() ; index ++) {
- NodeOperation * operation = this->operations[index];
+ for (index = 0; index < this->operations.size(); index++) {
+ NodeOperation *operation = this->operations[index];
operation->setbNodeTree(this->context.getbNodeTree());
operation->initExecution();
}
- for (index = 0 ; index < this->groups.size() ; index ++) {
- ExecutionGroup * executionGroup = this->groups[index];
+ for (index = 0; index < this->groups.size(); index++) {
+ ExecutionGroup *executionGroup = this->groups[index];
executionGroup->setChunksize(context.getChunksize());
executionGroup->initExecution();
}
@@ -142,12 +142,12 @@ void ExecutionSystem::execute()
WorkScheduler::finish();
WorkScheduler::stop();
- for (index = 0 ; index < this->operations.size() ; index ++) {
- NodeOperation * operation = this->operations[index];
+ for (index = 0; index < this->operations.size(); index++) {
+ NodeOperation *operation = this->operations[index];
operation->deinitExecution();
}
- for (index = 0 ; index < this->groups.size() ; index ++) {
- ExecutionGroup * executionGroup = this->groups[index];
+ for (index = 0; index < this->groups.size(); index++) {
+ ExecutionGroup *executionGroup = this->groups[index];
executionGroup->deinitExecution();
}
}
@@ -155,10 +155,10 @@ void ExecutionSystem::execute()
void ExecutionSystem::executeGroups(CompositorPriority priority)
{
unsigned int index;
- vector<ExecutionGroup*> executionGroups;
+ vector<ExecutionGroup *> executionGroups;
this->findOutputExecutionGroup(&executionGroups, priority);
- for (index = 0 ; index < executionGroups.size(); index ++) {
+ for (index = 0; index < executionGroups.size(); index++) {
ExecutionGroup *group = executionGroups[index];
group->execute(this);
}
@@ -175,15 +175,15 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
// for every input add write and read operation if input is not a read operation
// only add read operation to other links when they are attached to buffered operations.
unsigned int index;
- for (index = 0 ; index < operation->getNumberOfInputSockets();index++) {
+ for (index = 0; index < operation->getNumberOfInputSockets(); index++) {
InputSocket *inputsocket = operation->getInputSocket(index);
if (inputsocket->isConnected()) {
SocketConnection *connection = inputsocket->getConnection();
- NodeOperation *otherEnd = (NodeOperation*)connection->getFromNode();
+ NodeOperation *otherEnd = (NodeOperation *)connection->getFromNode();
if (!otherEnd->isReadBufferOperation()) {
// check of other end already has write operation
OutputSocket *fromsocket = connection->getFromSocket();
- WriteBufferOperation * writeoperation = fromsocket->findAttachedWriteBufferOperation();
+ WriteBufferOperation *writeoperation = fromsocket->findAttachedWriteBufferOperation();
if (writeoperation == NULL) {
writeoperation = new WriteBufferOperation();
writeoperation->setbNodeTree(this->getContext().getbNodeTree());
@@ -201,11 +201,11 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
}
}
/*
- link the outputsocket to a write operation
- link the writeoperation to a read operation
- link the read operation to the next node.
- */
- OutputSocket * outputsocket = operation->getOutputSocket();
+ * link the outputsocket to a write operation
+ * link the writeoperation to a read operation
+ * link the read operation to the next node.
+ */
+ OutputSocket *outputsocket = operation->getOutputSocket();
if (outputsocket->isConnected()) {
int index;
WriteBufferOperation *writeOperation;
@@ -214,8 +214,8 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
this->addOperation(writeOperation);
ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
writeOperation->readResolutionFromInputSocket();
- for (index = 0 ; index < outputsocket->getNumberOfConnections()-1;index ++) {
- SocketConnection * connection = outputsocket->getConnection(index);
+ for (index = 0; index < outputsocket->getNumberOfConnections() - 1; index++) {
+ SocketConnection *connection = outputsocket->getConnection(index);
ReadBufferOperation *readoperation = new ReadBufferOperation();
readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
connection->setFromSocket(readoperation->getOutputSocket());
@@ -230,11 +230,11 @@ void ExecutionSystem::convertToOperations()
{
unsigned int index;
for (index = 0; index < this->nodes.size(); index++) {
- Node *node = (Node*)this->nodes[index];
+ Node *node = (Node *)this->nodes[index];
node->convertToOperations(this, &this->context);
}
- for (index = 0 ; index < this->connections.size(); index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
if (connection->isValid()) {
if (connection->getFromSocket()->getDataType() != connection->getToSocket()->getDataType()) {
@@ -244,27 +244,27 @@ void ExecutionSystem::convertToOperations()
}
// determine all resolutions of the operations (Width/Height)
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isOutputOperation(context.isRendering()) && !operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0,0};
- unsigned int preferredResolution[2] = {0,0};
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
}
- for (index = 0 ; index < this->operations.size(); index ++) {
+ for (index = 0; index < this->operations.size(); index++) {
NodeOperation *operation = this->operations[index];
if (operation->isOutputOperation(context.isRendering()) && operation->isPreviewOperation()) {
- unsigned int resolution[2] = {0,0};
- unsigned int preferredResolution[2] = {0,0};
+ unsigned int resolution[2] = {0, 0};
+ unsigned int preferredResolution[2] = {0, 0};
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
}
// add convert resolution operations when needed.
- for (index = 0 ; index < this->connections.size(); index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
if (connection->isValid()) {
if (connection->needsResolutionConversion()) {
@@ -272,13 +272,12 @@ void ExecutionSystem::convertToOperations()
}
}
}
-
}
void ExecutionSystem::groupOperations()
{
- vector<NodeOperation*> outputOperations;
- NodeOperation * operation;
+ vector<NodeOperation *> outputOperations;
+ NodeOperation *operation;
unsigned int index;
// surround complex operations with ReadBufferOperation and WriteBufferOperation
for (index = 0; index < this->operations.size(); index++) {
@@ -288,7 +287,7 @@ void ExecutionSystem::groupOperations()
}
}
ExecutionSystemHelper::findOutputNodeOperations(&outputOperations, this->getOperations(), this->context.isRendering());
- for (vector<NodeOperation*>::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter) {
+ for (vector<NodeOperation *>::iterator iter = outputOperations.begin(); iter != outputOperations.end(); ++iter) {
operation = *iter;
ExecutionGroup *group = new ExecutionGroup();
group->addOperation(this, operation);
@@ -303,10 +302,10 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection)
}
-void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result, CompositorPriority priority) const
+void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result, CompositorPriority priority) const
{
unsigned int index;
- for (index = 0 ; index < this->groups.size() ; index ++) {
+ for (index = 0; index < this->groups.size(); index++) {
ExecutionGroup *group = this->groups[index];
if (group->isOutputExecutionGroup() && group->getRenderPriotrity() == priority) {
result->push_back(group);
@@ -314,10 +313,10 @@ void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result,
}
}
-void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const
+void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup *> *result) const
{
unsigned int index;
- for (index = 0 ; index < this->groups.size() ; index ++) {
+ for (index = 0; index < this->groups.size(); index++) {
ExecutionGroup *group = this->groups[index];
if (group->isOutputExecutionGroup()) {
result->push_back(group);
diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
index 2d889e269e0..bcb606316ab 100644
--- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
+++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
@@ -37,38 +37,38 @@
#include "COM_ReadBufferOperation.h"
#include "COM_ViewerBaseOperation.h"
-Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree * tree, bNode *groupnode)
+Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_start, bNodeTree *tree, bNode *groupnode)
{
- vector<Node*>& nodes = system.getNodes();
- vector<SocketConnection*>& links = system.getConnections();
+ vector<Node *>& nodes = system.getNodes();
+ vector<SocketConnection *>& links = system.getConnections();
Node *mainnode = NULL;
- const bNode * activeGroupNode = system.getContext().getActivegNode();
+ const bNode *activeGroupNode = system.getContext().getActivegNode();
bool isActiveGroup = activeGroupNode == groupnode;
/* add all nodes of the tree to the node list */
- bNode *node = (bNode*)tree->nodes.first;
+ bNode *node = (bNode *)tree->nodes.first;
while (node != NULL) {
Node *execnode = addNode(nodes, node, isActiveGroup);
if (node->type == CMP_NODE_COMPOSITE) {
mainnode = execnode;
}
- node = (bNode*)node->next;
+ node = (bNode *)node->next;
}
- NodeRange node_range(nodes.begin()+nodes_start, nodes.end());
+ NodeRange node_range(nodes.begin() + nodes_start, nodes.end());
/* add all nodelinks of the tree to the link list */
- bNodeLink *nodelink = (bNodeLink*)tree->links.first;
+ bNodeLink *nodelink = (bNodeLink *)tree->links.first;
while (nodelink != NULL) {
addNodeLink(node_range, links, nodelink);
- nodelink = (bNodeLink*)nodelink->next;
+ nodelink = (bNodeLink *)nodelink->next;
}
/* Expand group nodes */
- for (unsigned int i=nodes_start; i < nodes.size(); ++i) {
+ for (unsigned int i = nodes_start; i < nodes.size(); ++i) {
Node *execnode = nodes[i];
if (execnode->isGroupNode()) {
- GroupNode * groupNode = (GroupNode*)execnode;
+ GroupNode *groupNode = (GroupNode *)execnode;
groupNode->ungroup(system);
}
}
@@ -76,15 +76,15 @@ Node *ExecutionSystemHelper::addbNodeTree(ExecutionSystem &system, int nodes_sta
return mainnode;
}
-void ExecutionSystemHelper::addNode(vector<Node*>& nodes, Node *node)
+void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node)
{
nodes.push_back(node);
}
-Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode, bool inActiveGroup)
+Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *bNode, bool inActiveGroup)
{
Converter converter;
- Node * node;
+ Node *node;
node = converter.convert(bNode);
node->setIsInActiveGroup(inActiveGroup);
if (node != NULL) {
@@ -93,21 +93,21 @@ Node *ExecutionSystemHelper::addNode(vector<Node*>& nodes, bNode *bNode, bool in
}
return NULL;
}
-void ExecutionSystemHelper::addOperation(vector<NodeOperation*>& operations, NodeOperation *operation)
+void ExecutionSystemHelper::addOperation(vector<NodeOperation *>& operations, NodeOperation *operation)
{
operations.push_back(operation);
}
-void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup*>& executionGroups, ExecutionGroup *executionGroup)
+void ExecutionSystemHelper::addExecutionGroup(vector<ExecutionGroup *>& executionGroups, ExecutionGroup *executionGroup)
{
executionGroups.push_back(executionGroup);
}
-void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* result, vector<NodeOperation*>& operations, bool rendering)
+void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation *> *result, vector<NodeOperation *>& operations, bool rendering)
{
unsigned int index;
- for (index = 0 ; index < operations.size() ; index ++) {
+ for (index = 0; index < operations.size(); index++) {
NodeOperation *operation = operations[index];
if (operation->isOutputOperation(rendering)) {
result->push_back(operation);
@@ -118,18 +118,18 @@ void ExecutionSystemHelper::findOutputNodeOperations(vector<NodeOperation*>* res
static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
if (bnode != NULL) {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->getbNode() == bnode)
return node->findInputSocketBybNodeSocket(bsocket);
}
}
else {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->isProxyNode()) {
InputSocket *proxySocket = node->getInputSocket(0);
- if (proxySocket->getbNodeSocket()==bsocket)
+ if (proxySocket->getbNodeSocket() == bsocket)
return proxySocket;
}
}
@@ -139,29 +139,29 @@ static InputSocket *find_input(NodeRange &node_range, bNode *bnode, bNodeSocket
static OutputSocket *find_output(NodeRange &node_range, bNode *bnode, bNodeSocket *bsocket)
{
if (bnode != NULL) {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->getbNode() == bnode)
return node->findOutputSocketBybNodeSocket(bsocket);
}
}
else {
- for (NodeIterator it=node_range.first; it!=node_range.second; ++it) {
+ for (NodeIterator it = node_range.first; it != node_range.second; ++it) {
Node *node = *it;
if (node->isProxyNode()) {
OutputSocket *proxySocket = node->getOutputSocket(0);
- if (proxySocket->getbNodeSocket()==bsocket)
+ if (proxySocket->getbNodeSocket() == bsocket)
return proxySocket;
}
}
}
return NULL;
}
-SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection*>& links, bNodeLink *bNodeLink)
+SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vector<SocketConnection *>& links, bNodeLink *bNodeLink)
{
/// @note: cyclic lines will be ignored. This has been copied from node.c
if (bNodeLink->tonode != 0 && bNodeLink->fromnode != 0) {
- if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level!=0xFFF)) { // only add non cyclic lines! so execution will procede
+ if (!(bNodeLink->fromnode->level >= bNodeLink->tonode->level && bNodeLink->tonode->level != 0xFFF)) { // only add non cyclic lines! so execution will procede
return NULL;
}
}
@@ -178,9 +178,9 @@ SocketConnection *ExecutionSystemHelper::addNodeLink(NodeRange &node_range, vect
return connection;
}
-SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection*>& links, OutputSocket *fromSocket, InputSocket *toSocket)
+SocketConnection *ExecutionSystemHelper::addLink(vector<SocketConnection *>& links, OutputSocket *fromSocket, InputSocket *toSocket)
{
- SocketConnection * newconnection = new SocketConnection();
+ SocketConnection *newconnection = new SocketConnection();
newconnection->setFromSocket(fromSocket);
newconnection->setToSocket(toSocket);
fromSocket->addConnection(newconnection);
@@ -199,12 +199,12 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("-- BEGIN COMPOSITOR DUMP --\r\n");
printf("digraph compositorexecution {\r\n");
tot = system->getNodes().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
node = system->getNodes()[i];
printf("// NODE: %s\r\n", node->getbNode()->typeinfo->name);
}
tot = system->getOperations().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
operation = system->getOperations()[i];
printf("// OPERATION: %p\r\n", operation);
printf("\t\"O_%p\"", operation);
@@ -212,32 +212,33 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
tot2 = operation->getNumberOfInputSockets();
if (tot2 != 0) {
printf("{");
- for (int j = 0 ; j < tot2 ; j ++) {
+ for (int j = 0; j < tot2; j++) {
InputSocket *socket = operation->getInputSocket(j);
if (j != 0) {
printf("|");
}
printf("<IN_%p>", socket);
switch (socket->getDataType()) {
- case COM_DT_VALUE:
- printf("Value");
- break;
- case COM_DT_VECTOR:
- printf("Vector");
- break;
- case COM_DT_COLOR:
- printf("Color");
- break;
+ case COM_DT_VALUE:
+ printf("Value");
+ break;
+ case COM_DT_VECTOR:
+ printf("Vector");
+ break;
+ case COM_DT_COLOR:
+ printf("Color");
+ break;
}
}
printf("}");
printf("|");
}
if (operation->isViewerOperation()) {
- ViewerBaseOperation * viewer = (ViewerBaseOperation*)operation;
+ ViewerBaseOperation *viewer = (ViewerBaseOperation *)operation;
if (viewer->isActiveViewerOutput()) {
printf("Active viewer");
- } else {
+ }
+ else {
printf("Viewer");
}
}
@@ -261,22 +262,22 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
if (tot2 != 0) {
printf("|");
printf("{");
- for (int j = 0 ; j < tot2 ; j ++) {
+ for (int j = 0; j < tot2; j++) {
OutputSocket *socket = operation->getOutputSocket(j);
if (j != 0) {
printf("|");
}
printf("<OUT_%p>", socket);
switch (socket->getDataType()) {
- case COM_DT_VALUE:
- printf("Value");
- break;
- case COM_DT_VECTOR:
- printf("Vector");
- break;
- case COM_DT_COLOR:
- printf("Color");
- break;
+ case COM_DT_VALUE:
+ printf("Value");
+ break;
+ case COM_DT_VECTOR:
+ printf("Vector");
+ break;
+ case COM_DT_COLOR:
+ printf("Color");
+ break;
}
}
printf("}");
@@ -285,7 +286,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("\r\n");
}
tot = system->getExecutionGroups().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
group = system->getExecutionGroups()[i];
printf("// GROUP: %d\r\n", i);
printf("subgraph {\r\n");
@@ -294,16 +295,16 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
printf("}\r\n");
}
tot = system->getOperations().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
operation = system->getOperations()[i];
if (operation->isReadBufferOperation()) {
- ReadBufferOperation * read = (ReadBufferOperation*)operation;
- WriteBufferOperation * write = read->getMemoryProxy()->getWriteBufferOperation();
+ ReadBufferOperation *read = (ReadBufferOperation *)operation;
+ WriteBufferOperation *write = read->getMemoryProxy()->getWriteBufferOperation();
printf("\t\"O_%p\" -> \"O_%p\" [style=dotted]\r\n", write, read);
}
}
tot = system->getConnections().size();
- for (int i = 0 ; i < tot ; i ++) {
+ for (int i = 0; i < tot; i++) {
connection = system->getConnections()[i];
printf("// CONNECTION: %p.%p -> %p.%p\r\n", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket());
printf("\t\"O_%p\":\"OUT_%p\" -> \"O_%p\":\"IN_%p\"", connection->getFromNode(), connection->getFromSocket(), connection->getToNode(), connection->getToSocket());
@@ -312,15 +313,15 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
}
else {
switch (connection->getFromSocket()->getDataType()) {
- case COM_DT_VALUE:
- printf(" [color=grey]");
- break;
- case COM_DT_VECTOR:
- printf(" [color=blue]");
- break;
- case COM_DT_COLOR:
- printf(" [color=orange]");
- break;
+ case COM_DT_VALUE:
+ printf(" [color=grey]");
+ break;
+ case COM_DT_VECTOR:
+ printf(" [color=blue]");
+ break;
+ case COM_DT_COLOR:
+ printf(" [color=orange]");
+ break;
}
}
printf("\r\n");
diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp
index c9705ad69fb..3ca74f157b4 100644
--- a/source/blender/compositor/intern/COM_InputSocket.cpp
+++ b/source/blender/compositor/intern/COM_InputSocket.cpp
@@ -25,18 +25,18 @@
#include "COM_SocketConnection.h"
#include "COM_ExecutionSystem.h"
-InputSocket::InputSocket(DataType datatype) :Socket(datatype)
+InputSocket::InputSocket(DataType datatype) : Socket(datatype)
{
this->connection = NULL;
this->resizeMode = COM_SC_CENTER;
}
-InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) :Socket(datatype)
+InputSocket::InputSocket(DataType datatype, InputSocketResizeMode resizeMode) : Socket(datatype)
{
this->connection = NULL;
this->resizeMode = resizeMode;
}
-InputSocket::InputSocket(InputSocket *from) :Socket(from->getDataType())
+InputSocket::InputSocket(InputSocket *from) : Socket(from->getDataType())
{
this->connection = NULL;
this->resizeMode = from->getResizeMode();
@@ -54,7 +54,7 @@ SocketConnection *InputSocket::getConnection()
return this->connection;
}
-void InputSocket::determineResolution(unsigned int resolution[],unsigned int preferredResolution[])
+void InputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
if (this->isConnected()) {
this->connection->getFromSocket()->determineResolution(resolution, preferredResolution);
@@ -78,22 +78,22 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket)
void InputSocket::relinkConnectionsDuplicate(InputSocket *relinkToSocket, int editorNodeInputSocketIndex, ExecutionSystem *graph)
{
if (!this->isConnected()) {
- Node *node = (Node*)this->getNode();
+ Node *node = (Node *)this->getNode();
switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
+ case COM_DT_COLOR:
+ node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VECTOR:
+ node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VALUE:
+ node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
}
return;
}
- SocketConnection * newConnection = new SocketConnection();
- OutputSocket * fromSocket = this->getConnection()->getFromSocket();
+ SocketConnection *newConnection = new SocketConnection();
+ OutputSocket *fromSocket = this->getConnection()->getFromSocket();
newConnection->setToSocket(relinkToSocket);
newConnection->setFromSocket(fromSocket);
relinkToSocket->setConnection(newConnection);
@@ -107,17 +107,17 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, int editorNode
relinkConnections(relinkToSocket);
}
else {
- Node *node = (Node*)this->getNode();
+ Node *node = (Node *)this->getNode();
switch (this->getDataType()) {
- case COM_DT_COLOR:
- node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VECTOR:
- node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
- case COM_DT_VALUE:
- node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
- break;
+ case COM_DT_COLOR:
+ node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VECTOR:
+ node->addSetVectorOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
+ case COM_DT_VALUE:
+ node->addSetValueOperation(graph, relinkToSocket, editorNodeInputSocketIndex);
+ break;
}
}
}
@@ -140,7 +140,7 @@ SocketReader *InputSocket::getReader()
NodeOperation *InputSocket::getOperation() const
{
if (isConnected()) {
- return (NodeOperation*)this->connection->getFromSocket()->getNode();
+ return (NodeOperation *)this->connection->getFromSocket()->getNode();
}
else {
return NULL;
@@ -156,14 +156,14 @@ float *InputSocket::getStaticValues()
static float default_null = 0.0f;
switch (this->getDataType()) {
- case COM_DT_VALUE:
- return &((bNodeSocketValueFloat*)b_socket->default_value)->value;
- case COM_DT_COLOR:
- return ((bNodeSocketValueRGBA*)b_socket->default_value)->value;
- case COM_DT_VECTOR:
- return ((bNodeSocketValueVector*)b_socket->default_value)->value;
- default:
- /* XXX this should never happen, just added to please the compiler */
- return &default_null;
+ case COM_DT_VALUE:
+ return &((bNodeSocketValueFloat *)b_socket->default_value)->value;
+ case COM_DT_COLOR:
+ return ((bNodeSocketValueRGBA *)b_socket->default_value)->value;
+ case COM_DT_VECTOR:
+ return ((bNodeSocketValueVector *)b_socket->default_value)->value;
+ default:
+ /* XXX this should never happen, just added to please the compiler */
+ return &default_null;
}
}
diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
index 90f6d4a738d..ceed53c4c0d 100644
--- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp
+++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp
@@ -32,30 +32,30 @@ unsigned int MemoryBuffer::determineBufferSize()
int MemoryBuffer::getWidth() const
{
- return this->rect.xmax-this->rect.xmin;
+ return this->rect.xmax - this->rect.xmin;
}
int MemoryBuffer::getHeight() const
{
- return this->rect.ymax-this->rect.ymin;
+ return this->rect.ymax - this->rect.ymin;
}
-MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, unsigned int chunkNumber, rcti *rect)
+MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, unsigned int chunkNumber, rcti *rect)
{
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->memoryProxy = memoryProxy;
this->chunkNumber = chunkNumber;
- this->buffer = (float*)MEM_mallocN(sizeof(float)*determineBufferSize()*COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
+ this->buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
this->state = COM_MB_ALLOCATED;
this->datatype = COM_DT_COLOR;
this->chunkWidth = this->rect.xmax - this->rect.xmin;
}
-MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
+MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
{
BLI_init_rcti(&this->rect, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
this->memoryProxy = memoryProxy;
this->chunkNumber = -1;
- this->buffer = (float*)MEM_mallocN(sizeof(float)*determineBufferSize()*COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
+ this->buffer = (float *)MEM_mallocN(sizeof(float) * determineBufferSize() * COM_NUMBER_OF_CHANNELS, "COM_MemoryBuffer");
this->state = COM_MB_TEMPORARILY;
this->datatype = COM_DT_COLOR;
this->chunkWidth = this->rect.xmax - this->rect.xmin;
@@ -63,12 +63,12 @@ MemoryBuffer::MemoryBuffer(MemoryProxy * memoryProxy, rcti *rect)
MemoryBuffer *MemoryBuffer::duplicate()
{
MemoryBuffer *result = new MemoryBuffer(this->memoryProxy, &this->rect);
- memcpy(result->buffer, this->buffer, this->determineBufferSize()*COM_NUMBER_OF_CHANNELS*sizeof(float));
+ memcpy(result->buffer, this->buffer, this->determineBufferSize() * COM_NUMBER_OF_CHANNELS * sizeof(float));
return result;
}
void MemoryBuffer::clear()
{
- memset(this->buffer, 0, this->determineBufferSize()*COM_NUMBER_OF_CHANNELS*sizeof(float));
+ memset(this->buffer, 0, this->determineBufferSize() * COM_NUMBER_OF_CHANNELS * sizeof(float));
}
float *MemoryBuffer::convertToValueBuffer()
@@ -81,7 +81,7 @@ float *MemoryBuffer::convertToValueBuffer()
const float *fp_src = this->buffer;
float *fp_dst = result;
- for (i = 0; i < size ; i++, fp_dst++, fp_src += COM_NUMBER_OF_CHANNELS) {
+ for (i = 0; i < size; i++, fp_dst++, fp_src += COM_NUMBER_OF_CHANNELS) {
*fp_dst = *fp_src;
}
@@ -110,17 +110,17 @@ void MemoryBuffer::copyContentFrom(MemoryBuffer *otherBuffer)
int otherOffset;
- for (otherY = minY ; otherY<maxY ; otherY ++) {
- otherOffset = ((otherY-otherBuffer->rect.ymin) * otherBuffer->chunkWidth + minX-otherBuffer->rect.xmin)*COM_NUMBER_OF_CHANNELS;
- offset = ((otherY - this->rect.ymin) * this->chunkWidth + minX-this->rect.xmin)*COM_NUMBER_OF_CHANNELS;
- memcpy(&this->buffer[offset], &otherBuffer->buffer[otherOffset], (maxX-minX) * COM_NUMBER_OF_CHANNELS*sizeof(float));
+ for (otherY = minY; otherY < maxY; otherY++) {
+ otherOffset = ((otherY - otherBuffer->rect.ymin) * otherBuffer->chunkWidth + minX - otherBuffer->rect.xmin) * COM_NUMBER_OF_CHANNELS;
+ offset = ((otherY - this->rect.ymin) * this->chunkWidth + minX - this->rect.xmin) * COM_NUMBER_OF_CHANNELS;
+ memcpy(&this->buffer[offset], &otherBuffer->buffer[otherOffset], (maxX - minX) * COM_NUMBER_OF_CHANNELS * sizeof(float));
}
}
void MemoryBuffer::read(float result[4], int x, int y)
{
- if (x>=this->rect.xmin && x < this->rect.xmax &&
- y>=this->rect.ymin && y < this->rect.ymax)
+ if (x >= this->rect.xmin && x < this->rect.xmax &&
+ y >= this->rect.ymin && y < this->rect.ymax)
{
const int dx = x - this->rect.xmin;
const int dy = y - this->rect.ymin;
@@ -173,84 +173,84 @@ void MemoryBuffer::readCubic(float result[4], float x, float y)
read(color3, x2, y1);
read(color4, x2, y2);
- color1[0] = color1[0]*mvaluey + color2[0]*valuey;
- color1[1] = color1[1]*mvaluey + color2[1]*valuey;
- color1[2] = color1[2]*mvaluey + color2[2]*valuey;
- color1[3] = color1[3]*mvaluey + color2[3]*valuey;
-
- color3[0] = color3[0]*mvaluey + color4[0]*valuey;
- color3[1] = color3[1]*mvaluey + color4[1]*valuey;
- color3[2] = color3[2]*mvaluey + color4[2]*valuey;
- color3[3] = color3[3]*mvaluey + color4[3]*valuey;
-
- result[0] = color1[0]*mvaluex + color3[0]*valuex;
- result[1] = color1[1]*mvaluex + color3[1]*valuex;
- result[2] = color1[2]*mvaluex + color3[2]*valuex;
- result[3] = color1[3]*mvaluex + color3[3]*valuex;
+ color1[0] = color1[0] * mvaluey + color2[0] * valuey;
+ color1[1] = color1[1] * mvaluey + color2[1] * valuey;
+ color1[2] = color1[2] * mvaluey + color2[2] * valuey;
+ color1[3] = color1[3] * mvaluey + color2[3] * valuey;
+
+ color3[0] = color3[0] * mvaluey + color4[0] * valuey;
+ color3[1] = color3[1] * mvaluey + color4[1] * valuey;
+ color3[2] = color3[2] * mvaluey + color4[2] * valuey;
+ color3[3] = color3[3] * mvaluey + color4[3] * valuey;
+
+ result[0] = color1[0] * mvaluex + color3[0] * valuex;
+ result[1] = color1[1] * mvaluex + color3[1] * valuex;
+ result[2] = color1[2] * mvaluex + color3[2] * valuex;
+ result[3] = color1[3] * mvaluex + color3[3] * valuex;
}
// table of (exp(ar) - exp(a)) / (1 - exp(a)) for r in range [0, 1] and a = -2
// used instead of actual gaussian, otherwise at high texture magnifications circular artifacts are visible
#define EWA_MAXIDX 255
-static float EWA_WTS[EWA_MAXIDX + 1] =
-{ 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
- 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
- 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
- 0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
- 0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
- 0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
- 0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
- 0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
- 0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
- 0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
- 0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
- 0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
- 0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
- 0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
- 0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
- 0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
- 0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
- 0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
- 0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
- 0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
- 0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
- 0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
- 0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
- 0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
- 0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
- 0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
- 0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
- 0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
- 0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
- 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
- 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
- 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
+static float EWA_WTS[EWA_MAXIDX + 1] = {
+ 1.f, 0.990965f, 0.982f, 0.973105f, 0.96428f, 0.955524f, 0.946836f, 0.938216f, 0.929664f,
+ 0.921178f, 0.912759f, 0.904405f, 0.896117f, 0.887893f, 0.879734f, 0.871638f, 0.863605f,
+ 0.855636f, 0.847728f, 0.839883f, 0.832098f, 0.824375f, 0.816712f, 0.809108f, 0.801564f,
+ 0.794079f, 0.786653f, 0.779284f, 0.771974f, 0.76472f, 0.757523f, 0.750382f, 0.743297f,
+ 0.736267f, 0.729292f, 0.722372f, 0.715505f, 0.708693f, 0.701933f, 0.695227f, 0.688572f,
+ 0.68197f, 0.67542f, 0.66892f, 0.662471f, 0.656073f, 0.649725f, 0.643426f, 0.637176f,
+ 0.630976f, 0.624824f, 0.618719f, 0.612663f, 0.606654f, 0.600691f, 0.594776f, 0.588906f,
+ 0.583083f, 0.577305f, 0.571572f, 0.565883f, 0.56024f, 0.55464f, 0.549084f, 0.543572f,
+ 0.538102f, 0.532676f, 0.527291f, 0.521949f, 0.516649f, 0.511389f, 0.506171f, 0.500994f,
+ 0.495857f, 0.490761f, 0.485704f, 0.480687f, 0.475709f, 0.470769f, 0.465869f, 0.461006f,
+ 0.456182f, 0.451395f, 0.446646f, 0.441934f, 0.437258f, 0.432619f, 0.428017f, 0.42345f,
+ 0.418919f, 0.414424f, 0.409963f, 0.405538f, 0.401147f, 0.39679f, 0.392467f, 0.388178f,
+ 0.383923f, 0.379701f, 0.375511f, 0.371355f, 0.367231f, 0.363139f, 0.359079f, 0.355051f,
+ 0.351055f, 0.347089f, 0.343155f, 0.339251f, 0.335378f, 0.331535f, 0.327722f, 0.323939f,
+ 0.320186f, 0.316461f, 0.312766f, 0.3091f, 0.305462f, 0.301853f, 0.298272f, 0.294719f,
+ 0.291194f, 0.287696f, 0.284226f, 0.280782f, 0.277366f, 0.273976f, 0.270613f, 0.267276f,
+ 0.263965f, 0.26068f, 0.257421f, 0.254187f, 0.250979f, 0.247795f, 0.244636f, 0.241502f,
+ 0.238393f, 0.235308f, 0.232246f, 0.229209f, 0.226196f, 0.223206f, 0.220239f, 0.217296f,
+ 0.214375f, 0.211478f, 0.208603f, 0.20575f, 0.20292f, 0.200112f, 0.197326f, 0.194562f,
+ 0.191819f, 0.189097f, 0.186397f, 0.183718f, 0.18106f, 0.178423f, 0.175806f, 0.17321f,
+ 0.170634f, 0.168078f, 0.165542f, 0.163026f, 0.16053f, 0.158053f, 0.155595f, 0.153157f,
+ 0.150738f, 0.148337f, 0.145955f, 0.143592f, 0.141248f, 0.138921f, 0.136613f, 0.134323f,
+ 0.132051f, 0.129797f, 0.12756f, 0.125341f, 0.123139f, 0.120954f, 0.118786f, 0.116635f,
+ 0.114501f, 0.112384f, 0.110283f, 0.108199f, 0.106131f, 0.104079f, 0.102043f, 0.100023f,
+ 0.0980186f, 0.09603f, 0.094057f, 0.0920994f, 0.0901571f, 0.08823f, 0.0863179f, 0.0844208f,
+ 0.0825384f, 0.0806708f, 0.0788178f, 0.0769792f, 0.0751551f, 0.0733451f, 0.0715493f, 0.0697676f,
+ 0.0679997f, 0.0662457f, 0.0645054f, 0.0627786f, 0.0610654f, 0.0593655f, 0.0576789f, 0.0560055f,
+ 0.0543452f, 0.0526979f, 0.0510634f, 0.0494416f, 0.0478326f, 0.0462361f, 0.0446521f, 0.0430805f,
+ 0.0415211f, 0.039974f, 0.0384389f, 0.0369158f, 0.0354046f, 0.0339052f, 0.0324175f, 0.0309415f,
+ 0.029477f, 0.0280239f, 0.0265822f, 0.0251517f, 0.0237324f, 0.0223242f, 0.020927f, 0.0195408f,
+ 0.0181653f, 0.0168006f, 0.0154466f, 0.0141031f, 0.0127701f, 0.0114476f, 0.0101354f, 0.00883339f,
+ 0.00754159f, 0.00625989f, 0.00498819f, 0.00372644f, 0.00247454f, 0.00123242f, 0.f
};
static void radangle2imp(float a2, float b2, float th, float *A, float *B, float *C, float *F)
{
float ct2 = cosf(th);
- const float st2 = 1.f - ct2*ct2; // <- sin(th)^2
+ const float st2 = 1.f - ct2 * ct2; // <- sin(th)^2
ct2 *= ct2;
- *A = a2*st2 + b2*ct2;
- *B = (b2 - a2)*sinf(2.f*th);
- *C = a2*ct2 + b2*st2;
- *F = a2*b2;
+ *A = a2 * st2 + b2 * ct2;
+ *B = (b2 - a2) * sinf(2.f * th);
+ *C = a2 * ct2 + b2 * st2;
+ *F = a2 * b2;
}
// all tests here are done to make sure possible overflows are hopefully minimized
static void imp2radangle(float A, float B, float C, float F, float *a, float *b, float *th, float *ecc)
{
- if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
+ if (F <= 1e-5f) { // use arbitrary major radius, zero minor, infinite eccentricity
*a = sqrtf(A > C ? A : C);
*b = 0.f;
*ecc = 1e10f;
- *th = 0.5f*(atan2f(B, A - C) + (float)M_PI);
+ *th = 0.5f * (atan2f(B, A - C) + (float)M_PI);
}
else {
- const float AmC = A - C, ApC = A + C, F2 = F*2.f;
- const float r = sqrtf(AmC*AmC + B*B);
+ const float AmC = A - C, ApC = A + C, F2 = F * 2.f;
+ const float r = sqrtf(AmC * AmC + B * B);
float d = ApC - r;
*a = (d <= 0.f) ? sqrtf(A > C ? A : C) : sqrtf(F2 / d);
d = ApC + r;
@@ -263,7 +263,7 @@ static void imp2radangle(float A, float B, float C, float F, float *a, float *b,
*ecc = *a / *b;
}
// incr theta by 0.5*pi (angle of major axis)
- *th = 0.5f*(atan2f(B, AmC) + (float)M_PI);
+ *th = 0.5f * (atan2f(B, AmC) + (float)M_PI);
}
}
@@ -280,11 +280,11 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
// scaling dxt/dyt by full resolution can cause overflow because of huge A/B/C and esp. F values,
// scaling by aspect ratio alone does the opposite, so try something in between instead...
const float ff2 = width, ff = sqrtf(ff2), q = height / ff;
- const float Ux = dx*ff, Vx = dx*q, Uy = dy*ff, Vy = dy*q;
- float A = Vx*Vx + Vy*Vy;
- float B = -2.f*(Ux*Vx + Uy*Vy);
- float C = Ux*Ux + Uy*Uy;
- float F = A*C - B*B*0.25f;
+ const float Ux = dx * ff, Vx = dx * q, Uy = dy * ff, Vy = dy * q;
+ float A = Vx * Vx + Vy * Vy;
+ float B = -2.f * (Ux * Vx + Uy * Vy);
+ float C = Ux * Ux + Uy * Uy;
+ float F = A * C - B * B * 0.25f;
float a, b, th, ecc, a2, b2, ue, ve, U0, V0, DDQ, U, ac1, ac2, BU, d;
int u, v, u1, u2, v1, v2;
// The so-called 'high' quality ewa method simply adds a constant of 1 to both A & C,
@@ -294,13 +294,13 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
// Use a different radius based on interpolation switch, just enough to anti-alias when interpolation is off,
// and slightly larger to make result a bit smoother than bilinear interpolation when interpolation is on
// (minimum values: const float rmin = intpol ? 1.f : 0.5f;)
- const float rmin = 1.5625f/ff2;
+ const float rmin = 1.5625f / ff2;
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
- if ((b2 = b*b) < rmin) {
- if ((a2 = a*a) < rmin) {
+ if ((b2 = b * b) < rmin) {
+ if ((a2 = a * a) < rmin) {
B = 0.f;
A = C = rmin;
- F = A*C;
+ F = A * C;
}
else {
b2 = rmin;
@@ -308,9 +308,9 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
}
}
- ue = ff*sqrtf(C);
- ve = ff*sqrtf(A);
- d = (float)(EWA_MAXIDX + 1) / (F*ff2);
+ ue = ff * sqrtf(C);
+ ve = ff * sqrtf(A);
+ d = (float)(EWA_MAXIDX + 1) / (F * ff2);
A *= d;
B *= d;
C *= d;
@@ -323,24 +323,24 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
v2 = (int)(ceilf(V0 + ve));
U0 -= 0.5f;
V0 -= 0.5f;
- DDQ = 2.f*A;
+ DDQ = 2.f * A;
U = u1 - U0;
- ac1 = A*(2.f*U + 1.f);
- ac2 = A*U*U;
- BU = B*U;
+ ac1 = A * (2.f * U + 1.f);
+ ac2 = A * U * U;
+ BU = B * U;
d = result[0] = result[1] = result[2] = result[3] = 0.f;
- for (v=v1; v<=v2; ++v) {
+ for (v = v1; v <= v2; ++v) {
const float V = v - V0;
- float DQ = ac1 + B*V;
- float Q = (C*V + BU)*V + ac2;
- for (u=u1; u<=u2; ++u) {
+ float DQ = ac1 + B * V;
+ float Q = (C * V + BU) * V + ac2;
+ for (u = u1; u <= u2; ++u) {
if (Q < (float)(EWA_MAXIDX + 1)) {
float tc[4];
const float wt = EWA_WTS[(Q < 0.f) ? 0 : (unsigned int)Q];
read(tc, clipuv(u, width), clipuv(v, height));
madd_v3_v3fl(result, tc, wt);
- result[3] += result[3] ? tc[3]*wt : 0.f;
+ result[3] += result[3] ? tc[3] * wt : 0.f;
d += wt;
}
Q += DQ;
@@ -349,10 +349,10 @@ void MemoryBuffer::readEWA(float result[4], float fx, float fy, float dx, float
}
// d should hopefully never be zero anymore
- d = 1.f/d;
+ d = 1.f / d;
result[0] *= d;
result[1] *= d;
result[2] *= d;
// clipping can be ignored if alpha used, texr->ta already includes filtered edge
- result[3] = result[3] ? result[3] *d : 1.f;
+ result[3] = result[3] ? result[3] * d : 1.f;
}
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp
index 2324eacd26c..62e030b777c 100644
--- a/source/blender/compositor/intern/COM_Node.cpp
+++ b/source/blender/compositor/intern/COM_Node.cpp
@@ -43,23 +43,23 @@ Node::Node(bNode *editorNode, bool create_sockets)
this->editorNode = editorNode;
if (create_sockets) {
- bNodeSocket * input = (bNodeSocket*)editorNode->inputs.first;
+ bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
while (input != NULL) {
DataType dt = COM_DT_VALUE;
if (input->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input);
- input = (bNodeSocket*)input->next;
+ input = (bNodeSocket *)input->next;
}
- bNodeSocket *output = (bNodeSocket*)editorNode->outputs.first;
+ bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first;
while (output != NULL) {
DataType dt = COM_DT_VALUE;
if (output->type == SOCK_RGBA) dt = COM_DT_COLOR;
if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR;
this->addOutputSocket(dt, output);
- output = (bNodeSocket*)output->next;
+ output = (bNodeSocket *)output->next;
}
}
}
@@ -75,9 +75,9 @@ bNode *Node::getbNode()
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
SetValueOperation *operation = new SetValueOperation();
- bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)bSock->default_value;
+ bNodeSocketValueFloat *val = (bNodeSocketValueFloat *)bSock->default_value;
operation->setValue(val->value);
this->addLink(graph, operation->getOutputSocket(), inputsocket);
graph->addOperation(operation);
@@ -118,9 +118,9 @@ SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSock
void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
SetColorOperation *operation = new SetColorOperation();
- bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)bSock->default_value;
+ bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)bSock->default_value;
operation->setChannel1(val->value[0]);
operation->setChannel2(val->value[1]);
operation->setChannel3(val->value[2]);
@@ -131,8 +131,8 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket
void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex);
- bNodeSocketValueVector *val = (bNodeSocketValueVector*)bSock->default_value;
+ bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex);
+ bNodeSocketValueVector *val = (bNodeSocketValueVector *)bSock->default_value;
SetVectorOperation *operation = new SetVectorOperation();
operation->setX(val->value[0]);
operation->setY(val->value[1]);
@@ -143,7 +143,7 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke
bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->inputs.first;
+ bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first;
int index = 0;
while (bSock != NULL) {
if (index == editorNodeInputSocketIndex) {
@@ -156,7 +156,7 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex)
}
bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
{
- bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->outputs.first;
+ bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first;
int index = 0;
while (bSock != NULL) {
if (index == editorNodeInputSocketIndex) {
@@ -170,9 +170,9 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex)
InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
{
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
unsigned int index;
- for (index = 0 ; index < inputsockets.size(); index ++) {
+ for (index = 0; index < inputsockets.size(); index++) {
InputSocket *input = inputsockets[index];
if (input->getbNodeSocket() == socket) {
return input;
@@ -183,9 +183,9 @@ InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket)
OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket)
{
- vector<OutputSocket*> &outputsockets = this->getOutputSockets();
+ vector<OutputSocket *> &outputsockets = this->getOutputSockets();
unsigned int index;
- for (index = 0 ; index < outputsockets.size(); index ++) {
+ for (index = 0; index < outputsockets.size(); index++) {
OutputSocket *output = outputsockets[index];
if (output->getbNodeSocket() == socket) {
return output;
diff --git a/source/blender/compositor/intern/COM_NodeOperation.cpp b/source/blender/compositor/intern/COM_NodeOperation.cpp
index 148ad48ba3a..1c05c2a3ae8 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_NodeOperation.cpp
@@ -41,9 +41,9 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
{
unsigned int temp[2];
unsigned int temp2[2];
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (unsigned int index = 0 ; index < inputsockets.size();index++) {
+ for (unsigned int index = 0; index < inputsockets.size(); index++) {
InputSocket *inputSocket = inputsockets[index];
if (inputSocket->isConnected()) {
if (index == this->resolutionInputSocketIndex) {
@@ -54,7 +54,7 @@ void NodeOperation::determineResolution(unsigned int resolution[], unsigned int
}
}
}
- for (unsigned int index = 0 ; index < inputsockets.size();index++) {
+ for (unsigned int index = 0; index < inputsockets.size(); index++) {
InputSocket *inputSocket = inputsockets[index];
if (inputSocket->isConnected()) {
if (index != resolutionInputSocketIndex) {
@@ -103,10 +103,10 @@ NodeOperation *NodeOperation::getInputOperation(unsigned int inputSocketIndex)
return this->getInputSocket(inputSocketIndex)->getOperation();
}
-void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
+void NodeOperation::getConnectedInputSockets(vector<InputSocket *> *sockets)
{
- vector<InputSocket*> &inputsockets = this->getInputSockets();
- for (vector<InputSocket*>::iterator iterator = inputsockets.begin() ; iterator!= inputsockets.end() ; iterator++) {
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
+ for (vector<InputSocket *>::iterator iterator = inputsockets.begin(); iterator != inputsockets.end(); iterator++) {
InputSocket *socket = *iterator;
if (socket->isConnected()) {
sockets->push_back(socket);
@@ -114,7 +114,7 @@ void NodeOperation::getConnectedInputSockets(vector<InputSocket*> *sockets)
}
}
-bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOperation *readOperation, rcti *output)
+bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
{
if (this->isInputNode()) {
BLI_init_rcti(output, input->xmin, input->xmax, input->ymin, input->ymax);
@@ -122,12 +122,12 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
}
else {
unsigned int index;
- vector<InputSocket*> &inputsockets = this->getInputSockets();
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
- for (index = 0 ; index < inputsockets.size() ; index++) {
+ for (index = 0; index < inputsockets.size(); index++) {
InputSocket *inputsocket = inputsockets[index];
if (inputsocket->isConnected()) {
- NodeOperation *inputoperation = (NodeOperation*)inputsocket->getConnection()->getFromNode();
+ NodeOperation *inputoperation = (NodeOperation *)inputsocket->getConnection()->getFromNode();
bool result = inputoperation->determineDependingAreaOfInterest(input, readOperation, output);
if (result) {
return true;
@@ -138,24 +138,24 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
}
}
-cl_mem NodeOperation::COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader* reader)
+cl_mem NodeOperation::COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader *reader)
{
cl_int error;
- MemoryBuffer* result = (MemoryBuffer*)reader->initializeTileData(NULL, inputMemoryBuffers);
+ MemoryBuffer *result = (MemoryBuffer *)reader->initializeTileData(NULL, inputMemoryBuffers);
const cl_image_format imageFormat = {
CL_RGBA,
CL_FLOAT
};
- cl_mem clBuffer = clCreateImage2D(context, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, &imageFormat, result->getWidth(),
+ cl_mem clBuffer = clCreateImage2D(context, CL_MEM_READ_ONLY | CL_MEM_USE_HOST_PTR, &imageFormat, result->getWidth(),
result->getHeight(), 0, result->getBuffer(), &error);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
if (error == CL_SUCCESS) cleanup->push_back(clBuffer);
error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clBuffer);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, offsetIndex, result);
return clBuffer;
@@ -165,11 +165,11 @@ void NodeOperation::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel ke
{
if (offsetIndex != -1) {
cl_int error;
- rcti* rect = memoryBuffer->getRect();
+ rcti *rect = memoryBuffer->getRect();
cl_int2 offset = {rect->xmin, rect->ymin};
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
}
@@ -180,7 +180,7 @@ void NodeOperation::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offs
cl_int2 offset = {this->getWidth(), this->getHeight()};
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
}
@@ -193,10 +193,10 @@ void NodeOperation::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel ke
void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer) {
cl_int error;
- const size_t size[] = {outputMemoryBuffer->getWidth(),outputMemoryBuffer->getHeight()};
+ const size_t size[] = {outputMemoryBuffer->getWidth(), outputMemoryBuffer->getHeight()};
error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
}
void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex) {
@@ -210,17 +210,19 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
cl_int2 offset;
bool breaked = false;
- for (offsety = 0 ; offsety < height && (!breaked); offsety+=localSize) {
+ for (offsety = 0; offsety < height && (!breaked); offsety += localSize) {
offset[1] = offsety;
- if (offsety+localSize < height) {
+ if (offsety + localSize < height) {
size[1] = localSize;
- } else {
+ }
+ else {
size[1] = height - offsety;
}
- for (offsetx = 0 ; offsetx < width && (!breaked) ; offsetx+=localSize) {
- if (offsetx+localSize < width) {
+ for (offsetx = 0; offsetx < width && (!breaked); offsetx += localSize) {
+ if (offsetx + localSize < width) {
size[0] = localSize;
- } else {
+ }
+ else {
size[0] = width - offsetx;
}
offset[0] = offsetx;
@@ -228,7 +230,7 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
clFlush(queue);
if (isBreaked()) {
breaked = false;
@@ -240,9 +242,8 @@ void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel,
cl_kernel NodeOperation::COM_clCreateKernel(cl_program program, const char *kernelname, list<cl_kernel> *clKernelsToCleanUp)
{
cl_int error;
- cl_kernel kernel = clCreateKernel(program, kernelname, &error) ;
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
- }
+ cl_kernel kernel = clCreateKernel(program, kernelname, &error);
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
else {
if (clKernelsToCleanUp) clKernelsToCleanUp->push_back(kernel);
}
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.cpp b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
index e6d3789b06d..9d005804098 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.cpp
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.cpp
@@ -49,12 +49,12 @@ void OpenCLDevice::deinitialize()
void OpenCLDevice::execute(WorkPackage *work)
{
const unsigned int chunkNumber = work->getChunkNumber();
- ExecutionGroup * executionGroup = work->getExecutionGroup();
+ ExecutionGroup *executionGroup = work->getExecutionGroup();
rcti rect;
executionGroup->determineChunkRect(&rect, chunkNumber);
- MemoryBuffer ** inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
- MemoryBuffer * outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
+ MemoryBuffer **inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
+ MemoryBuffer *outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
executionGroup->getOutputNodeOperation()->executeOpenCLRegion(this->context, this->program, this->queue, &rect,
chunkNumber, inputBuffers, outputBuffer);
diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp
index 77bad3c006f..da08b512003 100644
--- a/source/blender/compositor/intern/COM_OutputSocket.cpp
+++ b/source/blender/compositor/intern/COM_OutputSocket.cpp
@@ -25,22 +25,23 @@
#include "COM_SocketConnection.h"
#include "COM_NodeOperation.h"
-OutputSocket::OutputSocket(DataType datatype) :Socket(datatype)
+OutputSocket::OutputSocket(DataType datatype) : Socket(datatype)
{
}
int OutputSocket::isOutputSocket() const { return true; }
-const int OutputSocket::isConnected() const { return this->connections.size()!=0; }
+const int OutputSocket::isConnected() const { return this->connections.size() != 0; }
void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
{
NodeBase *node = this->getNode();
if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation*)node;
+ NodeOperation *operation = (NodeOperation *)node;
if (operation->isResolutionSet()) {
resolution[0] = operation->getWidth();
resolution[1] = operation->getHeight();
- } else {
+ }
+ else {
operation->determineResolution(resolution, preferredResolution);
operation->setResolution(resolution);
}
@@ -63,7 +64,7 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single)
}
else {
unsigned int index;
- for (index = 0 ; index < this->connections.size();index ++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
connection->setFromSocket(relinkToSocket);
relinkToSocket->addConnection(connection);
@@ -92,13 +93,13 @@ void OutputSocket::clearConnections()
WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const
{
unsigned int index;
- for (index = 0 ; index < this->connections.size();index++) {
+ for (index = 0; index < this->connections.size(); index++) {
SocketConnection *connection = this->connections[index];
NodeBase *node = connection->getToNode();
if (node->isOperation()) {
- NodeOperation *operation = (NodeOperation*)node;
+ NodeOperation *operation = (NodeOperation *)node;
if (operation->isWriteBufferOperation()) {
- return (WriteBufferOperation*)operation;
+ return (WriteBufferOperation *)operation;
}
}
}
diff --git a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
index 9ea90809de4..01043664412 100644
--- a/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
+++ b/source/blender/compositor/intern/COM_SingleThreadedNodeOperation.cpp
@@ -22,7 +22,7 @@
#include "COM_SingleThreadedNodeOperation.h"
-SingleThreadedNodeOperation::SingleThreadedNodeOperation(): NodeOperation()
+SingleThreadedNodeOperation::SingleThreadedNodeOperation() : NodeOperation()
{
this->cachedInstance = NULL;
setComplex(true);
diff --git a/source/blender/compositor/intern/COM_Socket.cpp b/source/blender/compositor/intern/COM_Socket.cpp
index af9ad1967a5..11739a4e9c5 100644
--- a/source/blender/compositor/intern/COM_Socket.cpp
+++ b/source/blender/compositor/intern/COM_Socket.cpp
@@ -38,6 +38,6 @@ DataType Socket::getDataType() const
int Socket::isInputSocket() const { return false; }
int Socket::isOutputSocket() const { return false; }
-const int Socket::isConnected() const {return false;}
-void Socket::setNode(NodeBase *node) {this->node = node;}
-NodeBase *Socket::getNode() const {return this->node;}
+const int Socket::isConnected() const { return false; }
+void Socket::setNode(NodeBase *node) { this->node = node; }
+NodeBase *Socket::getNode() const { return this->node; }
diff --git a/source/blender/compositor/intern/COM_SocketConnection.cpp b/source/blender/compositor/intern/COM_SocketConnection.cpp
index 9f0c736392a..1edeb6158b9 100644
--- a/source/blender/compositor/intern/COM_SocketConnection.cpp
+++ b/source/blender/compositor/intern/COM_SocketConnection.cpp
@@ -38,7 +38,7 @@ void SocketConnection::setFromSocket(OutputSocket *fromsocket)
this->fromSocket = fromsocket;
}
-OutputSocket *SocketConnection::getFromSocket() const {return this->fromSocket;}
+OutputSocket *SocketConnection::getFromSocket() const { return this->fromSocket; }
void SocketConnection::setToSocket(InputSocket *tosocket)
{
if (tosocket == NULL) {
@@ -47,7 +47,7 @@ void SocketConnection::setToSocket(InputSocket *tosocket)
this->toSocket = tosocket;
}
-InputSocket *SocketConnection::getToSocket() const {return this->toSocket;}
+InputSocket *SocketConnection::getToSocket() const { return this->toSocket; }
NodeBase *SocketConnection::getFromNode() const
{
@@ -79,10 +79,10 @@ bool SocketConnection::isValid() const
bool SocketConnection::needsResolutionConversion() const
{
- if (this->ignoreResizeCheck) {return false;}
- NodeOperation *fromOperation = (NodeOperation*)this->getFromNode();
- NodeOperation *toOperation = (NodeOperation*)this->getToNode();
- if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) {return false;}
+ if (this->ignoreResizeCheck) { return false; }
+ NodeOperation *fromOperation = (NodeOperation *)this->getFromNode();
+ NodeOperation *toOperation = (NodeOperation *)this->getToNode();
+ if (this->toSocket->getResizeMode() == COM_SC_NO_RESIZE) { return false; }
const unsigned int fromWidth = fromOperation->getWidth();
const unsigned int fromHeight = fromOperation->getHeight();
const unsigned int toWidth = toOperation->getWidth();
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index ba8bfe55310..fb7a8f8a764 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -40,19 +40,19 @@
/// @brief list of all CPUDevices. for every hardware thread an instance of CPUDevice is created
-static vector<CPUDevice*> cpudevices;
+static vector<CPUDevice *> cpudevices;
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
/// @brief list of all thread for every CPUDevice in cpudevices a thread exists
static ListBase cputhreads;
/// @brief all scheduled work for the cpu
-static ThreadQueue * cpuqueue;
-static ThreadQueue * gpuqueue;
+static ThreadQueue *cpuqueue;
+static ThreadQueue *gpuqueue;
#ifdef COM_OPENCL_ENABLED
static cl_context context;
static cl_program program;
/// @brief list of all OpenCLDevices. for every OpenCL GPU device an instance of OpenCLDevice is created
-static vector<OpenCLDevice*> gpudevices;
+static vector<OpenCLDevice *> gpudevices;
/// @brief list of all thread for every GPUDevice in cpudevices a thread exists
static ListBase gputhreads;
/// @brief all scheduled work for the gpu
@@ -66,10 +66,10 @@ static bool openclActive = false;
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
void *WorkScheduler::thread_execute_cpu(void *data)
{
- Device *device = (Device*)data;
+ Device *device = (Device *)data;
WorkPackage *work;
- while ((work = (WorkPackage*)BLI_thread_queue_pop(cpuqueue))) {
+ while ((work = (WorkPackage *)BLI_thread_queue_pop(cpuqueue))) {
device->execute(work);
delete work;
}
@@ -79,10 +79,10 @@ void *WorkScheduler::thread_execute_cpu(void *data)
void *WorkScheduler::thread_execute_gpu(void *data)
{
- Device *device = (Device*)data;
+ Device *device = (Device *)data;
WorkPackage *work;
- while ((work = (WorkPackage*)BLI_thread_queue_pop(gpuqueue))) {
+ while ((work = (WorkPackage *)BLI_thread_queue_pop(gpuqueue))) {
device->execute(work);
delete work;
}
@@ -120,7 +120,7 @@ void WorkScheduler::start(CompositorContext &context)
unsigned int index;
cpuqueue = BLI_thread_queue_init();
BLI_init_threads(&cputhreads, thread_execute_cpu, cpudevices.size());
- for (index = 0 ; index < cpudevices.size() ; index ++) {
+ for (index = 0; index < cpudevices.size(); index++) {
Device *device = cpudevices[index];
BLI_insert_thread(&cputhreads, device);
}
@@ -128,7 +128,7 @@ void WorkScheduler::start(CompositorContext &context)
if (context.getHasActiveOpenCLDevices()) {
gpuqueue = BLI_thread_queue_init();
BLI_init_threads(&gputhreads, thread_execute_gpu, gpudevices.size());
- for (index = 0 ; index < gpudevices.size() ; index ++) {
+ for (index = 0; index < gpudevices.size(); index++) {
Device *device = gpudevices[index];
BLI_insert_thread(&gputhreads, device);
}
@@ -178,7 +178,7 @@ bool WorkScheduler::hasGPUDevices()
{
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
#ifdef COM_OPENCL_ENABLED
- return gpudevices.size()>0;
+ return gpudevices.size() > 0;
#else
return 0;
#endif
@@ -197,7 +197,7 @@ void WorkScheduler::initialize()
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
int numberOfCPUThreads = BLI_system_thread_count();
- for (int index = 0 ; index < numberOfCPUThreads ; index ++) {
+ for (int index = 0; index < numberOfCPUThreads; index++) {
CPUDevice *device = new CPUDevice();
device->initialize();
cpudevices.push_back(device);
@@ -209,13 +209,13 @@ void WorkScheduler::initialize()
cl_uint numberOfPlatforms = 0;
cl_int error;
error = clGetPlatformIDs(0, 0, &numberOfPlatforms);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
if (G.f & G_DEBUG) printf("%d number of platforms\n", numberOfPlatforms);
cl_platform_id *platforms = new cl_platform_id[numberOfPlatforms];
error = clGetPlatformIDs(numberOfPlatforms, platforms, 0);
unsigned int indexPlatform;
cl_uint totalNumberOfDevices = 0;
- for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) {
+ for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
cl_platform_id platform = platforms[indexPlatform];
cl_uint numberOfDevices;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
@@ -224,16 +224,16 @@ void WorkScheduler::initialize()
cl_device_id *cldevices = new cl_device_id[totalNumberOfDevices];
unsigned int numberOfDevicesReceived = 0;
- for (indexPlatform = 0 ; indexPlatform < numberOfPlatforms ; indexPlatform ++) {
+ for (indexPlatform = 0; indexPlatform < numberOfPlatforms; indexPlatform++) {
cl_platform_id platform = platforms[indexPlatform];
cl_uint numberOfDevices;
clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, 0, &numberOfDevices);
- clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices+numberOfDevicesReceived*sizeof (cl_device_id), 0);
+ clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numberOfDevices, cldevices + numberOfDevicesReceived * sizeof (cl_device_id), 0);
numberOfDevicesReceived += numberOfDevices;
}
if (totalNumberOfDevices > 0) {
context = clCreateContext(NULL, totalNumberOfDevices, cldevices, clContextError, NULL, &error);
- if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error);
error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0);
if (error != CL_SUCCESS) {
@@ -241,10 +241,10 @@ void WorkScheduler::initialize()
size_t ret_val_size = 0;
printf("CLERROR[%d]: %s\n", error, clewErrorString(error));
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, 0, NULL, &ret_val_size);
- if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
- char *build_log = new char[ret_val_size+1];
+ if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ char *build_log = new char[ret_val_size + 1];
error2 = clGetProgramBuildInfo(program, cldevices[0], CL_PROGRAM_BUILD_LOG, ret_val_size, build_log, NULL);
- if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+ if (error2 != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
build_log[ret_val_size] = '\0';
printf("%s", build_log);
delete build_log;
@@ -252,11 +252,11 @@ void WorkScheduler::initialize()
}
else {
unsigned int indexDevices;
- for (indexDevices = 0 ; indexDevices < totalNumberOfDevices ; indexDevices ++) {
+ for (indexDevices = 0; indexDevices < totalNumberOfDevices; indexDevices++) {
cl_device_id device = cldevices[indexDevices];
OpenCLDevice *clDevice = new OpenCLDevice(context, device, program);
clDevice->initialize(),
- gpudevices.push_back(clDevice);
+ gpudevices.push_back(clDevice);
if (G.f & G_DEBUG) {
char resultString[32];
error = clGetDeviceInfo(device, CL_DEVICE_NAME, 32, resultString, 0);
@@ -267,8 +267,8 @@ void WorkScheduler::initialize()
}
}
}
- delete [] cldevices;
- delete [] platforms;
+ delete[] cldevices;
+ delete[] platforms;
}
#endif
#endif
@@ -278,14 +278,14 @@ void WorkScheduler::deinitialize()
{
#if COM_CURRENT_THREADING_MODEL == COM_TM_QUEUE
Device *device;
- while (cpudevices.size()>0) {
+ while (cpudevices.size() > 0) {
device = cpudevices.back();
cpudevices.pop_back();
device->deinitialize();
delete device;
}
#ifdef COM_OPENCL_ENABLED
- while (gpudevices.size()>0) {
+ while (gpudevices.size() > 0) {
device = gpudevices.back();
gpudevices.pop_back();
device->deinitialize();