Revision: 43104
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43104
Author:   blendix
Date:     2012-01-03 17:33:38 +0000 (Tue, 03 Jan 2012)
Log Message:
-----------
Merge changes from commits 42814, 42928, 43004 into new compositing nodes code,
to complete the previous merge commit.

Modified Paths:
--------------
    branches/tile/source/blender/compositor/nodes/COM_ViewerNode.cpp
    
branches/tile/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_PreviewOperation.cpp
    
branches/tile/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
    branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.h
    branches/tile/source/blender/compositor/operations/COM_ViewerOperation.cpp

Modified: branches/tile/source/blender/compositor/nodes/COM_ViewerNode.cpp
===================================================================
--- branches/tile/source/blender/compositor/nodes/COM_ViewerNode.cpp    
2012-01-03 15:28:53 UTC (rev 43103)
+++ branches/tile/source/blender/compositor/nodes/COM_ViewerNode.cpp    
2012-01-03 17:33:38 UTC (rev 43104)
@@ -37,7 +37,8 @@
        if (imageSocket->isConnected()) {
                bNode* editorNode = this->getbNode();
                ViewerOperation *viewerOperation = new ViewerOperation();
-               viewerOperation->setColorManagement( 
context->getScene()->r.color_mgt_flag);
+               viewerOperation->setColorManagement( 
context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT);
+               viewerOperation->setColorPredivide( 
context->getScene()->r.color_mgt_flag & R_COLOR_MANAGEMENT_PREDIVIDE);
                viewerOperation->setbNodeTree(context->getbNodeTree());
                viewerOperation->setImage(image);
                viewerOperation->setImageUser(imageUser);

Modified: 
branches/tile/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
    2012-01-03 15:28:53 UTC (rev 43103)
+++ 
branches/tile/source/blender/compositor/operations/COM_AlphaOverPremultiplyOperation.cpp
    2012-01-03 17:33:38 UTC (rev 43104)
@@ -36,7 +36,8 @@
        inputColor1Operation->read(inputColor1, x, y, inputBuffers);
        inputColor2Operation->read(inputOverColor, x, y, inputBuffers);
 
-    if(inputOverColor[3]<=0.0f) {
+       /* Zero alpha values should still permit an add of RGB data */
+    if(inputOverColor[3]<0.0f) {
         outputValue[0] = inputColor1[0];
         outputValue[1] = inputColor1[1];
         outputValue[2] = inputColor1[2];

Modified: 
branches/tile/source/blender/compositor/operations/COM_PreviewOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_PreviewOperation.cpp 
2012-01-03 15:28:53 UTC (rev 43103)
+++ branches/tile/source/blender/compositor/operations/COM_PreviewOperation.cpp 
2012-01-03 17:33:38 UTC (rev 43104)
@@ -89,11 +89,9 @@
             color[2] = 0.0f;
             color[3] = 1.0f;
                        input->read(color, rx, ry, memoryBuffers);
-            /// @todo: linear conversion only when scene color management is 
selected.
-            outputBuffer[offset] = FTOCHAR(linearrgb_to_srgb(color[0]));
-            outputBuffer[offset+1] = FTOCHAR(linearrgb_to_srgb(color[1]));
-            outputBuffer[offset+2] = FTOCHAR(linearrgb_to_srgb(color[2]));
-            outputBuffer[offset+3] = FTOCHAR(color[3]);
+            /// @todo: linear conversion only when scene color management is 
selected, also check predivide.
+                       linearrgb_to_srgb_v4(color, color);
+            F4TOCHAR4(color, outputBuffer+offset);
             offset +=4;
         }
     }

Modified: 
branches/tile/source/blender/compositor/operations/COM_SplitViewerOperation.cpp
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_SplitViewerOperation.cpp 
    2012-01-03 15:28:53 UTC (rev 43103)
+++ 
branches/tile/source/blender/compositor/operations/COM_SplitViewerOperation.cpp 
    2012-01-03 17:33:38 UTC (rev 43104)
@@ -27,6 +27,7 @@
 #include "BKE_image.h"
 #include "BLI_utildefines.h"
 #include "BLI_math_color.h"
+#include "BLI_math_vector.h"
 
 extern "C" {
     #include "MEM_guardedalloc.h"
@@ -72,25 +73,26 @@
     for (y = y1 ; y < y2 ; y++) {
         for (x = x1 ; x < x2 ; x++) {
             bool image1;
+                       float srgb[4];
             image1 = xSplit?x>perc:y>perc;
             if (image1) {
                                image1Input->read(&(buffer[offset]), x, y, 
memoryBuffers);
             } else {
                                image2Input->read(&(buffer[offset]), x, y, 
memoryBuffers);
             }
-            /// @todo: linear conversion only when scene color management is 
selected.
+            /// @todo: linear conversion only when scene color management is 
selected, also check predivide.
             if (this->doColorManagement) {
-                bufferDisplay[offset] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset]));
-                bufferDisplay[offset+1] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset+1]));
-                bufferDisplay[offset+2] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset+2]));
-                bufferDisplay[offset+3] = FTOCHAR(buffer[offset+3]);
+                               if(this->doColorPredivide) {
+                                       linearrgb_to_srgb_predivide_v4(srgb, 
buffer+offset);
+                               } else {
+                                       linearrgb_to_srgb_v4(srgb, 
buffer+offset);
+                               }
             } else {
-                bufferDisplay[offset] = FTOCHAR((buffer[offset]));
-                bufferDisplay[offset+1] = FTOCHAR((buffer[offset+1]));
-                bufferDisplay[offset+2] = FTOCHAR((buffer[offset+2]));
-                bufferDisplay[offset+3] = FTOCHAR(buffer[offset+3]);
+                               copy_v4_v4(srgb, buffer+offset);
             }
 
