diff options
Diffstat (limited to 'libraries/evas/src/modules/engines/software_16_wince/evas_wince_ddraw_buffer.cpp')
-rw-r--r-- | libraries/evas/src/modules/engines/software_16_wince/evas_wince_ddraw_buffer.cpp | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/libraries/evas/src/modules/engines/software_16_wince/evas_wince_ddraw_buffer.cpp b/libraries/evas/src/modules/engines/software_16_wince/evas_wince_ddraw_buffer.cpp deleted file mode 100644 index 944ed53..0000000 --- a/libraries/evas/src/modules/engines/software_16_wince/evas_wince_ddraw_buffer.cpp +++ /dev/null | |||
@@ -1,195 +0,0 @@ | |||
1 | |||
2 | #include <cstdio> | ||
3 | |||
4 | #define WIN32_LEAN_AND_MEAN | ||
5 | #include <windows.h> | ||
6 | #undef WIN32_LEAN_AND_MEAN | ||
7 | #include <ddraw.h> | ||
8 | |||
9 | #include "evas_common.h" | ||
10 | #include "evas_engine.h" | ||
11 | |||
12 | |||
13 | typedef LONG (*fct_DirectDrawCreate)(LPGUID, LPUNKNOWN *, LPUNKNOWN *); | ||
14 | |||
15 | fct_DirectDrawCreate lib_DirectDrawCreate; | ||
16 | |||
17 | typedef struct Evas_Engine_WinCE_DDraw_Priv Evas_Engine_WinCE_DDraw_Priv; | ||
18 | |||
19 | struct Evas_Engine_WinCE_DDraw_Priv | ||
20 | { | ||
21 | HMODULE module; | ||
22 | LPDIRECTDRAW object; | ||
23 | LPDIRECTDRAWSURFACE surface; | ||
24 | int width; | ||
25 | int height; | ||
26 | int stride; | ||
27 | }; | ||
28 | |||
29 | void * | ||
30 | evas_software_wince_ddraw_init(HWND window, | ||
31 | int width, | ||
32 | int height) | ||
33 | { | ||
34 | DDSURFACEDESC surface_desc; | ||
35 | Evas_Engine_WinCE_DDraw_Priv *priv; | ||
36 | HRESULT res; | ||
37 | |||
38 | priv = (Evas_Engine_WinCE_DDraw_Priv *)malloc(sizeof(Evas_Engine_WinCE_DDraw_Priv)); | ||
39 | if (!priv) | ||
40 | return NULL; | ||
41 | |||
42 | priv->module = LoadLibrary(L"ddraw.dll"); | ||
43 | if (!priv->module) | ||
44 | { | ||
45 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not load ddraw.dll\n"); | ||
46 | goto free_priv; | ||
47 | } | ||
48 | |||
49 | lib_DirectDrawCreate = (fct_DirectDrawCreate)GetProcAddress(priv->module, L"DirectDrawCreate"); | ||
50 | if (!lib_DirectDrawCreate) | ||
51 | { | ||
52 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not initialize DirectDraw\n"); | ||
53 | goto free_lib; | ||
54 | } | ||
55 | |||
56 | res = lib_DirectDrawCreate(NULL, (IUnknown**)&priv->object, NULL); | ||
57 | if (FAILED(res)) | ||
58 | { | ||
59 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not create DirectDraw object\n"); | ||
60 | goto free_lib; | ||
61 | } | ||
62 | |||
63 | res = priv->object->SetCooperativeLevel(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); | ||
64 | if (FAILED(res)) | ||
65 | { | ||
66 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not set window to fullscreen\n"); | ||
67 | goto release_object; | ||
68 | } | ||
69 | |||
70 | memset(&surface_desc, 0, sizeof(surface_desc)); | ||
71 | surface_desc.dwSize = sizeof(surface_desc); | ||
72 | surface_desc.dwFlags = DDSD_CAPS; | ||
73 | surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; | ||
74 | |||
75 | res = priv->object->CreateSurface(&surface_desc, &priv->surface, NULL); | ||
76 | if (FAILED(res)) | ||
77 | { | ||
78 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not create surface\n"); | ||
79 | goto release_object; | ||
80 | } | ||
81 | |||
82 | memset(&surface_desc, 0, sizeof(surface_desc)); | ||
83 | surface_desc.dwSize = sizeof(surface_desc); | ||
84 | res = priv->surface->Lock(NULL, &surface_desc, DDLOCK_READONLY, NULL); | ||
85 | if (FAILED(res)) | ||
86 | { | ||
87 | fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not lock surface\n"); | ||
88 | goto release_surface; | ||
89 | } | ||
90 | |||
91 | priv->width = surface_desc.dwWidth; | ||
92 | priv->height = surface_desc.dwHeight; | ||
93 | priv->stride = surface_desc.lPitch / 2; | ||
94 | |||
95 | if ((priv->width != width) || | ||
96 | (priv->height != height)) | ||
97 | { | ||
98 | fprintf(stderr, "[Engine] [WinCE DDraw] Size mismatch\n"); | ||
99 | fprintf(stderr, "[Engine] [WinCE DDraw] asked : %dx%d\n", width, height); | ||
100 | fprintf(stderr, "[Engine] [WinCE DDraw] got : %dx%d\n", priv->width, priv->height); | ||
101 | goto release_surface; | ||
102 | } | ||
103 | |||
104 | res = priv->surface->Unlock(NULL); | ||
105 | if (FAILED(res)) | ||
106 | { | ||
107 | fprintf(stderr, "[Engine] [WinCE DDraw] Can not unlock surface\n"); | ||
108 | goto release_surface; | ||
109 | } | ||
110 | |||
111 | return priv; | ||
112 | |||
113 | release_surface: | ||
114 | priv->surface->Release(); | ||
115 | release_object: | ||
116 | priv->object->Release(); | ||
117 | free_lib: | ||
118 | FreeLibrary(priv->module); | ||
119 | free_priv: | ||
120 | free(priv); | ||
121 | |||
122 | return 0; | ||
123 | } | ||
124 | |||
125 | void | ||
126 | evas_software_wince_ddraw_shutdown(void *priv) | ||
127 | { | ||
128 | ((Evas_Engine_WinCE_DDraw_Priv *)priv)->surface->Release(); | ||
129 | ((Evas_Engine_WinCE_DDraw_Priv *)priv)->object->Release(); | ||
130 | FreeLibrary(((Evas_Engine_WinCE_DDraw_Priv *)priv)->module); | ||
131 | free(priv); | ||
132 | } | ||
133 | |||
134 | |||
135 | FB_Output_Buffer * | ||
136 | evas_software_wince_ddraw_output_buffer_new(void *priv, | ||
137 | int width, | ||
138 | int height) | ||
139 | { | ||
140 | FB_Output_Buffer *fbob; | ||
141 | void *buffer; | ||
142 | |||
143 | fbob = (FB_Output_Buffer *)calloc(1, sizeof(FB_Output_Buffer)); | ||
144 | if (!fbob) return NULL; | ||
145 | |||
146 | buffer = malloc (width * height * 2); /* we are sure to have 16bpp */ | ||
147 | if (!buffer) | ||
148 | { | ||
149 | free(fbob); | ||
150 | return NULL; | ||
151 | } | ||
152 | |||
153 | fbob->priv = priv; | ||
154 | |||
155 | fbob->im = (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), width, height, (DATA32 *)buffer, 0, EVAS_COLORSPACE_RGB565_A5P); | ||
156 | if (fbob->im) | ||
157 | fbob->im->stride = ((Evas_Engine_WinCE_DDraw_Priv *)priv)->stride; | ||
158 | |||
159 | return fbob; | ||
160 | } | ||
161 | |||
162 | void | ||
163 | evas_software_wince_ddraw_output_buffer_free(FB_Output_Buffer *fbob) | ||
164 | { | ||
165 | free(fbob->im->pixels); | ||
166 | free(fbob); | ||
167 | } | ||
168 | |||
169 | void | ||
170 | evas_software_wince_ddraw_output_buffer_paste(FB_Output_Buffer *fbob) | ||
171 | { | ||
172 | DDSURFACEDESC surface_desc; | ||
173 | Evas_Engine_WinCE_DDraw_Priv *priv; | ||
174 | HRESULT res; | ||
175 | |||
176 | priv = (Evas_Engine_WinCE_DDraw_Priv *)fbob->priv; | ||
177 | |||
178 | memset(&surface_desc, 0, sizeof(surface_desc)); | ||
179 | surface_desc.dwSize = sizeof(surface_desc); | ||
180 | res = priv->surface->Lock(NULL, &surface_desc, DDLOCK_WRITEONLY, NULL); | ||
181 | if (FAILED(res)) | ||
182 | return; | ||
183 | |||
184 | if ((fbob->im->cache_entry.w == surface_desc.dwWidth) && | ||
185 | (fbob->im->cache_entry.h == surface_desc.dwHeight)) | ||
186 | memcpy(surface_desc.lpSurface, fbob->im->pixels, | ||
187 | surface_desc.dwWidth * surface_desc.dwHeight * 2); | ||
188 | |||
189 | priv->surface->Unlock(NULL); | ||
190 | } | ||
191 | |||
192 | void | ||
193 | evas_software_wince_ddraw_surface_resize(FB_Output_Buffer *fbob) | ||
194 | { | ||
195 | } | ||