sl@0
|
1 |
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@internalTechnology
|
sl@0
|
19 |
@prototype
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef SGIMAGE_SW_H
|
sl@0
|
23 |
#define SGIMAGE_SW_H
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <e32def.h>
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
/**
|
sl@0
|
29 |
@internalTechnology
|
sl@0
|
30 |
@prototype
|
sl@0
|
31 |
|
sl@0
|
32 |
This interface allows direct access to the pixel data of an image from user-side
|
sl@0
|
33 |
code. It is intended for use by software implementations of functions in the
|
sl@0
|
34 |
Graphics subsystem.
|
sl@0
|
35 |
|
sl@0
|
36 |
This interface is only supported if the image is or can be stored in system memory.
|
sl@0
|
37 |
This is always the case on platforms without hardware acceleration and also on
|
sl@0
|
38 |
platforms with Unified Memory Architecture (UMA) hardware accelerators.
|
sl@0
|
39 |
*/
|
sl@0
|
40 |
class MSgImage_Sw
|
sl@0
|
41 |
{
|
sl@0
|
42 |
public:
|
sl@0
|
43 |
enum { EInterfaceUid = 0x102858F0 };
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
@internalTechnology
|
sl@0
|
46 |
@prototype
|
sl@0
|
47 |
|
sl@0
|
48 |
Retrieves the base address of the pixel data in system memory.
|
sl@0
|
49 |
|
sl@0
|
50 |
@pre In builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE, the image has been prepared
|
sl@0
|
51 |
for CPU access to its pixel data by a previous call to BeginDataAccess().
|
sl@0
|
52 |
@post None.
|
sl@0
|
53 |
@return The base address of the pixel data in system memory.
|
sl@0
|
54 |
@panic SGRES-ADAPTER 4 in debug builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE,
|
sl@0
|
55 |
if the image has not been prepared for CPU access to its pixel data by
|
sl@0
|
56 |
a previous call to BeginDataAccess().
|
sl@0
|
57 |
*/
|
sl@0
|
58 |
virtual TAny* DataAddress() const = 0;
|
sl@0
|
59 |
/**
|
sl@0
|
60 |
@internalTechnology
|
sl@0
|
61 |
@prototype
|
sl@0
|
62 |
|
sl@0
|
63 |
Retrieves the number of bytes between rows of the pixel data in system memory.
|
sl@0
|
64 |
|
sl@0
|
65 |
@pre None.
|
sl@0
|
66 |
@post None.
|
sl@0
|
67 |
@return The number of bytes between rows of the pixel data in system memory.
|
sl@0
|
68 |
*/
|
sl@0
|
69 |
virtual TInt DataStride() const = 0;
|
sl@0
|
70 |
/**
|
sl@0
|
71 |
@internalTechnology
|
sl@0
|
72 |
@prototype
|
sl@0
|
73 |
|
sl@0
|
74 |
Marks the beginning of CPU access to the pixel data. This function must be
|
sl@0
|
75 |
called before DataAddress() in builds with SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE
|
sl@0
|
76 |
and prepares the image for CPU access to its pixel data in system memory. Calls
|
sl@0
|
77 |
to BeginDataAccess() must be coupled with subsequent calls to EndDataAccess().
|
sl@0
|
78 |
|
sl@0
|
79 |
@pre aCpuAccess is not ESgCpuAccessNone.
|
sl@0
|
80 |
@pre The image has not been mapped for CPU access to its pixel data by a
|
sl@0
|
81 |
call to RSgImage::MapReadOnly(), RSgImage::MapWriteOnly() or
|
sl@0
|
82 |
RSgImage::MapReadWrite().
|
sl@0
|
83 |
@pre The image has not been prepared for CPU access to its pixel data by a
|
sl@0
|
84 |
call to BeginDataAccess().
|
sl@0
|
85 |
@post The image is prepared for CPU access to its pixel data.
|
sl@0
|
86 |
@param aCpuAccess Whether the pixel data is going to be only read, only
|
sl@0
|
87 |
written or read and written by the CPU until the corresponding call
|
sl@0
|
88 |
to EndDataAccess().
|
sl@0
|
89 |
@return KErrNone if successful.
|
sl@0
|
90 |
@return KErrArgument if aCpuAccess is ESgCpuAccessNone.
|
sl@0
|
91 |
@return KErrInUse if the image was already mapped or prepared for CPU access
|
sl@0
|
92 |
to its pixel data.
|
sl@0
|
93 |
@return KErrNoMemory if there is not enough system memory.
|
sl@0
|
94 |
*/
|
sl@0
|
95 |
virtual TInt BeginDataAccess(TSgCpuAccess aCpuAccess) = 0;
|
sl@0
|
96 |
/**
|
sl@0
|
97 |
@internalTechnology
|
sl@0
|
98 |
@prototype
|
sl@0
|
99 |
|
sl@0
|
100 |
Marks the end of CPU access to the pixel data. This function must be called
|
sl@0
|
101 |
when finished using the values returned by DataAddress() in builds with
|
sl@0
|
102 |
SYMBIAN_GRAPHICS_AUTOFLUSH_CACHE and ensures that, if the CPU has modified
|
sl@0
|
103 |
the pixel data, any subsequent usage of the image by the GPU will reflect
|
sl@0
|
104 |
its new state. Calls to EndDataAccess() must correspond to prior calls to
|
sl@0
|
105 |
BeginDataAccess().
|
sl@0
|
106 |
|
sl@0
|
107 |
@pre The image has been prepared for CPU access to its pixel data by a
|
sl@0
|
108 |
successful call to BeginDataAccess().
|
sl@0
|
109 |
@post The image is no longer prepared for CPU access to its pixel data.
|
sl@0
|
110 |
@return KErrNone if successful.
|
sl@0
|
111 |
@return KErrGeneral if the image had not been prepared for CPU access to its
|
sl@0
|
112 |
pixel data by a successful call to BeginDataAccess().
|
sl@0
|
113 |
*/
|
sl@0
|
114 |
virtual TInt EndDataAccess() = 0;
|
sl@0
|
115 |
};
|
sl@0
|
116 |
|
sl@0
|
117 |
|
sl@0
|
118 |
#endif // SGIMAGE_SW_H
|