os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiimagesourceimpl.cpp
Update contrib.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #include "swdirectgdiimagesourceimpl.h"
17 #include "swdirectgdidriverimpl.h"
18 #include <graphics/sgimage_sw.h>
21 Constructs a CSwDirectGdiImageTargetImpl
22 @param aDriver The driver implementation which created this target.
24 CSwDirectGdiImageSourceImpl::CSwDirectGdiImageSourceImpl(CSwDirectGdiDriverImpl& aDriver) :
30 Destroys a CSwDirectGdiImageSourceImpl.
32 @post This image source is removed from the associated driver's list of source images.
34 CSwDirectGdiImageSourceImpl::~CSwDirectGdiImageSourceImpl()
36 iDriver.UnregisterSourceImage(*this);
40 Two-phase construction of a CDirectGdiImageSourceImpl object.
41 @param aImage On success, holds a pointer to the newly-created image.
42 @param aDriver The driver to register this image with.
43 @param aSgImage The RSgImage which this image will be based upon.
44 @return KErrNone if successful, KErrNoMemory if not enough memory could be allocated, otherwise a return
45 value from Construct().
47 TInt CSwDirectGdiImageSourceImpl::New(CSwDirectGdiImageSourceImpl*& aImage, CSwDirectGdiDriverImpl& aDriver, const RSgImage& aSgImage)
49 CSwDirectGdiImageSourceImpl* image = new CSwDirectGdiImageSourceImpl(aDriver);
52 TInt err = image->Construct(aSgImage);
61 Gets the supplied image structure and sets the internal data.
62 @param aSgImage The RSgImage to create the source image from.
63 @return KErrNone if successful, KErrNotSupported if the RSgImage doesn't have the required interface,
64 otherwise an error from CDirectGdiImageRef::Construct().
66 TInt CSwDirectGdiImageSourceImpl::Construct(const RSgImage& aSgImage)
68 TInt err = CDirectGdiImageRef::Construct(aSgImage);
70 MSgImage_Sw* pImage = NULL;
73 RSgImage image = Image();
74 err = image.GetInterface(pImage);
79 err = iDriver.RegisterSourceImage(*this);
84 iDataBuffer = pImage->DataAddress();
85 iStride = pImage->DataStride();