os/graphics/graphicsdeviceinterface/directgdiadaptation/swsrc/swdirectgdiimagetargetimpl.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 "swdirectgdiimagetargetimpl.h"
17 #include "swdirectgdidriverimpl.h"
21 Constructs a CSwDirectGdiImageTargetImpl.
22 @param aDriver The driver implementation which created this target.
23 @param aDrawDevice A pointer to the draw device associated with this target.
24 This class takes ownership of aDrawDevice.
26 CSwDirectGdiImageTargetImpl::CSwDirectGdiImageTargetImpl(CSwDirectGdiDriverImpl& aDriver, CFbsDrawDevice* aDrawDevice):
28 iDrawDevice(aDrawDevice)
33 Destroys a CSwDirectGdiImageTargetImpl.
34 @post This image target is removed from the associated driver's list of target images.
36 CSwDirectGdiImageTargetImpl::~CSwDirectGdiImageTargetImpl()
38 iDriver.UnregisterTargetImage(*this);
43 Two-phase construction of a CSwDirectGdiImageTarget object.
45 @param aImage On success, holds a pointer to the newly-created image.
46 @param aDriver The driver to register this image with.
47 @param aDrawDevice The draw device to associate with this target. This target will take ownership
48 of the draw device if this method returns without an error, if the method returns with an error
49 then the caller still owns the draw device.
50 @param aSgImage The RSgImage which this image will be based upon.
52 @return KErrNone if successful, KErrNoMemory if not enough memory could be allocated, otherwise a return
53 value from Construct().
55 TInt CSwDirectGdiImageTargetImpl::New(CSwDirectGdiImageTargetImpl*& aImage, CSwDirectGdiDriverImpl& aDriver, CFbsDrawDevice* aDrawDevice, const RSgImage& aSgImage)
57 CSwDirectGdiImageTargetImpl* image = new CSwDirectGdiImageTargetImpl(aDriver, aDrawDevice);
60 TInt err = image->Construct(aSgImage);
65 image->iDrawDevice = NULL;
72 Obtains a draw device pointer that is associated with this target
73 @return A pointer to the draw device.
75 CFbsDrawDevice* CSwDirectGdiImageTargetImpl::DrawDevice() const
81 Gets the supplied image structure and sets the internal data. If it fails for any reason, it will
84 @param aSgImage The RSgImage to create the source image from.
85 @return KErrNone if successful, KErrNotSupported if the RSgImage doesn't have the required interface,
86 otherwise an error from CDirectGdiImageRef::Construct().
88 TInt CSwDirectGdiImageTargetImpl::Construct(const RSgImage& aSgImage)
90 TInt err = CDirectGdiImageRef::Construct(aSgImage);
94 err = iDriver.RegisterTargetImage(*this);