+                       F4TOCHAR4(srgb, bufferDisplay+offset);
+
             offset +=4;
         }
         offset += (this->getWidth()-(x2-x1))*4;

Modified: 
branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.h
===================================================================
--- 
branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.h    
    2012-01-03 15:28:53 UTC (rev 43103)
+++ 
branches/tile/source/blender/compositor/operations/COM_ViewerBaseOperation.h    
    2012-01-03 17:33:38 UTC (rev 43104)
@@ -39,6 +39,7 @@
     float centerY;
        OrderOfChunks chunkOrder;
     bool doColorManagement;
+       bool doColorPredivide;
 
 public:
        bool isOutputOperation(bool rendering) const {return !rendering;}
@@ -56,7 +57,8 @@
     float getCenterY() { return this->centerY; }
        OrderOfChunks getChunkOrder() { return this->chunkOrder; }
        const int getRenderPriority() const;
-        void setColorManagement(bool doColorManagement) 
{this->doColorManagement = doColorManagement;}
+       void setColorManagement(bool doColorManagement) 
{this->doColorManagement = doColorManagement;}
+       void setColorPredivide(bool doColorPredivide) {this->doColorPredivide = 
doColorPredivide;}
        bool isViewerOperation() {return true;}
                
 protected:

Modified: 
branches/tile/source/blender/compositor/operations/COM_ViewerOperation.cpp
===================================================================
--- branches/tile/source/blender/compositor/operations/COM_ViewerOperation.cpp  
2012-01-03 15:28:53 UTC (rev 43103)
+++ branches/tile/source/blender/compositor/operations/COM_ViewerOperation.cpp  
2012-01-03 17:33:38 UTC (rev 43104)
@@ -30,6 +30,7 @@
 #include "PIL_time.h"
 #include "BLI_utildefines.h"
 #include "BLI_math_color.h"
+#include "BLI_math_vector.h"
 
 extern "C" {
        #include "MEM_guardedalloc.h"
@@ -70,7 +71,7 @@
        const int y2 = rect->ymax;
        const int offsetadd = (this->getWidth()-(x2-x1))*4;
        int offset = (y1*this->getWidth() + x1 ) * 4;
-       float alpha[4];
+       float alpha[4], srgb[4];
        int x;
        int y;
        bool breaked = false;
@@ -82,19 +83,19 @@
                                alphaInput->read(alpha, x, y, memoryBuffers);
                                buffer[offset+3] = alpha[0];
                        }
-                       /// @todo: linear conversion only when scene color 
management is selected.
+                       /// @todo: linear conversion only when scene color 
management is selected, also check predivide.
                        if (this->doColorManagement) {
-                               bufferDisplay[offset] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset]));
-                               bufferDisplay[offset+1] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset+1]));
-                               bufferDisplay[offset+2] = 
FTOCHAR(linearrgb_to_srgb(buffer[offset+2]));
-                               bufferDisplay[offset+3] = 
FTOCHAR(buffer[offset+3]);
+                               if(this->doColorPredivide) {
+                                       linearrgb_to_srgb_predivide_v4(srgb, 
buffer+offset);
+                               } else {
+                                       linearrgb_to_srgb_v4(srgb, 
buffer+offset);
+                               }
                        } else {
-                               bufferDisplay[offset] = 
FTOCHAR((buffer[offset]));
-                               bufferDisplay[offset+1] = 
FTOCHAR((buffer[offset+1]));
-                               bufferDisplay[offset+2] = 
FTOCHAR((buffer[offset+2]));
-                               bufferDisplay[offset+3] = 
FTOCHAR(buffer[offset+3]);
+                               copy_v4_v4(srgb, buffer+offset);
                        }
-                       
+
+                       F4TOCHAR4(srgb, bufferDisplay+offset);
+
                        offset +=4;
                }
                if (tree->test_break && tree->test_break(tree->tbh)) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to