svgtopt/SVG/SVGEngine/src/SVGEngineInterfaceImpl.cpp
branchRCL_3
changeset 18 1902ade171ab
parent 17 db5c883ad1c5
equal deleted inserted replaced
17:db5c883ad1c5 18:1902ade171ab
  1053 
  1053 
  1054     // check the panning in four directions now.
  1054     // check the panning in four directions now.
  1055     TInt aX,aY;
  1055     TInt aX,aY;
  1056     // Check in Left direction
  1056     // Check in Left direction
  1057     aX = 1; aY = 0;
  1057     aX = 1; aY = 0;
  1058     //Coverity fixes
  1058     if ( xmax <= clipWidth && aX < 0 )
  1059     if ( bound.iX >= zero )
       
  1060         aX = 0;
  1059         aX = 0;
  1061  
  1060     if ( bound.iX >= zero && aX > 0 )
       
  1061         aX = 0;
       
  1062     if ( ymax <= clipHeight && aY < 0 )
       
  1063         aY = 0;
       
  1064     if ( bound.iY >= zero && aY > 0 )
       
  1065         aY = 0;
  1062     // Do panning
  1066     // Do panning
  1063     left = ((aY)||(aX));
  1067     if ( ( aY == 0 ) && ( aX == 0 ) )
       
  1068 	    left = EFalse;
       
  1069     else
       
  1070 	    left = ETrue;
  1064 
  1071 
  1065     // Check in Right direction
  1072     // Check in Right direction
  1066     aX = -1; aY = 0;
  1073     aX = -1; aY = 0;
  1067     if ( xmax <= clipWidth )
  1074     if ( xmax <= clipWidth && aX < 0 )
  1068         aX = 0;
  1075         aX = 0;
  1069     
  1076     if ( bound.iX >= zero && aX > 0 )
       
  1077         aX = 0;
       
  1078     if ( ymax <= clipHeight && aY < 0 )
       
  1079         aY = 0;
       
  1080     if ( bound.iY >= zero && aY > 0 )
       
  1081         aY = 0;
  1070     // Do panning
  1082     // Do panning
  1071     right = ((aY)||(aX));
  1083     if ( ( aY == 0 ) && ( aX == 0 ) )
       
  1084 	    right = EFalse;
       
  1085     else
       
  1086 	    right = ETrue;
  1072 
  1087 
  1073     // Check in Up direction
  1088     // Check in Up direction
  1074     aX = 0; aY = 1;
  1089     aX = 0; aY = 1;
  1075     if ( bound.iY >= zero )
  1090     if ( xmax <= clipWidth && aX < 0 )
       
  1091         aX = 0;
       
  1092     if ( bound.iX >= zero && aX > 0 )
       
  1093         aX = 0;
       
  1094     if ( ymax <= clipHeight && aY < 0 )
  1076         aY = 0;
  1095         aY = 0;
  1077     
  1096     if ( bound.iY >= zero && aY > 0 )
       
  1097         aY = 0;
  1078     // Do panning
  1098     // Do panning
  1079     up = ((aY)||(aX));
  1099     if ( ( aY == 0 ) && ( aX == 0 ) )
       
  1100 	    up = EFalse;
       
  1101     else
       
  1102 	    up = ETrue;
  1080 
  1103 
  1081     // Check in down direction
  1104     // Check in down direction
  1082     aX = 0; aY = -1;
  1105     aX = 0; aY = -1;
  1083     if ( ymax <= clipHeight )
  1106     if ( xmax <= clipWidth && aX < 0 )
       
  1107         aX = 0;
       
  1108     if ( bound.iX >= zero && aX > 0 )
       
  1109         aX = 0;
       
  1110     if ( ymax <= clipHeight && aY < 0 )
  1084         aY = 0;
  1111         aY = 0;
  1085     
  1112     if ( bound.iY >= zero && aY > 0 )
       
  1113         aY = 0;
  1086     // Do panning
  1114     // Do panning
  1087     down = ((aY)||(aX));
  1115     if ( ( aY == 0 ) && ( aX == 0 ) )
       
  1116 	    down = EFalse;
       
  1117     else
       
  1118 	    down = ETrue;
  1088 
  1119 
  1089     }
  1120     }
  1090 // --------------------------------------------------------------------------
  1121 // --------------------------------------------------------------------------
  1091 // EXPORT_C void CSvgEngineInterfaceImpl::Rotate( TReal32 aAngle,
  1122 // EXPORT_C void CSvgEngineInterfaceImpl::Rotate( TReal32 aAngle,
  1092 // ---------------------------------------------------------------------------
  1123 // ---------------------------------------------------------------------------
  1186         TSize bbSize = GetSvgBoundingBox().Size();
  1217         TSize bbSize = GetSvgBoundingBox().Size();
  1187             if( svgElement->iWidthInPercentage )
  1218             if( svgElement->iWidthInPercentage )
  1188             {
  1219             {
  1189                 bbSize.iWidth  = ((TReal32)bbSize.iWidth)  * percentWidth / 100.0;    
  1220                 bbSize.iWidth  = ((TReal32)bbSize.iWidth)  * percentWidth / 100.0;    
  1190             }
  1221             }
       
  1222             else
       
  1223             {
       
  1224                 bbSize.iWidth = bbSize.iWidth;
       
  1225             }
  1191         
  1226         
  1192             if( svgElement->iHeightInPercentage )
  1227             if( svgElement->iHeightInPercentage )
  1193             {
  1228             {
  1194                 bbSize.iHeight = ((TReal32)bbSize.iHeight) * percentHeight / 100.0;    
  1229                 bbSize.iHeight = ((TReal32)bbSize.iHeight) * percentHeight / 100.0;    
       
  1230             }
       
  1231             else
       
  1232             {
       
  1233                 bbSize.iHeight = bbSize.iHeight;
  1195             }
  1234             }
  1196         return bbSize;
  1235         return bbSize;
  1197         }
  1236         }
  1198     }
  1237     }
  1199 
  1238 
  1497         {
  1536         {
  1498             iSvgEngine->GenerateMask(aMask);
  1537             iSvgEngine->GenerateMask(aMask);
  1499         }
  1538         }
  1500     }
  1539     }
  1501 
  1540 
  1502 EXPORT_C void CSvgEngineInterfaceImpl::GenerateMask(CSvgtBitmap* aMask, TInt aEngine )
       
  1503     {
       
  1504         if ( ChooseEngine( aEngine ) )
       
  1505         {
       
  1506             iSvgEngine->GenerateMask(aMask);
       
  1507         }
       
  1508     }
       
  1509 
  1541 
  1510 // --------------------------------------------------------------------------
  1542 // --------------------------------------------------------------------------
  1511 // EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
  1543 // EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
  1512 // ---------------------------------------------------------------------------
  1544 // ---------------------------------------------------------------------------
  1513 EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
  1545 EXPORT_C void CSvgEngineInterfaceImpl::SetBackgroundColor(TUint32 aRGBA8888Color, CSvgEngineImpl* aEngine)
  2470     if( aEngine )
  2502     if( aEngine )
  2471         {
  2503         {
  2472         aEngine->SetGdiContextL( aFrameBuffer );
  2504         aEngine->SetGdiContextL( aFrameBuffer );
  2473         }
  2505         }
  2474 }
  2506 }
  2475 
       
  2476 // --------------------------------------------------------------------------
       
  2477 //  M2G: Overloaded SetGdiContextL() for CSvgtBitmap to enable rendering on target buffer.
       
  2478 // ---------------------------------------------------------------------------
       
  2479 EXPORT_C void CSvgEngineInterfaceImpl::SetGdiContextL( CSvgEngineImpl* aEngine, CSvgtBitmap* aFrameBuffer )
       
  2480     {
       
  2481     if( aEngine )
       
  2482         {
       
  2483         aEngine->EnableTargetRendering(ETrue);
       
  2484         aEngine->SetGdiContextL( aFrameBuffer );
       
  2485         }
       
  2486     }
       
  2487 
       
  2488 // --------------------------------------------------------------------------
  2507 // --------------------------------------------------------------------------
  2489 // EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
  2508 // EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
  2490 // ---------------------------------------------------------------------------
  2509 // ---------------------------------------------------------------------------
  2491 EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
  2510 EXPORT_C void CSvgEngineInterfaceImpl::SetDocument( CSvgEngineImpl* aEngine, CSvgDocumentImpl* aDocument )
  2492 {
  2511 {
  3081 EXPORT_C void CSvgEngineInterfaceImpl::GetFourPointElementBoundingBox(CSvgTextElementImpl* aTextElementHandle, TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4)
  3100 EXPORT_C void CSvgEngineInterfaceImpl::GetFourPointElementBoundingBox(CSvgTextElementImpl* aTextElementHandle, TPoint& aPoint1, TPoint& aPoint2, TPoint& aPoint3, TPoint& aPoint4)
  3082 {
  3101 {
  3083     TSvgFourPointRect fourPointRect;
  3102     TSvgFourPointRect fourPointRect;
  3084 
  3103 
  3085 	//updates CTM from root
  3104 	//updates CTM from root
       
  3105 	aTextElementHandle->UpdateCTM();
       
  3106 
  3086     if (aTextElementHandle)
  3107     if (aTextElementHandle)
  3087     {
  3108     {
  3088         aTextElementHandle->UpdateCTM();
       
  3089         aTextElementHandle->GetFourPointBBox(fourPointRect);
  3109         aTextElementHandle->GetFourPointBBox(fourPointRect);
  3090     }
  3110     }
  3091 
  3111 
  3092     fourPointRect.GetPoints(aPoint1, aPoint2, aPoint3, aPoint4);
  3112     fourPointRect.GetPoints(aPoint1, aPoint2, aPoint3, aPoint4);
  3093 }
  3113 }