os/mm/mdfdevvideoextensions/nga_mdf_postprocessor_shai/src/NGAPostProcSurfaceHandler.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200 (2012-06-15)
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description:
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
 
sl@0
    19
#include <e32base.h>
sl@0
    20
#include <graphics/surface.h> //TSurfaceId
sl@0
    21
#include <graphics/surfacemanager.h> //RSurfaceManager
sl@0
    22
#include "MdfRDebug.h"
sl@0
    23
sl@0
    24
#include "NGAPostProcSurfaceHandler.h"
sl@0
    25
sl@0
    26
//**************************************************
sl@0
    27
sl@0
    28
CNGAPostProcSurfaceHandler* CNGAPostProcSurfaceHandler::NewL() 
sl@0
    29
{ 
sl@0
    30
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() ++"));
sl@0
    31
sl@0
    32
    CNGAPostProcSurfaceHandler* self = new (ELeave) CNGAPostProcSurfaceHandler; 
sl@0
    33
    CleanupStack::PushL(self);
sl@0
    34
    self->ConstructL(); 
sl@0
    35
    CleanupStack::Pop();
sl@0
    36
sl@0
    37
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler:NewL() --"));
sl@0
    38
    return self; 
sl@0
    39
}
sl@0
    40
sl@0
    41
void CNGAPostProcSurfaceHandler::ConstructL() 
sl@0
    42
{ 
sl@0
    43
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() ++"), this);
sl@0
    44
    iSurfaceManager = new (ELeave) RSurfaceManager();
sl@0
    45
    User::LeaveIfError(iSurfaceManager->Open());
sl@0
    46
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:ConstructL() --"), this);
sl@0
    47
}
sl@0
    48
sl@0
    49
CNGAPostProcSurfaceHandler::CNGAPostProcSurfaceHandler() 
sl@0
    50
:iSurfaceManager(NULL),
sl@0
    51
 iSurfaceAttributes(iSurfaceAttributesBuf())
sl@0
    52
{
sl@0
    53
}
sl@0
    54
sl@0
    55
CNGAPostProcSurfaceHandler::~CNGAPostProcSurfaceHandler()
sl@0
    56
{
sl@0
    57
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() ++"), this);
sl@0
    58
   if (iSurfaceManager)
sl@0
    59
   {
sl@0
    60
    iSurfaceManager->Close();
sl@0
    61
    delete iSurfaceManager;
sl@0
    62
    iSurfaceManager = NULL;
sl@0
    63
   }
sl@0
    64
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:~() --"), this);
sl@0
    65
}
sl@0
    66
sl@0
    67
TInt CNGAPostProcSurfaceHandler::CreateSurface(
sl@0
    68
							const RSurfaceManager::TSurfaceCreationAttributes & aAttributes, 
sl@0
    69
							TSurfaceId& aSurfaceId, const RChunk& aChunk) 
sl@0
    70
{ 
sl@0
    71
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
sl@0
    72
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
sl@0
    73
   
sl@0
    74
sl@0
    75
   iSurfaceAttributes = aAttributes;
sl@0
    76
   return(iSurfaceManager->CreateSurface(iSurfaceAttributesBuf, aSurfaceId, aChunk));
sl@0
    77
}
sl@0
    78
TInt CNGAPostProcSurfaceHandler::CreateSurface(
sl@0
    79
							const RSurfaceManager::TSurfaceCreationAttributesBuf & aAttributes, 
sl@0
    80
							TSurfaceId& aSurfaceId) 
sl@0
    81
{ 
sl@0
    82
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() ++"), this);
sl@0
    83
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:CreateSurface() --"), this);
sl@0
    84
    return(iSurfaceManager->CreateSurface(aAttributes, aSurfaceId));
sl@0
    85
}
sl@0
    86
sl@0
    87
sl@0
    88
TInt CNGAPostProcSurfaceHandler::OpenSurface(const TSurfaceId& aSurfaceId) 
sl@0
    89
{ 
sl@0
    90
 PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() ++"), this);
sl@0
    91
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:OpenSurface() --"), this);
sl@0
    92
	return(iSurfaceManager->OpenSurface(aSurfaceId));
sl@0
    93
    
sl@0
    94
}
sl@0
    95
sl@0
    96
TInt CNGAPostProcSurfaceHandler::MapSurface(const TSurfaceId& aSurfaceId, RChunk& aHandle) 
sl@0
    97
{ 
sl@0
    98
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() ++"), this);
sl@0
    99
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:MapSurface() --"), this);
sl@0
   100
	return(iSurfaceManager->MapSurface(aSurfaceId, aHandle));
sl@0
   101
}
sl@0
   102
sl@0
   103
TInt CNGAPostProcSurfaceHandler::SurfaceInfo(const TSurfaceId& aSurfaceId, 
sl@0
   104
											RSurfaceManager::TInfoBuf& aInfo) 
sl@0
   105
{
sl@0
   106
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() ++"), this);
sl@0
   107
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SurfaceInfo() --"), this);
sl@0
   108
	return(iSurfaceManager->SurfaceInfo(aSurfaceId, aInfo));
sl@0
   109
}
sl@0
   110
sl@0
   111
TInt CNGAPostProcSurfaceHandler::DestroySurface(const TSurfaceId& aSurfaceId) 
sl@0
   112
{ 
sl@0
   113
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() ++"), this);
sl@0
   114
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:DestroySurface() --"), this);
sl@0
   115
	return(iSurfaceManager->CloseSurface(aSurfaceId));
sl@0
   116
}
sl@0
   117
sl@0
   118
TInt CNGAPostProcSurfaceHandler::GetBufferOffset(const TSurfaceId& aSurfaceId, TInt aBuffer, TInt& aOffset) 
sl@0
   119
{ 
sl@0
   120
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() aBuffer = %d++"), this, aBuffer);
sl@0
   121
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:GetBufferOffset() --"), this);
sl@0
   122
	return(iSurfaceManager->GetBufferOffset(aSurfaceId, aBuffer, aOffset));
sl@0
   123
}
sl@0
   124
sl@0
   125
TInt CNGAPostProcSurfaceHandler::AddSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
sl@0
   126
{
sl@0
   127
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() ++"), this);
sl@0
   128
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:AddSurfaceHint() --"), this);
sl@0
   129
	return(iSurfaceManager->AddSurfaceHint(aSurfaceId, aHint));
sl@0
   130
}
sl@0
   131
sl@0
   132
TInt CNGAPostProcSurfaceHandler::SetSurfaceHint(const TSurfaceId& aSurfaceId,const RSurfaceManager::THintPair& aHint)
sl@0
   133
{
sl@0
   134
   PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() ++"), this);
sl@0
   135
	PP_DEBUG(_L("CNGAPostProcSurfaceHandler[%x]:SetSurfaceHint() --"), this);
sl@0
   136
	return(iSurfaceManager->SetSurfaceHint(aSurfaceId, aHint));
sl@0
   137
}
sl@0
   138