uigraphics/AknIcon/SvgtFbsRasterizer/inc/SvgtFbsRasterizer.h
changeset 0 05e9090e2422
child 1 ba33815114d6
equal deleted inserted replaced
-1:000000000000 0:05e9090e2422
       
     1 /*
       
     2 * Copyright (c) 2002 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:   CSvgtFbsRasterizer class.
       
    15 *
       
    16 */			
       
    17 
       
    18 #ifndef SVGTFBSRASTERIZER_H
       
    19 #define SVGTFBSRASTERIZER_H
       
    20 
       
    21 #include "SvgtRegisteredBitmap.h"
       
    22 #include "svgtgraphicsinterface.h"
       
    23 #include <fbsrasterizer.h>
       
    24 #include <e32base.h>
       
    25 #include <VG/openvg.h>
       
    26 
       
    27 const TUid KUidNvgProprietaryFormat = { 968435518 };
       
    28 const TInt KMaxRecentBmpCacheSize = 0x40000;
       
    29 
       
    30 class CRasterizerCacheItem;
       
    31 class CRasterizedBitmapCache;
       
    32 class MVGImageBinder;
       
    33 class CSvgtRegisteredBitmap;
       
    34 class CNvgEngine;
       
    35 class TAknIconHeader;
       
    36 
       
    37 TBool operator==(const CFbsRasterizer::TBitmapDesc& aBitmapDesc1, const CFbsRasterizer::TBitmapDesc& aBitmapDesc2);
       
    38 
       
    39 
       
    40 /** Example implementation of a rasterizer that is used to generate pixel
       
    41 data for extended bitmaps of example type KUidExtendedBitmapExample. 
       
    42  */
       
    43 NONSHARABLE_CLASS (CSvgtFbsRasterizer) : public CFbsRasterizer
       
    44     {
       
    45 public:
       
    46     IMPORT_C static CFbsRasterizer* New();
       
    47     ~CSvgtFbsRasterizer();
       
    48     
       
    49     // From CFbsRasterizer
       
    50     void BeginBitmap(TInt64 aBitmapId, const TBitmapDesc& aBitmapDesc, const TRegion* aRegionOfInterest);
       
    51     void EndBitmap(TInt64 aBitmapId);
       
    52     const TUint32* ScanLine(TInt64 aBitmapId, const TPoint& aPixel, TInt aLength);
       
    53     TInt GetInterface(TUid aInterfaceId, TAny*& aInterface);
       
    54 
       
    55 private:
       
    56     CSvgtFbsRasterizer();
       
    57     CSvgtRegisteredBitmap* RegisteredBitmap(TInt64 aBitmapId);
       
    58     CSvgtRegisteredBitmap* RecentBitmap(TInt64 aBitmapId);
       
    59     static TInt IdleFunction(TAny* aPtr);
       
    60     
       
    61     void DoBeginBitmapL(TInt64 aBitmapId, const TBitmapDesc& aBitmapDesc,
       
    62                         const TRegion* aRegionOfInterest);
       
    63     CSvgtRegisteredBitmap* DoCreateAndRegisterBitmapL(TInt64 aBitmapId, const TBitmapDesc& aBitmapDesc, CFbsBitmap * aPixmap);    
       
    64     void InitializeRasterizer();
       
    65     CRasterizerCacheItem* FetchFromCache( TInt64 aBitmapId );
       
    66     
       
    67     /*
       
    68      * RenderL retrieves data from the Extended Bitmap and passes the data to nvgdecoder  
       
    69      */
       
    70     void RenderL( const TBitmapDesc& aBitmapDesc, CSvgtRegisteredBitmap& aBitmap  );
       
    71     /*
       
    72      * Rendering of Bitmap
       
    73      */
       
    74     void RenderBitmapL(CSvgtRegisteredBitmap& aPixMap, CFbsBitmap * aMask, const TBitmapDesc& aBitmapDesc, TPtr8& aDataPtr8, TAknIconHeader& aIconHeader);
       
    75     /* 
       
    76      * Rendering of mask
       
    77      */
       
    78     void RenderMaskL(CSvgtRegisteredBitmap& aPixMap, CFbsBitmap * aMask, const TBitmapDesc& aBitmapDesc, TPtr8& aDataPtr8, TAknIconHeader& aIconHeader);
       
    79 
       
    80     /**
       
    81      * UpdateMatrices() 
       
    82      * locally stores the current environment parameters like paint,path handles,position matrices etc., 
       
    83      * so as to revert back (after operations done by nvgdecoder) so that the original position of the icons are intact
       
    84      */
       
    85     void UpdateMatrices();
       
    86    
       
    87     /**RestoreMatrices() reverts back the position matrices,path and paint handles which are locally stored using UpdateCurrentMatrices 
       
    88     so that the original positions of the icons are intact
       
    89     */            
       
    90     void RestoreMatrices();
       
    91     /**
       
    92      * ApplyMarginL applies MarginCorrection to icons which donot comply to the S60 width-height/aspect ratio restrictions
       
    93     */   
       
    94     TSize ApplyMarginL(VGImage aVgImage, TSize aSize);
       
    95         
       
    96     /**
       
    97      * Map OpenVg Error codes to symbian error codes
       
    98      */
       
    99     TInt MapOpenVgErrorCodeToSymbian(TInt aErrorCode);
       
   100 private: //Data members
       
   101     /** List of currently registered extended bitmaps, the key is the bitmap id.
       
   102      */
       
   103     TDblQue<CSvgtRegisteredBitmap> iRegisteredBmps;
       
   104     /** List of recently used extended bitmaps, the key is the bitmap id.
       
   105      */
       
   106     TDblQue<CSvgtRegisteredBitmap> iRecentBmps;
       
   107     /** Total size in bytes of the pre-rendered buffers for all the recently used extended bitmaps.
       
   108      */
       
   109     TInt iTotalRecentBmpSize;
       
   110     /** An idle-time active object to clean up the recently used extended bitmaps.
       
   111      */
       
   112     CIdle* iIdle;
       
   113 
       
   114     CSvgtGraphicsInterface * iGraphicsInterface;
       
   115          
       
   116     TBool iIsRasterizerValidState;
       
   117     TBool iMatricesUpdated;
       
   118     CNvgEngine* iNvgEngine;
       
   119     
       
   120     VGPaint iUserStrokePaint;
       
   121     VGPaint iUserFillPaint;
       
   122     VGint iMatrixMode;
       
   123     TReal32 iImageMatrix[9];
       
   124     TReal32 iPathMatrix[9];
       
   125     TReal32 iFillPaintMatrix[9];
       
   126     TReal32 iStrokePaintMatrix[9];
       
   127     TInt   iCacheLimit;
       
   128     TBool   iSpecialProcess;
       
   129     };
       
   130 
       
   131 #endif // SVGTFBSRASTERIZER_H