internetradio2.0/uisrc/irstationinfopicture.cpp
changeset 3 ee64f059b8e1
parent 2 2e1adbfc62af
child 4 3f2d53f144fe
child 5 0930554dc389
equal deleted inserted replaced
2:2e1adbfc62af 3:ee64f059b8e1
     1 /*
       
     2 * Copyright (c) 2009 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 #include <fbs.h>
       
    19 #include <w32std.h>
       
    20 #include <gdi.h>
       
    21 #include "irstationinfopicture.h"
       
    22 #include "irdebug.h"
       
    23 
       
    24 CIRStationInfoPicture::CIRStationInfoPicture(CWindowGc& gc,CFbsBitmap& aBitmap, 
       
    25 											 CFbsBitmap& aBitmapMask)
       
    26 											 :iBitmap(&aBitmap),iBitmapMask(&aBitmapMask)
       
    27 	
       
    28 	{
       
    29 	IRLOG_DEBUG( "CIRStationInfoPicture::CIRStationInfoPicture - Entering" );
       
    30 	TSize sizeInPixels = gc.Device()->SizeInPixels();
       
    31 	TSize sizeInTwips = gc.Device()->SizeInTwips();
       
    32 	TSize bitmapSizeInPixels = aBitmap.SizeInPixels();
       
    33 	iSizeInTwips = TSize(sizeInTwips.iWidth * bitmapSizeInPixels.iWidth / sizeInPixels.iWidth,
       
    34 		sizeInTwips.iHeight * bitmapSizeInPixels.iHeight / sizeInPixels.iHeight);
       
    35 	IRLOG_DEBUG( "CIRStationInfoPicture::CIRStationInfoPicture - Exiting" );
       
    36 	}
       
    37 
       
    38 
       
    39 void CIRStationInfoPicture::ExternalizeL(RWriteStream& ) const
       
    40 	{
       
    41 	IRLOG_DEBUG( "CIRStationInfoPicture::ExternalizeL" );
       
    42 	return;
       
    43 	}
       
    44 
       
    45 void CIRStationInfoPicture::GetOriginalSizeInTwips(TSize& aSize) const 
       
    46     { 
       
    47     aSize = iSizeInTwips; 
       
    48     }
       
    49 
       
    50 // The actual drawing code
       
    51 void CIRStationInfoPicture::Draw(CGraphicsContext&   aGc, 
       
    52 		                      	 const TPoint& 	     aTopLeft,
       
    53 		                      	 const TRect& 	     /*aClipRect*/,
       
    54 		                         MGraphicsDeviceMap* /*aMap*/) const
       
    55     {	
       
    56 	IRLOG_DEBUG( "CIRStationInfoPicture::Draw - Entering" );
       
    57 	CBitmapContext& gc = static_cast<CBitmapContext &>(aGc);
       
    58 	TRect bmpPieceRect(TPoint(0,0), iBitmap->SizeInPixels());
       
    59 	//the picture draw itself
       
    60 	gc.BitBltMasked(aTopLeft,iBitmap, bmpPieceRect,iBitmapMask, ETrue);
       
    61 	IRLOG_DEBUG( "CIRStationInfoPicture::ExternalizeL - Exiting" );
       
    62     }
       
    63 
       
    64 
       
    65