[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/pigment
From:       Cyrille Berger <cyb () lepi ! org>
Date:       2010-04-24 5:59:07
Message-ID: 20100424060219.B0941AC8A2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1118243 by berger:

use the IntegerMath functions for a major speed improvement


 M  +34 -0     KoColorSpaceMaths.h  
 M  +3 -3      tests/TestKoCompositeOps.cpp  


--- trunk/koffice/libs/pigment/KoColorSpaceMaths.h #1118242:1118243
@@ -420,6 +420,40 @@
 
 #endif
 
+//------------------------------ quint8 specialization ------------------------------//
+
+template<>
+inline qint32 KoColorSpaceMaths<quint8>::multiply(qint32 a, qint32 b)
+{
+    return UINT8_MULT(a, b);
+}
+
+template<>
+inline quint8 KoColorSpaceMaths<quint8>::divide(quint8 a, quint8 b)
+{
+    return UINT8_DIVIDE(a, b);
+}
+
+template<>
+inline quint8 KoColorSpaceMaths<quint8>::blend(quint8 a, quint8 b, quint8 c)
+{
+    return UINT8_BLEND(a, b, c);
+}
+
+//------------------------------ quint16 specialization ------------------------------//
+
+template<>
+inline qint64 KoColorSpaceMaths<quint16>::multiply(qint64 a, qint64 b)
+{
+    return UINT16_MULT(a, b);
+}
+
+template<>
+inline quint16 KoColorSpaceMaths<quint16>::divide(quint16 a, quint16 b)
+{
+    return UINT16_DIVIDE(a, b);
+}
+
 //------------------------------ various specialization ------------------------------//
 
 
--- trunk/koffice/libs/pigment/tests/TestKoCompositeOps.cpp #1118242:1118243
@@ -129,7 +129,7 @@
     QCOMPAREui(p16f1.red, 11666);
     QCOMPAREui(p16f1.green, 10333);
     QCOMPAREui(p16f1.blue, 18666);
-    QCOMPAREui(p16f1.alpha, 49150);
+    QCOMPAREui(p16f1.alpha, 49151);
 
     // Test no mask, full opacity, quarter-transparent src, half-transparent dst
     p16f.red = 10000; p16f.green = 15000; p16f.blue = 20000; p16f.alpha = QUARTER_OPACITY;
@@ -138,7 +138,7 @@
     QCOMPAREui(p16f1.red, 13000);
     QCOMPAREui(p16f1.green, 6599);
     QCOMPAREui(p16f1.blue, 17599);
-    QCOMPAREui(p16f1.alpha, 40958);
+    QCOMPAREui(p16f1.alpha, 40959);
 
     // Test no mask, full opacity, quarter-transparent dst, half-transparent src
     p16f.red = 10000; p16f.green = 15000; p16f.blue = 20000; p16f.alpha = HALF_OPACITY;
@@ -147,7 +147,7 @@
     QCOMPAREui(p16f1.red, 11000);
     QCOMPAREui(p16f1.green, 12199);
     QCOMPAREui(p16f1.blue, 19199);
-    QCOMPAREui(p16f1.alpha, 40958);
+    QCOMPAREui(p16f1.alpha, 40959);
 }
 #if 0
 void TestKoCompositeOps::testCompositeAlphaDarken()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic