Rev 877 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
877 | serge | 1 | |
2 | { |
||
3 | local_pixmap_t *pixmap; |
||
4 | |||
5 | |||
6 | size_t size; |
||
7 | |||
8 | |||
9 | |||
10 | |||
11 | (io->height == 0)|| (io->height > 2048)) |
||
12 | { |
||
13 | dbgprintf("Invalid pixmap size w:%d h:%d\n", io->width,io->height); |
||
14 | return ERR_PARAM; |
||
15 | }; |
||
16 | |||
17 | |||
18 | size = pitch*io->height; |
||
19 | |||
20 | |||
21 | |||
22 | |||
23 | if ( !local) |
||
24 | { |
||
25 | dbgprintf("Not enough memory for pixmap\n"); |
||
26 | return ERR_PARAM; |
||
27 | }; |
||
28 | |||
29 | |||
30 | if(!pixmap) |
||
31 | { |
||
32 | rhd_mem_free(&rhd, RHD_MEM_FB,local); |
||
33 | return ERR_PARAM; |
||
34 | } |
||
35 | else |
||
36 | { |
||
37 | void *mapped; |
||
38 | |||
39 | |||
40 | |||
41 | |||
42 | { |
||
43 | CommitPages(mapped, ((u32_t)local+rhd.LinearAddr)|7|(1<<9), size); |
||
881 | serge | 44 | |
877 | serge | 45 | |
46 | io->pitch = pitch; |
||
47 | io->handle = (u32_t)pixmap; |
||
48 | |||
49 | |||
50 | pixmap->height = io->height; |
||
51 | pixmap->format = PICT_a8r8g8b8; |
||
52 | pixmap->flags = io->flags; |
||
53 | pixmap->pitch = pitch; |
||
54 | pixmap->mapped = mapped; |
||
55 | pixmap->pitch_offset = ((pitch/64)<<22)| (((u32_t)local+rhd.fbLocation)>>10); |
||
881 | serge | 56 | pixmap->local = local; |
877 | serge | 57 | |
58 | |||
59 | dbgprintf("width: %d height: %d\n",pixmap->width,pixmap->height ); |
||
60 | dbgprintf("map at %x\n", pixmap->mapped); |
||
61 | |||
62 | |||
63 | }; |
||
64 | rhd_mem_free(&rhd, RHD_MEM_FB,local); |
||
65 | free(pixmap); |
||
66 | }; |
||
67 | return ERR_PARAM; |
||
68 | }; |
||
69 | |||
70 | |||
71 | |||
72 | { |
||
73 | local_pixmap_t *pixmap; |
||
74 | size_t size; |
||
75 | |||
76 | |||
77 | |||
78 | |||
79 | return ERR_PARAM; |
||
80 | else |
||
81 | pixmap = (local_pixmap_t*)io->handle; |
||
82 | |||
83 | |||
84 | |||
85 | |||
86 | UserFree(pixmap->mapped); |
||
87 | |||
88 | |||
89 | free(pixmap); |
||
90 | |||
91 | |||
92 | io->pitch = 0; |
||
93 | io->mapped = NULL; |
||
94 | io->handle = 0; |
||
95 | |||
96 | |||
97 | };22)|><22)|>9),><9),> |
||
98 |