webengine/pagescaler/inc/minimapgenerator.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 the License "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 
       
    19 
       
    20 #ifndef CMINIMAPGENERATOR_H
       
    21 #define CMINIMAPGENERATOR_H
       
    22 
       
    23 //  INCLUDES
       
    24 
       
    25 #include <e32base.h>
       
    26 
       
    27 #include "minimapscaler.h"
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // DATA TYPES
       
    34 
       
    35 // FUNCTION PROTOTYPES
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 
       
    39 class CMinimap;
       
    40 class CFbsBitGc;
       
    41 class CFbsBitmap;
       
    42 class CFbsBitmapDevice;
       
    43 class CWindowGc;
       
    44 class CMinimapGenerator;
       
    45 class CMinimapOOMCollector;
       
    46 
       
    47 // CLASS DECLARATION
       
    48 
       
    49 
       
    50 /**
       
    51 *
       
    52 *
       
    53 *  @lib webkit.dll
       
    54 *  @since 3.1
       
    55 */
       
    56 class CMinimapGenerator : public CBase, MMinimapScalerCallback
       
    57     {
       
    58     public:  // Constructors and destructor
       
    59 
       
    60         /**
       
    61         * Two-phased constructor.
       
    62         */
       
    63         static CMinimapGenerator* NewL(CMinimap& aMinimap);
       
    64 
       
    65         /**
       
    66         * Destructor.
       
    67         */
       
    68         virtual ~CMinimapGenerator();
       
    69 
       
    70     public: // New functions
       
    71 
       
    72 
       
    73         /**
       
    74         *
       
    75         * @since 3.1
       
    76         * @param
       
    77         * @return
       
    78         */
       
    79         void SetKeepBitmap(TBool aKeepBitmaps);
       
    80 
       
    81 
       
    82         /**
       
    83         *
       
    84         * @since 3.1
       
    85         * @param
       
    86         * @return
       
    87         */
       
    88         void Invalidate();
       
    89 
       
    90         /**
       
    91         *
       
    92         * @since 3.1
       
    93         * @param
       
    94         * @return
       
    95         */
       
    96         void UpdateL(TBool aScrolling=EFalse);
       
    97 
       
    98         /**
       
    99         *
       
   100         * @since 3.1
       
   101         * @param
       
   102         * @return
       
   103         */
       
   104         void ScrollL();
       
   105 
       
   106         /**
       
   107         *
       
   108         * @since 3.1
       
   109         * @param
       
   110         * @return
       
   111         */
       
   112         void Clear();
       
   113 
       
   114 
       
   115         /**
       
   116         * @since 3.1
       
   117         * @param
       
   118         * @return
       
   119         */
       
   120         void Draw(CFbsBitGc& aGc, const TRect& aTo) const;
       
   121         void Draw(CWindowGc& aGc, const TRect& aTo) const;
       
   122 
       
   123         /**
       
   124         *
       
   125         * @since 3.1
       
   126         * @param
       
   127         * @return
       
   128         */
       
   129         void SetKeepsBitmaps(TBool aKeepBitmaps);
       
   130 
       
   131         /**
       
   132         *
       
   133         * @since 3.1
       
   134         * @param
       
   135         * @return
       
   136         */
       
   137         TBool KeepsBitmaps() const;
       
   138 
       
   139         /**
       
   140         *
       
   141         * @since now
       
   142         * @param
       
   143         * @return
       
   144         */
       
   145         void DrawColoringMask(CFbsBitGc& aGc, const TRect& aMinimapViewportOnDoc) const;
       
   146         void DrawColoringMask(CWindowGc& aGc, const TRect& aMinimapViewportOnDoc) const;
       
   147 
       
   148          /**
       
   149         *
       
   150         * @since now
       
   151         * @param
       
   152         * @return
       
   153         */
       
   154         void VisitArea(const TRect &aArea);
       
   155 
       
   156         /**
       
   157         * @since 3.1
       
   158         * @param
       
   159         * @return the scaled copy of the page
       
   160         */
       
   161         CFbsBitmap* ScaledPage() const;
       
   162 
       
   163 
       
   164         /**
       
   165         * @since 3.1
       
   166         * @param
       
   167         * @return size of the document being scaled
       
   168         */
       
   169         TSize DocSize() const { return iDocSize; }
       
   170 
       
   171     private: // Functions from MMinimapScalerCallback
       
   172 
       
   173         void ScalingCompletedL(CFbsBitmap& aResult, const TRect& aTargetRect);
       
   174 
       
   175     public:
       
   176 
       
   177         TBool StartAsyncBufferUpdateL();
       
   178 
       
   179     private:
       
   180 
       
   181         TBool FastBufferUpdateL();
       
   182         TBool CheckAndCreateBitmapsL();
       
   183     public:
       
   184         void DeleteUnscaledBitmap();
       
   185         void DeleteBufferBitmap();
       
   186 
       
   187 #ifdef __OOM__
       
   188         TBool IsCollectingMemory();
       
   189         void CollectMemory();
       
   190 #endif
       
   191 
       
   192     private:        
       
   193         void InvalidateBuffers();
       
   194         void CalcBufferPosition();
       
   195         TRect BufferRect() const;
       
   196         template<class GC> void DrawT(GC& aGc, const TRect& aTo) const;
       
   197         template<class GC> void DrawColoringMaskT(GC& aGc, const TRect& aMinimapViewportOnDoc) const;
       
   198 
       
   199     private:
       
   200 
       
   201         /**
       
   202         * C++ constructor.
       
   203         */
       
   204         CMinimapGenerator(CMinimap& aMinimap);
       
   205 
       
   206         /**
       
   207         * By default Symbian 2nd phase constructor is private.
       
   208         */
       
   209         void ConstructL();
       
   210 
       
   211 
       
   212     private:    // Data
       
   213 
       
   214         CMinimap* iMinimap; // not owned
       
   215         CMinimapScaler* iScaler; // owned
       
   216 
       
   217         CFbsBitmap* iUnscaledBitmap; //owned
       
   218         CFbsBitmapDevice* iUnscaledBitmapDevice; //owned
       
   219         CFbsBitGc* iUnscaledBitmapGc; //owned
       
   220         CFbsBitmap* iBufferBitmap; //owned
       
   221         CFbsBitmapDevice* iBufferBitmapDevice; //owned
       
   222         CFbsBitGc* iBufferBitmapGc; //owned
       
   223 
       
   224         CIdle* iAsyncUpdateStarted; // owned
       
   225 
       
   226         RRegion iValidLQRegion;
       
   227         RRegion iValidHQRegion;
       
   228 
       
   229         TPoint iBufferPos;
       
   230 
       
   231         TSize iDocSize;
       
   232 
       
   233         TBool iKeepsBitmaps;
       
   234 
       
   235         TInt iLastHQUpdatePos;
       
   236 
       
   237         /**
       
   238         * Maps the visited regions. Used to control mmap coloring.
       
   239         */
       
   240         RRegion iVisitedRegion;
       
   241         
       
   242         CMinimapOOMCollector* iOOMCollector;
       
   243     };
       
   244 
       
   245 #endif      // CMINIMAPGENERATOR_H
       
   246 
       
   247 // End of File