uigraphics/NVGRenderStage/src/nvgrenderstage.h
author William Roberts <williamr@symbian.org>
Thu, 07 Jan 2010 12:19:27 +0000
changeset 20 f6fd4830a02c
parent 15 1bd1043e4812
permissions -rw-r--r--
Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15
1bd1043e4812 COnfigure NVGRenderStage in wsini.ini, and tweak some comments
William Roberts <williamr@symbian.org>
parents: 14
diff changeset
     1
// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
//
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
//
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
// Contributors:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
//
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
// Description:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
//
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
#ifndef NVGRENDERSTAGE_H
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
#define NVGRENDERSTAGE_H
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
/**
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
@file
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
@test
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
@internalComponent - Internal Symbian test code
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
*/
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
#include <graphics/wsrenderstage.h>
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
#include <graphics/wsgraphicdrawer.h>
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
#include <graphics/wsgraphicscontext.h>
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    28
#include <nvg.h>
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
#include "vgigraphicsinterface.h"
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    31
/** Struct to form a simple LRU cache of conversion results
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    32
 */
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    33
class TCachedConversion
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    34
  {
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    35
public:
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    36
  TCachedConversion();
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    37
  ~TCachedConversion();
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    38
  inline void Deque();
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    39
  
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    40
public:
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    41
  TDblQueLink iLink;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    42
  TUint32 iBitmapID;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    43
  TUint32 iDiscriminator;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    44
  CFbsBitmap* iCachedResult;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    45
  };
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    47
void TCachedConversion::Deque() {iLink.Deque();}
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    48
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    49
/** This is a render stage used for processing NVG Icon bitmaps in the absence of
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    50
graphics acceleration hardware. The software implementation of OpenVG is used to
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    51
render the NVG drawing commands onto a normal CFbsBitmap, and a simple LRU cache
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
    52
is used to keep the results for faster redrawing.
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    54
This render stage implements the MWsGraphicsContext interface so that it can intercept
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    55
any drawing commands that draw an extended bitmap, any commands that draw a normal 
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    56
bitmap are just passed through to the next renderstage (along with any commands that
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    57
do not involve bitmaps at all).
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    58
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    59
A CNvgRenderStage object is created by a CNvgRenderStageFactory.
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    60
 */
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    61
class CNvgRenderStage : public CWsRenderStage, public MWsGraphicsContext
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    62
	{
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    63
public:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    64
	static CNvgRenderStage* NewL(MWsGraphicDrawerEnvironment* aEnv, MWsScreen* aScreen, MWsScreenRedraw* aScreenRedraw, CWsRenderStage* aNextStage);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    65
	virtual ~CNvgRenderStage();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    66
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    67
public: 
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    68
	// Implementation of CWsRenderStage
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    69
	TAny* ResolveObjectInterface(TUint aTypeId);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    70
	virtual void Begin(const TRegion* aRegion);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    71
	virtual void End(TRequestStatus* aCompositorReady);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    72
	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    73
public:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    74
	// Implementation of MWsGraphicsContext
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    75
	void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    76
	void BitBlt(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap,	const TRect& aSourceRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    77
	void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    78
	void BitBltMasked(const TPoint& aDestPos, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, const TPoint& aMaskPos);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    79
	void ResetClippingRegion();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    80
	void Clear();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    81
	void Clear(const TRect& aRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    82
	void ResetBrushPattern();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    83
	void ResetFont();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    84
	void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    85
	void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    86
	void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    87
	void DrawBitmap(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap, const TRect& aSourceRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    88
	void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap& aSourceBitmap,const TRect& aSourceRect, const CFbsBitmap& aMaskBitmap, TBool aInvertMask);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    89
	void DrawRoundRect(const TRect& aRect, const TSize& aEllipse);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    90
	void DrawPolyLine(const TArray<TPoint>& aPointList); 
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    91
	void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList);  
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    92
	void DrawPolygon(const TArray<TPoint>& aPointList, TFillRule aFillRule=EAlternate);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    93
	void DrawEllipse(const TRect& aRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    94
	void DrawLine(const TPoint& aStart, const TPoint& aEnd);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    95
	void DrawLineTo(const TPoint& aPoint);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    96
	void DrawLineBy(const TPoint& aVector);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    97
	void DrawRect(const TRect& aRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    98
	void DrawText(const TDesC& aText,const TTextParameters* aParam);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
    99
	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   100
	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   101
	void DrawText(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipFillRect,TInt aBaselineOffset,TTextAlign aHrz=ELeft,TInt aMargin=0);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   102
	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   103
	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TPoint& aPosition,TBool aUp);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   104
	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TBool aUp);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   105
	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   106
	void DrawTextVertical(const TDesC& aText,const TTextParameters* aParam,const TRect& aClipRect,TInt aBaselineOffset,TInt aTextWidth,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   107
	void MoveTo(const TPoint& aPoint);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   108
	void MoveBy(const TPoint& aVector);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   109
	void Plot(const TPoint& aPoint);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   110
	void Reset();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   111
	void SetBrushColor(const TRgb& aColor);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   112
	void SetBrushOrigin(const TPoint& aOrigin);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   113
	void SetBrushStyle(TBrushStyle aBrushStyle);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   114
	void SetClippingRegion(const TRegion& aRegion);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   115
	void SetDrawMode(TDrawMode aDrawMode);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   116
	void SetOrigin(const TPoint& aPoint = TPoint(0, 0));
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   117
	void SetPenColor(const TRgb& aColor);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   118
	void SetPenStyle(TPenStyle aPenStyle);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   119
	void SetPenSize(const TSize& aSize);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   120
	void SetTextShadowColor(const TRgb& aColor);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   121
	void SetCharJustification(TInt aExcessWidth, TInt aNumChars);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   122
	void SetWordJustification(TInt aExcessWidth, TInt aNumGaps);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   123
	void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   124
	void SetStrikethroughStyle(TFontStrikethrough aStrikethroughStyle);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   125
	void SetBrushPattern(const CFbsBitmap& aBitmap);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   126
	void SetBrushPattern(TInt aFbsBitmapHandle);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   127
	void SetFont(const CFont* aFont);	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   128
	void CopyRect(const TPoint& aOffset, const TRect& aRect);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   129
	void UpdateJustification(const TDesC& aText,const TTextParameters* aParam);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   130
	void UpdateJustificationVertical(const TDesC& aText,const TTextParameters* aParam,TBool aUp);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   131
	void SetFontNoDuplicate(const CFont* aFont);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   132
	TBool HasBrushPattern() const;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   133
	TBool HasFont() const;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   134
	TRgb BrushColor() const;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   135
	TRgb PenColor() const;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   136
	TRgb TextShadowColor() const;	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   137
	TInt GetError();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   138
	TPoint Origin() const;	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   139
	const TRegion& ClippingRegion();	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   140
	TInt Push();	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   141
	void Pop();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   142
	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   143
private:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   144
	CNvgRenderStage();
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   145
	void ConstructL(CWsRenderStage* aNextStage);
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   146
	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   147
private:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   148
	// Helper methods that support the implementation of MWsGraphicsContext
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   149
	CFbsBitmap* GetConvertedBitmap(const CFbsBitmap& aSourceBitmap);
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   150
	void CopyExtendedBitmapToNormalBitmap(const CFbsBitmap& aExtendedBitmapSrc, CFbsBitmap& aBitmapDst);
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   151
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   152
private:
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   153
	MWsGraphicsContext* iGc;	
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   154
	TInt iExtendedBitmapError;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   155
	TPoint iOrigin;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   156
	RRegion iEmptyRegion;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   157
	CFbsBitmap* iBrushPattern;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   158
	CFbsBitmap* iInternalBrushPattern;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   159
	MWsGraphicsContext::TBrushStyle iBrushStyle;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   160
	CVGIGraphicsInterface* iGraphicsInterface;
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   161
	CNvgEngine* iNvgEngine;
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   162
	
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   163
	// LRU Cache of rendered bitmaps
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   164
#define MAX_NVG_CACHE_SIZE 128
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   165
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   166
	TDblQue<TCachedConversion> iCache;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   167
  TDblQueIter<TCachedConversion> iCacheIterator;
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   168
	TUint iCacheFree;
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   169
	};
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   170
20
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   171
// #define DEBUG_NVG_RENDERSTAGE
f6fd4830a02c Add LRU cache of rendered bitmaps, to improve redraw performance in the absence of graphics HW support for OpenVG
William Roberts <williamr@symbian.org>
parents: 15
diff changeset
   172
14
dfd4516c2f08 Add new component NVGRenderStage to handle conversion of NVG Icons into CFbsBitmap
William Roberts <williamr@symbian.org>
parents:
diff changeset
   173
#endif // NVGRENDERSTAGE_H