os/graphics/graphicsdeviceinterface/bitgdi/sbit/SCREENDV.CPP
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) 1997-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 //
    15 
    16 #include <hal.h>
    17 #include <fbs.h>
    18 #include <bitbase.h>
    19 #include <bitdev.h>
    20 #include <bitdraw.h>
    21 #include <bitdrawscaling.h>
    22 #include <bitdraworigin.h>
    23 #include <bitdrawinterfaceid.h>
    24 #include "BITPANIC.H"
    25 #include <bmalphablend.h>
    26 #include <graphics/gdi/gdiconsts.h>
    27 
    28 
    29 #if defined(SYMBIAN_GRAPHICS_GCE)
    30 #include <bitdrawsurface.h>
    31 #endif
    32 
    33 /**
    34 @param aScreenNo The screen number. If the device has a support for only one screen, its 
    35                  number is 0.
    36 */
    37 CFbsScreenDevice::CFbsScreenDevice(TInt aScreenNo):
    38 	CFbsDevice(),
    39     iScreenNo(aScreenNo)
    40 	{
    41     }
    42 
    43 
    44 /** Creates a new CFbsScreenDevice object.
    45 
    46 @param aLibname Not used.
    47 @param aDispMode The display mode of the device.
    48 @return The newly created FBSERV screen device. */ 
    49 EXPORT_C CFbsScreenDevice* CFbsScreenDevice::NewL(const TDesC& /*aLibname*/,
    50 												  TDisplayMode aDispMode)
    51 	{
    52 	return CFbsScreenDevice::NewL(KDefaultScreenNo, aDispMode);
    53 	}
    54 
    55 /** Creates a new CFbsScreenDevice object.
    56 	
    57 @param aLibname Not used.
    58 @param aDispMode The display mode of the device.
    59 @param aWhite Not used. 
    60 @return The newly created font and bitmap server screen device.
    61 @deprecated Use two param version instead. */
    62 EXPORT_C CFbsScreenDevice* CFbsScreenDevice::NewL(const TDesC& /*aLibname*/,
    63 												  TDisplayMode aDispMode,
    64 												  TRgb /*aWhite*/)
    65 	{
    66 	return CFbsScreenDevice::NewL(KDefaultScreenNo, aDispMode);
    67 	}
    68 
    69 /** 
    70 Creates a new CFbsScreenDevice object.
    71 @param aScreenNo The screen number. If the device has a support for only one screen, its 
    72                  number is 0.
    73 @param aDispMode The display mode of the device.
    74 @return The newly created FBSERV screen device. 
    75 */ 
    76 EXPORT_C CFbsScreenDevice* CFbsScreenDevice::NewL(TInt aScreenNo, TDisplayMode aDispMode)
    77 	{
    78 	CFbsScreenDevice* self = new (ELeave) CFbsScreenDevice(aScreenNo);
    79 	CleanupStack::PushL(self);
    80 	self->ConstructL(aScreenNo, aDispMode);
    81 	CleanupStack::Pop(); // self
    82 	return self;
    83 	}
    84 
    85 /** Frees all resources owned by the object prior to its destruction. */
    86 EXPORT_C CFbsScreenDevice::~CFbsScreenDevice()
    87 	{
    88     }
    89 
    90 void CFbsScreenDevice::ConstructL(TInt aScreenNo, TDisplayMode aDispMode)
    91 	{
    92 	iDrawDevice = CFbsDrawDevice::NewScreenDeviceL(aScreenNo, aDispMode);
    93 	iScreenDevice = ETrue;
    94 	iTypefaceStore = CFbsTypefaceStore::NewL(this);
    95 	if(aDispMode != EGray4) // Flicker-free blitting not enabled under EGray4 because it messes up the EGray16-emulating dithering
    96 		{
    97 		TInt scanLineBytes = iDrawDevice->ScanLineBytes();
    98 		const TSize screenSize = SizeInPixels();
    99 		if(screenSize.iHeight > screenSize.iWidth)
   100 			{
   101 			scanLineBytes = scanLineBytes * screenSize.iHeight / screenSize.iWidth;
   102 			}
   103 		iBitBltMaskedBuffer = new(ELeave) TUint8[scanLineBytes * 2];
   104 		}
   105 	}
   106 
   107 
   108 /** Copies a scanline into a buffer.
   109 
   110 This implements the pure virtual function
   111 CBitmapDevice::GetScanLine(). */
   112 EXPORT_C void CFbsScreenDevice::GetScanLine(TDes8& aBuf,const TPoint& aStartPixel,
   113 											TInt aLength,TDisplayMode aDispMode) const
   114     {
   115 	if (!iDrawDevice)
   116 		return;
   117 
   118 	((CFbsScreenDevice*)this)->DoGetScanLine(aBuf,aStartPixel,aLength,aDispMode);
   119 	}
   120 
   121 
   122 /** Gets the RGB colour of an individual pixel on a bitmapped graphics
   123 device.
   124 
   125 This implements the pure virtual function
   126 CBitmapDevice::GetPixel(). */ 
   127 EXPORT_C void CFbsScreenDevice::GetPixel(TRgb& aColor,const TPoint& aPoint) const
   128     {
   129 	if (!iDrawDevice)
   130 		return;
   131 
   132 	TRect deviceRect;
   133 	iDrawDevice->GetDrawRect(deviceRect);
   134 	if (!deviceRect.Contains(aPoint))
   135 		return;
   136 
   137 	aColor = iDrawDevice->ReadPixel(aPoint.iX,aPoint.iY);
   138 	}
   139 
   140 
   141 /** Converts a horizontal dimension from pixels to twips.
   142 
   143 This implements the pure virtual function
   144 MGraphicsDeviceMap::HorizontalPixelsToTwips(). */
   145 EXPORT_C TInt CFbsScreenDevice::HorizontalPixelsToTwips(TInt aPixels) const
   146     {
   147 	TInt64 pixels=aPixels;
   148 	pixels=(iDrawDevice->HorzTwipsPerThousandPixels() * pixels + 500) / 1000;
   149 	return I64INT(pixels);
   150 	}
   151 
   152 
   153 /** Converts a vertical dimension from pixels to twips.
   154 
   155 This implements the pure virtual function
   156 MGraphicsDeviceMap::VerticalPixelsToTwips(). */	
   157 EXPORT_C TInt CFbsScreenDevice::VerticalPixelsToTwips(TInt aPixels) const
   158    {
   159 	TInt64 pixels=aPixels;
   160 	pixels=(iDrawDevice->VertTwipsPerThousandPixels() * pixels + 500) / 1000;
   161 	return I64INT(pixels);
   162 	}
   163 
   164 
   165 /**
   166 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   167 Calling this method has no effect.
   168 @deprecated
   169 */
   170 EXPORT_C void CFbsScreenDevice::DrawSpriteBegin()
   171 	{
   172 	}
   173 
   174 
   175 /**
   176 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   177 Calling this method has no effect.
   178 @deprecated
   179 */
   180 EXPORT_C void CFbsScreenDevice::DrawSpriteEnd()
   181 	{
   182 	}
   183 
   184 
   185 /**
   186 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   187 Calling this method has no effect.
   188 
   189 @return NULL.
   190 @deprecated
   191 */
   192 EXPORT_C TSpriteBase* CFbsScreenDevice::HideSprite() const
   193 	{
   194 	return NULL;
   195 	}
   196 
   197 
   198 /**
   199 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   200 Calling this method has no effect.
   201 
   202 @param aRect Ignored.
   203 @param aClippingRegion Ignored.
   204 @return NULL.
   205 @deprecated
   206 */
   207 EXPORT_C TSpriteBase* CFbsScreenDevice::HideSprite(const TRect& /*aRect*/,
   208 												   const TRegion* /*aClippingRegion*/) const
   209 	{
   210 	return NULL;
   211 	}
   212 
   213 
   214 /**
   215 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   216 Calling this method has no effect.
   217 
   218 @param aSprite Ignored.
   219 @deprecated
   220 */
   221 EXPORT_C void CFbsScreenDevice::ShowSprite(TSpriteBase* /*aSprite*/) const
   222 	{
   223 	}
   224 
   225 
   226 /**
   227 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   228 Calling this method has no effect.
   229 
   230 @param aSprite Ignored.
   231 @param aRect Ignored.
   232 @param aClippingRegion Ignored.
   233 @deprecated
   234 */
   235 EXPORT_C void CFbsScreenDevice::ShowSprite(TSpriteBase* /*aSprite*/,const TRect& /*aRect*/,
   236 										   const TRegion* /*aClippingRegion*/) const
   237 	{
   238 	}
   239 
   240 
   241 /** Changes the screen device.
   242 
   243 @param aOldDevice A pointer to the old screen device. */
   244 EXPORT_C void CFbsScreenDevice::ChangeScreenDevice(CFbsScreenDevice* aOldDevice)
   245 	{
   246 	if (aOldDevice == NULL)
   247 		{
   248 		TInt ret = iDrawDevice->InitScreen();
   249 		BG_ASSERT_ALWAYS(ret == KErrNone,EBitgdiPanicInvalidWindowHandle);
   250 		}
   251 	else
   252 		{
   253 		delete aOldDevice->iGraphicsAccelerator;
   254 		aOldDevice->iGraphicsAccelerator = NULL;
   255 
   256 		if (aOldDevice != this)
   257 			{
   258 			iDrawDevice->SetDisplayMode(aOldDevice->iDrawDevice);
   259 			iOrientation = aOldDevice->iOrientation;
   260 			}
   261 		// else we're re-initialising the existing CFbsScreenDevice's graphics accelerator only
   262 		}
   263 
   264 	//Check if the screen device is scaled or the origin is moved. 
   265 	//If it is, then do not create graphics accelerator
   266 	//instance, because it does not have support for scaling&origin.
   267 	TBool scalingOff = ETrue;
   268 	TBool originZero = ETrue;
   269 	MScalingSettings* scalingSettings = NULL;
   270 	if(iDrawDevice->GetInterface(KScalingSettingsInterfaceID, 
   271 							reinterpret_cast <TAny*&> (scalingSettings)) == KErrNone)
   272 		{
   273 		BG_ASSERT_DEBUG_INVARIANT(scalingSettings);
   274 		scalingOff = scalingSettings->IsScalingOff();
   275 		}
   276 	MDrawDeviceOrigin* originInterface = NULL;
   277 	if(iDrawDevice->GetInterface(KDrawDeviceOriginInterfaceID, 
   278 							reinterpret_cast <TAny*&> (originInterface)) == KErrNone)
   279 		{
   280 		BG_ASSERT_DEBUG_INVARIANT(originInterface);
   281 		TPoint origin;
   282 		originInterface->Get(origin);
   283 		originZero = origin.iX == 0 && origin.iY == 0;
   284 		}
   285 	if(scalingOff && originZero)
   286 		{
   287 		RHardwareBitmap screen;
   288         //Some explanations about "-1 - iScreenNo" expression.
   289         //SetAsScreenReference() is a public, exported method with a default argument'value -1.
   290         //In SetAsScreenReference()'s implementation before "Multiple screens" source code update,
   291         //"-1" value meant - this is a screen hardware bitmap. Positive value meant - 
   292         //in-memory hardware bitmap.
   293         //After "Multiple screens" update, the meaning of SetAsScreenReference()'s argument is:
   294         // - Positive value - in-memory hardware bitmap;
   295         // - Negative value - screen number: "-1" - screen 0, "-2" - screen 1, "-3" - screen 2, ...;
   296 		if(screen.SetAsScreenReference(-1 - iScreenNo)==KErrNone)
   297 			{
   298 			TRAP_IGNORE(iGraphicsAccelerator = CHardwareGraphicsAccelerator::NewL(screen));
   299 			}
   300 		}
   301 	}
   302 
   303 
   304 /** Gets the palette attributes of the device.
   305 
   306 @param aModifiable On return, holds information on whether or not the device 
   307 palette is modifiable (ETrue) or fixed (EFalse). 
   308 @param aNumEntries On return, holds the number of entries in the device 
   309 palette. */
   310 EXPORT_C void CFbsScreenDevice::PaletteAttributes(TBool& aModifiable,TInt& aNumEntries) const
   311 	{
   312 	aModifiable = (iDrawDevice->DisplayMode() == EColor256);
   313 	aNumEntries = TDisplayModeUtils::NumDisplayModeColors(iDrawDevice->DisplayMode());
   314 	}
   315 
   316 
   317 /** Sets the device's palette to the specified palette.
   318 
   319 Setting the palette is only possible if the device has a modifiable palette, 
   320 which can be determined by calling PaletteAttributes().
   321 
   322 @param aPalette The new palette for the device. */
   323 EXPORT_C void CFbsScreenDevice::SetPalette(CPalette* aPalette)
   324 	{
   325 	SetCustomPalette(aPalette); // Have to ignore error for compatibility
   326 	}
   327 
   328 
   329 /** Gets the device's current palette.
   330 
   331 This function is only supported if the device has a modifiable palette, 
   332 which can be determined by calling PaletteAttributes().
   333 
   334 @param aPalette On return, holds the devices current palette. 
   335 @return KErrNone, if successful; otherwise, another of the system-wide error 
   336 codes. */
   337 EXPORT_C TInt CFbsScreenDevice::GetPalette(CPalette*& aPalette) const
   338 	{
   339 	return iDrawDevice->GetCustomPalette(aPalette);
   340 	}
   341 
   342 
   343 /**
   344 This method has been deprecated.  Sprites are no longer supported in BitGDI.
   345 Calling this method has no effect.
   346 @deprecated
   347 */
   348 EXPORT_C void CFbsScreenDevice::CancelSprite() const
   349 	{
   350 	}
   351 
   352 
   353 /** Sets or unsets auto-update for the screen.
   354 
   355 @param aValue ETrue, if the screen is set to auto-update; EFalse, otherwise. */
   356 EXPORT_C void CFbsScreenDevice::SetAutoUpdate(TBool aValue)
   357 	{
   358 	iDrawDevice->SetAutoUpdate(aValue);
   359 	}
   360 
   361 
   362 /** Forces any out of date region of the screen to update. */
   363 EXPORT_C void CFbsScreenDevice::Update()
   364 	{
   365 	iDrawDevice->Update();
   366 	}
   367 
   368 
   369 /** Forces any out of date region of the screen to update, 
   370 and additionally forces the specified region to update.
   371 
   372 @param aRegion The region of the screen to update, in addition 
   373 to any out of date region. */
   374 EXPORT_C void CFbsScreenDevice::Update(const TRegion& aRegion)
   375 	{
   376 	iDrawDevice->Update(aRegion);
   377 	}
   378 
   379 
   380 /** Gets the size of the device area, in twips.
   381 
   382 This implements the pure virtual function CGraphicsDevice::SizeInTwips().
   383 
   384 @see CGraphicsDevice::SizeInTwips() */
   385 EXPORT_C TSize CFbsScreenDevice::SizeInTwips() const
   386 	{
   387 	TSize twipssize;
   388 	twipssize.iWidth = HorizontalPixelsToTwips(iDrawDevice->SizeInPixels().iWidth);
   389 	twipssize.iHeight = VerticalPixelsToTwips(iDrawDevice->SizeInPixels().iHeight);
   390 	return twipssize;
   391 	}
   392 
   393 
   394 /** Converts a horizontal dimension from twips to pixels.
   395 
   396 This implements the pure virtual function
   397 MGraphicsDeviceMap::HorizontalTwipsToPixels(). */
   398 EXPORT_C TInt CFbsScreenDevice::HorizontalTwipsToPixels(TInt aTwips) const
   399     {
   400 	const TInt htptp = iDrawDevice->HorzTwipsPerThousandPixels();
   401 	TInt64 twips = aTwips;
   402 	twips = (1000 * twips + (htptp >> 1)) / htptp;
   403 	return I64INT(twips);
   404 	}
   405 
   406 
   407 /** Converts a vertical dimension from twips to pixels.
   408 
   409 This implements the pure virtual function
   410 MGraphicsDeviceMap::VerticalTwipsToPixels(). */	
   411 EXPORT_C TInt CFbsScreenDevice::VerticalTwipsToPixels(TInt aTwips) const
   412     {
   413 	const TInt vtptp = iDrawDevice->VertTwipsPerThousandPixels();
   414 	TInt64 twips = aTwips;
   415 	twips = (1000 * twips + (vtptp >> 1)) / vtptp;
   416 	return I64INT(twips);
   417 	}
   418 
   419 
   420 /** Creates and returns a hardware bitmap (a bitmap which can be drawn to by a 
   421 graphics accelerator whose operations may be implemented in hardware or software), 
   422 whose handle is to the screen.
   423 
   424 This allows the caller to draw to the screen like any other hardware bitmap.
   425 
   426 This function may not be supported on all hardware. If unsupported, it returns 
   427 an RHardwareBitmap with a handle of zero.
   428 
   429 The hardware bitmap can be used to draw directly to the screen. Use it to 
   430 create a TAcceleratedBitmapSpec object, which can either be used to get a 
   431 TAcceleratedBitmapInfo, or can be passed to a graphics operation (an instance 
   432 of a class derived from class TGraphicsOperation) e.g. a bitblt to copy one 
   433 part of the screen to another.
   434 
   435 Direct screen access must only be carried out in combination with the Window 
   436 Server's direct screen access classes; i.e. only use the hardware bitmap on 
   437 the CFbsScreenDevice which you get from CDirectScreenAccess, and not from 
   438 your own CFbsScreenDevice.
   439 
   440 @return A hardware bitmap whose handle is to the screen.
   441 @see TAcceleratedBitmapSpec
   442 @see TGraphicsOperation
   443 @see CGraphicsAccelerator::Operation()
   444 @see CDirectScreenAccess */
   445 EXPORT_C RHardwareBitmap CFbsScreenDevice::HardwareBitmap()
   446 	{
   447 	RHardwareBitmap hwb;
   448     //Some explanations about "-1 - iScreenNo" expression.
   449     //SetAsScreenReference() is a public, exported method with a default argument'value -1.
   450     //In SetAsScreenReference()'s implementation before "Multiple screens" source code update,
   451     //"-1" value meant - this is a screen hardware bitmap. Positive value meant - 
   452     //in-memory hardware bitmap.
   453     //After "Multiple screens" update, the meaning of SetAsScreenReference()'s argument is:
   454     // - Positive value - in-memory hardware bitmap;
   455     // - Negative value - screen number: "-1" - screen 0, "-2" - screen 1, "-3" - screen 2, ...;
   456 	hwb.SetAsScreenReference(-1 - iScreenNo);
   457 	return hwb;
   458 	}
   459 
   460 /** Returns pointer to the location of first pixel in frame buffer. Not necessarily the same as pointer
   461 to frame buffer.
   462 
   463 @return Pointer to the location of first pixel or NULL if it is not accessible.
   464 @internalComponent
   465 */
   466 EXPORT_C const TUint32* CFbsScreenDevice::Bits() const
   467 	{
   468 	TAny* interface = NULL;
   469 	TInt ret = iDrawDevice->GetInterface(KFastBlit2InterfaceID, interface);
   470 	if (ret != KErrNone)
   471 		return NULL;
   472 	
   473 	return reinterpret_cast<MFastBlit2*>(interface)->Bits();	
   474 	}
   475 
   476 /** Returns frame buffer line pitch or stride.
   477 
   478 @return Frame buffer stride.
   479 @internalComponent
   480 */
   481 EXPORT_C TInt CFbsScreenDevice::Stride() const
   482 	{
   483 	return iDrawDevice->ScanLineBytes();	
   484 	}
   485 
   486 /** Query the screen number to which the object refers.
   487 
   488 @return Screen number as passed in aScreenNo to NewL.
   489 @publishedAll
   490 @released
   491 */
   492 EXPORT_C TInt CFbsScreenDevice::ScreenNo() const
   493 	{
   494 	return iScreenNo;	
   495 	}
   496 
   497 /** Get the surface identifier for the current device orientation of the screen.
   498 If screen device doesn't support providing a surface, the caller is panicked.
   499 
   500 @param aSurface	Set to the surface identifier for the screen buffer.
   501 @internalTechnology
   502 @prototype
   503 */
   504 EXPORT_C void CFbsScreenDevice::GetSurface(TSurfaceId& aSurface) const
   505 	{
   506 #if defined(SYMBIAN_GRAPHICS_GCE)
   507 	TAny* interface = NULL;
   508 	TInt ret = iDrawDevice->GetInterface(KSurfaceInterfaceID, interface);
   509 	if (ret == KErrNone)
   510 	    {
   511 	    reinterpret_cast<MSurfaceId*>(interface)->GetSurface(aSurface);
   512 	    return;
   513 	    }
   514 #endif
   515 	(void)aSurface;		// Satisfies the compiler, if its a Non-GCE build.
   516 	Panic(EBitgdiPanicInvalidScreenDeviceLibrary);
   517 	}
   518 
   519 /** This function is used to request the device orientations supported by the
   520 screen device.
   521 
   522 @return A bitwise combination of one or more TDeviceOrientation enumerated
   523 values indicating the device orientations that are supported by this device.
   524 @internalTechnology
   525 @prototype
   526 */
   527 EXPORT_C TUint CFbsScreenDevice::DeviceOrientationsAvailable() const
   528 	{
   529 #if defined(SYMBIAN_GRAPHICS_GCE)
   530 	TAny* interface = NULL;
   531 	TInt ret = iDrawDevice->GetInterface(KSurfaceInterfaceID, interface);
   532 	if (ret == KErrNone)
   533 	    return reinterpret_cast<MSurfaceId*>(interface)->DeviceOrientationsAvailable();
   534 #endif
   535 	Panic(EBitgdiPanicInvalidScreenDeviceLibrary);
   536 	return 0; // Make the compiler happy.
   537 	}
   538 
   539 /** This function selects the surface and device buffer to use in the screen
   540 driver for this screen. Normal and 180° rotations will generally use the same
   541 surface, while 90° and 270° will use another. The surfaces may have different
   542 width, height, stride and surface, so functions that make use of any of these
   543 may be affected after a change in surface orientation, and the return value
   544 should be checked for this reason.
   545 
   546 This call does not change the way rendering is performed, but may operate on
   547 the underlying memory using a new shape. The call does not change the display
   548 controller’s settings, as this is handled via the GCE. All this changes are the
   549 internal attributes of the screen device and driver objects. A CFbsBitGc object
   550 activated on the device should be reactivated, to update its own attributes, or
   551 drawing may be corrupted.
   552 
   553 Note: while TDeviceOrientation values do not directly correspond to
   554 CFbsBitGc::TGraphicsOrientation values, and cannot be used interchangeably, it
   555 is simple to generate the former from the latter using the left-shift operator
   556 (i.e. device == (1 << graphics)). In particular a device orientation of 90
   557 degrees clockwise is equivalent to a content orientation of 90 degrees anti-
   558 clockwise, which is what TGraphicsOrientation refers to for the equivalent
   559 setting. The letters "CW" in the TDeviceOrientation enumeration refer to a
   560 clockwise device rotation, so EDeviceOrientation90CW is a 90 degree clockwise
   561 rotation of the device.
   562 
   563 @param aOrientation	The new device orientation, relative to the normal physical
   564 screen orientation.
   565 @return ETrue is returned if any of the surface, width, height or stride
   566 attributes of the screen device have changed as a result of the call or EFalse
   567 if none of the attributes have changed.
   568 @internalTechnology
   569 @prototype
   570 */
   571 EXPORT_C TBool CFbsScreenDevice::SetDeviceOrientation(TDeviceOrientation aOrientation) const
   572 	{
   573 #if defined(SYMBIAN_GRAPHICS_GCE)
   574 	TAny* interface = NULL;
   575 	TInt ret = iDrawDevice->GetInterface(KSurfaceInterfaceID, interface);
   576 	if (ret == KErrNone)
   577 	    return reinterpret_cast<MSurfaceId*>(interface)->SetDeviceOrientation(aOrientation);
   578 #endif
   579 	(void)aOrientation; // Satisfies the compiler, if its a Non-GCE build.
   580 	Panic(EBitgdiPanicInvalidScreenDeviceLibrary);
   581 	return EFalse; // Make the compiler happy.
   582 	}
   583 
   584 /** This function is used to request the current device orientation.
   585 
   586 @return One of the TDeviceOrientation enumerated values.
   587 @internalTechnology
   588 @prototype
   589 */
   590 EXPORT_C TDeviceOrientation CFbsScreenDevice::DeviceOrientation() const
   591 	{
   592 #if defined(SYMBIAN_GRAPHICS_GCE)
   593 	TAny* interface = NULL;
   594 	TInt ret = iDrawDevice->GetInterface(KSurfaceInterfaceID, interface);
   595 	if (ret == KErrNone)
   596 	    return reinterpret_cast<MSurfaceId*>(interface)->DeviceOrientation();
   597 #endif
   598 	Panic(EBitgdiPanicInvalidScreenDeviceLibrary);
   599 	return EDeviceOrientationNormal; // Make the compiler happy.
   600 	}
   601