svgtopt/SVG/SVGEngine/src/SVGEngineImpl.cpp
changeset 26 796196dd6e68
parent 19 df65ec4f2d28
child 39 1902ade171ab
equal deleted inserted replaced
21:4c62338e03c8 26:796196dd6e68
    57 
    57 
    58 #include "SVGFloatCssValueImpl.h"
    58 #include "SVGFloatCssValueImpl.h"
    59 #include "SVGTimeContainer.h"
    59 #include "SVGTimeContainer.h"
    60 #include "SVGMediaAnimationElementImpl.h"
    60 #include "SVGMediaAnimationElementImpl.h"
    61 
    61 
       
    62 #include <svgtbitmap.h>
    62 // Constants
    63 // Constants
    63 // length of </text>
    64 // length of </text>
    64 const TInt KClosingTextTagLength = 7;
    65 const TInt KClosingTextTagLength = 7;
    65 // Length of </textArea>
    66 // Length of </textArea>
    66 const TInt KClosingTextAreaTagLength = 11;
    67 const TInt KClosingTextAreaTagLength = 11;
   746 
   747 
   747         iGfxContext->Flush();
   748         iGfxContext->Flush();
   748 
   749 
   749         // Get the redering result onto CFbsBitmap.
   750         // Get the redering result onto CFbsBitmap.
   750         if(iFrameBufferSize.iWidth > 0)
   751         if(iFrameBufferSize.iWidth > 0)
   751             iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask,iFrameBufferSize,iRenderDspMode,iMaskDspMode );    
   752             {
       
   753             if(iIsTargetRenderingEnabled) 
       
   754                 { // M2G
       
   755                 iGfxContext->UpdateFramebufferL( iTargetBitmapBuffer, iTargetMaskBuffer,iFrameBufferSize,
       
   756                         iTargetBitmapBuffer->DisplayMode(),iTargetMaskBuffer->DisplayMode());
       
   757                 }
       
   758             else 
       
   759                 iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask,iFrameBufferSize,iRenderDspMode,
       
   760                         iMaskDspMode );
       
   761             }
   752         else
   762         else
   753          iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask );
   763             {
       
   764             if(iIsTargetRenderingEnabled)  //M2G
       
   765                 iGfxContext->UpdateFramebufferL( iTargetBitmapBuffer, iTargetMaskBuffer );
       
   766             else
       
   767                 iGfxContext->UpdateFramebufferL( iFrameBuffer, iMask );
       
   768 
       
   769             }
   754 
   770 
   755         if ( !iIgnoreUpdateScreen && iRequestObserver != NULL )
   771         if ( !iIgnoreUpdateScreen && iRequestObserver != NULL )
   756             {
   772             {
   757             iRequestObserver->UpdateScreen();
   773             iRequestObserver->UpdateScreen();
   758             }
   774             }
  1257         {
  1273         {
  1258         iGfxContext->GenerateMask( aMask );
  1274         iGfxContext->GenerateMask( aMask );
  1259         }
  1275         }
  1260     }
  1276     }
  1261 
  1277 
       
  1278 void CSvgEngineImpl::GenerateMask(CSvgtBitmap* aMask)
       
  1279     {
       
  1280     if ( iGfxContext )
       
  1281         {
       
  1282         iGfxContext->GenerateMask( aMask );
       
  1283         }
       
  1284     }
  1262 //
  1285 //
  1263 // ---------------------------------------------------------------------------
  1286 // ---------------------------------------------------------------------------
  1264 // set background color
  1287 // set background color
  1265 // ---------------------------------------------------------------------------
  1288 // ---------------------------------------------------------------------------
  1266 void CSvgEngineImpl::SetBackgroundColor(TUint32 aRGBA8888Color)
  1289 void CSvgEngineImpl::SetBackgroundColor(TUint32 aRGBA8888Color)
  1370     else if ( iGfxContext )
  1393     else if ( iGfxContext )
  1371         {
  1394         {
  1372         iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
  1395         iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
  1373         }
  1396         }
  1374     }
  1397     }
  1375 
  1398 //----------------------------------------------------------------------------------------------
       
  1399 //M2G: SetGdiContextL() is overloaded to accept CSvgtBitmap to enable rendering on target buffer.
       
  1400 //-----------------------------------------------------------------------------------------------
       
  1401 void CSvgEngineImpl::SetGdiContextL(CSvgtBitmap* aCurrentBitmap, CSvgtBitmap* aMask)
       
  1402     {
       
  1403 
       
  1404     // Handle for both Non-NULL and NULL parameter
       
  1405     iTargetBitmapBuffer = aCurrentBitmap;
       
  1406     iTargetMaskBuffer = aMask;
       
  1407 
       
  1408     if ( aCurrentBitmap )
       
  1409         {
       
  1410         if ( !iGfxContext )
       
  1411             {
       
  1412                 iGfxContext = CGfx2dGcOpenVG::NewL( iTargetBitmapBuffer->SizeInPixels(), iBitmapFontSpec, iSvgBitmapFontProvider, EFalse );
       
  1413                 
       
  1414                 // The API is called Only in case of JSR226. Incase if the midlet developer
       
  1415                 // has changed the RedenderQuality of the midlet.ByDefualt the value of 
       
  1416                 // iRenderQuality is 2 i.e. VG_RENDERING_QUALITY_BETTER.
       
  1417                 iGfxContext->SetAntialiasingMode( iRenderQuality );
       
  1418             }
       
  1419         else
       
  1420             {
       
  1421             iGfxContext->ChangeBufferSizeL( iTargetBitmapBuffer->SizeInPixels() );
       
  1422             }
       
  1423         }
       
  1424     else if ( iGfxContext )
       
  1425         {
       
  1426         iGfxContext->ChangeBufferSizeL( TSize( 0,0 ) );
       
  1427         }
       
  1428         
       
  1429     }
  1376 // ---------------------------------------------------------------------------
  1430 // ---------------------------------------------------------------------------
  1377 // void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
  1431 // void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
  1378 // ---------------------------------------------------------------------------
  1432 // ---------------------------------------------------------------------------
  1379 
  1433 
  1380 void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
  1434 void CSvgEngineImpl::StartEngine(CSvgErrorImpl* aError)
  1458 // --------------------------------------------------------------------------
  1512 // --------------------------------------------------------------------------
  1459 // void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
  1513 // void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
  1460 // ---------------------------------------------------------------------------
  1514 // ---------------------------------------------------------------------------
  1461 void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
  1515 void CSvgEngineImpl::RenderFrame( TUint aCurrentTime )
  1462     {
  1516     {
  1463     if ( !iFrameBuffer || !iSvgDocument ||
  1517     if(iIsTargetRenderingEnabled) //M2G: If target rendering is enabled
  1464          iFrameBuffer->SizeInPixels().iWidth == 0 || iFrameBuffer->SizeInPixels().iHeight == 0 )
  1518         {
  1465         {
  1519         if ( !iTargetBitmapBuffer || !iSvgDocument ||
  1466         return;
  1520               iTargetBitmapBuffer->SizeInPixels().iWidth == 0 || 
  1467         }
  1521               iTargetBitmapBuffer->SizeInPixels().iHeight == 0 )
  1468 
  1522             {
       
  1523             return;
       
  1524             }
       
  1525         }
       
  1526     else
       
  1527         {
       
  1528         if (!iFrameBuffer || !iSvgDocument
       
  1529             || iFrameBuffer->SizeInPixels().iWidth == 0
       
  1530             || iFrameBuffer->SizeInPixels().iHeight == 0)
       
  1531             {
       
  1532             return;
       
  1533             }
       
  1534         }
  1469     if ( aCurrentTime == 0 )
  1535     if ( aCurrentTime == 0 )
  1470         {
  1536         {
  1471         SeekEngine( 0 );
  1537         SeekEngine( 0 );
  1472         }
  1538         }
  1473 
  1539 
  3151     if (iGfxContext)
  3217     if (iGfxContext)
  3152         {
  3218         {
  3153         ((CGfx2dGcOpenVG *)iGfxContext)->SetBitmapHeader(aHeaderData);
  3219         ((CGfx2dGcOpenVG *)iGfxContext)->SetBitmapHeader(aHeaderData);
  3154         }
  3220         }
  3155     }
  3221     }
       
  3222 //---------------------------------------------------------------
       
  3223 // M2G: Enable rendering on target buffer.
       
  3224 //----------------------------------------------------------------
       
  3225 void CSvgEngineImpl::EnableTargetRendering(TBool aTargetRendering )
       
  3226     {
       
  3227     iIsTargetRenderingEnabled = aTargetRendering; 
       
  3228     }
       
  3229 
       
  3230 //---------------------------------------------------------------
       
  3231 // M2G: TBool CSvgEngineImpl::IsTargetRenderingEnabled() const 
       
  3232 //----------------------------------------------------------------
       
  3233 TBool CSvgEngineImpl::IsTargetRenderingEnabled() const 
       
  3234     {
       
  3235     return iIsTargetRenderingEnabled; 
       
  3236     }
  3156 //NGA
  3237 //NGA
  3157 // ---------------------------------------------------------------------------
  3238 // ---------------------------------------------------------------------------
  3158 // SetGdiContext File
  3239 // SetGdiContext File
  3159 // ---------------------------------------------------------------------------
  3240 // ---------------------------------------------------------------------------
  3160 
  3241