[opengtl-commits] [350] fix the blur test

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 350
Author:   cyrille
Date:     2008-09-02 08:33:55 +0200 (Tue, 02 Sep 2008)

Log Message:
-----------
fix the blur test

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/PixelConvertExpressionFactory_p.cpp


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/PixelConvertExpressionFactory_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/PixelConvertExpressionFactory_p.cpp	2008-09-01 22:36:12 UTC (rev 349)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/PixelConvertExpressionFactory_p.cpp	2008-09-02 06:33:55 UTC (rev 350)
@@ -40,10 +40,15 @@
       virtual const GTLCore::Type* type() const { return m_dstType; }
       virtual GTLCore::ExpressionResult generateValue( GTLCore::GenerationContext& _gc, llvm::BasicBlock* bb ) const
       {
-        llvm::Value* pixelPtr = value()->generateValue( _gc, bb).value();
+        if( value()->type()->dataType() == GTLCore::Type::STRUCTURE )
+        {
+          llvm::Value* pixelPtr = value()->generateValue( _gc, bb).value();
         
-        llvm::Value* pixelDataPtr = OpenShiva::CodeGenerator::accessPixelDataPtr( _gc, bb, pixelPtr);
-        return GTLCore::ExpressionResult( new llvm::LoadInst( pixelDataPtr, "", bb ) , m_dstType );
+          llvm::Value* pixelDataPtr = OpenShiva::CodeGenerator::accessPixelDataPtr( _gc, bb, pixelPtr);
+          return GTLCore::ExpressionResult( new llvm::LoadInst( pixelDataPtr, "", bb ) , m_dstType );
+        } else {
+          return value()->generateValue( _gc, bb);
+        }
       }
     private:
       const GTLCore::Type* m_dstType;
@@ -65,6 +70,6 @@
 
 bool PixelConvertExpressionFactory::canConvertBetween( const GTLCore::Type* srcType, const GTLCore::Type* dstType) const
 {
-  return  srcType->dataType() == GTLCore::Type::STRUCTURE and srcType->structName().startWith( "pixel" )
-      and (*srcType->structDataMembers())[0].type() == dstType;
+  return (srcType->dataType() == GTLCore::Type::STRUCTURE and srcType->structName().startWith( "pixel" ) and (*srcType->structDataMembers())[0].type() == dstType )
+      or (dstType->dataType() == GTLCore::Type::STRUCTURE and dstType->structName().startWith( "pixel" ) and (*dstType->structDataMembers())[0].type() == srcType );
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/