diff options
Diffstat (limited to 'source/blender/compositor/intern')
13 files changed, 57 insertions, 38 deletions
diff --git a/source/blender/compositor/intern/COM_CompositorContext.cpp b/source/blender/compositor/intern/COM_CompositorContext.cpp index fbdb4cd6b28..e1cc25d028a 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.cpp +++ b/source/blender/compositor/intern/COM_CompositorContext.cpp @@ -31,6 +31,8 @@ CompositorContext::CompositorContext() this->m_hasActiveOpenCLDevices = false; this->m_activegNode = NULL; this->m_fastCalculation = false; + this->m_viewSettings = NULL; + this->m_displaySettings = NULL; } const int CompositorContext::getFramenumber() const @@ -42,13 +44,3 @@ const int CompositorContext::getFramenumber() const return -1; /* this should never happen */ } } - -const int CompositorContext::isColorManaged() const -{ - if (this->m_rd) { - return this->m_rd->color_mgt_flag & R_COLOR_MANAGEMENT; - } - else { - return 0; /* this should never happen */ - } -} diff --git a/source/blender/compositor/intern/COM_CompositorContext.h b/source/blender/compositor/intern/COM_CompositorContext.h index 2f6abf39985..2f5e8c0648d 100644 --- a/source/blender/compositor/intern/COM_CompositorContext.h +++ b/source/blender/compositor/intern/COM_CompositorContext.h @@ -27,6 +27,7 @@ #include "BKE_text.h" #include <string> #include "DNA_node_types.h" +#include "DNA_color_types.h" #include "BLI_rect.h" #include "DNA_scene_types.h" #include "COM_defines.h" @@ -79,6 +80,9 @@ private: */ bool m_fastCalculation; + /* @brief color management settings */ + const ColorManagedViewSettings *m_viewSettings; + const ColorManagedDisplaySettings *m_displaySettings; public: /** * @brief constructor initializes the context with default values. @@ -126,6 +130,26 @@ public: const RenderData *getRenderData() const { return this->m_rd; } /** + * @brief set view settings of color color management + */ + void setViewSettings(const ColorManagedViewSettings *viewSettings) { this->m_viewSettings = viewSettings; } + + /** + * @brief get view settings of color color management + */ + const ColorManagedViewSettings *getViewSettings() const { return this->m_viewSettings; } + + /** + * @brief set display settings of color color management + */ + void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings) { this->m_displaySettings = displaySettings; } + + /** + * @brief get display settings of color color management + */ + const ColorManagedDisplaySettings *getDisplaySettings() const { return this->m_displaySettings; } + + /** * @brief set the quality */ void setQuality(CompositorQuality quality) { this->m_quality = quality; } @@ -152,8 +176,6 @@ public: int getChunksize() { return this->getbNodeTree()->chunksize; } - const int isColorManaged() const; - void setFastCalculation(bool fastCalculation) {this->m_fastCalculation = fastCalculation;} bool isFastCalculation() {return this->m_fastCalculation;} }; diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 801505e9d39..a13717c9d86 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -44,7 +44,8 @@ #include "MEM_guardedalloc.h" #endif -ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation) +ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation, + const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings) { this->m_context.setbNodeTree(editingtree); this->m_context.setFastCalculation(fastcalculation); @@ -69,6 +70,9 @@ ExecutionSystem::ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool re ExecutionSystemHelper::addbNodeTree(*this, 0, editingtree, NULL); this->m_context.setRenderData(rd); + this->m_context.setViewSettings(viewSettings); + this->m_context.setDisplaySettings(displaySettings); + this->convertToOperations(); this->groupOperations(); /* group operations in ExecutionGroups */ unsigned int index; diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.h b/source/blender/compositor/intern/COM_ExecutionSystem.h index 39e7bc80279..56a60bf7a03 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.h +++ b/source/blender/compositor/intern/COM_ExecutionSystem.h @@ -25,6 +25,7 @@ class ExecutionGroup; #ifndef _COM_ExecutionSystem_h #define _COM_ExecutionSystem_h +#include "DNA_color_types.h" #include "DNA_node_types.h" #include <vector> #include "COM_Node.h" @@ -156,7 +157,8 @@ public: * @param editingtree [bNodeTree *] * @param rendering [true false] */ - ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation); + ExecutionSystem(RenderData *rd, bNodeTree *editingtree, bool rendering, bool fastcalculation, + const ColorManagedViewSettings *viewSettings, const ColorManagedDisplaySettings *displaySettings); /** * Destructor diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index e41361fcb2e..bedbfc72722 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -79,14 +79,10 @@ void ExecutionSystemHelper::addNode(vector<Node *>& nodes, Node *node) Node *ExecutionSystemHelper::addNode(vector<Node *>& nodes, bNode *b_node, bool inActiveGroup, bool fast) { - Node *node; - node = Converter::convert(b_node, fast); + Node *node = Converter::convert(b_node, fast); node->setIsInActiveGroup(inActiveGroup); - if (node != NULL) { - addNode(nodes, node); - return node; - } - return NULL; + addNode(nodes, node); + return node; } void ExecutionSystemHelper::addOperation(vector<NodeOperation *>& operations, NodeOperation *operation) { diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cpp b/source/blender/compositor/intern/COM_MemoryBuffer.cpp index 0994f3f8890..bdbe21f82ea 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cpp +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cpp @@ -253,7 +253,7 @@ static void imp2radangle(float A, float B, float C, float F, float *a, float *b, } } -float clipuv(float x, float limit) +static float clipuv(float x, float limit) { x = (x < 0) ? 0 : ((x >= limit) ? (limit - 1) : x); return x; diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 50393d14f35..5922b0e6b08 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -75,12 +75,12 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket graph->addOperation(operation); } -void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket) +void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket) { if (this->isInActiveGroup()) { if (!(this->getbNode()->flag & NODE_HIDDEN)) { // do not calculate previews of hidden nodes. if (this->getbNode()->flag & NODE_PREVIEW) { - PreviewOperation *operation = new PreviewOperation(); + PreviewOperation *operation = new PreviewOperation(context->getViewSettings(), context->getDisplaySettings()); system->addOperation(operation); operation->setbNode(this->getbNode()); operation->setbNodeTree(system->getContext().getbNodeTree()); @@ -90,11 +90,11 @@ void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSock } } -void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket) +void Node::addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket) { if (inputSocket->isConnected() && this->isInActiveGroup()) { OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket(); - this->addPreviewOperation(system, outputsocket); + this->addPreviewOperation(system, context, outputsocket); } } diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index 7ce40e3cb34..bfccd069ad1 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -135,8 +135,8 @@ public: */ OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket); protected: - void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket); - void addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket); + void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, InputSocket *inputSocket); + void addPreviewOperation(ExecutionSystem *system, CompositorContext *context, OutputSocket *outputSocket); bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex); bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex); diff --git a/source/blender/compositor/intern/COM_NodeBase.h b/source/blender/compositor/intern/COM_NodeBase.h index b55e444be80..64d669b5e9a 100644 --- a/source/blender/compositor/intern/COM_NodeBase.h +++ b/source/blender/compositor/intern/COM_NodeBase.h @@ -97,7 +97,7 @@ public: * @return [true:false] * @see NodeOperation */ - virtual const int isOperation() const { return false; } + virtual const bool isOperation() const { return false; } /** * @brief check if this is an input node diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 93a19529d34..dfa22a29e41 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -88,7 +88,7 @@ public: * @return [true:false] * @see NodeBase */ - const int isOperation() const { return true; } + const bool isOperation() const { return true; } /** * @brief determine the resolution of this node diff --git a/source/blender/compositor/intern/COM_OutputSocket.h b/source/blender/compositor/intern/COM_OutputSocket.h index dc5ca27cbda..c6b7993c561 100644 --- a/source/blender/compositor/intern/COM_OutputSocket.h +++ b/source/blender/compositor/intern/COM_OutputSocket.h @@ -64,7 +64,7 @@ public: /** * @brief determine the actual data type and channel info. */ - void relinkConnections(OutputSocket *relinkToSocket) { this->relinkConnections(relinkToSocket, false); }; + void relinkConnections(OutputSocket *relinkToSocket) { this->relinkConnections(relinkToSocket, false); } void relinkConnections(OutputSocket *relinkToSocket, bool single); const int getNumberOfConnections() { return this->m_connections.size(); } diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp index f732a40e768..eb9c26d4f43 100644 --- a/source/blender/compositor/intern/COM_WorkScheduler.cpp +++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp @@ -25,6 +25,7 @@ #include "BKE_global.h" +#include "COM_compositor.h" #include "COM_WorkScheduler.h" #include "COM_CPUDevice.h" #include "COM_OpenCLDevice.h" @@ -265,7 +266,7 @@ bool WorkScheduler::hasGPUDevices() #endif } -extern void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) +static void clContextError(const char *errinfo, const void *private_info, size_t cb, void *user_data) { printf("OPENCL error: %s\n", errinfo); } diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp index cb9166c929d..49ab9db5dd8 100644 --- a/source/blender/compositor/intern/COM_compositor.cpp +++ b/source/blender/compositor/intern/COM_compositor.cpp @@ -37,12 +37,14 @@ extern "C" { static ThreadMutex s_compositorMutex; static char is_compositorMutex_init = FALSE; -void intern_freeCompositorCaches() +static void intern_freeCompositorCaches() { deintializeDistortionCache(); } -void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) +void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering, + const ColorManagedViewSettings *viewSettings, + const ColorManagedDisplaySettings *displaySettings) { /* initialize mutex, TODO this mutex init is actually not thread safe and * should be done somewhere as part of blender startup, all the other @@ -71,7 +73,7 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) bool twopass = (editingtree->flag & NTREE_TWO_PASS) > 0 && !rendering; /* initialize execution system */ if (twopass) { - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass); + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, twopass, viewSettings, displaySettings); system->execute(); delete system; @@ -84,14 +86,14 @@ void COM_execute(RenderData *rd, bNodeTree *editingtree, int rendering) } - ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false); + ExecutionSystem *system = new ExecutionSystem(rd, editingtree, rendering, false, viewSettings, displaySettings); system->execute(); delete system; BLI_mutex_unlock(&s_compositorMutex); } -void COM_freeCaches() +static void UNUSED_FUNCTION(COM_freeCaches)() { if (is_compositorMutex_init) { BLI_mutex_lock(&s_compositorMutex); @@ -100,7 +102,7 @@ void COM_freeCaches() } } -void COM_deinitialize() +void COM_deinitialize() { if (is_compositorMutex_init) { BLI_mutex_lock(&s_compositorMutex); |