os/mm/mdfdevvideoextensions/nga_mdf_postprocessor/src/NGAPostProcSurfaceHandler.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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:
    15 *
    16 */
    17 
    18  
    19 #include <e32base.h>
    20 #include <graphics/surface.h> //TSurfaceId
    21 #include <graphics/surfacemanager.h> //RSurfaceManager
    22 #include "MdfRDebug.h"
    23 
    24 #include "NGAPostProcSurfaceHandler.h"
    25 
    26 //**************************************************
    27 
    28 CNGAPostProcSurfaceHandler* CNGAPostProcSurfaceHandler::NewL() 
    29 { 
    30    PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() ++"));
    31 
    32     CNGAPostProcSurfaceHandler* self = new (ELeave) CNGAPostProcSurfaceHandler; 
    33     CleanupStack::PushL(self);
    34     self->ConstructL(); 
    35     CleanupStack::Pop();
    36 
    37    PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() --"));
    38     return self; 
    39 }
    40 
    41 void CNGAPostProcSurfaceHandler::ConstructL() 
    42 { 
    43    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() ++"), this);
    44     iSurfaceManager = new (ELeave) RSurfaceManager();
    45     User::LeaveIfError(iSurfaceManager->Open());
    46    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() --"), this);
    47 }
    48 
    49 CNGAPostProcSurfaceHandler::CNGAPostProcSurfaceHandler() 
    50 :iSurfaceManager(NULL)
    51 {
    52 }
    53 
    54 CNGAPostProcSurfaceHandler::~CNGAPostProcSurfaceHandler()
    55 {
    56    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() ++"), this);
    57    if (iSurfaceManager)
    58    {
    59     iSurfaceManager->Close();
    60     delete iSurfaceManager;
    61     iSurfaceManager = NULL;
    62    }
    63    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() --"), this);
    64 }
    65 
    66 TInt CNGAPostProcSurfaceHandler::CreateSurface(
    67 							const RSurfaceManager::TSurfaceCreationAttributesBuf & aAttributes, 
    68 							TSurfaceId& aSurfaceId) 
    69 { 
    70    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
    71    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
    72     return(iSurfaceManager->CreateSurface(aAttributes, aSurfaceId));
    73 }
    74 
    75 
    76 TInt CNGAPostProcSurfaceHandler::OpenSurface(const TSurfaceId& aSurfaceId) 
    77 { 
    78  PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() ++"), this);
    79 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() --"), this);
    80 	return(iSurfaceManager->OpenSurface(aSurfaceId));
    81     
    82 }
    83 
    84 TInt CNGAPostProcSurfaceHandler::MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle) 
    85 { 
    86    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() ++"), this);
    87 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() --"), this);
    88 	return(iSurfaceManager->MapSurface(aSurfaceId, aHandle));
    89 }
    90 
    91 TInt CNGAPostProcSurfaceHandler::SurfaceInfo(const TSurfaceId& aSurfaceId, 
    92 											RSurfaceManager::TInfoBuf& aInfo) 
    93 {
    94    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() ++"), this);
    95 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() --"), this);
    96 	return(iSurfaceManager->SurfaceInfo(aSurfaceId, aInfo));
    97 }
    98 
    99 TInt CNGAPostProcSurfaceHandler::DestroySurface(const TSurfaceId& aSurfaceId) 
   100 { 
   101    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() ++"), this);
   102 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() --"), this);
   103 	return(iSurfaceManager->CloseSurface(aSurfaceId));
   104 }
   105 
   106 TInt CNGAPostProcSurfaceHandler::GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset) 
   107 { 
   108    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() aBuffer = %d++"), this, aBuffer);
   109 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() --"), this);
   110 	return(iSurfaceManager->GetBufferOffset(aSurfaceId, aBuffer, aOffset));
   111 }
   112 
   113 TInt CNGAPostProcSurfaceHandler::AddSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
   114 {
   115    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() ++"), this);
   116 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() --"), this);
   117 	return(iSurfaceManager->AddSurfaceHint(aSurfaceId, aHint));
   118 }
   119 
   120 TInt CNGAPostProcSurfaceHandler::SetSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
   121 {
   122    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() ++"), this);
   123 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() --"), this);
   124 	return(iSurfaceManager->SetSurfaceHint(aSurfaceId, aHint));
   125 }
   126