graphicscomposition/openwfsupport/test/tstreamoperation/surfaceutility.cpp
changeset 36 01a6848ebfd7
parent 0 5d03bc08d59c
child 164 25ffed67c7ef
equal deleted inserted replaced
0:5d03bc08d59c 36:01a6848ebfd7
    20 #include <e32std.h>
    20 #include <e32std.h>
    21 #include <imageconversion.h>
    21 #include <imageconversion.h>
    22 #include "surfaceutility.h"
    22 #include "surfaceutility.h"
    23 
    23 
    24 CSurfaceUtility::CSurfaceUtility(CSurfaceUtility* aClone)
    24 CSurfaceUtility::CSurfaceUtility(CSurfaceUtility* aClone)
    25 	:	iScreenNum(0), iSurfaces(aClone?&(aClone->iSurfaces):NULL)
    25 	:	iSurfaces(aClone?&(aClone->iSurfaces):NULL)
    26 	{
    26 	{
    27 	}
    27 	}
    28 	
    28 	
    29 CSurfaceUtility* CSurfaceUtility::NewL(CSurfaceUtility* aClone/*=NULL*/)
    29 CSurfaceUtility* CSurfaceUtility::NewL(CSurfaceUtility* aClone/*=NULL*/)
    30 	{
    30 	{
   373 		{
   373 		{
   374 		linePtr += info.iStride;
   374 		linePtr += info.iStride;
   375 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   375 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   376 		}
   376 		}
   377 	
   377 	
   378 	TInt err = SubmitUpdate(iScreenNum, aSurface, 0, NULL);
   378 	TInt err = SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   379 	if (err!=KErrNone)
   379 	if (err!=KErrNone)
   380 		LOG(("Error submitting update: 0x%X\n", err));
   380 		LOG(("Error submitting update: 0x%X\n", err));
   381 
   381 
   382 	CleanupStack::PopAndDestroy(/* chunk */);
   382 	CleanupStack::PopAndDestroy(/* chunk */);
   383 	}
   383 	}
   495 		{
   495 		{
   496 		linePtr += info.iStride;
   496 		linePtr += info.iStride;
   497 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   497 		Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * BytesPerPixelL(info.iPixelFormat));
   498 		}
   498 		}
   499 	
   499 	
   500 	TInt err = SubmitUpdate(iScreenNum, aSurface, 0, NULL);
   500 	TInt err = SubmitUpdate(KAllScreens, aSurface, 0, NULL);
   501 	if (err!=KErrNone)
   501 	if (err!=KErrNone)
   502 		LOG(("Error submitting update: 0x%X\n", err));
   502 		LOG(("Error submitting update: 0x%X\n", err));
   503 
   503 
   504 	CleanupStack::PopAndDestroy(/* chunk */);
   504 	CleanupStack::PopAndDestroy(/* chunk */);
   505 	}
   505 	}
   533 
   533 
   534 @param aScreenNumber	The screen to be updated where the surface is shown.
   534 @param aScreenNumber	The screen to be updated where the surface is shown.
   535 @param aSurface	The surface which has been updated.
   535 @param aSurface	The surface which has been updated.
   536 @param aRegion	The area of the surface affected, or NULL for all of it.
   536 @param aRegion	The area of the surface affected, or NULL for all of it.
   537 */
   537 */
   538 TInt CSurfaceUtility::SubmitUpdate(TInt aScreenNumber, const TSurfaceId& aSurface,TInt aBufferNumber, TInt aNullRegion)
   538 TInt CSurfaceUtility::SubmitUpdate(TInt /* aScreenNumber */, const TSurfaceId& aSurface,TInt aBufferNumber, TInt aNullRegion)
   539     {
   539     {
   540     if (aNullRegion==0)
   540     if (aNullRegion==0)
   541         {
   541         {
   542         return SubmitUpdate(aScreenNumber, aSurface, aBufferNumber);
   542         return SubmitUpdate(KAllScreens, aSurface, aBufferNumber);
   543         }
   543         }
   544     else
   544     else
   545         if (aBufferNumber==0)
   545         if (aBufferNumber==0)
   546             {
   546             {
   547             return SubmitUpdate(aScreenNumber, aSurface, aNullRegion);
   547             return SubmitUpdate(KAllScreens, aSurface, aNullRegion);
   548             }
   548             }
   549         else
   549         else
   550             {
   550             {
   551             return KErrNotSupported;
   551             return KErrNotSupported;
   552             }
   552             }
   553     }
   553     }
   554 
   554 
   555 TInt CSurfaceUtility::SubmitUpdate(TInt aScreenNumber, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
   555 TInt CSurfaceUtility::SubmitUpdate(TInt /* aScreenNumber */, const TSurfaceId& aSurface, const TRegion* aRegion,TInt aBufferNumber)
   556     {
   556     {
   557     return SubmitUpdate(aScreenNumber, aSurface, aBufferNumber, aRegion);
   557     return SubmitUpdate(KAllScreens, aSurface, aBufferNumber, aRegion);
   558     }
   558     }
   559 
   559 
   560 TInt CSurfaceUtility::SubmitUpdate(TInt aScreenNumber, const TSurfaceId& aSurface,TInt aBufferNumber, const TRegion* aRegion)
   560 TInt CSurfaceUtility::SubmitUpdate(TInt /* aScreenNumber */, const TSurfaceId& aSurface,TInt aBufferNumber, const TRegion* aRegion)
   561 	{
   561 	{
   562 	if (!iSurfaceUpdateSession.Handle())
   562 	if (!iSurfaceUpdateSession.Handle())
   563 	    {
   563 	    {
   564 	    iSurfaceUpdateSession.Connect();
   564 	    iSurfaceUpdateSession.Connect();
   565 	    }
   565 	    }
   568         LOG(("Error - SUS client not started!"));
   568         LOG(("Error - SUS client not started!"));
   569         return KErrNotReady;
   569         return KErrNotReady;
   570         }
   570         }
   571     else
   571     else
   572         {
   572         {
   573         TInt err =iSurfaceUpdateSession.SubmitUpdate(aScreenNumber, aSurface, aBufferNumber, aRegion); 
   573         TInt err =iSurfaceUpdateSession.SubmitUpdate(KAllScreens, aSurface, aBufferNumber, aRegion); 
   574         if (err!=KErrNone)
   574         if (err!=KErrNone)
   575             LOG(("Error submitting update: 0x%X\n", err));
   575             LOG(("Error submitting update: 0x%X\n", err));
   576         return err;
   576         return err;
   577         }
   577         }
   578 	}
   578 	}
   579 
       
   580 void CSurfaceUtility::SetAutoUpdateScreenNum(TInt aScreenNum)
       
   581     {
       
   582     iScreenNum=aScreenNum;
       
   583     }
       
   584 
   579 
   585 void CSurfaceUtility::FillNativeStreamSurfaceL(TSurfaceId& aSurface, TUint8* aBufferPtr, const TRgb& aColor)
   580 void CSurfaceUtility::FillNativeStreamSurfaceL(TSurfaceId& aSurface, TUint8* aBufferPtr, const TRgb& aColor)
   586 	{
   581 	{
   587 	RSurfaceManager::TInfoBuf infoBuf;
   582 	RSurfaceManager::TInfoBuf infoBuf;
   588 	RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
   583 	RSurfaceManager::TSurfaceInfoV01& info = infoBuf();