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.
22 #ifndef SGIMAGEADAPTER_H
23 #define SGIMAGEADAPTER_H
25 #include <graphics/sgresourceadapter.h>
26 #include <graphics/sgimage.h>
34 This interface must be implemented by all the user-side objects in the adaptation
35 layer of the Graphics subsystem which are referenced by instances of RSgImage.
36 The interface between the user-side and the kernel-side parts of the adaptation
37 layer is outside the scope of the specification of the Graphics Resource API.
41 class MSgImageAdapter: public MSgDrawableAdapter
49 Retrieves the values of the attributes of the image represented by this adapter
52 @param aInfo On input, the globally unique identifiers of the user-defined
53 attributes to be retrieved from the image, if any. On return, the values
54 of the attributes of the image and the values of the selected user-defined
56 @pre If aInfo.iUserAttributes is not null then it points to an array of
57 aInfo.iUserAttributeCount elements with globally unique identifiers
58 corresponding to user-defined attributes attached to the image.
59 @return KErrNone if successful.
60 @return KErrNotFound if any of the user-defined attributes to be retrieved from
61 the image cannot be found.
62 @see RSgImage::GetInfo()
64 virtual TInt GetInfo(TSgImageInfo& aInfo) const = 0;
70 Temporarily makes the pixel data of the image represented by this adapter object
71 accessible for reading by the CPU.
73 @param aDataAddress On return, the base address of the pixel data in the address
74 space of the calling process.
75 @param aDataStride On return, the number of bytes between rows of the pixel data.
76 @pre The image is not mapped yet.
77 @pre The image was created with CPU access ESgCpuAccessReadOnly or
78 ESgCpuAccessReadWrite.
79 @pre The image was created by the calling process.
80 @post The pixel data of the image is directly accessible in the address space
81 of the calling process for reading only, until Unmap() is called.
82 @return KErrNone if successful.
83 @return KErrInUse if the image is already mapped or in exclusive use by the GPU.
84 @return KErrAccessDenied if the image was not created with CPU access
85 ESgCpuAccessReadOnly or ESgCpuAccessReadWrite.
86 @return KErrPermissionDenied if the image was created by another process.
87 @return KErrNoMemory if there is not enough system memory.
88 @see RSgImage::MapReadOnly()
90 virtual TInt MapReadOnly(const TAny*& aDataAddress, TInt& aDataStride) = 0;
96 Temporarily makes the pixel data of the image represented by this adapter object
97 accessible for writing by the CPU.
99 @param aDataAddress On return, the base address of the pixel data in the address
100 space of the calling process.
101 @param aDataStride On return, the number of bytes between rows of the pixel data.
102 @pre The image is not mapped yet.
103 @pre The image was created with CPU access ESgCpuAccessWriteOnly or
104 ESgCpuAccessReadWrite.
105 @pre The image was created by the calling process.
106 @post The pixel data of the image is directly accessible in the address space
107 of the calling process for writing only, until Unmap() is called.
108 @return KErrNone if successful.
109 @return KErrInUse if the image is already mapped or in exclusive use by the GPU.
110 @return KErrAccessDenied if the image was not created with CPU access
111 ESgCpuAccessWriteOnly or ESgCpuAccessReadWrite.
112 @return KErrPermissionDenied if the image was created by another process.
113 @return KErrNoMemory if there is not enough system memory.
114 @see RSgImage::MapWriteOnly()
116 virtual TInt MapWriteOnly(TAny*& aDataAddress, TInt& aDataStride) = 0;
122 Temporarily makes the pixel data of the image represented by this adapter object
123 accessible for reading and writing by the CPU.
125 @param aDataAddress On return, the base address of the pixel data in the address
126 space of the calling process.
127 @param aDataStride On return, the number of bytes between rows of the pixel data.
128 @pre The image is not mapped yet.
129 @pre The image was created with CPU access ESgCpuAccessReadWrite.
130 @pre The image was created by the calling process.
131 @post The pixel data of the image is directly accessible in the address space
132 of the calling process for reading and writing, until Unmap() is called.
133 @return KErrNone if successful.
134 @return KErrInUse if the image is already mapped or in exclusive use by the GPU.
135 @return KErrAccessDenied if the image was not created with CPU access
136 ESgCpuAccessReadWrite.
137 @return KErrPermissionDenied if the image was created by another process.
138 @return KErrNoMemory if there is not enough system memory.
139 @see RSgImage::MapReadWrite()
141 virtual TInt MapReadWrite(TAny*& aDataAddress, TInt& aDataStride) = 0;
147 Makes the pixel data of the image represented by this adapter object no longer
148 accessible by the CPU.
150 @pre The image is mapped for CPU access by a previous call to MapReadOnly(),
151 MapWriteOnly() or MapReadWrite().
152 @post The GPU is guaranteed to be able to get access to the image.
153 @post The address range in the calling process used for the mapping is no longer
155 @return KErrNone if successful.
156 @return KErrGeneral if the image was not mapped for CPU access.
157 @see RSgImage::Unmap()
159 virtual TInt Unmap() = 0;
163 #endif // SGIMAGEADAPTER_H