os/mm/mdfdevvideoextensions/nga_mdf_postprocessor_shai/src/NGAPostProcSurfaceHandler.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mdfdevvideoextensions/nga_mdf_postprocessor_shai/src/NGAPostProcSurfaceHandler.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,138 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description:
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 + 
    1.22 +#include <e32base.h>
    1.23 +#include <graphics/surface.h> //TSurfaceId
    1.24 +#include <graphics/surfacemanager.h> //RSurfaceManager
    1.25 +#include "MdfRDebug.h"
    1.26 +
    1.27 +#include "NGAPostProcSurfaceHandler.h"
    1.28 +
    1.29 +//**************************************************
    1.30 +
    1.31 +CNGAPostProcSurfaceHandler* CNGAPostProcSurfaceHandler::NewL() 
    1.32 +{ 
    1.33 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() ++"));
    1.34 +
    1.35 +    CNGAPostProcSurfaceHandler* self = new (ELeave) CNGAPostProcSurfaceHandler; 
    1.36 +    CleanupStack::PushL(self);
    1.37 +    self->ConstructL(); 
    1.38 +    CleanupStack::Pop();
    1.39 +
    1.40 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() --"));
    1.41 +    return self; 
    1.42 +}
    1.43 +
    1.44 +void CNGAPostProcSurfaceHandler::ConstructL() 
    1.45 +{ 
    1.46 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() ++"), this);
    1.47 +    iSurfaceManager = new (ELeave) RSurfaceManager();
    1.48 +    User::LeaveIfError(iSurfaceManager->Open());
    1.49 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() --"), this);
    1.50 +}
    1.51 +
    1.52 +CNGAPostProcSurfaceHandler::CNGAPostProcSurfaceHandler() 
    1.53 +:iSurfaceManager(NULL),
    1.54 + iSurfaceAttributes(iSurfaceAttributesBuf())
    1.55 +{
    1.56 +}
    1.57 +
    1.58 +CNGAPostProcSurfaceHandler::~CNGAPostProcSurfaceHandler()
    1.59 +{
    1.60 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() ++"), this);
    1.61 +   if (iSurfaceManager)
    1.62 +   {
    1.63 +    iSurfaceManager->Close();
    1.64 +    delete iSurfaceManager;
    1.65 +    iSurfaceManager = NULL;
    1.66 +   }
    1.67 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() --"), this);
    1.68 +}
    1.69 +
    1.70 +TInt CNGAPostProcSurfaceHandler::CreateSurface(
    1.71 +							const RSurfaceManager::TSurfaceCreationAttributes & aAttributes, 
    1.72 +							TSurfaceId& aSurfaceId, const RChunk& aChunk) 
    1.73 +{ 
    1.74 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
    1.75 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
    1.76 +   
    1.77 +
    1.78 +   iSurfaceAttributes = aAttributes;
    1.79 +   return(iSurfaceManager->CreateSurface(iSurfaceAttributesBuf, aSurfaceId, aChunk));
    1.80 +}
    1.81 +TInt CNGAPostProcSurfaceHandler::CreateSurface(
    1.82 +							const RSurfaceManager::TSurfaceCreationAttributesBuf & aAttributes, 
    1.83 +							TSurfaceId& aSurfaceId) 
    1.84 +{ 
    1.85 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
    1.86 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
    1.87 +    return(iSurfaceManager->CreateSurface(aAttributes, aSurfaceId));
    1.88 +}
    1.89 +
    1.90 +
    1.91 +TInt CNGAPostProcSurfaceHandler::OpenSurface(const TSurfaceId& aSurfaceId) 
    1.92 +{ 
    1.93 + PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() ++"), this);
    1.94 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() --"), this);
    1.95 +	return(iSurfaceManager->OpenSurface(aSurfaceId));
    1.96 +    
    1.97 +}
    1.98 +
    1.99 +TInt CNGAPostProcSurfaceHandler::MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle) 
   1.100 +{ 
   1.101 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() ++"), this);
   1.102 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() --"), this);
   1.103 +	return(iSurfaceManager->MapSurface(aSurfaceId, aHandle));
   1.104 +}
   1.105 +
   1.106 +TInt CNGAPostProcSurfaceHandler::SurfaceInfo(const TSurfaceId& aSurfaceId, 
   1.107 +											RSurfaceManager::TInfoBuf& aInfo) 
   1.108 +{
   1.109 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() ++"), this);
   1.110 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() --"), this);
   1.111 +	return(iSurfaceManager->SurfaceInfo(aSurfaceId, aInfo));
   1.112 +}
   1.113 +
   1.114 +TInt CNGAPostProcSurfaceHandler::DestroySurface(const TSurfaceId& aSurfaceId) 
   1.115 +{ 
   1.116 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() ++"), this);
   1.117 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() --"), this);
   1.118 +	return(iSurfaceManager->CloseSurface(aSurfaceId));
   1.119 +}
   1.120 +
   1.121 +TInt CNGAPostProcSurfaceHandler::GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset) 
   1.122 +{ 
   1.123 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() aBuffer = %d++"), this, aBuffer);
   1.124 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() --"), this);
   1.125 +	return(iSurfaceManager->GetBufferOffset(aSurfaceId, aBuffer, aOffset));
   1.126 +}
   1.127 +
   1.128 +TInt CNGAPostProcSurfaceHandler::AddSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
   1.129 +{
   1.130 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() ++"), this);
   1.131 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() --"), this);
   1.132 +	return(iSurfaceManager->AddSurfaceHint(aSurfaceId, aHint));
   1.133 +}
   1.134 +
   1.135 +TInt CNGAPostProcSurfaceHandler::SetSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
   1.136 +{
   1.137 +   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() ++"), this);
   1.138 +	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() --"), this);
   1.139 +	return(iSurfaceManager->SetSurfaceHint(aSurfaceId, aHint));
   1.140 +}
   1.141 +