os/graphics/windowing/windowserverplugins/openwfc/inc/elementwrapper.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserverplugins/openwfc/inc/elementwrapper.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,148 @@
     1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// A class which wraps OpenWF element related functionality.
    1.18 +
    1.19 +//
    1.20 +
    1.21 +#ifndef ELEMENTWRAPPER_H_
    1.22 +#define ELEMENTWRAPPER_H_
    1.23 +
    1.24 +#include "openwfcwrapper.h"
    1.25 +#include <graphics/wselement.h>
    1.26 +#include <graphics/surface.h>
    1.27 +#include <WF/wfc.h>
    1.28 +
    1.29 +#if defined(ENABLE_LI_LOGGING)
    1.30 +#define LILOG(X)  RDebug::Printf X
    1.31 +#else
    1.32 +#define LILOG(X)
    1.33 +#endif
    1.34 +
    1.35 +#define OWF_SURFACE_WIDTH  (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
    1.36 +#define OWF_SURFACE_HEIGHT (768) /* needs to be > 640 + 2 to allow S60 nHD config to work */
    1.37 +
    1.38 +NONSHARABLE_CLASS(CElementWrapper) : public CBase, public MWsElement
    1.39 +    {
    1.40 +public:  
    1.41 +    enum TOwfUpdates
    1.42 +        {   //All setters should set EUpdate_PostIllegalUpdate
    1.43 +        EUpdate_None                        = 0,
    1.44 +
    1.45 +        EUpdate_DESTINATION_RECTANGLE       = 0x00000001,
    1.46 +        EUpdate_SOURCE                      = 0x00000002,
    1.47 +        EUpdate_SOURCE_RECTANGLE            = 0x00000004,
    1.48 +        EUpdate_SOURCE_FLIP                 = 0x00000008,
    1.49 +        EUpdate_SOURCE_ROTATION             = 0x00000010,
    1.50 +        EUpdate_SOURCE_SCALE_FILTER         = 0x00000020,  //No client-side code yet to drive this
    1.51 +        EUpdate_TRANSPARENCY_TYPES          = 0x00000040,
    1.52 +        EUpdate_GLOBAL_ALPHA                = 0x00000080,
    1.53 +        EUpdate_MASK                        = 0x00000100,  //No client-side code yet to drive this
    1.54 +        EUpdate_DESTINATION_CLIP_RECTANGLE  = EUpdate_DESTINATION_RECTANGLE|EUpdate_SOURCE_RECTANGLE,
    1.55 +
    1.56 +        EUpdate_SOURCE_GEOMETRY_SET         = EUpdate_SOURCE_RECTANGLE|EUpdate_SOURCE_FLIP|EUpdate_SOURCE_ROTATION,
    1.57 +        EUpdate_ALL_ATTRIBS                 = 0x000fffff,
    1.58 +        EUpdate_AttributesIllegal           = 0x00100000,   //If set then the owf scene will not be updated because it would be illegal.
    1.59 +        EUpdate_SettingValid                = 0x00200000,
    1.60 +
    1.61 +        EUpdate_Insert                      = 0x01000000,
    1.62 +        EUpdate_Remove                      = 0x02000000,
    1.63 +        EUpdate_Destroy                     = 0x04000000,
    1.64 +        EUpdate_SceneCommited               = 0x10000000,
    1.65 +        };    
    1.66 +
    1.67 +public: // from MWsElement  
    1.68 +    const TSurfaceId& ConnectedSurface() const;
    1.69 +    TInt ConnectSurface(const TSurfaceId& aSurface);
    1.70 +
    1.71 +    TInt SetSourceRectangle(const TRect& aSrc);
    1.72 +    TInt GetSourceRectangle(TRect& aSrc);
    1.73 +    
    1.74 +    TInt SetSourceFlipping(const TBool aFlip);
    1.75 +    TBool SourceFlipping() const;
    1.76 +    
    1.77 +    MWsElement* ElementAbove();
    1.78 +    MWsElement* ElementBelow();
    1.79 +
    1.80 +    TInt SetGlobalAlpha(const TInt aAlpha);
    1.81 +    void GlobalAlpha(TInt& aAlpha) const;
    1.82 +
    1.83 +    TInt SetSourceRotation(const TElementRotation aElementRotation);
    1.84 +    MWsElement::TElementRotation SourceRotation() const;
    1.85 +    
    1.86 +    TInt SetTargetRendererFlags(const TUint32& aTargetRendererFlags);
    1.87 +    TInt SetRenderStageFlags(const TUint32& aRenderStageFlags);
    1.88 +    void GetTargetRendererFlags(TUint32& aTargetRendererFlags) const;
    1.89 +    void GetRenderStageFlags(TUint32& aRenderStageFlags) const;
    1.90 +
    1.91 +    TInt SetDestinationRectangle(const TRect& aDest);
    1.92 +    TInt GetDestinationRectangle(TRect& aDest) const;
    1.93 +    TInt SetDestinationClippingRect(const TRect& aDestClipRect);
    1.94 +    TInt GetDestinationClippingRect(TRect& aDestClipRect) const;
    1.95 +    
    1.96 +public:
    1.97 +    static CElementWrapper* NewL(COpenWfcWrapper& aCOpenWfcWrapper, CElementWrapper*& aCleanupPrevRef);
    1.98 +    CElementWrapper(COpenWfcWrapper& aOpenWfcWrapper);
    1.99 +    ~CElementWrapper();
   1.100 +    void ConstructL(CElementWrapper*& aCleanupPrevRef);
   1.101 +    void RemoveAfter(CElementWrapper** apBelow);
   1.102 +    void InsertAfter(CElementWrapper*& aRefBelow, CElementWrapper* aBelow, TOwfUpdates aUpdateFlag);
   1.103 +    CElementWrapper** RefsMyElementBelow();
   1.104 +    CElementWrapper*& MyElementAbove();
   1.105 +    COpenWfcWrapper& Owner()const { return iOpenWfcWrapper;}
   1.106 +    TBool FlushSceneChanges();
   1.107 +    WFCElement Element(){ return iElement;};
   1.108 +    TOwfUpdates UpdateFlags()const {return static_cast<TOwfUpdates>(iUpdateFlags);}
   1.109 +    TInt ReplicateElements(WFCContext aContext, WFCElement& aPreviousTargetElement, const TPoint& aOffset);
   1.110 +
   1.111 +protected:
   1.112 +    void SetEltDestinationRectangle(WFCElement aElement)const;
   1.113 +    void SetEltDestinationRectangle(WFCElement aElement, const TPoint& aOffset)const;
   1.114 +    void SetEltSource(WFCElement aElement)const;
   1.115 +    void SetEltSourceComposed();
   1.116 +    void SetEltSourceRectangle(WFCElement aElement);
   1.117 +    void SetEltSourceFlip(WFCElement aElement)const;
   1.118 +    void SetEltTransparencyTypes(WFCElement aElement)const;
   1.119 +    void FlushAttributeChanges(WFCElement aElement, TInt aUpdateFlags);
   1.120 +    TBool IsNewElementLegal()const;
   1.121 +    
   1.122 +private: //methods
   1.123 +    TBool UnsetSurface(TSurfaceId& aSurface);
   1.124 +    static TInt WfcRotation(MWsElement::TElementRotation aRotation);
   1.125 +    void HelpStreamGetHeader(khronos_int32_t* width, khronos_int32_t* height )const;
   1.126 +    TRect SetSourceDestRect(const TRect& aDestElementRect, const TRect& aDestElementClippedRect,const TRect& aSrcOriginalElementRect,const TBool& aElementFlip,const MWsElement::TElementRotation& aElementRotation) const;
   1.127 +    TInt SurfaceInfo(const TSurfaceId& aSurface, RSurfaceManager::TInfoBuf& aInfo);
   1.128 +
   1.129 +
   1.130 +private: //data
   1.131 +    TUint                         iUpdateFlags;
   1.132 +    COpenWfcWrapper&              iOpenWfcWrapper;
   1.133 +    TSurfaceId                    iComposedSurfaceId;
   1.134 +    TSurfaceId                    iSurfaceId;
   1.135 +    TSize                         iSurfaceSize;
   1.136 +    TRect                         iSourcRect; 
   1.137 +    TRect                         iDestinationRect;
   1.138 +    TRect                         iDestinationClippingRect;
   1.139 +    TInt                          iGlobalAlpha;
   1.140 +    TBool                         iFlipped;
   1.141 +    MWsElement::TElementRotation  iRotation;
   1.142 +    TUint32                       iTargetRendererFlags;
   1.143 +    TUint32                       iRenderStageFlags;
   1.144 +    WFCElement                    iElement;
   1.145 +    CElementWrapper*              iElementAbove;     //used to maintain the scene list
   1.146 +    CElementWrapper*              iElementBelow;     //used to maintain the scene list
   1.147 +    CElementWrapper**             iCleanupPrevRef;    //used to clean up the context on exit
   1.148 +    CElementWrapper*              iCleanupNext;       //used to clean up the context on exit
   1.149 +    };
   1.150 +
   1.151 +#endif /* ELEMENTWRAPPER_H_ */