os/graphics/graphicsutils/commongraphicsheaders/inc/surface.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // surface
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @publishedPartner
    21  @released
    22 */
    23 #ifndef __SURFACE_H__
    24 #define __SURFACE_H__
    25 
    26 #include <e32def.h>
    27 
    28 class TSurfaceId
    29 	{
    30 	public:
    31 	enum
    32 		{
    33 		EInvalidSurface = 0,
    34 		EScreenSurface = 1,
    35 		EStreamHandle = 2,
    36 		EAdaptationSurfaceBase = 33,
    37 		};
    38 	struct TSurfaceUsage 			 //TSurfaceId::TSurfaceUsage::
    39 		{
    40 		enum	
    41 			{
    42 			//screen usage
    43 			EScreenField=0,
    44 			EHalField=1,
    45 			EHalFlippedFlag=0x80000000,
    46 			ETypeGuidField=2,
    47 			//stream handle usage
    48 			EObjectRefField=0,
    49 			//general class usage
    50 			ETypeClassField=3,
    51 			ETypeClassShift=24
    52 			};
    53 		};
    54 	typedef TSurfaceUsage TScreenSurfaceUsage; 			 //Backward compatibility
    55 	
    56 	
    57 	inline static TSurfaceId CreateNullId(void) 
    58 		{
    59 		TSurfaceId id = TSurfaceId();
    60 		for (TInt i = 0; i < 4; ++i) id.iInternal[i] = 0; 
    61 		return id;
    62 		};
    63 	inline TBool IsNull() const 
    64 		{
    65 		return ((iInternal[0] == 0) &&
    66 				(iInternal[1] == 0) &&
    67 				(iInternal[2] == 0) &&
    68 				(iInternal[3] == 0));
    69 			
    70 		};
    71 	inline TInt Type() const {return (TInt)(iInternal[3] >> 24);}
    72 	public:
    73 	TUint32 iInternal[4];
    74 	};
    75 
    76 
    77 inline bool operator == (const TSurfaceId& lhs, const TSurfaceId& rhs)
    78 	{
    79 	return ((lhs.iInternal[0] == rhs.iInternal[0]) &&
    80 			(lhs.iInternal[1] == rhs.iInternal[1]) &&
    81 			(lhs.iInternal[2] == rhs.iInternal[2]) &&
    82 			(lhs.iInternal[3] == rhs.iInternal[3]));
    83 	}
    84 
    85 inline bool operator != (const TSurfaceId& lhs, const TSurfaceId& rhs)
    86 	{
    87 	return !(lhs == rhs);
    88 	}
    89 
    90 #endif
    91