1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#ifndef SURFACE_H
#define SURFACE_H
#include "qxldd.h"
static _inline UINT32 GetSurfaceIdFromInfo(SurfaceInfo *info)
{
PDev *pdev;
pdev = info->u.pdev;
if (info == &pdev->surface0_info) {
return 0;
}
return info - pdev->Res.surfaces_info;
}
static _inline SurfaceInfo *GetSurfaceInfo(PDev *pdev, UINT32 id)
{
if (id == 0) {
return &pdev->surface0_info;
}
return &pdev->Res.surfaces_info[id];
}
static _inline UINT32 GetSurfaceId(SURFOBJ *surf)
{
SurfaceInfo *surface;
surface = (SurfaceInfo *)surf->dhsurf;
return GetSurfaceIdFromInfo(surface);
}
static _inline void FreeSurface(PDev *pdev, UINT32 surface_id)
{
pdev->Res.surfaces_used[surface_id] = 0;
}
static UINT32 GetFreeSurface(PDev *pdev)
{
UINT32 x;
//not effective, fix me
for (x = 1; x < pdev->n_surfaces; ++x) {
if (!pdev->Res.surfaces_used[x]) {
pdev->Res.surfaces_used[x] = 1;
return x;
}
}
return 0;
}
enum {
DEVICE_BITMAP_ALLOCATION_TYPE_SURF0,
DEVICE_BITMAP_ALLOCATION_TYPE_DEVRAM,
DEVICE_BITMAP_ALLOCATION_TYPE_VRAM,
};
BOOL CreateDrawArea(PDev *pdev, UINT8 *base_mem, ULONG format, UINT32 cx, UINT32 cy, UINT32 stride,
UINT32 surface_id);
VOID FreeDrawArea(DrawArea *drawarea);
HBITMAP CreateDeviceBitmap(PDev *pdev, SIZEL size, ULONG format, QXLPHYSICAL *phys_mem,
UINT8 **base_mem, UINT32 surface_id, UINT8 allocation_type);
VOID DeleteDeviceBitmap(PDev *pdev, UINT32 surface_id, UINT8 allocation_type);
#endif
|