diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/modules/engines/software_16_wince/evas_wince_fb_buffer.c | 210 |
1 files changed, 0 insertions, 210 deletions
diff --git a/libraries/evas/src/modules/engines/software_16_wince/evas_wince_fb_buffer.c b/libraries/evas/src/modules/engines/software_16_wince/evas_wince_fb_buffer.c deleted file mode 100644 index 6a81bf4..0000000 --- a/libraries/evas/src/modules/engines/software_16_wince/evas_wince_fb_buffer.c +++ /dev/null | |||
@@ -1,210 +0,0 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_engine.h" | ||
3 | |||
4 | |||
5 | #define GETGXINFO 0x00020000 | ||
6 | |||
7 | typedef struct GXDeviceInfo | ||
8 | { | ||
9 | long Version; //00 (should filled with 100 before calling ExtEscape) | ||
10 | void *pvFrameBuffer; //04 | ||
11 | unsigned long cbStride; //08 | ||
12 | unsigned long cxWidth; //0c | ||
13 | unsigned long cyHeight; //10 | ||
14 | unsigned long cBPP; //14 | ||
15 | unsigned long ffFormat; //18 | ||
16 | char Unused[0x84 - 7 * 4]; | ||
17 | } GXDeviceInfo; | ||
18 | |||
19 | |||
20 | #define GETRAWFRAMEBUFFER 0x00020001 | ||
21 | |||
22 | typedef struct _RawFrameBufferInfo | ||
23 | { | ||
24 | WORD wFormat; | ||
25 | WORD wBPP; | ||
26 | VOID *pFramePointer; | ||
27 | int cxStride; | ||
28 | int cyStride; | ||
29 | int cxPixels; | ||
30 | int cyPixels; | ||
31 | } RawFrameBufferInfo; | ||
32 | |||
33 | |||
34 | typedef struct Evas_Engine_WinCE_FB_Priv Evas_Engine_WinCE_FB_Priv; | ||
35 | |||
36 | struct Evas_Engine_WinCE_FB_Priv | ||
37 | { | ||
38 | int width; | ||
39 | int height; | ||
40 | void *buffer; | ||
41 | }; | ||
42 | |||
43 | static int | ||
44 | _evas_software_wince_gxinfo_init(HDC dc, int *width, int *height, void **buffer) | ||
45 | { | ||
46 | GXDeviceInfo gxInfo = { 0 }; | ||
47 | int result; | ||
48 | |||
49 | gxInfo.Version = 100; | ||
50 | result = ExtEscape(dc, GETGXINFO, 0, NULL, sizeof(gxInfo), | ||
51 | (char *) &gxInfo); | ||
52 | if (result <= 0) | ||
53 | { | ||
54 | ERR("ExtEscape() with GETGXINFO failed"); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | *width = gxInfo.cyHeight; | ||
59 | *height = gxInfo.cxWidth; | ||
60 | *buffer = gxInfo.pvFrameBuffer; | ||
61 | |||
62 | return 1; | ||
63 | } | ||
64 | |||
65 | void * | ||
66 | evas_software_wince_fb_init(HWND window, | ||
67 | int width, | ||
68 | int height) | ||
69 | { | ||
70 | WCHAR oemstr[100]; | ||
71 | RawFrameBufferInfo rfbi; | ||
72 | HDC dc; | ||
73 | Evas_Engine_WinCE_FB_Priv *priv; | ||
74 | |||
75 | priv = (Evas_Engine_WinCE_FB_Priv *)malloc(sizeof(Evas_Engine_WinCE_FB_Priv)); | ||
76 | if (!priv) | ||
77 | return NULL; | ||
78 | |||
79 | dc = GetDC (window); | ||
80 | if (!dc) | ||
81 | { | ||
82 | ERR("Can not get DC"); | ||
83 | free(priv); | ||
84 | return NULL; | ||
85 | } | ||
86 | |||
87 | SystemParametersInfo (SPI_GETOEMINFO, sizeof (oemstr), oemstr, 0); | ||
88 | if (((oemstr[12] == 'H') && | ||
89 | (oemstr[13] == '3') && | ||
90 | (oemstr[14] == '8')) || | ||
91 | ((oemstr[12] == 'H') && | ||
92 | (oemstr[13] == '3') && | ||
93 | (oemstr[14] == '9'))) | ||
94 | { | ||
95 | if (!_evas_software_wince_gxinfo_init(dc, &priv->width, &priv->height, &priv->buffer)) | ||
96 | { | ||
97 | ReleaseDC(window, dc); | ||
98 | free(priv); | ||
99 | return NULL; | ||
100 | } | ||
101 | |||
102 | if ((priv->width != width) || | ||
103 | (priv->height != height)) | ||
104 | { | ||
105 | ERR("Size mismatch: asked: %dx%d, got: %dx%d", | ||
106 | width, height, priv->width, priv->height); | ||
107 | ReleaseDC(window, dc); | ||
108 | free(priv); | ||
109 | return NULL; | ||
110 | } | ||
111 | |||
112 | ReleaseDC(window, dc); | ||
113 | |||
114 | return priv; | ||
115 | } | ||
116 | |||
117 | if (!ExtEscape(dc, GETRAWFRAMEBUFFER, 0, 0, sizeof(rfbi), (char *) &rfbi)|| | ||
118 | (rfbi.wBPP != 16) || | ||
119 | (rfbi.wFormat != 1)) | ||
120 | { | ||
121 | ERR("ExtEscape() with GETRAWFRAMEBUFFER failed. " | ||
122 | "Trying ExtEscape() with GETGXINFO"); | ||
123 | if (!_evas_software_wince_gxinfo_init(dc, &priv->width, &priv->height, &priv->buffer)) | ||
124 | { | ||
125 | ReleaseDC(window, dc); | ||
126 | free(priv); | ||
127 | return NULL; | ||
128 | } | ||
129 | |||
130 | ReleaseDC(window, dc); | ||
131 | return priv; | ||
132 | } | ||
133 | |||
134 | priv->width = rfbi.cxPixels; | ||
135 | priv->height = rfbi.cyPixels; | ||
136 | priv->buffer = rfbi.pFramePointer; | ||
137 | |||
138 | if ((priv->width != width) || | ||
139 | (priv->height != height)) | ||
140 | { | ||
141 | ERR("Size mismatch: asked: %dx%d, got: %dx%d", | ||
142 | width, height, priv->width, priv->height); | ||
143 | ReleaseDC(window, dc); | ||
144 | free(priv); | ||
145 | return NULL; | ||
146 | } | ||
147 | |||
148 | ReleaseDC(window, dc); | ||
149 | |||
150 | return priv; | ||
151 | } | ||
152 | |||
153 | void | ||
154 | evas_software_wince_fb_shutdown(void *priv) | ||
155 | { | ||
156 | free(priv); | ||
157 | } | ||
158 | |||
159 | |||
160 | FB_Output_Buffer * | ||
161 | evas_software_wince_fb_output_buffer_new(void *priv, | ||
162 | int width, | ||
163 | int height) | ||
164 | { | ||
165 | FB_Output_Buffer *fbob; | ||
166 | void *buffer; | ||
167 | |||
168 | fbob = calloc(1, sizeof(FB_Output_Buffer)); | ||
169 | if (!fbob) return NULL; | ||
170 | |||
171 | buffer = malloc (width * height * 2); /* we are sure to have 16bpp */ | ||
172 | if (!buffer) | ||
173 | { | ||
174 | free(fbob); | ||
175 | return NULL; | ||
176 | } | ||
177 | |||
178 | fbob->priv = priv; | ||
179 | |||
180 | fbob->im = (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), width, height, (DATA32 *)buffer, 0, EVAS_COLORSPACE_RGB565_A5P); | ||
181 | if (fbob->im) | ||
182 | fbob->im->stride = width; | ||
183 | |||
184 | return fbob; | ||
185 | } | ||
186 | |||
187 | void | ||
188 | evas_software_wince_fb_output_buffer_free(FB_Output_Buffer *fbob) | ||
189 | { | ||
190 | free(fbob->im->pixels); | ||
191 | free(fbob); | ||
192 | } | ||
193 | |||
194 | void | ||
195 | evas_software_wince_fb_output_buffer_paste(FB_Output_Buffer *fbob) | ||
196 | { | ||
197 | Evas_Engine_WinCE_FB_Priv *priv; | ||
198 | |||
199 | priv = (Evas_Engine_WinCE_FB_Priv *)fbob->priv; | ||
200 | |||
201 | if ((fbob->im->cache_entry.w == priv->width) && | ||
202 | (fbob->im->cache_entry.h == priv->height)) | ||
203 | memcpy(priv->buffer, fbob->im->pixels, | ||
204 | priv->width * priv->height * 2); | ||
205 | } | ||
206 | |||
207 | void | ||
208 | evas_software_wince_fb_surface_resize(FB_Output_Buffer *fbob) | ||
209 | { | ||
210 | } | ||