javauis/lcdui_akn/lcdgd/src/lcdgdrvi.cpp
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005 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 #include <graphicsaccelerator.h>
       
    19 #include <ecom/ecom.h>
       
    20 #include <ecom/implementationproxy.h>
       
    21 #include <lcdgdrv.h>
       
    22 #include "lcdgdrvif.h"
       
    23 #include "lcdtransform.h"
       
    24 #include "calctransform.h"
       
    25 #include "collision.h"
       
    26 #include "lcdgdev.h"
       
    27 
       
    28 #ifdef _DEBUG
       
    29 TBool DbgValidateImageType(const TImageType& aType);
       
    30 TBool DbgValidateRendererArray(const TImageRenderer aRendererArray[], TInt aCount);
       
    31 #endif
       
    32 
       
    33 /**
       
    34  * Used in blitter/renderer searches
       
    35  */
       
    36 inline TBool operator == (const TImageType& aLhs, const TImageType& aRhs)
       
    37 {
       
    38     return (aLhs.iTransparency == aRhs.iTransparency) &&
       
    39            (aLhs.iAlphaMode == aRhs.iAlphaMode) &&
       
    40            (aLhs.iColorMode == aRhs.iColorMode);
       
    41 }
       
    42 
       
    43 inline void Swap(TInt& aX, TInt& aY)
       
    44 {
       
    45     TInt tmp = aX;
       
    46     aX = aY;
       
    47     aY = tmp;
       
    48 }
       
    49 
       
    50 #define ASCIITEXT(x) (const TUint8*)x
       
    51 #define UCS16TEXT(x) (const TText*)L##x
       
    52 
       
    53 struct TLcdDriverType
       
    54 {
       
    55     TDisplayMode    iMode;
       
    56     const TUint8*   iDataType;      // ASCII/UTF8
       
    57     const TText*    iLibName;       // UNICODE
       
    58     TInt            iInterfaceUid;
       
    59 };
       
    60 const TLcdDriverType LcdDriverTypeTab[] =
       
    61 {
       
    62     { EColor64K,  ASCIITEXT(LCDGD_COLOR64K_DRIVER_ID_STR),  UCS16TEXT("LCDC64K"),  LCDGD_COLOR64K_IMPLEMENTATION_UID },
       
    63     { EColor4K,   ASCIITEXT(LCDGD_COLOR4K_DRIVER_ID_STR),   UCS16TEXT("LCDC4K"),   LCDGD_COLOR4K_IMPLEMENTATION_UID  },
       
    64     { EColor16MU, ASCIITEXT(LCDGD_COLOR16MU_DRIVER_ID_STR), UCS16TEXT("LCDC16MU"), LCDGD_COLOR16MU_IMPLEMENTATION_UID },
       
    65     { EColor16MA, ASCIITEXT(LCDGD_COLOR16MA_DRIVER_ID_STR), UCS16TEXT("LCDC16MA"), LCDGD_COLOR16MA_IMPLEMENTATION_UID }
       
    66 };
       
    67 const TInt KLcdDriverTypeTabSize = sizeof(LcdDriverTypeTab)/sizeof(LcdDriverTypeTab[0]);
       
    68 
       
    69 // *****************************************************************
       
    70 // Driver implementation ECOM interface.
       
    71 //
       
    72 // *****************************************************************
       
    73 EXPORT_C CLcdGraphicsDriverImpl* CLcdGraphicsDriverImpl::NewL(TDisplayMode aDisplayMode)
       
    74 {
       
    75     const TLcdDriverType* type = &LcdDriverTypeTab[0];
       
    76     const TLcdDriverType* end  = type + KLcdDriverTypeTabSize;
       
    77     while (type < end)
       
    78     {
       
    79         if (type->iMode == aDisplayMode)
       
    80         {
       
    81             break;
       
    82         }
       
    83         type++;
       
    84     }
       
    85 
       
    86     if (type == end)
       
    87     {
       
    88         User::Leave(KErrNotSupported);
       
    89     }
       
    90 
       
    91     TEComResolverParams resolverParams;
       
    92 
       
    93     TPtrC8 dataType(type->iDataType);
       
    94     resolverParams.SetDataType(dataType);
       
    95 
       
    96     TUid    interfaceUid  = KLcdDriverInterfaceUid;
       
    97     TUint32 dtorKeyOffset = _FOFF(CLcdGraphicsDriverImpl, iDtor_ID_Key);
       
    98 
       
    99     //
       
   100     // Try to load via ECOM
       
   101     //
       
   102     CLcdGraphicsDriverImpl* impl = NULL;
       
   103     impl = (CLcdGraphicsDriverImpl*)REComSession::CreateImplementationL(interfaceUid, dtorKeyOffset, resolverParams);
       
   104 
       
   105     return impl;
       
   106 }
       
   107 
       
   108 EXPORT_C CLcdGraphicsDriverImpl::CLcdGraphicsDriverImpl
       
   109 (
       
   110     const TDriverInfo& aDriverInfo,
       
   111     const TImageRenderer* aRendererArray,
       
   112     TInt aRendererCount,
       
   113     const TColorMap* aColorMapArray,
       
   114     TInt aColorMapCount,
       
   115     const TCollisionDetector* aCollisionDetectorArray,
       
   116     TInt aCollisionDetectorCount,
       
   117     const TDrawFunctions* aDrawFunctionsArray,
       
   118     TInt aDrawFunctionsCount
       
   119 )
       
   120         : iDriverInfo(aDriverInfo)
       
   121         , iRendererArray(aRendererArray)
       
   122         , iRendererCount(aRendererCount)
       
   123         , iColorMapArray(aColorMapArray)
       
   124         , iColorMapCount(aColorMapCount)
       
   125         , iCollisionDetectorArray(aCollisionDetectorArray)
       
   126         , iCollisionDetectorCount(aCollisionDetectorCount)
       
   127         , iDrawFunctionsArray(aDrawFunctionsArray)
       
   128         , iDrawFunctionsCount(aDrawFunctionsCount)
       
   129 {
       
   130 }
       
   131 
       
   132 EXPORT_C CLcdGraphicsDriverImpl::~CLcdGraphicsDriverImpl()
       
   133 {
       
   134     if (iDtor_ID_Key != KNullUid)
       
   135     {
       
   136         REComSession::DestroyedImplementation(iDtor_ID_Key);
       
   137     }
       
   138 }
       
   139 
       
   140 EXPORT_C void CLcdGraphicsDriverImpl::GetDriverInfo(CLcdGraphicsDriver::TDriverInfo& aDriverInfo) const
       
   141 {
       
   142     aDriverInfo=iDriverInfo;
       
   143 }
       
   144 
       
   145 EXPORT_C TInt CLcdGraphicsDriverImpl::DrawRegion
       
   146 (
       
   147     const TAcceleratedBitmapInfo* aDstColorBitmap,
       
   148     const TRect&                  aDstRect,
       
   149     const TAcceleratedBitmapInfo* aSrcColorBitmap,
       
   150     const TAcceleratedBitmapInfo* aSrcAlphaBitmap,
       
   151     TTransparency                 aSrcTransparency,
       
   152     const TRect&                  aSrcRect,
       
   153     TTransformType                aSrcTransform,
       
   154     const TRect&                  aClipRect
       
   155 )
       
   156 {
       
   157     ASSERT(aDstColorBitmap);
       
   158     ASSERT(aSrcColorBitmap);
       
   159 
       
   160     TInt err = KErrNotSupported;
       
   161 
       
   162     TImageType dstType;
       
   163     dstType.iColorMode = aDstColorBitmap->iDisplayMode;
       
   164     dstType.iAlphaMode = ENone;
       
   165     dstType.iTransparency = ETransparencyNone;
       
   166 
       
   167     TImageType srcType;
       
   168     srcType.iColorMode = aSrcColorBitmap->iDisplayMode;
       
   169     srcType.iAlphaMode = aSrcAlphaBitmap ? aSrcAlphaBitmap->iDisplayMode : ENone;
       
   170     srcType.iTransparency = aSrcTransparency;
       
   171 
       
   172     const TImageRenderer* renderer = GetRenderer(dstType, srcType, aSrcTransform, ECompositeSrcOver);
       
   173     if (renderer)
       
   174     {
       
   175         TImageRenderFunction drawRegion = renderer->iFunction;
       
   176 
       
   177         // calc source to target transform
       
   178         TLcdTransform transform = CalcTransform(aDstRect, aSrcRect, aSrcTransform);
       
   179 
       
   180         TRect dstRect(aDstRect);
       
   181         TRect srcRect(aSrcRect);
       
   182         TRect srcClipRect(aSrcColorBitmap->iSize);
       
   183         TRect dstClipRect(aDstColorBitmap->iSize);
       
   184 
       
   185         // clip cliprect to device rect
       
   186         dstClipRect.Intersection(aClipRect);
       
   187 
       
   188         // calculate source and target rects clipped to src and target bounds.
       
   189         ClipTransformRect(dstRect, srcRect, dstClipRect, srcClipRect, transform);
       
   190 
       
   191         // clip dst rect to cliprect shouldn't be necessary if
       
   192         // ClipTransformRect works
       
   193         dstRect.Intersection(dstClipRect);
       
   194 
       
   195         if (!dstRect.IsEmpty())
       
   196         {
       
   197             // calc target to source transform.
       
   198             transform = transform.Inverse();
       
   199 
       
   200             ASSERT(CheckBounds(aDstColorBitmap->iSize, aSrcColorBitmap->iSize, dstRect, transform));
       
   201 
       
   202             (*drawRegion)(aDstColorBitmap, NULL, dstRect, aSrcColorBitmap, aSrcAlphaBitmap, transform);
       
   203         }
       
   204 
       
   205         err = KErrNone;
       
   206     }
       
   207 
       
   208     return err;
       
   209 }
       
   210 
       
   211 EXPORT_C TInt CLcdGraphicsDriverImpl::CopyRegion
       
   212 (
       
   213     const TAcceleratedBitmapInfo*   aDstColorBitmap,
       
   214     const TAcceleratedBitmapInfo*   aDstAlphaBitmap,
       
   215     TTransparency                   aDstTransparency,
       
   216     const TRect&                    aDstRect,
       
   217     const TAcceleratedBitmapInfo*   aSrcColorBitmap,
       
   218     const TAcceleratedBitmapInfo*   aSrcAlphaBitmap,
       
   219     TTransparency                   aSrcTransparency,
       
   220     const TRect&                    aSrcRect,
       
   221     TTransformType                  aSrcTransform,
       
   222     const TRect&                    aClipRect
       
   223 )
       
   224 {
       
   225     ASSERT(aDstColorBitmap);
       
   226     ASSERT(aSrcColorBitmap);
       
   227 
       
   228     TInt err = KErrNotSupported;
       
   229     TImageType dstType;
       
   230     TImageType srcType;
       
   231 
       
   232     dstType.iColorMode = aDstColorBitmap->iDisplayMode;
       
   233     dstType.iAlphaMode = aDstAlphaBitmap ? aDstAlphaBitmap->iDisplayMode : ENone;
       
   234     dstType.iTransparency = aDstTransparency;
       
   235 
       
   236     srcType.iColorMode = aSrcColorBitmap->iDisplayMode;
       
   237     srcType.iAlphaMode = aSrcAlphaBitmap ? aSrcAlphaBitmap->iDisplayMode : ENone;
       
   238     srcType.iTransparency = aSrcTransparency;
       
   239 
       
   240     const TImageRenderer* renderer = GetRenderer(dstType, srcType, aSrcTransform, ECompositeSrcCopy);
       
   241     if (renderer)
       
   242     {
       
   243         TImageRenderFunction copyRegion = renderer->iFunction;
       
   244 
       
   245         // calc source to target transform
       
   246         TLcdTransform transform = CalcTransform(aDstRect, aSrcRect, aSrcTransform);
       
   247 
       
   248         TRect dstRect(aDstRect);
       
   249         TRect srcRect(aSrcRect);
       
   250         TRect srcClipRect(aSrcColorBitmap->iSize);
       
   251         TRect dstClipRect(aDstColorBitmap->iSize);
       
   252 
       
   253         // clip cliprect to device rect
       
   254         dstClipRect.Intersection(aClipRect);
       
   255 
       
   256         // clip source and target rects
       
   257         ClipTransformRect(dstRect, srcRect, dstClipRect, srcClipRect, transform);
       
   258 
       
   259         // check src and dst rects still correspond
       
   260         ASSERT(CheckTransform(dstRect, srcRect, transform));
       
   261 
       
   262         // clip dst rect to cliprect shouldn't be necessary if
       
   263         // ClipTransformRect works
       
   264         dstRect.Intersection(dstClipRect);
       
   265 
       
   266         if (!dstRect.IsEmpty())
       
   267         {
       
   268             // calc target to source transform.
       
   269             transform = transform.Inverse();
       
   270 
       
   271             // check source and dst rects lie within bounds
       
   272             ASSERT(CheckBounds(aDstColorBitmap->iSize, aSrcColorBitmap->iSize, dstRect, transform));
       
   273 
       
   274             (*copyRegion)(aDstColorBitmap, aDstAlphaBitmap, dstRect, aSrcColorBitmap, aSrcAlphaBitmap, transform);
       
   275         }
       
   276 
       
   277         err = KErrNone;
       
   278     }
       
   279 
       
   280     return err;
       
   281 }
       
   282 
       
   283 /**
       
   284 Detect collision between images. Returns ETrue if the overlapping
       
   285 region contains corresponding opaque pixels.
       
   286 */
       
   287 EXPORT_C TBool CLcdGraphicsDriverImpl::DetectCollision
       
   288 (
       
   289     const TAcceleratedBitmapInfo* aMask1,
       
   290     TTransparency       aTransparency1,
       
   291     const TSize&        aSize1,
       
   292     const TRect&        aRect1,
       
   293     TInt                aTransform1,
       
   294     const TPoint&       aPoint1,
       
   295 
       
   296     const TAcceleratedBitmapInfo* aMask2,
       
   297     TTransparency       aTransparency2,
       
   298     const TSize&        aSize2,
       
   299     const TRect&        aRect2,
       
   300     TInt                aTransform2,
       
   301     const TPoint&       aPoint2
       
   302 )
       
   303 {
       
   304     if ((aMask1 == NULL) && (aMask2 == NULL))
       
   305     {
       
   306         // if neither have mask all pixels opaque, so collide
       
   307         return ETrue;
       
   308     }
       
   309 
       
   310     ASSERT(aRect1.Intersects(TRect(aSize1)));
       
   311     ASSERT(aRect2.Intersects(TRect(aSize2)));
       
   312 
       
   313     TDisplayMode displayMode1 = aMask1 ? aMask1->iDisplayMode : ENone;
       
   314     TDisplayMode displayMode2 = aMask2 ? aMask2->iDisplayMode : ENone;
       
   315     const TCollisionDetector* detector = GetCollisionDetector(displayMode1,aTransparency1,displayMode2,aTransparency2);
       
   316     ASSERT(detector != NULL);
       
   317 
       
   318     TSize dstSize1=aRect1.Size();
       
   319     if (aTransform1 & EReflectDiag)
       
   320     {
       
   321         Swap(dstSize1.iWidth, dstSize1.iHeight);
       
   322     }
       
   323     TSize dstSize2=aRect2.Size();
       
   324     if (aTransform2 & EReflectDiag)
       
   325     {
       
   326         Swap(dstSize2.iWidth, dstSize2.iHeight);
       
   327     }
       
   328     TRect dstRect1(aPoint1, dstSize1);
       
   329     TRect dstRect2(aPoint2, dstSize2);
       
   330 
       
   331     TLcdTransform forward1 = CalcTransform(dstRect1, aRect1, (TTransformType)aTransform1);
       
   332     const TRect srcClipRect1(aSize1);
       
   333     TRect srcRect1 = aRect1;
       
   334     ClipTransformRect(dstRect1, srcRect1, dstRect2, srcClipRect1, forward1);
       
   335     TLcdTransform transform1 = forward1.Inverse();
       
   336 
       
   337     TLcdTransform forward2 = CalcTransform(dstRect2, aRect2, (TTransformType)aTransform2);
       
   338     const TRect srcClipRect2(aSize2);
       
   339     TRect srcRect2 = aRect2;
       
   340     ClipTransformRect(dstRect2, srcRect2, dstRect1, srcClipRect2, forward2);
       
   341     TLcdTransform transform2 = forward2.Inverse();
       
   342 
       
   343     return (*detector->iFunction)(aMask1, aMask2, srcRect1, srcRect2, transform1, transform2);
       
   344 }
       
   345 
       
   346 CLcdGraphicsDevice* CLcdGraphicsDriverImpl::CreateDeviceL(const TImageType& aType)
       
   347 {
       
   348     const TDrawFunctions* drawFunctions = GetDrawFunctions(aType.iColorMode);
       
   349     const TColorMap* colorMap = GetColorMap(aType.iColorMode);
       
   350 
       
   351     if (!drawFunctions || !colorMap)
       
   352     {
       
   353         User::Leave(KErrNotSupported);
       
   354     }
       
   355 
       
   356     CRenderFunctions* renderers = new(ELeave) CRenderFunctions;
       
   357     CleanupStack::PushL(renderers);
       
   358 
       
   359     const TImageRenderer* ptr = iRendererArray;
       
   360     const TImageRenderer* end = iRendererArray + iRendererCount;
       
   361     while (ptr < end)
       
   362     {
       
   363         //
       
   364         // extract only the drawRegion renderers
       
   365         //
       
   366         if ((ptr->iTargetType == aType) && (ptr->iCompositeRule == ECompositeSrcOver))
       
   367         {
       
   368             renderers->AppendL(*ptr);
       
   369         }
       
   370         ++ptr;
       
   371     }
       
   372 
       
   373     //
       
   374     // We need to find all renderers targeting aType
       
   375     //
       
   376     CLcdGraphicsDeviceImpl* impl = new(ELeave) CLcdGraphicsDeviceImpl
       
   377     (
       
   378         *this,
       
   379         aType,
       
   380         renderers,
       
   381         *colorMap,
       
   382         *drawFunctions
       
   383     );
       
   384     CleanupStack::Pop(renderers);
       
   385     return impl;
       
   386 }
       
   387 
       
   388 const TImageRenderer* CLcdGraphicsDriverImpl::GetRenderer
       
   389 (
       
   390     const TImageType& aTargetType,
       
   391     const TImageType& aSourceType,
       
   392     TTransformType aTransform,
       
   393     TCompositRule aCompositeRule
       
   394 )
       
   395 const
       
   396 {
       
   397     const TInt transformBit = 1<<aTransform;
       
   398 
       
   399     const TInt            count = iRendererCount;
       
   400     const TImageRenderer* array = iRendererArray;
       
   401 
       
   402     const TImageRenderer* ptr = array;
       
   403     const TImageRenderer* end = array + count;
       
   404 
       
   405     while (ptr < end)
       
   406     {
       
   407         if ((ptr->iCompositeRule == aCompositeRule) &&
       
   408                 (ptr->iTransformMask & transformBit)  &&
       
   409                 (ptr->iSourceType == aSourceType)     &&
       
   410                 (ptr->iTargetType == aTargetType))
       
   411         {
       
   412             return ptr;
       
   413         }
       
   414         ++ptr;
       
   415     }
       
   416 
       
   417     return NULL;
       
   418 }
       
   419 
       
   420 /**
       
   421  *
       
   422  */
       
   423 const TColorMap* CLcdGraphicsDriverImpl::GetColorMap(TDisplayMode aMode)
       
   424 {
       
   425     const TColorMap* ptr = iColorMapArray;
       
   426     const TColorMap* end = iColorMapArray + iColorMapCount;
       
   427 
       
   428     while (ptr < end)
       
   429     {
       
   430         if (ptr->iTargetMode == aMode)
       
   431         {
       
   432             return ptr;
       
   433         }
       
   434         ++ptr;
       
   435     }
       
   436 
       
   437     return NULL;
       
   438 }
       
   439 
       
   440 
       
   441 const TCollisionDetector* CLcdGraphicsDriverImpl::GetCollisionDetector
       
   442 (
       
   443     TDisplayMode    aDisplayMode1,
       
   444     TTransparency   aTransparency1,
       
   445     TDisplayMode    aDisplayMode2,
       
   446     TTransparency   aTransparency2
       
   447 )
       
   448 const
       
   449 {
       
   450     const TCollisionDetector* ptr = iCollisionDetectorArray;
       
   451     const TCollisionDetector* end = iCollisionDetectorArray + iCollisionDetectorCount;
       
   452 
       
   453     TUint displayMode1Bit   = 1<<aDisplayMode1;
       
   454     TUint transparency1Bit  = 1<<aTransparency1;
       
   455     TUint displayMode2Bit   = 1<<aDisplayMode2;
       
   456     TUint transparency2Bit  = 1<<aTransparency2;
       
   457 
       
   458     while (ptr < end)
       
   459     {
       
   460         if ((ptr->iDisplayMode1 & displayMode1Bit) &&
       
   461                 (ptr->iTransparency1 & transparency1Bit) &&
       
   462                 (ptr->iDisplayMode2 & displayMode2Bit) &&
       
   463                 (ptr->iTransparency2 & transparency2Bit))
       
   464         {
       
   465             return ptr;
       
   466         }
       
   467         ++ptr;
       
   468     }
       
   469 
       
   470     return NULL;
       
   471 }
       
   472 
       
   473 
       
   474 EXPORT_C const TDrawFunctions* CLcdGraphicsDriverImpl::GetDrawFunctions(TDisplayMode aMode) const
       
   475 {
       
   476     const TDrawFunctions* ptr = iDrawFunctionsArray;
       
   477     const TDrawFunctions* end = iDrawFunctionsArray + iDrawFunctionsCount;
       
   478     while (ptr < end)
       
   479     {
       
   480         if (ptr->iDisplayMode == aMode)
       
   481         {
       
   482             return ptr;
       
   483         }
       
   484         ++ptr;
       
   485     }
       
   486     return NULL;
       
   487 }
       
   488 
       
   489 #ifdef _DEBUG
       
   490 TBool DbgValidateRendererArray(const TImageRenderer aRendererArray[], TInt aCount)
       
   491 {
       
   492     for (TInt i=0; i<aCount; i++)
       
   493     {
       
   494         const TImageRenderer& renderer = aRendererArray[i];
       
   495 
       
   496         if (!DbgValidateImageType(renderer.iTargetType))
       
   497         {
       
   498             return EFalse;
       
   499         }
       
   500 
       
   501         if (!DbgValidateImageType(renderer.iSourceType))
       
   502         {
       
   503             return EFalse;
       
   504         }
       
   505 
       
   506         if (NULL == renderer.iFunction)
       
   507         {
       
   508             return EFalse;
       
   509         }
       
   510     }
       
   511     return ETrue;
       
   512 }
       
   513 
       
   514 TBool DbgValidateImageType(const TImageType& aType)
       
   515 {
       
   516     //
       
   517     // Validate displaymodes against transparency type.
       
   518     //
       
   519     switch (aType.iTransparency)
       
   520     {
       
   521     case ETransparencyNone:
       
   522         //
       
   523         // Must be none.
       
   524         //
       
   525         if (aType.iAlphaMode != ENone)
       
   526         {
       
   527             return EFalse;
       
   528         }
       
   529         break;
       
   530 
       
   531     case ETransparencyMaskBitmap:
       
   532         //
       
   533         // Must be one of EGray2 or matching display mode
       
   534         //
       
   535         if ((aType.iAlphaMode != EGray2) && (aType.iAlphaMode != aType.iColorMode))
       
   536         {
       
   537             return EFalse;
       
   538         }
       
   539         break;
       
   540 
       
   541     case ETransparencyAlphaBitmap:
       
   542         //
       
   543         // Must be EGray256 - the only supported alpha bitmap type.
       
   544         //
       
   545         if (aType.iAlphaMode != EGray256)
       
   546         {
       
   547             return EFalse;
       
   548         }
       
   549         break;
       
   550 
       
   551     case ETransparencyAlphaChannel:
       
   552         //
       
   553         // Alpha mode must be none
       
   554         // Color mode must be the Java ARGB8888 mode (build dependent)
       
   555         //
       
   556         if ((aType.iAlphaMode != ENone) || (aType.iColorMode != EColorARGB8888))
       
   557         {
       
   558             return EFalse;
       
   559         }
       
   560         break;
       
   561 
       
   562     case ETransparencyMaskChannel:
       
   563         if ((aType.iAlphaMode != ENone) || (aType.iColorMode != EColorARGB8888))
       
   564         {
       
   565             return EFalse;
       
   566         }
       
   567         break;
       
   568 
       
   569 #ifdef RD_JAVA_NGA_ENABLED
       
   570     case ETransparencyAlphaChannelPre:
       
   571     case ETransparencyMaskChannelPre:
       
   572         if ((aType.iAlphaMode != ENone) || (aType.iColorMode != EColorARGB8888))
       
   573         {
       
   574             return EFalse;
       
   575         }
       
   576         break;
       
   577 #endif // RD_JAVA_NGA_ENABLED
       
   578 
       
   579     case ETransparencyIgnoreChannel:
       
   580         if ((aType.iAlphaMode != ENone) || (aType.iColorMode != EColorARGB8888))
       
   581         {
       
   582             return EFalse;
       
   583         }
       
   584         break;
       
   585     }
       
   586 
       
   587     return ETrue;
       
   588 }
       
   589 #endif
       
   590