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