|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 @prototype |
|
20 */ |
|
21 |
|
22 #ifndef SGIMAGE_SW_H |
|
23 #define SGIMAGE_SW_H |
|
24 |
|
25 #include <e32def.h> |
|
26 |
|
27 |
|
28 /** |
|
29 @internalTechnology |
|
30 @prototype |
|
31 |
|
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 |
|
34 Graphics subsystem. |
|
35 |
|
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. |
|
39 */ |
|
40 class MSgImage_Sw |
|
41 { |
|
42 public: |
|
43 enum { EInterfaceUid = 0x102858F0 }; |
|
44 /** |
|
45 @internalTechnology |
|
46 @prototype |
|
47 |
|
48 Retrieves the base address of the pixel data in system memory. |
|
49 |
|
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(). |
|
52 @post None. |
|
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(). |
|
57 */ |
|
58 virtual TAny* DataAddress() const = 0; |
|
59 /** |
|
60 @internalTechnology |
|
61 @prototype |
|
62 |
|
63 Retrieves the number of bytes between rows of the pixel data in system memory. |
|
64 |
|
65 @pre None. |
|
66 @post None. |
|
67 @return The number of bytes between rows of the pixel data in system memory. |
|
68 */ |
|
69 virtual TInt DataStride() const = 0; |
|
70 /** |
|
71 @internalTechnology |
|
72 @prototype |
|
73 |
|
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(). |
|
78 |
|
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 |
|
88 to EndDataAccess(). |
|
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 |
|
92 to its pixel data. |
|
93 @return KErrNoMemory if there is not enough system memory. |
|
94 */ |
|
95 virtual TInt BeginDataAccess(TSgCpuAccess aCpuAccess) = 0; |
|
96 /** |
|
97 @internalTechnology |
|
98 @prototype |
|
99 |
|
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 |
|
105 BeginDataAccess(). |
|
106 |
|
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(). |
|
113 */ |
|
114 virtual TInt EndDataAccess() = 0; |
|
115 }; |
|
116 |
|
117 |
|
118 #endif // SGIMAGE_SW_H |