diff options
author | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-04 18:41:13 +1000 |
commit | dd7595a3475407a7fa96a97393bae8c5220e8762 (patch) | |
tree | e341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp | |
parent | Add the skeleton. (diff) | |
download | SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2 SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz |
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp')
-rw-r--r-- | libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp b/libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp new file mode 100644 index 0000000..7a0a8b7 --- /dev/null +++ b/libraries/evas/src/modules/engines/software_16_ddraw/evas_ddraw_buffer.cpp | |||
@@ -0,0 +1,87 @@ | |||
1 | #include "evas_common.h" | ||
2 | #include "evas_engine.h" | ||
3 | |||
4 | |||
5 | DDraw_Output_Buffer * | ||
6 | evas_software_ddraw_output_buffer_new(HWND window, | ||
7 | LPDIRECTDRAW object, | ||
8 | LPDIRECTDRAWSURFACE surface_primary, | ||
9 | LPDIRECTDRAWSURFACE surface_back, | ||
10 | LPDIRECTDRAWSURFACE surface_source, | ||
11 | int width, | ||
12 | int height) | ||
13 | { | ||
14 | DDSURFACEDESC surface_desc; | ||
15 | DDraw_Output_Buffer *ddob; | ||
16 | |||
17 | ddob = (DDraw_Output_Buffer *)calloc(1, sizeof(DDraw_Output_Buffer)); | ||
18 | if (!ddob) return NULL; | ||
19 | |||
20 | ddob->dd.window = window; | ||
21 | ddob->dd.object = object; | ||
22 | ddob->dd.surface_primary = surface_primary; | ||
23 | ddob->dd.surface_back = surface_back; | ||
24 | ddob->dd.surface_source = surface_source; | ||
25 | ddob->width = width; | ||
26 | ddob->height = height; | ||
27 | ddob->pitch = width * 2; | ||
28 | |||
29 | ZeroMemory(&surface_desc, sizeof(surface_desc)); | ||
30 | surface_desc.dwSize = sizeof(surface_desc); | ||
31 | |||
32 | if (FAILED(ddob->dd.surface_source->Lock(NULL, | ||
33 | &surface_desc, | ||
34 | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, | ||
35 | NULL))) | ||
36 | { | ||
37 | free(ddob); | ||
38 | return NULL; | ||
39 | } | ||
40 | |||
41 | ddob->data = (DATA16 *)surface_desc.lpSurface; | ||
42 | |||
43 | if (FAILED(ddob->dd.surface_source->Unlock(NULL))) | ||
44 | { | ||
45 | free(ddob); | ||
46 | return NULL; | ||
47 | } | ||
48 | if (ddob->im) | ||
49 | evas_cache_image_drop(&ddob->im->cache_entry); | ||
50 | |||
51 | ddob->im = (Soft16_Image *) evas_cache_image_data(evas_common_soft16_image_cache_get(), width, height, (DATA32 *) ddob->data, 0, EVAS_COLORSPACE_RGB565_A5P); | ||
52 | if (ddob->im) | ||
53 | ddob->im->stride = ddob->pitch; | ||
54 | |||
55 | return ddob; | ||
56 | } | ||
57 | |||
58 | void | ||
59 | evas_software_ddraw_output_buffer_free(DDraw_Output_Buffer *ddob, int sync) | ||
60 | { | ||
61 | free(ddob); | ||
62 | } | ||
63 | |||
64 | void | ||
65 | evas_software_ddraw_output_buffer_paste(DDraw_Output_Buffer *ddob) | ||
66 | { | ||
67 | RECT dst_rect; | ||
68 | RECT src_rect; | ||
69 | POINT p; | ||
70 | |||
71 | SetRect(&src_rect, 0, 0, ddob->width, ddob->height); | ||
72 | |||
73 | if (FAILED(ddob->dd.surface_back->BltFast(0, 0, | ||
74 | ddob->dd.surface_source, | ||
75 | &src_rect, | ||
76 | DDBLTFAST_NOCOLORKEY | DDBLTFAST_WAIT))) | ||
77 | return; | ||
78 | |||
79 | p.x = 0; | ||
80 | p.y = 0; | ||
81 | ClientToScreen(ddob->dd.window, &p); | ||
82 | GetClientRect(ddob->dd.window, &dst_rect); | ||
83 | OffsetRect(&dst_rect, p.x, p.y); | ||
84 | ddob->dd.surface_primary->Blt(&dst_rect, | ||
85 | ddob->dd.surface_back, &src_rect, | ||
86 | DDBLT_WAIT, NULL); | ||
87 | } | ||