os/graphics/fbs/fontandbitmapserver/sfbs/BitmapCompr.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/fbs/fontandbitmapserver/sfbs/BitmapCompr.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,86 @@
     1.4 +// Copyright (c) 2003-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 +//
    1.18 +
    1.19 +#ifndef __BITMAPCOMPR_H__
    1.20 +#define __BITMAPCOMPR_H__
    1.21 +
    1.22 +//Forward declaration
    1.23 +class TLineScanningPosition;
    1.24 +//Global function used by 12, 16, 24 bpp scan line decompression methods
    1.25 +void AdjustLineScanningPosition(TLineScanningPosition& aLineScanPos, 
    1.26 +								const TUint32* aBase, 
    1.27 +								TInt aBitmapWidth, 
    1.28 +								TInt aStartPos,
    1.29 +								TInt aCompressedDataBytes);
    1.30 +
    1.31 +/**
    1.32 +Possible values for the template argument of TScanLineDecompressor class.
    1.33 +@internalComponent
    1.34 +*/
    1.35 +typedef enum
    1.36 +	{
    1.37 +	E2bpp = 2,
    1.38 +	E3bpp = 3,
    1.39 +	E4bpp = 4
    1.40 +	} TScanLineDecompressorType;
    1.41 +
    1.42 +/**
    1.43 +This functor class is used for bitmap scanline decompression.
    1.44 +Possible values for the template argument of TScanLineDecompressor class are enumerated
    1.45 +in TScanLineDecompressorType enum.
    1.46 +Note: "BPP" means "bytes per pixel for source buffer".
    1.47 +Note: "BPP_DEST" means "bytes per pixel for destination buffer".
    1.48 +Note: Template class design was preffered to base-derived class design (with virtual 
    1.49 +CopyPixel() method), because performance is more important than code size for bitmap
    1.50 +scanline decompression.
    1.51 +@internalComponent
    1.52 +*/
    1.53 +template <TInt BPP, TInt BPP_DEST> 
    1.54 +class TScanLineDecompressor
    1.55 +	{
    1.56 +public:
    1.57 +	TScanLineDecompressor(const TUint32* aBase, 
    1.58 +							TInt aComprDataBytes, 
    1.59 +							TBool aCanAdjustLineScanPos);
    1.60 +	void operator()(TUint8* aDestBuffer, const TPoint& aPixel, 
    1.61 +					TLineScanningPosition& aLineScanPos, TInt aByteWidth, TInt aDestByteWidth, TInt aLength) const;
    1.62 +
    1.63 +private:
    1.64 +	TInt CalcStartPos(const TPoint& aPixel, TInt aByteWidth) const;
    1.65 +	TInt CalcDestStartPos(const TPoint& aPixel, TInt aByteWidth) const;
    1.66 +	TInt CalcEndPos(TInt aLength, const TPoint& aPixel, TInt aByteWidth) const;
    1.67 +	TUint8* CalcDestPtr(const TUint8* aDestBuffer, const TPoint& aPixel) const;
    1.68 +	TUint8* CalcDestPtrLimit(const TUint8* aDestPtr, const TPoint& aPixel, TInt aByteWidth, 
    1.69 +								TInt aLength, TInt aStartPos) const;
    1.70 +	TInt CalcAvailDestSpace(const TUint8* aDestPtr, const TUint8* aDestPtrLimit) const;
    1.71 +	TUint8* AdjustLineScanningPosition(TLineScanningPosition& aLineScanPos, TInt aByteWidth, 
    1.72 +										TInt aStartPos) const;
    1.73 +	TUint8* CopyPixel(TUint8* aDestPtr, const TUint8* aSrcPtr, TInt aCount) const;
    1.74 +	TUint8* CopyBlockPixel(TUint8* aDestPtr, const TUint8* aSrcPtr, TInt aCount) const;
    1.75 +
    1.76 +	TScanLineDecompressor(const TScanLineDecompressor&);//prevent default copy constructor
    1.77 +	TScanLineDecompressor& operator=(const TScanLineDecompressor&);//prevent default "=" operator
    1.78 +
    1.79 +private:
    1.80 +	const TUint32* iBase;
    1.81 +	const TInt iComprDataBytes;
    1.82 +	const TBool iCanAdjustLineScanPos;
    1.83 +
    1.84 +	};
    1.85 +
    1.86 +#include "BitmapCompr.inl"
    1.87 +
    1.88 +#endif//__BITMAPCOMPR_H__
    1.89 +