From 2ba7552b9cd94b62c850365bcc537f0b3e344917 Mon Sep 17 00:00:00 2001
From: Merov Linden <merov@lindenlab.com>
Date: Thu, 6 Feb 2014 11:57:01 -0800
Subject: [PATCH] ACME-1301 : Add colortransform as a secondary filter command

---
 .../llimage_libtest/filters/colortransform.xml   | 16 ++++++++++++++++
 indra/llimage/llimagefilter.cpp                  | 10 ++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 indra/integration_tests/llimage_libtest/filters/colortransform.xml

diff --git a/indra/integration_tests/llimage_libtest/filters/colortransform.xml b/indra/integration_tests/llimage_libtest/filters/colortransform.xml
new file mode 100644
index 00000000000..de4bebcce2e
--- /dev/null
+++ b/indra/integration_tests/llimage_libtest/filters/colortransform.xml
@@ -0,0 +1,16 @@
+<llsd>
+    <array>
+        <array>
+            <string>colortransform</string>
+            <real>0.2125</real>
+            <real>0.7154</real>
+            <real>0.0721</real>
+            <real>0.2125</real>
+            <real>0.7154</real>
+            <real>0.0721</real>
+            <real>0.2125</real>
+            <real>0.7154</real>
+            <real>0.0721</real>
+        </array>
+    </array>
+</llsd>
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index 9093e4b59c9..8f7e340d162 100755
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -256,6 +256,16 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image)
                     kernel.mMatrix[k][j] = mFilterData[i][index++].asReal();
             convolve(kernel,normalize,abs_value);
         }
+        else if (filter_name == "colortransform")
+        {
+            LLMatrix3 transform;
+            S32 index = 1;
+            for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++)
+                for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++)
+                    transform.mMatrix[k][j] = mFilterData[i][index++].asReal();
+            transform.transpose();
+            colorTransform(transform);
+        }
         else
         {
             llwarns << "Filter unknown, cannot execute filter command : " << filter_name << llendl;
-- 
GitLab