Rev 882 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 882 | Rev 1002 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | }; |
21 | }; |
22 | 22 | ||
Line 23... | Line 23... | ||
23 | pixmap_t* CreatePixmap(unsigned width, unsigned height, u32_t format, u32_t flags) |
23 | pixmap_t* CreatePixmap(unsigned width, unsigned height, u32_t format, u32_t flags) |
24 | { |
24 | { |
25 | pixmap_t *pixmap; |
25 | pixmap_t *pixmap; |
Line 26... | Line 26... | ||
26 | 26 | ||
27 | if( (width == 0) || ( width > 2048)|| |
27 | if( (width == 0) || ( width > 2048)|| |
28 | (height == 0) || (height > 2048)|| |
28 | (height == 0) || (height > 2048)|| |
29 | (format != PICT_a8r8g8b8)) |
29 | (format != PICT_a8r8g8b8)) |
Line 30... | Line 30... | ||
30 | return NULL; |
30 | return NULL; |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | pixmap = alloc_pixmap(); |
32 | pixmap = alloc_pixmap(); |
33 | 33 | ||
34 | if( pixmap ) |
34 | if( pixmap ) |
Line 35... | Line 35... | ||
35 | { |
35 | { |
36 | void *raw; |
36 | void *raw; |
37 | int pitch; |
37 | int pitch; |
38 | 38 | ||
Line 39... | Line 39... | ||
39 | pixmap->width = width; |
39 | pixmap->width = width; |
40 | pixmap->height = height; |
40 | pixmap->height = height; |
41 | pixmap->format = format; |
41 | pixmap->format = format; |
42 | pixmap->flags = flags; |
42 | pixmap->flags = flags; |
43 | 43 | ||
44 | if( (srv_hw2d != 0) && |
44 | if( (srv_hw2d != 0) && |
45 | ( (flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) |
45 | ( (flags & PX_MEM_MASK)==PX_MEM_LOCAL) ) |
46 | { |
46 | { |
47 | ioctl_t io; |
47 | ioctl_t io; |
48 | io.handle = srv_hw2d; |
48 | io.handle = srv_hw2d; |
49 | io.io_code = PX_CREATE; |
49 | io.io_code = PX_CREATE; |
50 | io.input = pixmap; |
50 | io.input = pixmap; |
51 | io.inp_size = 7; |
51 | io.inp_size = 7; |
52 | io.output = NULL; |
52 | io.output = NULL; |
53 | io.out_size = 0; |
- | |
54 | 53 | io.out_size = 0; |
|
55 | if (call_service(&io)==ERR_OK) |
54 | |
56 | return pixmap; |
55 | if (call_service(&io)==ERR_OK) |
57 | else |
56 | return pixmap; |
58 | { |
57 | else{ |
59 | free_pixmap(pixmap) ; |
58 | free_pixmap(pixmap) ; |
60 | return NULL; |
59 | return NULL; |
61 | } |
60 | } |
62 | } |
61 | } |
63 | else |
62 | else |
Line 64... | Line 63... | ||
64 | { |
63 | { |
65 | /* |
64 | /* |
Line 66... | Line 65... | ||
66 | Only system memory |
65 | Only system memory |
- | 66 | */ |
|
- | 67 | pixmap->flags &= ~PX_MEM_MASK; |
|
67 | */ |
68 | |
68 | pixmap->flags &= ~PX_MEM_MASK; |
69 | pitch = ((width+8)&~8)*4; |
69 | 70 | raw = UserAlloc(pitch * height); |
|
70 | pitch = ((width+8)&~8)*4; |
71 | |
71 | raw = UserAlloc(pitch * height); |
- | |
72 | - | ||
73 | if (! raw) |
- | |
74 | { |
72 | if ( !raw ){ |
75 | free_pixmap(pixmap); |
73 | free_pixmap(pixmap); |
76 | return NULL; |
74 | return NULL; |
77 | }; |
75 | }; |
Line 78... | Line 76... | ||
78 | pixmap->pitch = pitch; |
76 | pixmap->pitch = pitch; |
79 | pixmap->mapped = raw; |
77 | pixmap->mapped = raw; |
80 | }; |
78 | }; |