uiacceltk/hitchcock/ServerCore/Src/alfmappingfunctionhandlers.cpp
changeset 0 15bf7259bb7c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   Mapping function handlers
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "alfmappingfunctionhandlers.h"
       
    21 #include "alf/alfconstants.h"
       
    22 #include "alf/alfserverutils.h"
       
    23 
       
    24 #include <uiacceltk/HuiCurvePath.h>
       
    25 
       
    26 // CONSTANT MAPPING FUNCTION
       
    27 
       
    28 TAlfConstantMappingFunctionHandler::TAlfConstantMappingFunctionHandler( 
       
    29         MAlfInterfaceProvider& aResolver,
       
    30         TReal32 aValue )
       
    31         : iConstantMappingFunction( aValue ) , iResolver(aResolver)
       
    32     {
       
    33     }
       
    34 
       
    35 void TAlfConstantMappingFunctionHandler::Release()
       
    36     {
       
    37     delete this;
       
    38     }
       
    39     
       
    40 TAny* TAlfConstantMappingFunctionHandler::GetInterface(
       
    41     const THuiInterfaceSupport& aInterface)
       
    42     {
       
    43     switch ( aInterface )
       
    44         {
       
    45         case EHuiInterfaceMappingFunction:
       
    46             return &iConstantMappingFunction;
       
    47         default:
       
    48             return NULL;
       
    49         }
       
    50     }
       
    51     
       
    52 void TAlfConstantMappingFunctionHandler::HandleCmdL(
       
    53     TInt aCommandId, 
       
    54     const TDesC8& aInputBuffer, 
       
    55     TDes8& /*aResponse*/ )
       
    56     {
       
    57     switch ( aCommandId )
       
    58         {
       
    59         case EAlfConstantMappingFunctionSetValue:
       
    60             {
       
    61             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
    62             iConstantMappingFunction.iValue = *mapValues;
       
    63             break;
       
    64             }
       
    65  
       
    66         default:
       
    67             User::Leave( KErrNotSupported );
       
    68         }
       
    69     }
       
    70     
       
    71 // LINEAR MAPPING FUNCTION
       
    72 
       
    73 TAlfLinearMappingFunctionHandler::TAlfLinearMappingFunctionHandler( 
       
    74         MAlfInterfaceProvider& aResolver,
       
    75         TReal32 aFactor,
       
    76         TReal32 aOffset )
       
    77         : iLinearMappingFunction( aFactor,aOffset ) , iResolver(aResolver)
       
    78     {
       
    79     }
       
    80 
       
    81 void TAlfLinearMappingFunctionHandler::Release()
       
    82     {
       
    83     delete this;
       
    84     }
       
    85     
       
    86 TAny* TAlfLinearMappingFunctionHandler::GetInterface(
       
    87     const THuiInterfaceSupport& aInterface)
       
    88     {
       
    89     switch ( aInterface )
       
    90         {
       
    91         case EHuiInterfaceMappingFunction:
       
    92             return &iLinearMappingFunction;
       
    93         default:
       
    94             return NULL;
       
    95         }
       
    96     }
       
    97     
       
    98 void TAlfLinearMappingFunctionHandler::HandleCmdL(
       
    99     TInt aCommandId, 
       
   100     const TDesC8& aInputBuffer, 
       
   101     TDes8& /*aResponse*/ )
       
   102     {
       
   103     switch ( aCommandId )
       
   104         {
       
   105         case EAlfLinearMappingFunctionSetFactor:
       
   106             {
       
   107             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   108             iLinearMappingFunction.iFactor = *mapValues;
       
   109             break;
       
   110             }
       
   111             
       
   112         case EAlfLinearMappingFunctionSetOffset:
       
   113             {
       
   114             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   115             iLinearMappingFunction.iOffset = *mapValues;
       
   116             break;
       
   117             }
       
   118  
       
   119         default:
       
   120             User::Leave( KErrNotSupported );
       
   121         }
       
   122     }
       
   123 
       
   124 // SINE MAPPING FUNCTION
       
   125 
       
   126 TAlfSineMappingFunctionHandler::TAlfSineMappingFunctionHandler( 
       
   127         MAlfInterfaceProvider& aResolver,
       
   128         TReal32 aFactor,
       
   129         TReal32 aOffset )
       
   130         : iSineMappingFunction( aFactor,aOffset ) , iResolver(aResolver)
       
   131     {
       
   132     }
       
   133 
       
   134 void TAlfSineMappingFunctionHandler::Release()
       
   135     {
       
   136     delete this;
       
   137     }
       
   138     
       
   139 TAny* TAlfSineMappingFunctionHandler::GetInterface(
       
   140     const THuiInterfaceSupport& aInterface)
       
   141     {
       
   142     switch ( aInterface )
       
   143         {
       
   144         case EHuiInterfaceMappingFunction:
       
   145             return &iSineMappingFunction;
       
   146         default:
       
   147             return NULL;
       
   148         }
       
   149     }
       
   150     
       
   151 void TAlfSineMappingFunctionHandler::HandleCmdL(
       
   152     TInt aCommandId, 
       
   153     const TDesC8& aInputBuffer, 
       
   154     TDes8& /*aResponse*/ )
       
   155     {
       
   156     switch ( aCommandId )
       
   157         {
       
   158         case EAlfSineMappingFunctionSetFactor:
       
   159             {
       
   160             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   161             iSineMappingFunction.iFactor = *mapValues;
       
   162             break;
       
   163             }
       
   164             
       
   165         case EAlfSineMappingFunctionSetOffset:
       
   166             {
       
   167             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   168             iSineMappingFunction.iOffset = *mapValues;
       
   169             break;
       
   170             }
       
   171  
       
   172         default:
       
   173             User::Leave( KErrNotSupported );
       
   174         }
       
   175     }
       
   176 
       
   177 // COSINE MAPPING FUNCTION
       
   178 
       
   179 TAlfCosineMappingFunctionHandler::TAlfCosineMappingFunctionHandler( 
       
   180         MAlfInterfaceProvider& aResolver,
       
   181         TReal32 aFactor,
       
   182         TReal32 aOffset )
       
   183         : iCosineMappingFunction( aFactor,aOffset ) , iResolver(aResolver)
       
   184     {
       
   185     }
       
   186 
       
   187 void TAlfCosineMappingFunctionHandler::Release()
       
   188     {
       
   189     delete this;
       
   190     }
       
   191     
       
   192 TAny* TAlfCosineMappingFunctionHandler::GetInterface(
       
   193     const THuiInterfaceSupport& aInterface)
       
   194     {
       
   195     switch ( aInterface )
       
   196         {
       
   197         case EHuiInterfaceMappingFunction:
       
   198             return &iCosineMappingFunction;
       
   199         default:
       
   200             return NULL;
       
   201         }
       
   202     }
       
   203     
       
   204 void TAlfCosineMappingFunctionHandler::HandleCmdL(
       
   205     TInt aCommandId, 
       
   206     const TDesC8& aInputBuffer, 
       
   207     TDes8& /*aResponse*/ )
       
   208     {
       
   209     switch ( aCommandId )
       
   210         {
       
   211         case EAlfCosineMappingFunctionSetFactor:
       
   212             {
       
   213             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   214             iCosineMappingFunction.iFactor = *mapValues;
       
   215             break;
       
   216             }
       
   217             
       
   218         case EAlfCosineMappingFunctionSetOffset:
       
   219             {
       
   220             TReal32* mapValues = (TReal32*) aInputBuffer.Ptr();
       
   221             iCosineMappingFunction.iOffset = *mapValues;
       
   222             break;
       
   223             }
       
   224  
       
   225         default:
       
   226             User::Leave( KErrNotSupported );
       
   227         }
       
   228     }
       
   229 
       
   230 // AVERAGE MAPPING FUNCTION
       
   231 
       
   232 TAlfAverageMappingFunctionHandler::TAlfAverageMappingFunctionHandler( 
       
   233         MAlfInterfaceProvider& aResolver,
       
   234         MHuiMappingFunction* aFunc1, 
       
   235         MHuiMappingFunction* aFunc2 )
       
   236         : iAverageMappingFunction( aFunc1, aFunc2 ) , iResolver(aResolver)
       
   237     {
       
   238     }
       
   239 
       
   240 void TAlfAverageMappingFunctionHandler::Release()
       
   241     {
       
   242     delete this;
       
   243     }
       
   244     
       
   245 TAny* TAlfAverageMappingFunctionHandler::GetInterface(
       
   246     const THuiInterfaceSupport& aInterface)
       
   247     {
       
   248     switch ( aInterface )
       
   249         {
       
   250         case EHuiInterfaceMappingFunction:
       
   251             return &iAverageMappingFunction;
       
   252         default:
       
   253             return NULL;
       
   254         }
       
   255     }
       
   256     
       
   257 void TAlfAverageMappingFunctionHandler::HandleCmdL(
       
   258     TInt aCommandId, 
       
   259     const TDesC8& aInputBuffer, 
       
   260     TDes8& aResponse )
       
   261     {
       
   262     switch ( aCommandId )
       
   263         {
       
   264         case EAlfMappingFunctionMapValue:
       
   265             {
       
   266             TIntTReal* mapValues = (TIntTReal*) aInputBuffer.Ptr();
       
   267             
       
   268             const TReal32 returnValue = iAverageMappingFunction.MapValue( mapValues->iReal, mapValues->iInt );
       
   269             
       
   270             TPckg<TReal32> returnValuePckg(returnValue);
       
   271             aResponse = returnValuePckg; 
       
   272             break;
       
   273             }
       
   274         case EAlfAverageMappingFunctionSetFunction1:
       
   275             {
       
   276             TInt* params = (TInt*)aInputBuffer.Ptr();
       
   277             
       
   278             MHuiMappingFunction* func1 = NULL;
       
   279             
       
   280             if ( *params )
       
   281                 {
       
   282                 func1 = (MHuiMappingFunction*) iResolver.GetInterfaceL(EHuiInterfaceMappingFunction, *params );
       
   283                 }
       
   284             
       
   285             iAverageMappingFunction.iFunc1 = func1;
       
   286             break;
       
   287             }
       
   288         case EAlfAverageMappingFunctionSetFunction2:
       
   289             {
       
   290             TInt* params = (TInt*)aInputBuffer.Ptr();
       
   291             
       
   292             MHuiMappingFunction* func2 = NULL;
       
   293             
       
   294             if ( *params )
       
   295                 {
       
   296                 func2 = (MHuiMappingFunction*) iResolver.GetInterfaceL(EHuiInterfaceMappingFunction, *params );
       
   297                 }
       
   298             
       
   299             iAverageMappingFunction.iFunc2 = func2;
       
   300             break;
       
   301             }
       
   302         case EAlfAverageMappingFunctionSetFunctions:
       
   303             {
       
   304             TInt2* params = (TInt2*) aInputBuffer.Ptr();
       
   305             
       
   306             MHuiMappingFunction* func1 = NULL;
       
   307             MHuiMappingFunction* func2 = NULL;
       
   308             
       
   309             if ( params->iInt1 )
       
   310                 {
       
   311                 func1 = (MHuiMappingFunction*) iResolver.GetInterfaceL(EHuiInterfaceMappingFunction, params->iInt1 );
       
   312                 }
       
   313                 
       
   314             if ( params->iInt2 )
       
   315                 {
       
   316                 func2 = (MHuiMappingFunction*) iResolver.GetInterfaceL(EHuiInterfaceMappingFunction, params->iInt2 );
       
   317                 }
       
   318                 
       
   319                 
       
   320             iAverageMappingFunction.iFunc1 = func1;
       
   321             iAverageMappingFunction.iFunc2 = func2; 
       
   322             break;
       
   323             }
       
   324             
       
   325         case EAlfAverageMappingFunctionSetWeight:
       
   326             {
       
   327             TAlfTimedValue* opacity = (TAlfTimedValue*) aInputBuffer.Ptr() ;
       
   328             AlfTimedValueUtility::CopyTimedValue(*opacity, iAverageMappingFunction.iWeight, iResolver);    
       
   329             break;
       
   330             }
       
   331             
       
   332         default:
       
   333             User::Leave( KErrNotSupported );
       
   334         }
       
   335     }
       
   336     
       
   337 // CURVE PATH
       
   338 
       
   339 CAlfCurvePathHandler* CAlfCurvePathHandler::NewL( 
       
   340     MAlfInterfaceProvider& aResolver,
       
   341     CHuiCurvePath* aCurvePath )
       
   342     {
       
   343     CAlfCurvePathHandler* self = new (ELeave) CAlfCurvePathHandler( aResolver );
       
   344     CleanupStack::PushL( self );
       
   345     self->ConstructL( aCurvePath );
       
   346     CleanupStack::Pop( self );
       
   347     return self;
       
   348     }
       
   349     
       
   350 CAlfCurvePathHandler::CAlfCurvePathHandler( MAlfInterfaceProvider& aResolver )
       
   351  : iResolver( aResolver )
       
   352     {
       
   353     }
       
   354     
       
   355 void CAlfCurvePathHandler::ConstructL(CHuiCurvePath* aCurvePath)
       
   356     {
       
   357     if ( aCurvePath )
       
   358         {
       
   359         iCurvePath = aCurvePath;
       
   360         iOwnCurvePath = EFalse;
       
   361         }
       
   362     else
       
   363         {
       
   364         iCurvePath = CHuiCurvePath::NewL();
       
   365         iOwnCurvePath = ETrue;
       
   366         }
       
   367     }
       
   368     
       
   369 CAlfCurvePathHandler::~CAlfCurvePathHandler()
       
   370     {
       
   371     if ( iOwnCurvePath )
       
   372         {
       
   373         delete iCurvePath;
       
   374         }
       
   375     iCurvePath = NULL;
       
   376     }
       
   377     
       
   378 
       
   379 void CAlfCurvePathHandler::Release()
       
   380     {
       
   381     delete this;
       
   382     }
       
   383     
       
   384 TAny* CAlfCurvePathHandler::GetInterface(const THuiInterfaceSupport& aInterface)
       
   385     {
       
   386     switch ( aInterface )
       
   387         {
       
   388         case EHuiInterfaceMappingFunction:
       
   389             return static_cast<MHuiMappingFunction*>(iCurvePath);
       
   390         default:
       
   391             return NULL;
       
   392         }
       
   393     }
       
   394     
       
   395 void CAlfCurvePathHandler::HandleCmdL(TInt aCommandId, const TDesC8& aInputBuffer, TDes8& aResponse)
       
   396     {
       
   397     switch( aCommandId )
       
   398         {
       
   399         case EAlfCurvePathReset:
       
   400             {
       
   401             iCurvePath->Reset();
       
   402             break;
       
   403             }
       
   404             
       
   405         case EAlfCurvePathEnableLoop:
       
   406             {
       
   407             TBool* params = (TBool*) aInputBuffer.Ptr();
       
   408             iCurvePath->EnableLoop( *params );
       
   409             break;
       
   410             }
       
   411             
       
   412         case EAlfCurvePathLoop:
       
   413             {
       
   414             const TBool returnValue = iCurvePath->Loop();
       
   415             
       
   416             TPckg<TBool> returnValuePckg(returnValue);
       
   417             aResponse = returnValuePckg; 
       
   418             break;
       
   419             }
       
   420             
       
   421         case EAlfCurvePathSetOrigin:
       
   422             {
       
   423             TReal32* params = (TReal32*) aInputBuffer.Ptr();
       
   424             iCurvePath->SetOrigin( *params );
       
   425             break;
       
   426             }
       
   427             
       
   428         case EAlfCurvePathAppendLine:
       
   429             {
       
   430             TAlfCurvePathLineParams* params = (TAlfCurvePathLineParams*) aInputBuffer.Ptr();
       
   431             iCurvePath->AppendLineL( 
       
   432                 params->iStart,
       
   433                 params->iEnd,
       
   434                 params->iLength );
       
   435             break;
       
   436             }
       
   437             
       
   438         case EAlfCurvePathAppendLine2:
       
   439             {
       
   440             TAlfCurvePathLineRealParams* params = (TAlfCurvePathLineRealParams*) aInputBuffer.Ptr();
       
   441             THuiRealPoint start(params->iStart.iX, params->iStart.iY);
       
   442             THuiRealPoint end(params->iEnd.iX, params->iEnd.iY);
       
   443             iCurvePath->AppendLineL( 
       
   444                 start,
       
   445                 end,
       
   446                 params->iLength );
       
   447             break;
       
   448             }
       
   449             
       
   450         case EAlfCurvePathAppendArc:
       
   451             {
       
   452             TAlfCurvePathArcParams* params = (TAlfCurvePathArcParams*) aInputBuffer.Ptr();
       
   453             iCurvePath->AppendArcL( 
       
   454                 params->iOrigin,
       
   455                 params->iSize,
       
   456                 params->iStartAngle,
       
   457                 params->iEndAngle,
       
   458                 params->iLength );
       
   459             break;
       
   460             }
       
   461             
       
   462         case EAlfCurvePathAppendArc2:
       
   463             {
       
   464             TAlfCurvePathArcRealParams* params = (TAlfCurvePathArcRealParams*) aInputBuffer.Ptr();
       
   465             THuiRealPoint origin(params->iOrigin.iX, params->iOrigin.iY);
       
   466             THuiRealSize size2(params->iSize.iWidth, params->iSize.iHeight);
       
   467             iCurvePath->AppendArcL( 
       
   468                 origin,
       
   469                 size2,
       
   470                 params->iStartAngle,
       
   471                 params->iEndAngle,
       
   472                 params->iLength );
       
   473             break;
       
   474             }
       
   475             
       
   476         case EAlfCurvePathLength:
       
   477             {
       
   478             const TReal32 returnValue = iCurvePath->Length();
       
   479             
       
   480             TPckg<TReal32> returnValuePckg(returnValue);
       
   481             aResponse = returnValuePckg; 
       
   482             break;
       
   483             }
       
   484             
       
   485             
       
   486         case EAlfCurvePathEvaluate:
       
   487             {
       
   488             TReal32* params = (TReal32*) aInputBuffer.Ptr();
       
   489             
       
   490             
       
   491             THuiRealPoint result;
       
   492             iCurvePath->Evaluate( *params, result );
       
   493             
       
   494             TAlfRealPoint returnValue(result.iX, result.iY);
       
   495             TPckg<TAlfRealPoint> returnValuePckg(returnValue);
       
   496             aResponse = returnValuePckg; 
       
   497             break;
       
   498             }
       
   499             
       
   500         case EAlfCurvePathOffset:
       
   501             {
       
   502             TAlfTimedPoint returnValue;
       
   503             AlfTimedPointUtility::CopyTimedPoint(iCurvePath->iOffset, returnValue);
       
   504 
       
   505             TPckg<TAlfTimedPoint> returnValuePckg(returnValue);
       
   506             aResponse = returnValuePckg;
       
   507             break;
       
   508             }
       
   509         
       
   510         case EAlfCurvePathSetOffset:
       
   511             {
       
   512             TAlfTimedPoint* params = (TAlfTimedPoint*) aInputBuffer.Ptr();
       
   513             AlfTimedPointUtility::CopyTimedPoint(*params, iCurvePath->iOffset, iResolver);    
       
   514             break;
       
   515             }
       
   516             
       
   517         case EAlfCurvePathMapValue:
       
   518             {
       
   519             TIntTReal* mapValues = (TIntTReal*) aInputBuffer.Ptr();
       
   520             
       
   521             const TReal32 returnValue = iCurvePath->MapValue( mapValues->iReal, mapValues->iInt );
       
   522             
       
   523             TPckg<TReal32> returnValuePckg(returnValue);
       
   524             aResponse = returnValuePckg; 
       
   525             break;
       
   526             }
       
   527             
       
   528         default:
       
   529             User::Leave( KErrNotSupported );
       
   530         }
       
   531     }
       
   532 
       
   533     
       
   534     
       
   535 // TABLE MAPPING FUNCTION
       
   536 
       
   537 TAlfTableMappingFunctionHandler::TAlfTableMappingFunctionHandler( 
       
   538         MAlfInterfaceProvider& aResolver) 
       
   539         : iResolver(aResolver)
       
   540     {
       
   541     }
       
   542 
       
   543 void TAlfTableMappingFunctionHandler::Release()
       
   544     {
       
   545     delete this;
       
   546     }
       
   547     
       
   548 TAny* TAlfTableMappingFunctionHandler::GetInterface(
       
   549     const THuiInterfaceSupport& aInterface)
       
   550     {
       
   551     switch ( aInterface )
       
   552         {
       
   553         case EHuiInterfaceMappingFunction:
       
   554             return &iMappingFunction;
       
   555         default:
       
   556             return NULL;
       
   557         }
       
   558     }
       
   559     
       
   560 void TAlfTableMappingFunctionHandler::HandleCmdL(
       
   561     TInt aCommandId, 
       
   562     const TDesC8& aInputBuffer, 
       
   563     TDes8& aResponse )
       
   564     {
       
   565     switch ( aCommandId )
       
   566         {   
       
   567         case EAlfMappingFunctionMapValue:
       
   568             {
       
   569             TIntTReal* mapValues = (TIntTReal*) aInputBuffer.Ptr();
       
   570             
       
   571             const TReal32 returnValue = iMappingFunction.MapValue( mapValues->iReal, mapValues->iInt );
       
   572             
       
   573             TPckg<TReal32> returnValuePckg(returnValue);
       
   574             aResponse = returnValuePckg; 
       
   575             break;
       
   576             }            
       
   577         case EAlfMappingFunctionTableSetValues:
       
   578             {
       
   579             TAlfTableMappingFunctionParams* mapValues = (TAlfTableMappingFunctionParams*) aInputBuffer.Ptr();
       
   580             iMappingFunction.iParams = *mapValues;                        
       
   581             break;
       
   582             }            
       
   583         default:
       
   584             User::Leave( KErrNotSupported );
       
   585         }
       
   586     }
       
   587 
       
   588 TAlfTableMappingFunction::TAlfTableMappingFunction()
       
   589     {
       
   590         
       
   591     }
       
   592     
       
   593 TReal32 TAlfTableMappingFunction::MapValue(TReal32 aValue, TInt /*aComponent*/) const __SOFTFP
       
   594     {
       
   595     // For performance resons, this same function exist both client and serverside
       
   596     TReal32 retVal = aValue;
       
   597     
       
   598     TBool inverted = EFalse;
       
   599     
       
   600     if (iParams.iValues[KAlfTableMappingNumberOfMappedValues - 1] < iParams.iValues[0])
       
   601         {
       
   602         inverted = ETrue;    
       
   603         }
       
   604     
       
   605     TInt i = 0;
       
   606     
       
   607     if (!inverted)
       
   608         {
       
   609         // Find closest pre-calculated value...
       
   610         for (i=0; i<KAlfTableMappingNumberOfMappedValues-1;i++)
       
   611             {
       
   612             if ((!inverted && aValue < iParams.iValues[i]) ||
       
   613                 inverted && (aValue > iParams.iValues[i]))
       
   614                 {
       
   615                 retVal = iParams.iMappedValues[i];
       
   616                 break;                    
       
   617                 }
       
   618             retVal = iParams.iMappedValues[i];                   
       
   619             }
       
   620 
       
   621         // ...do approximation, real value is between pre-calculated values
       
   622         if (i != 0) 
       
   623             {
       
   624             TReal32 valueDelta = iParams.iValues[i] - aValue;
       
   625             if (inverted)
       
   626                 {
       
   627                 valueDelta = -valueDelta;    
       
   628                 }
       
   629             
       
   630             TReal32 valueStep = iParams.iValues[i] - iParams.iValues[i-1];
       
   631             TReal32 mappedValueStep = iParams.iMappedValues[i] - iParams.iMappedValues[i-1];
       
   632             TReal32 fix = (valueDelta/valueStep) * mappedValueStep;
       
   633             retVal -= fix;                               
       
   634             }     
       
   635         }
       
   636      
       
   637     return retVal;   
       
   638     }
       
   639