mdfdevvideoextensions/nga_mdf_postprocessor_shai/src/NGAPostProcSurfaceHandler.cpp
changeset 58 b6dbf97aba93
equal deleted inserted replaced
57:1cbb0d5bf7f2 58:b6dbf97aba93
       
     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  iSurfaceAttributes(iSurfaceAttributesBuf())
       
    52 {
       
    53 }
       
    54 
       
    55 CNGAPostProcSurfaceHandler::~CNGAPostProcSurfaceHandler()
       
    56 {
       
    57    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() ++"), this);
       
    58    if (iSurfaceManager)
       
    59    {
       
    60     iSurfaceManager->Close();
       
    61     delete iSurfaceManager;
       
    62     iSurfaceManager = NULL;
       
    63    }
       
    64    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() --"), this);
       
    65 }
       
    66 
       
    67 TInt CNGAPostProcSurfaceHandler::CreateSurface(
       
    68 							const RSurfaceManager::TSurfaceCreationAttributes & aAttributes, 
       
    69 							TSurfaceId& aSurfaceId, const RChunk& aChunk) 
       
    70 { 
       
    71    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
       
    72    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
       
    73    
       
    74 
       
    75    iSurfaceAttributes = aAttributes;
       
    76    return(iSurfaceManager->CreateSurface(iSurfaceAttributesBuf, aSurfaceId, aChunk));
       
    77 }
       
    78 TInt CNGAPostProcSurfaceHandler::CreateSurface(
       
    79 							const RSurfaceManager::TSurfaceCreationAttributesBuf & aAttributes, 
       
    80 							TSurfaceId& aSurfaceId) 
       
    81 { 
       
    82    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
       
    83    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
       
    84     return(iSurfaceManager->CreateSurface(aAttributes, aSurfaceId));
       
    85 }
       
    86 
       
    87 
       
    88 TInt CNGAPostProcSurfaceHandler::OpenSurface(const TSurfaceId& aSurfaceId) 
       
    89 { 
       
    90  PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() ++"), this);
       
    91 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() --"), this);
       
    92 	return(iSurfaceManager->OpenSurface(aSurfaceId));
       
    93     
       
    94 }
       
    95 
       
    96 TInt CNGAPostProcSurfaceHandler::MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle) 
       
    97 { 
       
    98    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() ++"), this);
       
    99 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() --"), this);
       
   100 	return(iSurfaceManager->MapSurface(aSurfaceId, aHandle));
       
   101 }
       
   102 
       
   103 TInt CNGAPostProcSurfaceHandler::SurfaceInfo(const TSurfaceId& aSurfaceId, 
       
   104 											RSurfaceManager::TInfoBuf& aInfo) 
       
   105 {
       
   106    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() ++"), this);
       
   107 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() --"), this);
       
   108 	return(iSurfaceManager->SurfaceInfo(aSurfaceId, aInfo));
       
   109 }
       
   110 
       
   111 TInt CNGAPostProcSurfaceHandler::DestroySurface(const TSurfaceId& aSurfaceId) 
       
   112 { 
       
   113    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() ++"), this);
       
   114 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() --"), this);
       
   115 	return(iSurfaceManager->CloseSurface(aSurfaceId));
       
   116 }
       
   117 
       
   118 TInt CNGAPostProcSurfaceHandler::GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset) 
       
   119 { 
       
   120    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() aBuffer = %d++"), this, aBuffer);
       
   121 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() --"), this);
       
   122 	return(iSurfaceManager->GetBufferOffset(aSurfaceId, aBuffer, aOffset));
       
   123 }
       
   124 
       
   125 TInt CNGAPostProcSurfaceHandler::AddSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
       
   126 {
       
   127    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() ++"), this);
       
   128 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() --"), this);
       
   129 	return(iSurfaceManager->AddSurfaceHint(aSurfaceId, aHint));
       
   130 }
       
   131 
       
   132 TInt CNGAPostProcSurfaceHandler::SetSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
       
   133 {
       
   134    PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() ++"), this);
       
   135 	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() --"), this);
       
   136 	return(iSurfaceManager->SetSurfaceHint(aSurfaceId, aHint));
       
   137 }
       
   138