uiacceltk/hitchcock/coretoolkit/inc/HuiCmdBufferBrush.h
changeset 0 15bf7259bb7c
child 17 c9d868f1e20c
equal deleted inserted replaced
-1:000000000000 0:15bf7259bb7c
       
     1 /*
       
     2 * Copyright (c) 2008 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 #ifndef HUICMDBUFFERBRUSH_H_
       
    19 #define HUICMDBUFFERBRUSH_H_
       
    20 
       
    21 #include <uiacceltk/HuiBrush.h>
       
    22 #include "huicanvaspainter.h"
       
    23 #include "huieffectable.h"
       
    24 
       
    25 // TASK: 1) Avkon provides markers in buffers to mark highlight
       
    26 // TASK: 2) fxml provides names for visual buffers -- snapshot of buffers in different times
       
    27 // TASK: 3) 
       
    28 
       
    29 // TODO: Support for effects in the brush
       
    30 // TODO: Support for parsing buffers in visual and passing it to cmdbufferbrushes
       
    31 // TODO: Support for drawing CmdBufferBrush
       
    32 // TODO: HuiCanvasPainter stores commandbuffers -- create links to those buffers.
       
    33 // 
       
    34 class CHuiFxEffect;
       
    35 class CHuiBrushArray;
       
    36 class CHuiCanvasGc;
       
    37 class CHuiCanvasWsGc;
       
    38 class CHuiCanvasVisual;
       
    39 class CHuiCanvasPainter;
       
    40 class CHuiGc;
       
    41 
       
    42 
       
    43 class CHuiCmdBufferBrush : public CHuiBrush, public MHuiEffectable, public MHuiCmdBufDestroyObserver
       
    44 {
       
    45 public:
       
    46    struct TLayeredBuffer
       
    47        {
       
    48        //TInt iBufferId; // which visual's buffer this is.
       
    49        TRect iBoundingRectangle;
       
    50        //TRegion iUpdateRegion;
       
    51        TPtrC8 iBufferPart; // range from huicanvaspainter's buffer
       
    52        CHuiCanvasCommandBuffer *iCommandBuffer; // reference to painter's command buffer
       
    53        TLayeredBuffer &operator=(const TLayeredBuffer &aVal)
       
    54            {
       
    55            //iBufferId = aVal.iBufferId;
       
    56            iBoundingRectangle = aVal.iBoundingRectangle;
       
    57            // iUpdateRegion = aVal.iUpdateRegion;
       
    58            iBufferPart.Set(aVal.iBufferPart);
       
    59            iCommandBuffer = aVal.iCommandBuffer;
       
    60            return *this;
       
    61            }
       
    62        };
       
    63 
       
    64 public: // construction
       
    65     static CHuiCmdBufferBrush *NewL(TInt aLayerId, CHuiCanvasGc &aGc, CHuiCanvasWsGc &aWsGc, CHuiCanvasVisual &aVisual, CHuiCanvasPainter &aPainter);
       
    66     ~CHuiCmdBufferBrush();
       
    67 public: // modifying buffers
       
    68    void AddBufferL(TLayeredBuffer aBuffer);
       
    69 
       
    70 public: // Accessors
       
    71     TInt LayerId() const { return iLayerId; }
       
    72 
       
    73 public: // from CHuiBrush
       
    74     virtual void Draw(CHuiGc& aGc, const MHuiBrushGuide& aGuide) const;
       
    75     void DrawSelf(CHuiGc &aGc, THuiRealRect aRect) const;
       
    76     virtual TInt Type2() const;
       
    77     void Flush() const;
       
    78     void ClearBackground(CHuiGc &aGc, TRect aRectangle) const;
       
    79     void DrawDrawingCommands(TInt aAction, CHuiGc &aGc, TRect aClippingRectangle, 
       
    80                              TPtrC8 aCommands, CHuiCanvasCommandBuffer *buf, const TRegion &aRegion) const;
       
    81     void CopyBuffer(CHuiGc &aGc, TRect aRectangle) const;
       
    82 
       
    83 
       
    84 public: // from MHuiEffectable
       
    85    //void SetEffect(CHuiFxEffect* aEffect);
       
    86    void EffectSetEffect(CHuiFxEffect* aEffect);
       
    87    TReal32 EffectOpacityTarget() const;
       
    88    void EffectSetOpacity(TReal32 aOpacity);
       
    89    void EffectDrawSelf( CHuiGc &aGc, const TRect & aDisplayRect) const;
       
    90    THuiRealRect EffectDisplayRect() const __SOFTFP;
       
    91    void SetLoadingEffect(TBool aLoading);
       
    92    void EffectSetSource( TBool aIsInput1 );
       
    93    TBool EffectGetSource() const;
       
    94 
       
    95    
       
    96 public: // from MHuiCmdBufDestroyObserver
       
    97     void DestroyBuffer(CHuiCanvasCommandBuffer *aBuffer);
       
    98 private:
       
    99     void ConstructL(TInt aLayerId, CHuiCanvasVisual &aVisual, CHuiCanvasPainter &aPainter);
       
   100     CHuiCmdBufferBrush( CHuiCanvasGc &aGc, CHuiCanvasWsGc &aWsGc);
       
   101 private:
       
   102     TInt iLayerId; // layer id of this brush
       
   103     RArray<TLayeredBuffer> iBuffers; // pointers to buffer subareas
       
   104 private:
       
   105     CHuiFxEffect *iEffect;
       
   106     CHuiCanvasGc &iCanvasGc;
       
   107     CHuiCanvasWsGc &iCanvasWsGc;
       
   108     CHuiCanvasVisual *iVisual;
       
   109     CHuiCanvasPainter *iCanvasPainter;
       
   110     friend void ParseCmdBufferL(CHuiBrushArray &aBrushes, TPtrC8 aBuffer, TPtrC8 aIndexTable, CHuiCanvasGc &aGc, CHuiCanvasWsGc &aWsGc, CHuiCanvasVisual &aVisual,CHuiCanvasPainter &aPainter);
       
   111 
       
   112 };
       
   113 void ParseCmdBufferL(CHuiBrushArray &aBrushes, TPtrC8 aBuffer, TPtrC8 aIndexTable, CHuiCanvasGc &aGc, CHuiCanvasWsGc &aWsGc, CHuiCanvasVisual &aVisual, CHuiCanvasPainter &aPainter);
       
   114 
       
   115 #endif