os/graphics/graphicsdeviceinterface/directgdi/test/tcontext_bitgdi.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicsdeviceinterface/directgdi/test/tcontext_bitgdi.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,537 @@
     1.4 +// Copyright (c) 2007-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 +#include "tcontextbase.h"
    1.20 +#include <gdi.h>
    1.21 +#include <bitdev.h>
    1.22 +
    1.23 +CTBitGdiContext::CTBitGdiContext() :
    1.24 +    iError(KErrNone)
    1.25 +	{
    1.26 +
    1.27 +	}
    1.28 +
    1.29 +CTBitGdiContext* CTBitGdiContext::NewL(CFbsBitmapDevice* aDevice, TBool aActivate)
    1.30 +	{
    1.31 +	CTBitGdiContext* self = new (ELeave) CTBitGdiContext;
    1.32 +	CleanupStack::PushL (self);
    1.33 +	self->ConstructL (aDevice, aActivate);
    1.34 +	CleanupStack::Pop ();
    1.35 +	return self;
    1.36 +	}
    1.37 +
    1.38 +void CTBitGdiContext::ConstructL(CFbsBitmapDevice* aDevice, TBool aActivate)
    1.39 +	{
    1.40 +	if(aActivate)
    1.41 +		{
    1.42 +		User::LeaveIfError(aDevice->CreateContext (iGc));
    1.43 +		}
    1.44 +	else
    1.45 +		{
    1.46 +		iGc = CFbsBitGc::NewL();
    1.47 +		}
    1.48 +	}
    1.49 +
    1.50 +CTBitGdiContext::~CTBitGdiContext()
    1.51 +	{
    1.52 +	delete iGc;
    1.53 +	}
    1.54 +
    1.55 +TInt CTBitGdiContext::Activate(CBitmapDevice *aDevice)
    1.56 +	{
    1.57 +	CFbsDevice* device = (CFbsDevice *)aDevice;
    1.58 +	iGc->Activate(device);
    1.59 +	return KErrNone;
    1.60 +	}
    1.61 +
    1.62 +void CTBitGdiContext::SetOrigin(const TPoint& aOrigin)
    1.63 +	{
    1.64 +	iGc->SetOrigin (aOrigin);
    1.65 +	}
    1.66 +
    1.67 +void CTBitGdiContext::SetClippingRegion(const TRegion& aRegion)
    1.68 +	{
    1.69 +	TInt result = iGc->SetClippingRegion (aRegion);
    1.70 +	SetError(result);
    1.71 +	}
    1.72 +
    1.73 +void CTBitGdiContext::ResetClippingRegion()
    1.74 +	{
    1.75 +	iGc->CancelClipping();
    1.76 +	}
    1.77 +
    1.78 +void CTBitGdiContext::SetDrawMode(DirectGdi::TDrawMode aMode)
    1.79 +	{
    1.80 +	CGraphicsContext::TDrawMode mode = CGraphicsContext::EDrawModePEN;	
    1.81 +	if (aMode == DirectGdi::EDrawModeWriteAlpha)
    1.82 +		{
    1.83 +		mode = CGraphicsContext::EDrawModeWriteAlpha;
    1.84 +		}	
    1.85 +	iGc->SetDrawMode(mode);
    1.86 +	}
    1.87 +
    1.88 +void CTBitGdiContext::SetPenColor(const TRgb& aColor)
    1.89 +	{
    1.90 +	iGc->SetPenColor (aColor);
    1.91 +	}
    1.92 +
    1.93 +void CTBitGdiContext::SetPenStyle(DirectGdi::TPenStyle aStyle)
    1.94 +	{
    1.95 +	// The CGraphicsContext::TPenStyle enumeration has the same values as the
    1.96 +	// DirectGdi::TPenStyle. If these change then this function will need to be updated.
    1.97 +	iGc->SetPenStyle(static_cast<CGraphicsContext::TPenStyle>(aStyle));
    1.98 +	}
    1.99 +
   1.100 +void CTBitGdiContext::SetPenSize(const TSize& aSize)
   1.101 +	{	
   1.102 +	iGc->SetPenSize (aSize);
   1.103 +	}
   1.104 +
   1.105 +void CTBitGdiContext::SetTextShadowColor(const TRgb& aColor)
   1.106 +	{
   1.107 +	iGc->SetShadowColor(aColor);
   1.108 +	}
   1.109 +
   1.110 +void CTBitGdiContext::SetBrushColor(const TRgb& aColor)
   1.111 +	{
   1.112 +	iGc->SetBrushColor (aColor);
   1.113 +	}
   1.114 +
   1.115 +void CTBitGdiContext::SetBrushStyle(DirectGdi::TBrushStyle aStyle)
   1.116 +	{
   1.117 +	// The CGraphicsContext::TBrushStyle enumeration has the same values as the
   1.118 +	// DirectGdi::TBrushStyle. If these change then this function will need to be updated.
   1.119 +	iGc->SetBrushStyle(static_cast<CGraphicsContext::TBrushStyle>(aStyle));
   1.120 +	}
   1.121 +
   1.122 +void CTBitGdiContext::SetBrushOrigin(const TPoint& aOrigin)
   1.123 +	{
   1.124 +	iGc->SetBrushOrigin (aOrigin);
   1.125 +	}
   1.126 +
   1.127 +void CTBitGdiContext::SetBrushPattern(const CFbsBitmap& aPattern)
   1.128 +	{
   1.129 +	iGc->UseBrushPattern (&aPattern);
   1.130 +	}
   1.131 +
   1.132 +void CTBitGdiContext::SetBrushPattern(TInt aHandle)
   1.133 +	{
   1.134 +	TInt result = iGc->UseBrushPattern(aHandle);
   1.135 +	SetError(result);
   1.136 +	}
   1.137 +
   1.138 +void CTBitGdiContext::ResetBrushPattern()
   1.139 +	{
   1.140 +	iGc->DiscardBrushPattern ();
   1.141 +	}
   1.142 +
   1.143 +void CTBitGdiContext::SetFont(const CFont* aFont)
   1.144 +	{
   1.145 +	iGc->UseFont (aFont);
   1.146 +	}
   1.147 +
   1.148 +void CTBitGdiContext::ResetFont()
   1.149 +	{
   1.150 +	iGc->DiscardFont ();
   1.151 +	}
   1.152 +
   1.153 +void CTBitGdiContext::Reset()
   1.154 +	{
   1.155 +	iGc->Reset ();
   1.156 +	}
   1.157 +
   1.158 +TRgb CTBitGdiContext::BrushColor()
   1.159 +	{
   1.160 +	return iGc->BrushColor ();
   1.161 +	}
   1.162 +
   1.163 +TRgb CTBitGdiContext::PenColor()
   1.164 +	{
   1.165 +	return iGc->PenColor ();
   1.166 +	}
   1.167 +
   1.168 +TRgb CTBitGdiContext::TextShadowColor()
   1.169 +	{
   1.170 +	TRgb shadowColor;
   1.171 +	iGc->GetShadowColor(shadowColor);
   1.172 +	return shadowColor;
   1.173 +	}
   1.174 +
   1.175 +void CTBitGdiContext::Clear(const TRect& aRect)
   1.176 +	{
   1.177 +	iGc->Clear (aRect);
   1.178 +	}
   1.179 +
   1.180 +void CTBitGdiContext::Clear()
   1.181 +	{
   1.182 +	iGc->Clear ();
   1.183 +	}
   1.184 +
   1.185 +void CTBitGdiContext::MoveTo(const TPoint& aPoint)
   1.186 +	{
   1.187 +	iGc->MoveTo (aPoint);
   1.188 +	}
   1.189 +
   1.190 +void CTBitGdiContext::MoveBy(const TPoint& aVector)
   1.191 +	{
   1.192 +	iGc->MoveBy (aVector);
   1.193 +	}
   1.194 +
   1.195 +void CTBitGdiContext::Plot(const TPoint& aPoint)
   1.196 +	{
   1.197 +	iGc->Plot (aPoint);
   1.198 +	}
   1.199 +
   1.200 +void CTBitGdiContext::DrawLine(const TPoint& aStart, const TPoint& aEnd)
   1.201 +	{
   1.202 +	iGc->DrawLine (aStart, aEnd);
   1.203 +	}
   1.204 +
   1.205 +void CTBitGdiContext::DrawLineTo(const TPoint& aPoint)
   1.206 +	{
   1.207 +	iGc->DrawLineTo (aPoint);
   1.208 +	}
   1.209 +
   1.210 +void CTBitGdiContext::DrawLineBy(const TPoint& aVector)
   1.211 +	{
   1.212 +	iGc->DrawLineBy (aVector);
   1.213 +	}
   1.214 +
   1.215 +void CTBitGdiContext::DrawRect(const TRect& aRect)
   1.216 +	{
   1.217 +	iGc->DrawRect (aRect);
   1.218 +	}
   1.219 +
   1.220 +void CTBitGdiContext::DrawRoundRect(const TRect& aRect,
   1.221 +		const TSize& aCornerSize)
   1.222 +	{
   1.223 +	iGc->DrawRoundRect (aRect, aCornerSize);
   1.224 +	}
   1.225 +
   1.226 +void CTBitGdiContext::DrawPolyLine(const CArrayFix<TPoint>& aPointList)
   1.227 +	{
   1.228 +	iGc->DrawPolyLine(&aPointList);
   1.229 +	}
   1.230 +
   1.231 +void CTBitGdiContext::DrawPolyLineNoEndPoint(const CArrayFix<TPoint>& aPointList)
   1.232 +	{
   1.233 +	iGc->DrawPolyLineNoEndPoint(&aPointList);
   1.234 +	}
   1.235 +
   1.236 +void CTBitGdiContext::DrawPolygon(const CArrayFix<TPoint>& aPoints, DirectGdi::TFillRule aRule)
   1.237 +	{
   1.238 +	TInt result = iGc->DrawPolygon(&aPoints, static_cast<CGraphicsContext::TFillRule>(aRule));
   1.239 +	SetError(result);
   1.240 +	}
   1.241 +
   1.242 +void CTBitGdiContext::DrawArc(const TRect& aRect, const TPoint& aStart,
   1.243 +		const TPoint& aEnd)
   1.244 +	{
   1.245 +	iGc->DrawArc (aRect, aStart, aEnd);
   1.246 +	}
   1.247 +
   1.248 +void CTBitGdiContext::DrawPie(const TRect& aRect, const TPoint& aStart,
   1.249 +		const TPoint& aEnd)
   1.250 +	{
   1.251 +	iGc->DrawPie (aRect, aStart, aEnd);
   1.252 +	}
   1.253 +
   1.254 +void CTBitGdiContext::DrawEllipse(const TRect& aRect)
   1.255 +	{
   1.256 +	iGc->DrawEllipse (aRect);
   1.257 +	}
   1.258 +
   1.259 +void CTBitGdiContext::BitBltMasked(const TPoint& aDestPos, 
   1.260 +		const CFbsBitmap& aBitmap, const TRect& aSourceRect, 
   1.261 +		const CFbsBitmap& aAlpha, const TPoint& aAlphaPos)
   1.262 +	{
   1.263 +	// This overload of BitBltMasked maps to AlphaBlendBitmaps in BitGDI, which has the same signiature.
   1.264 +	TInt result = iGc->AlphaBlendBitmaps(aDestPos, &aBitmap, aSourceRect, &aAlpha, aAlphaPos);
   1.265 +	SetError(result);
   1.266 +	}
   1.267 +
   1.268 +void CTBitGdiContext::BitBlt(const TPoint& aPoint, const CFbsBitmap& aBitmap)
   1.269 +	{
   1.270 +	iGc->BitBlt (aPoint, &aBitmap);
   1.271 +	}
   1.272 +
   1.273 +void CTBitGdiContext::DrawBitmap(const TRect& aDestRect,
   1.274 +		const CFbsBitmap& aSource)
   1.275 +	{
   1.276 +	iGc->DrawBitmap (aDestRect, &aSource);
   1.277 +	}
   1.278 +
   1.279 +void CTBitGdiContext::BitBlt(const TPoint& aDestPos,
   1.280 +		const CFbsBitmap& aBitmap, const TRect& aSrcRect)
   1.281 +	{
   1.282 +	iGc->BitBlt (aDestPos, &aBitmap, aSrcRect);
   1.283 +	}
   1.284 +
   1.285 +void CTBitGdiContext::BitBltMasked(const TPoint& aDestPos,
   1.286 +		const CFbsBitmap& aBitmap, const TRect& aSrcRect,
   1.287 +		const CFbsBitmap& aMask, TBool aInvertMask)
   1.288 +	{
   1.289 +	iGc->BitBltMasked (aDestPos, &aBitmap, aSrcRect, &aMask, aInvertMask);
   1.290 +	}
   1.291 +
   1.292 +void CTBitGdiContext::DrawBitmap(const TRect& aDestRect,
   1.293 +		const CFbsBitmap& aBitmap, const TRect& aSrcRect)
   1.294 +	{
   1.295 +	iGc->DrawBitmap (aDestRect, &aBitmap, aSrcRect);
   1.296 +	}
   1.297 +
   1.298 +void CTBitGdiContext::DrawBitmapMasked(const TRect& aDestRect,
   1.299 +		const CFbsBitmap& aBitmap, const TRect& aSrcRect,
   1.300 +		const CFbsBitmap& aMask, TBool aInvertMask)
   1.301 +	{
   1.302 +	iGc->DrawBitmapMasked (aDestRect, &aBitmap, aSrcRect, &aMask, aInvertMask);
   1.303 +	}
   1.304 +
   1.305 +void CTBitGdiContext::CopyRect(const TPoint& aOffset, const TRect& aRect)
   1.306 +	{
   1.307 +	iGc->CopyRect (aOffset, aRect);
   1.308 +	}
   1.309 +
   1.310 +TBool CTBitGdiContext::HasBrushPattern() const
   1.311 +	{
   1.312 +	return iGc->IsBrushPatternUsed ();
   1.313 +	}
   1.314 +
   1.315 +TBool CTBitGdiContext::HasFont() const
   1.316 +	{
   1.317 +	return iGc->IsFontUsed ();
   1.318 +	}
   1.319 +
   1.320 +void CTBitGdiContext::ExternalizeL(RWriteStream& aWriteStream)
   1.321 +	{
   1.322 +	iGc->ExternalizeL (aWriteStream);
   1.323 +	}
   1.324 +
   1.325 +void CTBitGdiContext::InternalizeL(RReadStream& aReadStream)
   1.326 +	{
   1.327 +	iGc->InternalizeL (aReadStream);
   1.328 +	}
   1.329 +
   1.330 +void CTBitGdiContext::SetCharJustification(TInt aExcessWidth, TInt aNumGaps)
   1.331 +	{
   1.332 +	iGc->SetCharJustification (aExcessWidth, aNumGaps);
   1.333 +	}
   1.334 +
   1.335 +void CTBitGdiContext::SetWordJustification(TInt aExcessWidth, TInt aNumChars)
   1.336 +	{
   1.337 +	iGc->SetWordJustification (aExcessWidth, aNumChars);
   1.338 +	}
   1.339 +
   1.340 +void CTBitGdiContext::SetUnderlineStyle(DirectGdi::TFontUnderline aUnderlineStyle)
   1.341 +	{
   1.342 +	iGc->SetUnderlineStyle (static_cast<TFontUnderline>(aUnderlineStyle));
   1.343 +	}
   1.344 +
   1.345 +void CTBitGdiContext::SetStrikethroughStyle(DirectGdi::TFontStrikethrough aStrikethroughStyle)
   1.346 +	{
   1.347 +	iGc->SetStrikethroughStyle (static_cast<TFontStrikethrough>(aStrikethroughStyle));
   1.348 +	}
   1.349 +
   1.350 +void CTBitGdiContext::UpdateJustification(const TDesC& aText, const DirectGdi::TTextParameters* aParam)
   1.351 +	{
   1.352 +	iGc->UpdateJustification(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam));
   1.353 +	}
   1.354 +
   1.355 +void CTBitGdiContext::UpdateJustificationVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp)
   1.356 +	{
   1.357 +	iGc->UpdateJustificationVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aUp);
   1.358 +	}
   1.359 +
   1.360 +void CTBitGdiContext::SetFontNoDuplicate(const CFont* /*aFont*/)
   1.361 +	{
   1.362 +	}
   1.363 +
   1.364 +void CTBitGdiContext::SetError(TInt aErr)
   1.365 +	{
   1.366 +	if (KErrNone == iError)
   1.367 +		{
   1.368 +		iError = aErr;
   1.369 +		}	
   1.370 +	}
   1.371 +
   1.372 +
   1.373 +TInt CTBitGdiContext::GetError()
   1.374 +	{
   1.375 +	TInt err = iError;
   1.376 +	iError = KErrNone;
   1.377 +	return err;
   1.378 +	}
   1.379 +
   1.380 +// text drawing
   1.381 +void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam)
   1.382 +	{
   1.383 +	iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam));
   1.384 +	}
   1.385 +
   1.386 +void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition)
   1.387 +	{
   1.388 +	iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aPosition);
   1.389 +	}
   1.390 +
   1.391 +void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox)
   1.392 +	{
   1.393 +	iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox);
   1.394 +	}
   1.395 +
   1.396 +void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset, 
   1.397 +		DirectGdi::TTextAlign aAlignment, TInt aMargin)
   1.398 +	{
   1.399 +	iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, static_cast<CGraphicsContext::TTextAlign>(aAlignment), aMargin);
   1.400 +	}
   1.401 +
   1.402 +void CTBitGdiContext::DrawText(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset, 
   1.403 +		TInt aTextWidth, DirectGdi::TTextAlign aAlignment, TInt aMargin)
   1.404 +	{
   1.405 +	iGc->DrawText(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aTextWidth, static_cast<CGraphicsContext::TTextAlign>(aAlignment), aMargin);
   1.406 +	}
   1.407 +
   1.408 +void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, TBool aUp)
   1.409 +	{
   1.410 +	iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aUp);
   1.411 +	}
   1.412 +
   1.413 +void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TPoint& aPosition, TBool aUp)
   1.414 +	{
   1.415 +	iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aPosition, aUp);
   1.416 +	}
   1.417 +
   1.418 +void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TBool aUp)
   1.419 +	{
   1.420 +	iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aUp);
   1.421 +	}
   1.422 +
   1.423 +void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset, 
   1.424 +			TBool aUp, DirectGdi::TTextAlign aVerticalAlignment, TInt aMargin)
   1.425 +	{
   1.426 +	iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aUp,
   1.427 +			static_cast<CGraphicsContext::TTextAlign>(aVerticalAlignment), aMargin);
   1.428 +	}
   1.429 +
   1.430 +void CTBitGdiContext::DrawTextVertical(const TDesC& aText, const DirectGdi::TTextParameters* aParam, const TRect& aBox, TInt aBaselineOffset, 
   1.431 +		TInt aTextWidth, TBool aUp, DirectGdi::TTextAlign aVerticalAlignment, TInt aMargin)
   1.432 +	{
   1.433 +	iGc->DrawTextVertical(aText, reinterpret_cast<const CGraphicsContext::TTextParameters*>(aParam), aBox, aBaselineOffset, aTextWidth, aUp,
   1.434 +			static_cast<CGraphicsContext::TTextAlign>(aVerticalAlignment), aMargin);
   1.435 +	}
   1.436 +
   1.437 +void CTBitGdiContext::DrawResource(const TPoint& aPos, 
   1.438 +								const TDrawableSourceAndEquivRotatedBmps& aSource, 
   1.439 +								DirectGdi::TGraphicsRotation aRotation)
   1.440 +	{
   1.441 +	switch (aRotation)
   1.442 +		{
   1.443 +		case DirectGdi::EGraphicsRotation90:
   1.444 +			iGc->BitBlt(aPos, aSource.iBmpRot90);
   1.445 +			break;
   1.446 +			
   1.447 +		case DirectGdi::EGraphicsRotation180:
   1.448 +			iGc->BitBlt(aPos, aSource.iBmpRot180);
   1.449 +			break;
   1.450 +			
   1.451 +		case DirectGdi::EGraphicsRotation270:
   1.452 +			iGc->BitBlt(aPos, aSource.iBmpRot270);
   1.453 +			break;
   1.454 +			
   1.455 +		default: // DirectGdi::EGraphicsRotationNone		
   1.456 +			iGc->BitBlt(aPos, aSource.iBmpRotNone);
   1.457 +			break;
   1.458 +		}
   1.459 +	}
   1.460 +
   1.461 +void CTBitGdiContext::DrawResource(const TRect& aDestRect, 
   1.462 +								const TDrawableSourceAndEquivRotatedBmps& aSource,
   1.463 +								DirectGdi::TGraphicsRotation aRotation)
   1.464 +	{
   1.465 +	switch (aRotation)
   1.466 +		{
   1.467 +		case DirectGdi::EGraphicsRotation90:
   1.468 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot90);
   1.469 +			break;
   1.470 +			
   1.471 +		case DirectGdi::EGraphicsRotation180:
   1.472 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot180);
   1.473 +			break;
   1.474 +			
   1.475 +		case DirectGdi::EGraphicsRotation270:
   1.476 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot270);
   1.477 +			break;
   1.478 +			
   1.479 +		default: // DirectGdi::EGraphicsRotationNone
   1.480 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone);
   1.481 +			break;
   1.482 +		}
   1.483 +	}
   1.484 +
   1.485 +void CTBitGdiContext::DrawResource(const TRect& aDestRect, 
   1.486 +								const TDrawableSourceAndEquivRotatedBmps& aSource, 
   1.487 +								const TRect& aSrcRect,
   1.488 +								DirectGdi::TGraphicsRotation aRotation)
   1.489 +	{
   1.490 +	switch (aRotation)
   1.491 +		{
   1.492 +		case DirectGdi::EGraphicsRotation90:
   1.493 +			{
   1.494 +			// Adjust the src rect to take account of the rotated bitmap			
   1.495 +			TRect rect = aSrcRect;
   1.496 +			rect.iBr.iX = aSrcRect.iTl.iX + aSrcRect.Height();
   1.497 +			rect.iBr.iY = aSrcRect.iTl.iY + aSrcRect.Width();
   1.498 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot90, rect);
   1.499 +			break;
   1.500 +			}
   1.501 +			
   1.502 +		case DirectGdi::EGraphicsRotation180:
   1.503 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot180, aSrcRect);
   1.504 +			break;
   1.505 +			
   1.506 +		case DirectGdi::EGraphicsRotation270:
   1.507 +			{
   1.508 +			// Adjust the src rect to take account of the rotated bitmap			
   1.509 +			TRect rect = aSrcRect;
   1.510 +			rect.iBr.iX = aSrcRect.iTl.iX + aSrcRect.Height();
   1.511 +			rect.iBr.iY = aSrcRect.iTl.iY + aSrcRect.Width();
   1.512 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRot270, rect);
   1.513 +			break;
   1.514 +			}
   1.515 +			
   1.516 +		default: // DirectGdi::EGraphicsRotationNone
   1.517 +			iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone, aSrcRect);
   1.518 +			break;
   1.519 +		}
   1.520 +	}
   1.521 +
   1.522 +void CTBitGdiContext::DrawResource(const TRect& aDestRect, 
   1.523 +								const TDrawableSourceAndEquivRotatedBmps& aSource, 
   1.524 +								const TDesC8& /*aParam*/)
   1.525 +	{			
   1.526 +	// NB we only support drawing drawable sources as images currently
   1.527 +	iGc->DrawBitmap(aDestRect, aSource.iBmpRotNone);		
   1.528 +	}
   1.529 +
   1.530 +TInt CTBitGdiContext::GetInterface(TUid /*aInterfaceId*/, TAny*& aInterface)
   1.531 +	{
   1.532 +	aInterface = NULL;
   1.533 +	return KErrNotSupported;	
   1.534 +	}
   1.535 +
   1.536 +void CTBitGdiContext::CopySettings(const CTContextBase& aGc)
   1.537 +	{
   1.538 +	CTBitGdiContext* gc = (CTBitGdiContext*)&aGc;
   1.539 +	iGc->CopySettings(*(gc->iGc));
   1.540 +	}