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.
32 This interface allows direct access to the pixel data of an image from user-side
33 code. It is intended for use by software implementations of functions in the
36 This interface is only supported if the image is or can be stored in system memory.
37 This is always the case on platforms without hardware acceleration and also on
38 platforms with Unified Memory Architecture (UMA) hardware accelerators.
43 enum { EInterfaceUid = 0x102858F0 };
48 Retrieves the base address of the pixel data in system memory.
50 @pre In builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE, the image has been prepared
51 for CPU access to its pixel data by a previous call to BeginDataAccess().
53 @return The base address of the pixel data in system memory.
54 @panic SGRES-ADAPTER 4 in debug builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE,
55 if the image has not been prepared for CPU access to its pixel data by
56 a previous call to BeginDataAccess().
58 virtual TAny* DataAddress() const = 0;
63 Retrieves the number of bytes between rows of the pixel data in system memory.
67 @return The number of bytes between rows of the pixel data in system memory.
69 virtual TInt DataStride() const = 0;
74 Marks the beginning of CPU access to the pixel data. This function must be
75 called before DataAddress() in builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE
76 and prepares the image for CPU access to its pixel data in system memory. Calls
77 to BeginDataAccess() must be coupled with subsequent calls to EndDataAccess().
79 @pre aCpuAccess is not ESgCpuAccessNone.
80 @pre The image has not been mapped for CPU access to its pixel data by a
81 call to RSgImage::MapReadOnly(), RSgImage::MapWriteOnly() or
82 RSgImage::MapReadWrite().
83 @pre The image has not been prepared for CPU access to its pixel data by a
84 call to BeginDataAccess().
85 @post The image is prepared for CPU access to its pixel data.
86 @param aCpuAccess Whether the pixel data is going to be only read, only
87 written or read and written by the CPU until the corresponding call
89 @return KErrNone if successful.
90 @return KErrArgument if aCpuAccess is ESgCpuAccessNone.
91 @return KErrInUse if the image was already mapped or prepared for CPU access
93 @return KErrNoMemory if there is not enough system memory.
95 virtual TInt BeginDataAccess(TSgCpuAccess aCpuAccess) = 0;
100 Marks the end of CPU access to the pixel data. This function must be called
101 when finished using the values returned by DataAddress() in builds with
102 SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE and ensures that, if the CPU has modified
103 the pixel data, any subsequent usage of the image by the GPU will reflect
104 its new state. Calls to EndDataAccess() must correspond to prior calls to
107 @pre The image has been prepared for CPU access to its pixel data by a
108 successful call to BeginDataAccess().
109 @post The image is no longer prepared for CPU access to its pixel data.
110 @return KErrNone if successful.
111 @return KErrGeneral if the image had not been prepared for CPU access to its
112 pixel data by a successful call to BeginDataAccess().
114 virtual TInt EndDataAccess() = 0;
118 #endif // SGIMAGE_SW_H