summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2018-02-07 22:10:24 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-02-07 22:20:20 +0900
commitd54f0f66cf1faca39816ed9daf7656fb4819d96e (patch)
tree2ac4fa83a78928a27023ea5bb419cdabb906c3aa
parent000d43b29e2cfff039e46c7de676f33dbdeb6949 (diff)
Evas: remove depth usage in GDI and DirectDraw engines
Test Plan: compilation and elementary_test Reviewers: raster Reviewed By: raster Subscribers: cedric, raster Differential Revision: https://phab.enlightenment.org/D5792
-rw-r--r--src/modules/ecore_evas/engines/win32/ecore_evas_win32.c2
-rw-r--r--src/modules/evas/engines/software_ddraw/Evas_Engine_Software_DDraw.h1
-rw-r--r--src/modules/evas/engines/software_ddraw/evas_ddraw_buffer.c17
-rw-r--r--src/modules/evas/engines/software_ddraw/evas_ddraw_main.cpp18
-rw-r--r--src/modules/evas/engines/software_ddraw/evas_engine.c2
-rw-r--r--src/modules/evas/engines/software_ddraw/evas_engine.h18
-rw-r--r--src/modules/evas/engines/software_ddraw/evas_outbuf.c155
-rw-r--r--src/modules/evas/engines/software_gdi/Evas_Engine_Software_Gdi.h1
-rw-r--r--src/modules/evas/engines/software_gdi/evas_engine.c13
-rw-r--r--src/modules/evas/engines/software_gdi/evas_engine.h11
-rw-r--r--src/modules/evas/engines/software_gdi/evas_gdi_buffer.c13
-rw-r--r--src/modules/evas/engines/software_gdi/evas_gdi_main.c33
-rw-r--r--src/modules/evas/engines/software_gdi/evas_outbuf.c168
13 files changed, 74 insertions, 378 deletions
diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
index 46c795b60b..a9e2d7b03e 100644
--- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
+++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c
@@ -1334,7 +1334,6 @@ _ecore_evas_engine_software_gdi_init(Ecore_Evas *ee)
1334 { 1334 {
1335 /* FIXME: REDRAW_DEBUG missing for now */ 1335 /* FIXME: REDRAW_DEBUG missing for now */
1336 einfo->info.window = ((Ecore_Win32_Window *)ee->prop.window)->window; 1336 einfo->info.window = ((Ecore_Win32_Window *)ee->prop.window)->window;
1337 einfo->info.depth = ecore_win32_screen_depth_get();
1338 einfo->info.rotation = 0; 1337 einfo->info.rotation = 0;
1339 einfo->info.borderless = 0; 1338 einfo->info.borderless = 0;
1340 einfo->info.fullscreen = 0; 1339 einfo->info.fullscreen = 0;
@@ -1377,7 +1376,6 @@ _ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee)
1377 { 1376 {
1378 /* FIXME: REDRAW_DEBUG missing for now */ 1377 /* FIXME: REDRAW_DEBUG missing for now */
1379 einfo->info.window = ((Ecore_Win32_Window *)ee->prop.window)->window; 1378 einfo->info.window = ((Ecore_Win32_Window *)ee->prop.window)->window;
1380 einfo->info.depth = ecore_win32_screen_depth_get();
1381 einfo->info.rotation = 0; 1379 einfo->info.rotation = 0;
1382 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) 1380 if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo))
1383 { 1381 {
diff --git a/src/modules/evas/engines/software_ddraw/Evas_Engine_Software_DDraw.h b/src/modules/evas/engines/software_ddraw/Evas_Engine_Software_DDraw.h
index 9735bb7c8b..bc2b69d291 100644
--- a/src/modules/evas/engines/software_ddraw/Evas_Engine_Software_DDraw.h
+++ b/src/modules/evas/engines/software_ddraw/Evas_Engine_Software_DDraw.h
@@ -17,7 +17,6 @@ struct _Evas_Engine_Info_Software_DDraw
17 17
18 struct { 18 struct {
19 HWND window; 19 HWND window;
20 int depth;
21 int rotation; 20 int rotation;
22 unsigned int fullscreen : 1; 21 unsigned int fullscreen : 1;
23 } info; 22 } info;
diff --git a/src/modules/evas/engines/software_ddraw/evas_ddraw_buffer.c b/src/modules/evas/engines/software_ddraw/evas_ddraw_buffer.c
index 3b94686d68..0886e37bb3 100644
--- a/src/modules/evas/engines/software_ddraw/evas_ddraw_buffer.c
+++ b/src/modules/evas/engines/software_ddraw/evas_ddraw_buffer.c
@@ -5,8 +5,7 @@
5 5
6 6
7DD_Output_Buffer * 7DD_Output_Buffer *
8evas_software_ddraw_output_buffer_new(int depth, 8evas_software_ddraw_output_buffer_new(int width,
9 int width,
10 int height, 9 int height,
11 void *data) 10 void *data)
12{ 11{
@@ -16,10 +15,9 @@ evas_software_ddraw_output_buffer_new(int depth,
16 if (!ddob) return NULL; 15 if (!ddob) return NULL;
17 16
18 ddob->data = data; 17 ddob->data = data;
19 ddob->depth = depth;
20 ddob->width = width; 18 ddob->width = width;
21 ddob->height = height; 19 ddob->height = height;
22 ddob->pitch = width * depth / 8; 20 ddob->pitch = width * 4;
23 ddob->psize = ddob->pitch * height; 21 ddob->psize = ddob->pitch * height;
24 22
25 if (!ddob->data) 23 if (!ddob->data)
@@ -48,7 +46,6 @@ evas_software_ddraw_output_buffer_paste(DD_Output_Buffer *ddob,
48 int ddraw_width, 46 int ddraw_width,
49 int ddraw_height, 47 int ddraw_height,
50 int ddraw_pitch, 48 int ddraw_pitch,
51 int ddraw_depth,
52 int x, 49 int x,
53 int y) 50 int y)
54{ 51{
@@ -69,9 +66,9 @@ evas_software_ddraw_output_buffer_paste(DD_Output_Buffer *ddob,
69 height = ((y + ddob->height) > ddraw_height) 66 height = ((y + ddob->height) > ddraw_height)
70 ? ddraw_height - y 67 ? ddraw_height - y
71 : ddob->height; 68 : ddob->height;
72 pitch = width * ddob->depth / 8; 69 pitch = width * 4;
73 70
74 dd_data = (DATA8 *)ddraw_data + y * ddraw_pitch + x * ddraw_depth; 71 dd_data = (DATA8 *)ddraw_data + y * ddraw_pitch + x * 32;
75 evas_data = (unsigned char *)ddob->data; 72 evas_data = (unsigned char *)ddob->data;
76 for (j = 0; j < height; j++, evas_data += ddob->pitch, dd_data += ddraw_pitch) 73 for (j = 0; j < height; j++, evas_data += ddob->pitch, dd_data += ddraw_pitch)
77 memcpy(dd_data, evas_data, pitch); 74 memcpy(dd_data, evas_data, pitch);
@@ -84,9 +81,3 @@ evas_software_ddraw_output_buffer_data(DD_Output_Buffer *ddob,
84 if (bytes_per_line_ret) *bytes_per_line_ret = ddob->pitch; 81 if (bytes_per_line_ret) *bytes_per_line_ret = ddob->pitch;
85 return ddob->data; 82 return ddob->data;
86} 83}
87
88int
89evas_software_ddraw_output_buffer_depth(DD_Output_Buffer *ddob)
90{
91 return ddob->depth;
92}
diff --git a/src/modules/evas/engines/software_ddraw/evas_ddraw_main.cpp b/src/modules/evas/engines/software_ddraw/evas_ddraw_main.cpp
index 2d98a04586..5d11b94124 100644
--- a/src/modules/evas/engines/software_ddraw/evas_ddraw_main.cpp
+++ b/src/modules/evas/engines/software_ddraw/evas_ddraw_main.cpp
@@ -3,7 +3,6 @@
3 3
4int 4int
5evas_software_ddraw_init (HWND window, 5evas_software_ddraw_init (HWND window,
6 int depth,
7 int fullscreen, 6 int fullscreen,
8 Outbuf *buf) 7 Outbuf *buf)
9{ 8{
@@ -38,12 +37,10 @@ evas_software_ddraw_init (HWND window,
38 pixel_format.dwSize = sizeof(pixel_format); 37 pixel_format.dwSize = sizeof(pixel_format);
39 buf->priv.dd.surface_primary->GetPixelFormat(&pixel_format); 38 buf->priv.dd.surface_primary->GetPixelFormat(&pixel_format);
40 39
41 if (pixel_format.dwRGBBitCount != (DWORD)depth) 40 if (pixel_format.dwRGBBitCount != 32)
42 goto release_object; 41 goto release_object;
43 42
44 buf->priv.dd.depth = depth; 43 res = buf->priv.dd.object->SetDisplayMode(width, height, 32);
45
46 res = buf->priv.dd.object->SetDisplayMode(width, height, depth);
47 if (FAILED(res)) 44 if (FAILED(res))
48 goto release_object; 45 goto release_object;
49 46
@@ -54,7 +51,8 @@ evas_software_ddraw_init (HWND window,
54 surface_desc.dwBackBufferCount = 1; 51 surface_desc.dwBackBufferCount = 1;
55 52
56 res = buf->priv.dd.object->CreateSurface(&surface_desc, 53 res = buf->priv.dd.object->CreateSurface(&surface_desc,
57 &buf->priv.dd.surface_primary, NULL); 54 &buf->priv.dd.surface_primary,
55 NULL);
58 if (FAILED(res)) 56 if (FAILED(res))
59 goto release_object; 57 goto release_object;
60 58
@@ -116,10 +114,8 @@ evas_software_ddraw_init (HWND window,
116 pixel_format.dwSize = sizeof(pixel_format); 114 pixel_format.dwSize = sizeof(pixel_format);
117 buf->priv.dd.surface_primary->GetPixelFormat(&pixel_format); 115 buf->priv.dd.surface_primary->GetPixelFormat(&pixel_format);
118 116
119 if (pixel_format.dwRGBBitCount != (DWORD)depth) 117 if (pixel_format.dwRGBBitCount != 32)
120 goto release_surface_back; 118 goto release_surface_back;
121
122 buf->priv.dd.depth = depth;
123 } 119 }
124 120
125 return 1; 121 return 1;
@@ -177,8 +173,7 @@ void *
177evas_software_ddraw_lock(Outbuf *buf, 173evas_software_ddraw_lock(Outbuf *buf,
178 int *ddraw_width, 174 int *ddraw_width,
179 int *ddraw_height, 175 int *ddraw_height,
180 int *ddraw_pitch, 176 int *ddraw_pitch)
181 int *ddraw_depth)
182{ 177{
183 DDSURFACEDESC surface_desc; 178 DDSURFACEDESC surface_desc;
184 179
@@ -194,7 +189,6 @@ evas_software_ddraw_lock(Outbuf *buf,
194 *ddraw_width = surface_desc.dwWidth; 189 *ddraw_width = surface_desc.dwWidth;
195 *ddraw_height = surface_desc.dwHeight; 190 *ddraw_height = surface_desc.dwHeight;
196 *ddraw_pitch = surface_desc.lPitch; 191 *ddraw_pitch = surface_desc.lPitch;
197 *ddraw_depth = surface_desc.ddpfPixelFormat.dwRGBBitCount >> 3;
198 192
199 return surface_desc.lpSurface; 193 return surface_desc.lpSurface;
200} 194}
diff --git a/src/modules/evas/engines/software_ddraw/evas_engine.c b/src/modules/evas/engines/software_ddraw/evas_engine.c
index 44e0f725f2..f74fe72f13 100644
--- a/src/modules/evas/engines/software_ddraw/evas_engine.c
+++ b/src/modules/evas/engines/software_ddraw/evas_engine.c
@@ -34,9 +34,7 @@ eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
34 34
35 ob = evas_software_ddraw_outbuf_setup(w, h, 35 ob = evas_software_ddraw_outbuf_setup(w, h,
36 info->info.rotation, 36 info->info.rotation,
37 OUTBUF_DEPTH_INHERIT,
38 info->info.window, 37 info->info.window,
39 info->info.depth,
40 info->info.fullscreen); 38 info->info.fullscreen);
41 if (!ob) goto on_error; 39 if (!ob) goto on_error;
42 40
diff --git a/src/modules/evas/engines/software_ddraw/evas_engine.h b/src/modules/evas/engines/software_ddraw/evas_engine.h
index aac482f034..0d050bfb80 100644
--- a/src/modules/evas/engines/software_ddraw/evas_engine.h
+++ b/src/modules/evas/engines/software_ddraw/evas_engine.h
@@ -5,6 +5,7 @@
5#define WIN32_LEAN_AND_MEAN 5#define WIN32_LEAN_AND_MEAN
6#include <windows.h> 6#include <windows.h>
7#undef WIN32_LEAN_AND_MEAN 7#undef WIN32_LEAN_AND_MEAN
8
8#include <ddraw.h> 9#include <ddraw.h>
9 10
10#include "../software_generic/Evas_Engine_Software_Generic.h" 11#include "../software_generic/Evas_Engine_Software_Generic.h"
@@ -14,7 +15,6 @@ typedef struct _DD_Output_Buffer DD_Output_Buffer;
14 15
15struct _Outbuf 16struct _Outbuf
16{ 17{
17 Outbuf_Depth depth;
18 int width; 18 int width;
19 int height; 19 int height;
20 int rot; 20 int rot;
@@ -28,7 +28,6 @@ struct _Outbuf
28 LPDIRECTDRAWSURFACE surface_primary; 28 LPDIRECTDRAWSURFACE surface_primary;
29 LPDIRECTDRAWSURFACE surface_back; 29 LPDIRECTDRAWSURFACE surface_back;
30 LPDIRECTDRAWCLIPPER clipper; 30 LPDIRECTDRAWCLIPPER clipper;
31 int depth;
32 unsigned char fullscreen : 1; 31 unsigned char fullscreen : 1;
33 unsigned char swap : 1; 32 unsigned char swap : 1;
34 unsigned char bit_swap : 1; 33 unsigned char bit_swap : 1;
@@ -67,7 +66,6 @@ struct _DD_Output_Buffer
67 void *data; 66 void *data;
68 int width; 67 int width;
69 int height; 68 int height;
70 int depth;
71 int pitch; 69 int pitch;
72 int psize; 70 int psize;
73}; 71};
@@ -108,9 +106,7 @@ void evas_software_ddraw_outbuf_free(Outbuf *buf);
108Outbuf *evas_software_ddraw_outbuf_setup(int width, 106Outbuf *evas_software_ddraw_outbuf_setup(int width,
109 int height, 107 int height,
110 int rotation, 108 int rotation,
111 Outbuf_Depth depth,
112 HWND window, 109 HWND window,
113 int w_depth,
114 int fullscreen); 110 int fullscreen);
115 111
116void evas_software_ddraw_outbuf_reconfigure(Outbuf *buf, 112void evas_software_ddraw_outbuf_reconfigure(Outbuf *buf,
@@ -144,14 +140,11 @@ int evas_software_ddraw_outbuf_width_get(Outbuf *buf);
144 140
145int evas_software_ddraw_outbuf_height_get(Outbuf *buf); 141int evas_software_ddraw_outbuf_height_get(Outbuf *buf);
146 142
147Outbuf_Depth evas_software_ddraw_outbuf_depth_get(Outbuf *buf);
148
149int evas_software_ddraw_outbuf_rot_get(Outbuf *buf); 143int evas_software_ddraw_outbuf_rot_get(Outbuf *buf);
150 144
151/* evas_ddraw_buffer.c */ 145/* evas_ddraw_buffer.c */
152 146
153DD_Output_Buffer *evas_software_ddraw_output_buffer_new(int depth, 147DD_Output_Buffer *evas_software_ddraw_output_buffer_new(int width,
154 int width,
155 int height, 148 int height,
156 void *data); 149 void *data);
157 150
@@ -162,15 +155,12 @@ void evas_software_ddraw_output_buffer_paste(DD_Output_Buffer *ddob,
162 int ddraw_width, 155 int ddraw_width,
163 int ddraw_height, 156 int ddraw_height,
164 int ddraw_pitch, 157 int ddraw_pitch,
165 int ddraw_depth,
166 int x, 158 int x,
167 int y); 159 int y);
168 160
169DATA8 *evas_software_ddraw_output_buffer_data(DD_Output_Buffer *ddob, 161DATA8 *evas_software_ddraw_output_buffer_data(DD_Output_Buffer *ddob,
170 int *bytes_per_line_ret); 162 int *bytes_per_line_ret);
171 163
172int evas_software_ddraw_output_buffer_depth(DD_Output_Buffer *ddob);
173
174/* evas_ddraw_main.cpp */ 164/* evas_ddraw_main.cpp */
175 165
176#ifdef __cplusplus 166#ifdef __cplusplus
@@ -178,7 +168,6 @@ extern "C" {
178#endif 168#endif
179 169
180int evas_software_ddraw_init (HWND window, 170int evas_software_ddraw_init (HWND window,
181 int depth,
182 int fullscreen, 171 int fullscreen,
183 Outbuf *buf); 172 Outbuf *buf);
184 173
@@ -189,8 +178,7 @@ int evas_software_ddraw_masks_get(Outbuf *buf);
189void *evas_software_ddraw_lock(Outbuf *buf, 178void *evas_software_ddraw_lock(Outbuf *buf,
190 int *ddraw_width, 179 int *ddraw_width,
191 int *ddraw_height, 180 int *ddraw_height,
192 int *ddraw_pitch, 181 int *ddraw_pitch);
193 int *ddraw_depth);
194 182
195void evas_software_ddraw_unlock_and_flip(Outbuf *buf); 183void evas_software_ddraw_unlock_and_flip(Outbuf *buf);
196 184
diff --git a/src/modules/evas/engines/software_ddraw/evas_outbuf.c b/src/modules/evas/engines/software_ddraw/evas_outbuf.c
index 55fd535333..0a4651337e 100644
--- a/src/modules/evas/engines/software_ddraw/evas_outbuf.c
+++ b/src/modules/evas/engines/software_ddraw/evas_outbuf.c
@@ -1,88 +1,6 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_engine.h" 2#include "evas_engine.h"
3 3
4
5static Eina_List *ddpool = NULL;
6static int ddsize = 0;
7
8#define ddmemlimit 10 * 1024 * 1024
9#define ddcountlimit 32
10
11static DD_Output_Buffer *
12_find_ddob(int depth, int w, int h, void *data)
13{
14 Eina_List *l;
15 Eina_List *ddl;
16 DD_Output_Buffer *ddob = NULL;
17 DD_Output_Buffer *ddob2;
18 int sz;
19 int lbytes;
20 int bpp;
21
22 bpp = depth / 8;
23 if (bpp == 3) bpp = 4;
24 lbytes = (((w * bpp) + 3) / 4) * 4;
25 sz = lbytes * h;
26 EINA_LIST_FOREACH(ddpool, l, ddob2)
27 {
28 if (ddob2->depth != depth)
29 continue;
30 if (ddob2->psize == sz)
31 {
32 ddob = ddob2;
33 ddl = l;
34 goto have_ddob;
35 }
36 }
37 if (!ddob)
38 return evas_software_ddraw_output_buffer_new(depth, w, h, data);
39
40 have_ddob:
41 ddpool = eina_list_remove_list(ddpool, ddl);
42 ddob->width = w;
43 ddob->height = h;
44 ddob->pitch = lbytes;
45 ddsize -= ddob->psize * (ddob->depth / 8);
46
47 return ddob;
48}
49
50static void
51_unfind_ddob(DD_Output_Buffer *ddob)
52{
53 ddpool = eina_list_prepend(ddpool, ddob);
54 ddsize += ddob->psize * ddob->depth / 8;
55 while ((ddsize > (ddmemlimit)) ||
56 (eina_list_count(ddpool) > ddcountlimit))
57 {
58 Eina_List *xl;
59
60 xl = eina_list_last(ddpool);
61 if (!xl)
62 {
63 ddsize = 0;
64 break;
65 }
66 ddob = xl->data;
67 ddpool = eina_list_remove_list(ddpool, xl);
68 evas_software_ddraw_output_buffer_free(ddob);
69 }
70}
71
72static void
73_clear_ddob(int sync EINA_UNUSED)
74{
75 while (ddpool)
76 {
77 DD_Output_Buffer *ddob;
78
79 ddob = ddpool->data;
80 ddpool = eina_list_remove_list(ddpool, ddpool);
81 evas_software_ddraw_output_buffer_free(ddob);
82 }
83 ddsize = 0;
84}
85
86void 4void
87evas_software_ddraw_outbuf_init(void) 5evas_software_ddraw_outbuf_init(void)
88{ 6{
@@ -102,9 +20,7 @@ Outbuf *
102evas_software_ddraw_outbuf_setup(int width, 20evas_software_ddraw_outbuf_setup(int width,
103 int height, 21 int height,
104 int rotation, 22 int rotation,
105 Outbuf_Depth depth,
106 HWND window, 23 HWND window,
107 int w_depth,
108 int fullscreen) 24 int fullscreen)
109{ 25{
110 Outbuf *buf; 26 Outbuf *buf;
@@ -115,10 +31,9 @@ evas_software_ddraw_outbuf_setup(int width,
115 31
116 buf->width = width; 32 buf->width = width;
117 buf->height = height; 33 buf->height = height;
118 buf->depth = depth;
119 buf->rot = rotation; 34 buf->rot = rotation;
120 35
121 if (!evas_software_ddraw_init(window, w_depth, fullscreen, buf)) 36 if (!evas_software_ddraw_init(window, fullscreen, buf))
122 { 37 {
123 free(buf); 38 free(buf);
124 return NULL; 39 return NULL;
@@ -128,7 +43,7 @@ evas_software_ddraw_outbuf_setup(int width,
128 Gfx_Func_Convert conv_func; 43 Gfx_Func_Convert conv_func;
129 DD_Output_Buffer *ddob; 44 DD_Output_Buffer *ddob;
130 45
131 ddob = evas_software_ddraw_output_buffer_new(w_depth, 1, 1, NULL); 46 ddob = evas_software_ddraw_output_buffer_new(1, 1, NULL);
132 47
133 conv_func = NULL; 48 conv_func = NULL;
134 if (ddob) 49 if (ddob)
@@ -139,7 +54,7 @@ evas_software_ddraw_outbuf_setup(int width,
139 conv_func = evas_common_convert_func_get(0, 54 conv_func = evas_common_convert_func_get(0,
140 width, 55 width,
141 height, 56 height,
142 evas_software_ddraw_output_buffer_depth (ddob), 57 32,
143 buf->priv.mask.r, 58 buf->priv.mask.r,
144 buf->priv.mask.g, 59 buf->priv.mask.g,
145 buf->priv.mask.b, 60 buf->priv.mask.b,
@@ -149,7 +64,7 @@ evas_software_ddraw_outbuf_setup(int width,
149 conv_func = evas_common_convert_func_get(0, 64 conv_func = evas_common_convert_func_get(0,
150 height, 65 height,
151 width, 66 width,
152 evas_software_ddraw_output_buffer_depth (ddob), 67 32,
153 buf->priv.mask.r, 68 buf->priv.mask.r,
154 buf->priv.mask.g, 69 buf->priv.mask.g,
155 buf->priv.mask.b, 70 buf->priv.mask.b,
@@ -163,11 +78,10 @@ evas_software_ddraw_outbuf_setup(int width,
163 { 78 {
164 ERR("DDraw engine Error" 79 ERR("DDraw engine Error"
165 " {" 80 " {"
166 " At depth %i:" 81 " At depth 32:"
167 " RGB format mask: %08x, %08x, %08x" 82 " RGB format mask: %08x, %08x, %08x"
168 " Not supported by and compiled in converters!" 83 " Not supported by and compiled in converters!"
169 " }", 84 " }",
170 buf->priv.dd.depth,
171 buf->priv.mask.r, 85 buf->priv.mask.r,
172 buf->priv.mask.g, 86 buf->priv.mask.g,
173 buf->priv.mask.b); 87 buf->priv.mask.b);
@@ -183,10 +97,10 @@ evas_software_ddraw_outbuf_reconfigure(Outbuf *buf,
183 int width, 97 int width,
184 int height, 98 int height,
185 int rotation, 99 int rotation,
186 Outbuf_Depth depth) 100 Outbuf_Depth depth EINA_UNUSED)
187{ 101{
188 if ((width == buf->width) && (height == buf->height) && 102 if ((width == buf->width) && (height == buf->height) &&
189 (rotation == buf->rot) && (depth == buf->depth)) 103 (rotation == buf->rot))
190 return; 104 return;
191 buf->width = width; 105 buf->width = width;
192 buf->height = height; 106 buf->height = height;
@@ -225,13 +139,7 @@ evas_software_ddraw_outbuf_new_region_for_update(Outbuf *buf,
225 (buf->priv.mask.g == 0x00ff00) && 139 (buf->priv.mask.g == 0x00ff00) &&
226 (buf->priv.mask.b == 0x0000ff)) 140 (buf->priv.mask.b == 0x0000ff))
227 { 141 {
228 obr->ddob = _find_ddob(buf->priv.dd.depth, w, h, NULL); 142 obr->ddob = evas_software_ddraw_output_buffer_new(w, h, NULL);
229/* obr->ddob = evas_software_x11_x_output_buffer_new(buf->priv.dd.disp, */
230/* buf->priv.dd.vis, */
231/* buf->priv.dd.depth, */
232/* w, h, */
233/* use_shm, */
234/* NULL); */
235 im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 143 im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
236 w, h, 144 w, h,
237 (DATA32 *) evas_software_ddraw_output_buffer_data(obr->ddob, &bpl), 145 (DATA32 *) evas_software_ddraw_output_buffer_data(obr->ddob, &bpl),
@@ -245,25 +153,9 @@ evas_software_ddraw_outbuf_new_region_for_update(Outbuf *buf,
245 evas_cache_image_surface_alloc(&im->cache_entry, w, h); 153 evas_cache_image_surface_alloc(&im->cache_entry, w, h);
246 im->extended_info = obr; 154 im->extended_info = obr;
247 if ((buf->rot == 0) || (buf->rot == 180)) 155 if ((buf->rot == 0) || (buf->rot == 180))
248 obr->ddob = _find_ddob(buf->priv.dd.depth, w, h, NULL); 156 obr->ddob = evas_software_ddraw_output_buffer_new(w, h, NULL);
249/*
250 obr->ddob = evas_software_x11_x_output_buffer_new(buf->priv.dd.disp,
251 buf->priv.dd.vis,
252 buf->priv.dd.depth,
253 w, h,
254 use_shm,
255 NULL);
256 */
257 else if ((buf->rot == 90) || (buf->rot == 270)) 157 else if ((buf->rot == 90) || (buf->rot == 270))
258 obr->ddob = _find_ddob(buf->priv.dd.depth, h, w, NULL); 158 obr->ddob = evas_software_ddraw_output_buffer_new(h, w, NULL);
259/*
260 obr->ddob = evas_software_x11_x_output_buffer_new(buf->priv.dd.disp,
261 buf->priv.dd.vis,
262 buf->priv.dd.depth,
263 h, w,
264 use_shm,
265 NULL);
266 */
267 } 159 }
268 160
269 buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im); 161 buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im);
@@ -289,7 +181,7 @@ evas_software_ddraw_outbuf_push_updated_region(Outbuf *buf,
289 181
290 if ((buf->rot == 0) || (buf->rot == 180)) 182 if ((buf->rot == 0) || (buf->rot == 180))
291 conv_func = evas_common_convert_func_get(0, w, h, 183 conv_func = evas_common_convert_func_get(0, w, h,
292 evas_software_ddraw_output_buffer_depth(obr->ddob), 184 32,
293 buf->priv.mask.r, 185 buf->priv.mask.r,
294 buf->priv.mask.g, 186 buf->priv.mask.g,
295 buf->priv.mask.b, 187 buf->priv.mask.b,
@@ -297,7 +189,7 @@ evas_software_ddraw_outbuf_push_updated_region(Outbuf *buf,
297 buf->rot); 189 buf->rot);
298 else if ((buf->rot == 90) || (buf->rot == 270)) 190 else if ((buf->rot == 90) || (buf->rot == 270))
299 conv_func = evas_common_convert_func_get(0, h, w, 191 conv_func = evas_common_convert_func_get(0, h, w,
300 evas_software_ddraw_output_buffer_depth(obr->ddob), 192 32,
301 buf->priv.mask.r, 193 buf->priv.mask.r,
302 buf->priv.mask.g, 194 buf->priv.mask.g,
303 buf->priv.mask.b, 195 buf->priv.mask.b,
@@ -340,7 +232,7 @@ evas_software_ddraw_outbuf_push_updated_region(Outbuf *buf,
340 if (data != src_data) 232 if (data != src_data)
341 conv_func(src_data, data, 233 conv_func(src_data, data,
342 0, 234 0,
343 bpl / ((evas_software_ddraw_output_buffer_depth(obr->ddob) / 8)) - obr->width, 235 bpl / 4 - obr->width,
344 obr->width, 236 obr->width,
345 obr->height, 237 obr->height,
346 x, 238 x,
@@ -358,7 +250,6 @@ evas_software_ddraw_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
358 int ddraw_width; 250 int ddraw_width;
359 int ddraw_height; 251 int ddraw_height;
360 int ddraw_pitch; 252 int ddraw_pitch;
361 int ddraw_depth;
362 253
363 if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return; 254 if (render_mode == EVAS_RENDER_MODE_ASYNC_INIT) return;
364 255
@@ -366,8 +257,7 @@ evas_software_ddraw_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
366 if (!(ddraw_data = evas_software_ddraw_lock(buf, 257 if (!(ddraw_data = evas_software_ddraw_lock(buf,
367 &ddraw_width, 258 &ddraw_width,
368 &ddraw_height, 259 &ddraw_height,
369 &ddraw_pitch, 260 &ddraw_pitch)))
370 &ddraw_depth)))
371 goto free_images; 261 goto free_images;
372 262
373 /* copy safely the images that need to be drawn onto the back surface */ 263 /* copy safely the images that need to be drawn onto the back surface */
@@ -382,7 +272,6 @@ evas_software_ddraw_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
382 ddraw_width, 272 ddraw_width,
383 ddraw_height, 273 ddraw_height,
384 ddraw_pitch, 274 ddraw_pitch,
385 ddraw_depth,
386 obr->x, 275 obr->x,
387 obr->y); 276 obr->y);
388 } 277 }
@@ -399,10 +288,8 @@ evas_software_ddraw_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
399 buf->priv.prev_pending_writes); 288 buf->priv.prev_pending_writes);
400 obr = im->extended_info; 289 obr = im->extended_info;
401 evas_cache_image_drop(&im->cache_entry); 290 evas_cache_image_drop(&im->cache_entry);
402 if (obr->ddob) _unfind_ddob(obr->ddob); 291 if (obr->ddob)
403/* 292 evas_software_ddraw_output_buffer_free(obr->ddob);
404 if (obr->ddob) evas_software_x11_x_output_buffer_free(obr->ddob);
405 */
406 free(obr); 293 free(obr);
407 } 294 }
408 buf->priv.prev_pending_writes = buf->priv.pending_writes; 295 buf->priv.prev_pending_writes = buf->priv.pending_writes;
@@ -425,10 +312,10 @@ evas_software_ddraw_outbuf_idle_flush(Outbuf *buf)
425 buf->priv.prev_pending_writes); 312 buf->priv.prev_pending_writes);
426 obr = im->extended_info; 313 obr = im->extended_info;
427 evas_cache_image_drop((Image_Entry *)im); 314 evas_cache_image_drop((Image_Entry *)im);
428 if (obr->ddob) _unfind_ddob(obr->ddob); 315 if (obr->ddob)
316 evas_software_ddraw_output_buffer_free(obr->ddob);
429 free(obr); 317 free(obr);
430 } 318 }
431 _clear_ddob(0);
432} 319}
433 320
434int 321int
@@ -443,12 +330,6 @@ evas_software_ddraw_outbuf_height_get(Outbuf *buf)
443 return buf->height; 330 return buf->height;
444} 331}
445 332
446Outbuf_Depth
447evas_software_ddraw_outbuf_depth_get(Outbuf *buf)
448{
449 return buf->depth;
450}
451
452int 333int
453evas_software_ddraw_outbuf_rot_get(Outbuf *buf) 334evas_software_ddraw_outbuf_rot_get(Outbuf *buf)
454{ 335{
diff --git a/src/modules/evas/engines/software_gdi/Evas_Engine_Software_Gdi.h b/src/modules/evas/engines/software_gdi/Evas_Engine_Software_Gdi.h
index deac5b29e1..c565a5e009 100644
--- a/src/modules/evas/engines/software_gdi/Evas_Engine_Software_Gdi.h
+++ b/src/modules/evas/engines/software_gdi/Evas_Engine_Software_Gdi.h
@@ -17,7 +17,6 @@ struct _Evas_Engine_Info_Software_Gdi
17 17
18 struct { 18 struct {
19 HWND window; 19 HWND window;
20 int depth;
21 int rotation; 20 int rotation;
22 unsigned int borderless : 1; 21 unsigned int borderless : 1;
23 unsigned int fullscreen : 1; 22 unsigned int fullscreen : 1;
diff --git a/src/modules/evas/engines/software_gdi/evas_engine.c b/src/modules/evas/engines/software_gdi/evas_engine.c
index 465607853e..de3b567021 100644
--- a/src/modules/evas/engines/software_gdi/evas_engine.c
+++ b/src/modules/evas/engines/software_gdi/evas_engine.c
@@ -16,6 +16,14 @@ struct _Render_Engine
16}; 16};
17 17
18/* engine api this module provides */ 18/* engine api this module provides */
19static void
20eng_output_info_setup(void *info)
21{
22 Evas_Engine_Info_Software_Gdi *einfo = info;
23
24 einfo->render_mode = EVAS_RENDER_MODE_BLOCKING;
25}
26
19static void * 27static void *
20eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h) 28eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
21{ 29{
@@ -35,9 +43,7 @@ eng_output_setup(void *engine, void *in, unsigned int w, unsigned int h)
35 43
36 ob = evas_software_gdi_outbuf_setup(w, h, 44 ob = evas_software_gdi_outbuf_setup(w, h,
37 info->info.rotation, 45 info->info.rotation,
38 OUTBUF_DEPTH_INHERIT,
39 info->info.window, 46 info->info.window,
40 info->info.depth,
41 info->info.borderless, 47 info->info.borderless,
42 info->info.fullscreen, 48 info->info.fullscreen,
43 info->info.region, 49 info->info.region,
@@ -81,9 +87,7 @@ eng_output_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w
81 ob = evas_software_gdi_outbuf_setup(w, 87 ob = evas_software_gdi_outbuf_setup(w,
82 h, 88 h,
83 info->info.rotation, 89 info->info.rotation,
84 OUTBUF_DEPTH_INHERIT,
85 info->info.window, 90 info->info.window,
86 info->info.depth,
87 info->info.borderless, 91 info->info.borderless,
88 info->info.fullscreen, 92 info->info.fullscreen,
89 info->info.region, 93 info->info.region,
@@ -134,6 +138,7 @@ module_open(Evas_Module *em)
134 func = pfunc; 138 func = pfunc;
135 /* now to override methods */ 139 /* now to override methods */
136#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) 140#define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_)
141 ORD(output_info_setup);
137 ORD(output_setup); 142 ORD(output_setup);
138 ORD(output_update); 143 ORD(output_update);
139 ORD(canvas_alpha_get); 144 ORD(canvas_alpha_get);
diff --git a/src/modules/evas/engines/software_gdi/evas_engine.h b/src/modules/evas/engines/software_gdi/evas_engine.h
index 88d1cac214..329ec33399 100644
--- a/src/modules/evas/engines/software_gdi/evas_engine.h
+++ b/src/modules/evas/engines/software_gdi/evas_engine.h
@@ -47,7 +47,6 @@ struct BITMAPINFO_GDI
47 47
48struct _Outbuf 48struct _Outbuf
49{ 49{
50 Outbuf_Depth depth;
51 int width; 50 int width;
52 int height; 51 int height;
53 int rot; 52 int rot;
@@ -60,7 +59,6 @@ struct _Outbuf
60 HWND window; 59 HWND window;
61 HDC dc; 60 HDC dc;
62 HRGN regions; 61 HRGN regions;
63 int depth;
64 unsigned char borderless : 1; 62 unsigned char borderless : 1;
65 unsigned char fullscreen : 1; 63 unsigned char fullscreen : 1;
66 unsigned char region : 1; 64 unsigned char region : 1;
@@ -101,7 +99,6 @@ struct _Gdi_Output_Buffer
101 int width; 99 int width;
102 int height; 100 int height;
103 void *data; 101 void *data;
104 int depth;
105 int pitch; 102 int pitch;
106 int psize; 103 int psize;
107}; 104};
@@ -109,7 +106,6 @@ struct _Gdi_Output_Buffer
109/* evas_gdi_main.c */ 106/* evas_gdi_main.c */
110 107
111int evas_software_gdi_init (HWND window, 108int evas_software_gdi_init (HWND window,
112 int depth,
113 unsigned int borderless, 109 unsigned int borderless,
114 unsigned int fullscreen, 110 unsigned int fullscreen,
115 unsigned int region, 111 unsigned int region,
@@ -123,7 +119,6 @@ void evas_software_gdi_bitmap_resize(Outbuf *buf);
123 119
124Gdi_Output_Buffer *evas_software_gdi_output_buffer_new(HDC dc, 120Gdi_Output_Buffer *evas_software_gdi_output_buffer_new(HDC dc,
125 BITMAPINFO_GDI *bitmap_info, 121 BITMAPINFO_GDI *bitmap_info,
126 int depth,
127 int width, 122 int width,
128 int height, 123 int height,
129 void *data); 124 void *data);
@@ -137,8 +132,6 @@ void evas_software_gdi_output_buffer_paste(Gdi_Output_Buffer *gdiob,
137DATA8 *evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob, 132DATA8 *evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob,
138 int *pitch); 133 int *pitch);
139 134
140int evas_software_gdi_output_buffer_depth(Gdi_Output_Buffer *gdiob);
141
142/* evas_outbuf.c */ 135/* evas_outbuf.c */
143 136
144void evas_software_gdi_outbuf_init(void); 137void evas_software_gdi_outbuf_init(void);
@@ -148,9 +141,7 @@ void evas_software_gdi_outbuf_free(Outbuf *buf);
148Outbuf *evas_software_gdi_outbuf_setup(int width, 141Outbuf *evas_software_gdi_outbuf_setup(int width,
149 int height, 142 int height,
150 int rotation, 143 int rotation,
151 Outbuf_Depth depth,
152 HWND window, 144 HWND window,
153 int w_depth,
154 unsigned int borderless, 145 unsigned int borderless,
155 unsigned int fullscreen, 146 unsigned int fullscreen,
156 unsigned int region, 147 unsigned int region,
@@ -188,8 +179,6 @@ int evas_software_gdi_outbuf_width_get(Outbuf *buf);
188 179
189int evas_software_gdi_outbuf_height_get(Outbuf *buf); 180int evas_software_gdi_outbuf_height_get(Outbuf *buf);
190 181
191Outbuf_Depth evas_software_gdi_outbuf_depth_get(Outbuf *buf);
192
193int evas_software_gdi_outbuf_rot_get(Outbuf *buf); 182int evas_software_gdi_outbuf_rot_get(Outbuf *buf);
194 183
195 184
diff --git a/src/modules/evas/engines/software_gdi/evas_gdi_buffer.c b/src/modules/evas/engines/software_gdi/evas_gdi_buffer.c
index ab233ddec8..8d9c1ac425 100644
--- a/src/modules/evas/engines/software_gdi/evas_gdi_buffer.c
+++ b/src/modules/evas/engines/software_gdi/evas_gdi_buffer.c
@@ -6,7 +6,6 @@
6Gdi_Output_Buffer * 6Gdi_Output_Buffer *
7evas_software_gdi_output_buffer_new(HDC dc, 7evas_software_gdi_output_buffer_new(HDC dc,
8 BITMAPINFO_GDI *bitmap_info, 8 BITMAPINFO_GDI *bitmap_info,
9 int depth,
10 int width, 9 int width,
11 int height, 10 int height,
12 void *data) 11 void *data)
@@ -20,7 +19,7 @@ evas_software_gdi_output_buffer_new(HDC dc,
20 { 19 {
21 bitmap_info->bih.biWidth = width; 20 bitmap_info->bih.biWidth = width;
22 bitmap_info->bih.biHeight = -height; 21 bitmap_info->bih.biHeight = -height;
23 bitmap_info->bih.biSizeImage = (depth >> 3) * width * height; 22 bitmap_info->bih.biSizeImage = 4 * width * height;
24 gdiob->bitmap = CreateDIBSection(dc, 23 gdiob->bitmap = CreateDIBSection(dc,
25 (const BITMAPINFO *)bitmap_info, 24 (const BITMAPINFO *)bitmap_info,
26 DIB_RGB_COLORS, 25 DIB_RGB_COLORS,
@@ -39,9 +38,7 @@ evas_software_gdi_output_buffer_new(HDC dc,
39 gdiob->data = data; 38 gdiob->data = data;
40 gdiob->width = width; 39 gdiob->width = width;
41 gdiob->height = height; 40 gdiob->height = height;
42 gdiob->depth = depth; 41 gdiob->pitch = width * 4;
43 gdiob->pitch = width * (depth >> 3);
44/* gdiob->psize = gdiob->pitch * height; */
45 42
46 return gdiob; 43 return gdiob;
47} 44}
@@ -83,9 +80,3 @@ evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob,
83 if (pitch) *pitch = gdiob->pitch; 80 if (pitch) *pitch = gdiob->pitch;
84 return gdiob->data; 81 return gdiob->data;
85} 82}
86
87int
88evas_software_gdi_output_buffer_depth(Gdi_Output_Buffer *gdiob)
89{
90 return gdiob->depth;
91}
diff --git a/src/modules/evas/engines/software_gdi/evas_gdi_main.c b/src/modules/evas/engines/software_gdi/evas_gdi_main.c
index 2ffc0c1270..98f1a79ab2 100644
--- a/src/modules/evas/engines/software_gdi/evas_gdi_main.c
+++ b/src/modules/evas/engines/software_gdi/evas_gdi_main.c
@@ -4,7 +4,6 @@
4 4
5int 5int
6evas_software_gdi_init (HWND window, 6evas_software_gdi_init (HWND window,
7 int depth,
8 unsigned int borderless, 7 unsigned int borderless,
9 unsigned int fullscreen EINA_UNUSED, 8 unsigned int fullscreen EINA_UNUSED,
10 unsigned int region, 9 unsigned int region,
@@ -26,14 +25,12 @@ evas_software_gdi_init (HWND window,
26 return 0; 25 return 0;
27 } 26 }
28 27
29 /* FIXME: check depth */ 28 if (GetDeviceCaps(buf->priv.gdi.dc, BITSPIXEL) != 32)
30 if (depth != GetDeviceCaps(buf->priv.gdi.dc, BITSPIXEL))
31 { 29 {
32 ERR("[Engine] [GDI] no compatible depth"); 30 ERR("[Engine] [GDI] no compatible depth");
33 ReleaseDC(window, buf->priv.gdi.dc); 31 ReleaseDC(window, buf->priv.gdi.dc);
34 return 0; 32 return 0;
35 } 33 }
36 buf->priv.gdi.depth = depth;
37 34
38 /* FIXME: support fullscreen */ 35 /* FIXME: support fullscreen */
39 36
@@ -49,32 +46,16 @@ evas_software_gdi_init (HWND window,
49 buf->priv.gdi.bitmap_info->bih.biWidth = buf->width; 46 buf->priv.gdi.bitmap_info->bih.biWidth = buf->width;
50 buf->priv.gdi.bitmap_info->bih.biHeight = -buf->height; 47 buf->priv.gdi.bitmap_info->bih.biHeight = -buf->height;
51 buf->priv.gdi.bitmap_info->bih.biPlanes = 1; 48 buf->priv.gdi.bitmap_info->bih.biPlanes = 1;
52 buf->priv.gdi.bitmap_info->bih.biSizeImage = (buf->priv.gdi.depth >> 3) * buf->width * buf->height; 49 buf->priv.gdi.bitmap_info->bih.biSizeImage = 4 * buf->width * buf->height;
53 buf->priv.gdi.bitmap_info->bih.biXPelsPerMeter = 0; 50 buf->priv.gdi.bitmap_info->bih.biXPelsPerMeter = 0;
54 buf->priv.gdi.bitmap_info->bih.biYPelsPerMeter = 0; 51 buf->priv.gdi.bitmap_info->bih.biYPelsPerMeter = 0;
55 buf->priv.gdi.bitmap_info->bih.biClrUsed = 0; 52 buf->priv.gdi.bitmap_info->bih.biClrUsed = 0;
56 buf->priv.gdi.bitmap_info->bih.biClrImportant = 0; 53 buf->priv.gdi.bitmap_info->bih.biClrImportant = 0;
57 buf->priv.gdi.bitmap_info->bih.biBitCount = buf->priv.gdi.depth; 54 buf->priv.gdi.bitmap_info->bih.biBitCount = 32;
58 buf->priv.gdi.bitmap_info->bih.biCompression = BI_BITFIELDS; 55 buf->priv.gdi.bitmap_info->bih.biCompression = BI_BITFIELDS;
59 56 buf->priv.gdi.bitmap_info->masks[0] = 0x00ff0000;
60 switch (depth) 57 buf->priv.gdi.bitmap_info->masks[1] = 0x0000ff00;
61 { 58 buf->priv.gdi.bitmap_info->masks[2] = 0x000000ff;
62 case 16:
63 buf->priv.gdi.bitmap_info->masks[0] = 0x0000f800;
64 buf->priv.gdi.bitmap_info->masks[1] = 0x000007e0;
65 buf->priv.gdi.bitmap_info->masks[2] = 0x0000001f;
66 break;
67 case 32:
68 buf->priv.gdi.bitmap_info->masks[0] = 0x00ff0000;
69 buf->priv.gdi.bitmap_info->masks[1] = 0x0000ff00;
70 buf->priv.gdi.bitmap_info->masks[2] = 0x000000ff;
71 break;
72 default:
73 ERR("[Engine] [GDI] wrong depth");
74 free(buf->priv.gdi.bitmap_info);
75 ReleaseDC(window, buf->priv.gdi.dc);
76 return 0;
77 }
78 59
79 return 1; 60 return 1;
80} 61}
@@ -96,5 +77,5 @@ evas_software_gdi_bitmap_resize(Outbuf *buf)
96{ 77{
97 buf->priv.gdi.bitmap_info->bih.biWidth = buf->width; 78 buf->priv.gdi.bitmap_info->bih.biWidth = buf->width;
98 buf->priv.gdi.bitmap_info->bih.biHeight = -buf->height; 79 buf->priv.gdi.bitmap_info->bih.biHeight = -buf->height;
99 buf->priv.gdi.bitmap_info->bih.biSizeImage = (buf->priv.gdi.depth >> 3) * buf->width * buf->height; 80 buf->priv.gdi.bitmap_info->bih.biSizeImage = 4 * buf->width * buf->height;
100} 81}
diff --git a/src/modules/evas/engines/software_gdi/evas_outbuf.c b/src/modules/evas/engines/software_gdi/evas_outbuf.c
index 68a1a3e463..e23cabe873 100644
--- a/src/modules/evas/engines/software_gdi/evas_outbuf.c
+++ b/src/modules/evas/engines/software_gdi/evas_outbuf.c
@@ -1,89 +1,6 @@
1#include "evas_common_private.h" 1#include "evas_common_private.h"
2#include "evas_engine.h" 2#include "evas_engine.h"
3 3
4
5static Eina_List *gdipool = NULL;
6static int gdisize = 0;
7static int gdimemlimit = 10 * 1024 * 1024;
8static int gdicountlimit = 32;
9
10static Gdi_Output_Buffer *
11_find_gdiob(HDC dc, BITMAPINFO_GDI *bitmap_info, int depth, int w, int h, void *data)
12{
13 Eina_List *l = NULL;
14 Eina_List *gdil = NULL;
15 Gdi_Output_Buffer *gdiob = NULL;
16 Gdi_Output_Buffer *gdiob2;
17 int sz;
18 int lbytes;
19 int bpp;
20
21 bpp = depth >> 3;
22 if (bpp == 3) bpp = 4;
23 lbytes = (((w * bpp) + 3) / 4) * 4;
24 sz = lbytes * h;
25 EINA_LIST_FOREACH(gdipool, l, gdiob2)
26 {
27 if ((gdiob2->dc != dc) ||
28 (gdiob2->bitmap_info != bitmap_info) ||
29 (gdiob2->depth != depth))
30 continue;
31 if (gdiob2->psize == sz)
32 {
33 gdiob = gdiob2;
34 gdil = l;
35 goto have_gdiob;
36 }
37 }
38 if (!gdiob)
39 return evas_software_gdi_output_buffer_new(dc, bitmap_info, depth, w, h, data);
40
41 have_gdiob:
42 gdipool = eina_list_remove_list(gdipool, gdil);
43 gdiob->width = w;
44 gdiob->height = h;
45 gdiob->pitch = lbytes;
46 gdisize -= gdiob->psize * (gdiob->depth >> 3);
47
48 return gdiob;
49}
50
51static void
52_unfind_gdiob(Gdi_Output_Buffer *gdiob)
53{
54 gdipool = eina_list_prepend(gdipool, gdiob);
55 gdisize += gdiob->psize * (gdiob->depth >> 3);
56 while ((gdisize > (gdimemlimit)) ||
57 ((int)eina_list_count(gdipool) > gdicountlimit))
58 {
59 Eina_List *xl;
60
61 xl = eina_list_last(gdipool);
62 if (!xl)
63 {
64 gdisize = 0;
65 break;
66 }
67 gdiob = xl->data;
68 gdipool = eina_list_remove_list(gdipool, xl);
69 evas_software_gdi_output_buffer_free(gdiob);
70 }
71}
72
73static void
74_clear_gdiob()
75{
76 while (gdipool)
77 {
78 Gdi_Output_Buffer *gdiob;
79
80 gdiob = gdipool->data;
81 gdipool = eina_list_remove_list(gdipool, gdipool);
82 evas_software_gdi_output_buffer_free(gdiob);
83 }
84 gdisize = 0;
85}
86
87void 4void
88evas_software_gdi_outbuf_init(void) 5evas_software_gdi_outbuf_init(void)
89{ 6{
@@ -104,7 +21,8 @@ evas_software_gdi_outbuf_free(Outbuf *buf)
104 buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes); 21 buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
105 obr = im->extended_info; 22 obr = im->extended_info;
106 evas_cache_image_drop(&im->cache_entry); 23 evas_cache_image_drop(&im->cache_entry);
107 if (obr->gdiob) _unfind_gdiob(obr->gdiob); 24 if (obr->gdiob)
25 evas_software_gdi_output_buffer_free(obr->gdiob);
108/* if (obr->mxob) _unfind_xob(obr->mxob, 0); */ 26/* if (obr->mxob) _unfind_xob(obr->mxob, 0); */
109 free(obr); 27 free(obr);
110 } 28 }
@@ -119,9 +37,7 @@ Outbuf *
119evas_software_gdi_outbuf_setup(int width, 37evas_software_gdi_outbuf_setup(int width,
120 int height, 38 int height,
121 int rotation, 39 int rotation,
122 Outbuf_Depth depth,
123 HWND window, 40 HWND window,
124 int w_depth,
125 unsigned int borderless, 41 unsigned int borderless,
126 unsigned int fullscreen, 42 unsigned int fullscreen,
127 unsigned int region, 43 unsigned int region,
@@ -136,13 +52,12 @@ evas_software_gdi_outbuf_setup(int width,
136 52
137 buf->width = width; 53 buf->width = width;
138 buf->height = height; 54 buf->height = height;
139 buf->depth = depth;
140 buf->rot = rotation; 55 buf->rot = rotation;
141 56
142 buf->priv.mask_dither = mask_dither; 57 buf->priv.mask_dither = mask_dither;
143 buf->priv.destination_alpha = destination_alpha; 58 buf->priv.destination_alpha = destination_alpha;
144 59
145 if (!evas_software_gdi_init(window, w_depth, borderless, fullscreen, region, buf)) 60 if (!evas_software_gdi_init(window, borderless, fullscreen, region, buf))
146 { 61 {
147 free(buf); 62 free(buf);
148 return NULL; 63 return NULL;
@@ -152,7 +67,7 @@ evas_software_gdi_outbuf_setup(int width,
152 Gfx_Func_Convert conv_func; 67 Gfx_Func_Convert conv_func;
153 Gdi_Output_Buffer *gdiob; 68 Gdi_Output_Buffer *gdiob;
154 69
155 gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc, buf->priv.gdi.bitmap_info, w_depth, 1, 1, NULL); 70 gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc, buf->priv.gdi.bitmap_info, 1, 1, NULL);
156 71
157 conv_func = NULL; 72 conv_func = NULL;
158 if (gdiob) 73 if (gdiob)
@@ -161,7 +76,7 @@ evas_software_gdi_outbuf_setup(int width,
161 conv_func = evas_common_convert_func_get(0, 76 conv_func = evas_common_convert_func_get(0,
162 width, 77 width,
163 height, 78 height,
164 evas_software_gdi_output_buffer_depth (gdiob), 79 32,
165 buf->priv.gdi.bitmap_info->masks[0], 80 buf->priv.gdi.bitmap_info->masks[0],
166 buf->priv.gdi.bitmap_info->masks[1], 81 buf->priv.gdi.bitmap_info->masks[1],
167 buf->priv.gdi.bitmap_info->masks[2], 82 buf->priv.gdi.bitmap_info->masks[2],
@@ -171,7 +86,7 @@ evas_software_gdi_outbuf_setup(int width,
171 conv_func = evas_common_convert_func_get(0, 86 conv_func = evas_common_convert_func_get(0,
172 height, 87 height,
173 width, 88 width,
174 evas_software_gdi_output_buffer_depth (gdiob), 89 32,
175 buf->priv.gdi.bitmap_info->masks[0], 90 buf->priv.gdi.bitmap_info->masks[0],
176 buf->priv.gdi.bitmap_info->masks[1], 91 buf->priv.gdi.bitmap_info->masks[1],
177 buf->priv.gdi.bitmap_info->masks[2], 92 buf->priv.gdi.bitmap_info->masks[2],
@@ -184,11 +99,10 @@ evas_software_gdi_outbuf_setup(int width,
184 { 99 {
185 ERR(".[ soft_gdi engine Error ]." 100 ERR(".[ soft_gdi engine Error ]."
186 " {" 101 " {"
187 " At depth %i:" 102 " At depth 32:"
188 " RGB format mask: %08lx, %08lx, %08lx" 103 " RGB format mask: %08lx, %08lx, %08lx"
189 " Not supported by and compiled in converters!" 104 " Not supported by and compiled in converters!"
190 " }", 105 " }",
191 buf->priv.gdi.depth,
192 buf->priv.gdi.bitmap_info->masks[0], 106 buf->priv.gdi.bitmap_info->masks[0],
193 buf->priv.gdi.bitmap_info->masks[1], 107 buf->priv.gdi.bitmap_info->masks[1],
194 buf->priv.gdi.bitmap_info->masks[2]); 108 buf->priv.gdi.bitmap_info->masks[2]);
@@ -204,10 +118,10 @@ evas_software_gdi_outbuf_reconfigure(Outbuf *buf,
204 int width, 118 int width,
205 int height, 119 int height,
206 int rotation, 120 int rotation,
207 Outbuf_Depth depth) 121 Outbuf_Depth depth EINA_UNUSED)
208{ 122{
209 if ((width == buf->width) && (height == buf->height) && 123 if ((width == buf->width) && (height == buf->height) &&
210 (rotation == buf->rot) && (depth == buf->depth)) 124 (rotation == buf->rot))
211 return; 125 return;
212 buf->width = width; 126 buf->width = width;
213 buf->height = height; 127 buf->height = height;
@@ -249,15 +163,9 @@ evas_software_gdi_outbuf_new_region_for_update(Outbuf *buf,
249 (buf->priv.gdi.bitmap_info->masks[1] == 0x00ff00) && 163 (buf->priv.gdi.bitmap_info->masks[1] == 0x00ff00) &&
250 (buf->priv.gdi.bitmap_info->masks[2] == 0x0000ff)) 164 (buf->priv.gdi.bitmap_info->masks[2] == 0x0000ff))
251 { 165 {
252 obr->gdiob = _find_gdiob(buf->priv.gdi.dc, 166 obr->gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc,
253 buf->priv.gdi.bitmap_info, 167 buf->priv.gdi.bitmap_info,
254 buf->priv.gdi.depth, 168 w, h, NULL);
255 w, h, NULL);
256/* obr->gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc, */
257/* buf->priv.gdi.bitmap_info, */
258/* buf->priv.gdi.depth, */
259/* w, h, */
260/* NULL); */
261 im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), 169 im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
262 w, h, 170 w, h,
263 (DATA32 *)evas_software_gdi_output_buffer_data(obr->gdiob, &bpl), 171 (DATA32 *)evas_software_gdi_output_buffer_data(obr->gdiob, &bpl),
@@ -276,31 +184,13 @@ evas_software_gdi_outbuf_new_region_for_update(Outbuf *buf,
276 evas_cache_image_surface_alloc(&im->cache_entry, w, h); 184 evas_cache_image_surface_alloc(&im->cache_entry, w, h);
277 im->extended_info = obr; 185 im->extended_info = obr;
278 if ((buf->rot == 0) || (buf->rot == 180)) 186 if ((buf->rot == 0) || (buf->rot == 180))
279 obr->gdiob = _find_gdiob(buf->priv.gdi.dc, 187 obr->gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc,
280 buf->priv.gdi.bitmap_info, 188 buf->priv.gdi.bitmap_info,
281 buf->priv.gdi.depth, 189 w, h, NULL);
282 w, h, NULL);
283/*
284 obr->gdiob = evas_software_x11_x_output_buffer_new(buf->priv.dd.disp,
285 buf->priv.dd.vis,
286 buf->priv.dd.depth,
287 w, h,
288 use_shm,
289 NULL);
290 */
291 else if ((buf->rot == 90) || (buf->rot == 270)) 190 else if ((buf->rot == 90) || (buf->rot == 270))
292 obr->gdiob = _find_gdiob(buf->priv.gdi.dc, 191 obr->gdiob = evas_software_gdi_output_buffer_new(buf->priv.gdi.dc,
293 buf->priv.gdi.bitmap_info, 192 buf->priv.gdi.bitmap_info,
294 buf->priv.gdi.depth, 193 h, w, NULL);
295 h, w, NULL);
296/*
297 obr->gdiob = evas_software_x11_x_output_buffer_new(buf->priv.dd.disp,
298 buf->priv.dd.vis,
299 buf->priv.dd.depth,
300 h, w,
301 use_shm,
302 NULL);
303 */
304/* if (buf->priv.gdi.mask) */ 194/* if (buf->priv.gdi.mask) */
305/* obr->mgdiob = _find_gdiob(buf->priv.gdi.dc, */ 195/* obr->mgdiob = _find_gdiob(buf->priv.gdi.dc, */
306/* buf->priv.gdi.bitmap_info, */ 196/* buf->priv.gdi.bitmap_info, */
@@ -336,16 +226,14 @@ evas_software_gdi_outbuf_push_updated_region(Outbuf *buf,
336 obr = update->extended_info; 226 obr = update->extended_info;
337 227
338 if ((buf->rot == 0) || (buf->rot == 180)) 228 if ((buf->rot == 0) || (buf->rot == 180))
339 conv_func = evas_common_convert_func_get(0, w, h, 229 conv_func = evas_common_convert_func_get(0, w, h, 32,
340 evas_software_gdi_output_buffer_depth(obr->gdiob),
341 buf->priv.gdi.bitmap_info->masks[0], 230 buf->priv.gdi.bitmap_info->masks[0],
342 buf->priv.gdi.bitmap_info->masks[1], 231 buf->priv.gdi.bitmap_info->masks[1],
343 buf->priv.gdi.bitmap_info->masks[2], 232 buf->priv.gdi.bitmap_info->masks[2],
344 PAL_MODE_NONE, 233 PAL_MODE_NONE,
345 buf->rot); 234 buf->rot);
346 else if ((buf->rot == 90) || (buf->rot == 270)) 235 else if ((buf->rot == 90) || (buf->rot == 270))
347 conv_func = evas_common_convert_func_get(0, h, w, 236 conv_func = evas_common_convert_func_get(0, h, w, 32,
348 evas_software_gdi_output_buffer_depth(obr->gdiob),
349 buf->priv.gdi.bitmap_info->masks[0], 237 buf->priv.gdi.bitmap_info->masks[0],
350 buf->priv.gdi.bitmap_info->masks[1], 238 buf->priv.gdi.bitmap_info->masks[1],
351 buf->priv.gdi.bitmap_info->masks[2], 239 buf->priv.gdi.bitmap_info->masks[2],
@@ -389,7 +277,7 @@ evas_software_gdi_outbuf_push_updated_region(Outbuf *buf,
389 if (data != src_data) 277 if (data != src_data)
390 conv_func(src_data, data, 278 conv_func(src_data, data,
391 0, 279 0,
392 bpl / (evas_software_gdi_output_buffer_depth(obr->gdiob) >> 3) - obr->width, 280 bpl / 4 - obr->width,
393 obr->width, 281 obr->width,
394 obr->height, 282 obr->height,
395 x, 283 x,
@@ -580,9 +468,9 @@ evas_software_gdi_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_UN
580 buf->priv.prev_pending_writes); 468 buf->priv.prev_pending_writes);
581 obr = im->extended_info; 469 obr = im->extended_info;
582 evas_cache_image_drop(&im->cache_entry); 470 evas_cache_image_drop(&im->cache_entry);
583 if (obr->gdiob) _unfind_gdiob(obr->gdiob); 471 if (obr->gdiob)
472 evas_software_gdi_output_buffer_free(obr->gdiob);
584/* if (obr->mgdiob) _unfind_gdiob(obr->mgdiob); */ 473/* if (obr->mgdiob) _unfind_gdiob(obr->mgdiob); */
585/* if (obr->gdiob) evas_software_x11_x_output_buffer_free(obr->gdiob); */
586 free(obr); 474 free(obr);
587 } 475 }
588 buf->priv.prev_pending_writes = buf->priv.pending_writes; 476 buf->priv.prev_pending_writes = buf->priv.pending_writes;
@@ -605,11 +493,11 @@ evas_software_gdi_outbuf_idle_flush(Outbuf *buf)
605 buf->priv.prev_pending_writes); 493 buf->priv.prev_pending_writes);
606 obr = im->extended_info; 494 obr = im->extended_info;
607 evas_cache_image_drop((Image_Entry *)im); 495 evas_cache_image_drop((Image_Entry *)im);
608 if (obr->gdiob) _unfind_gdiob(obr->gdiob); 496 if (obr->gdiob)
497 evas_software_gdi_output_buffer_free(obr->gdiob);
609/* if (obr->mxob) _unfind_xob(obr->mxob, 0); */ 498/* if (obr->mxob) _unfind_xob(obr->mxob, 0); */
610 free(obr); 499 free(obr);
611 } 500 }
612 _clear_gdiob();
613} 501}
614 502
615int 503int
@@ -624,12 +512,6 @@ evas_software_gdi_outbuf_height_get(Outbuf *buf)
624 return buf->height; 512 return buf->height;
625} 513}
626 514
627Outbuf_Depth
628evas_software_gdi_outbuf_depth_get(Outbuf *buf)
629{
630 return buf->depth;
631}
632
633int 515int
634evas_software_gdi_outbuf_rot_get(Outbuf *buf) 516evas_software_gdi_outbuf_rot_get(Outbuf *buf)
635{ 517{