1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#include <string.h>
#include "evas_common.h"
#include "evas_engine.h"
Gdi_Output_Buffer *
evas_software_gdi_output_buffer_new(HDC dc,
BITMAPINFO_GDI *bitmap_info,
int depth,
int width,
int height,
void *data)
{
Gdi_Output_Buffer *gdiob;
gdiob = calloc(1, sizeof(Gdi_Output_Buffer));
if (!gdiob) return NULL;
if (!data)
{
bitmap_info->bih.biWidth = width;
bitmap_info->bih.biHeight = -height;
bitmap_info->bih.biSizeImage = (depth >> 3) * width * height;
gdiob->bitmap = CreateDIBSection(dc,
(const BITMAPINFO *)bitmap_info,
DIB_RGB_COLORS,
(void **)(&data),
NULL,
0);
if (!gdiob->bitmap)
{
free(gdiob);
return NULL;
}
}
gdiob->bitmap_info = bitmap_info;
gdiob->dc = dc;
gdiob->data = data;
gdiob->width = width;
gdiob->height = height;
gdiob->depth = depth;
gdiob->pitch = width * (depth >> 3);
/* gdiob->psize = gdiob->pitch * height; */
return gdiob;
}
void
evas_software_gdi_output_buffer_free(Gdi_Output_Buffer *gdiob)
{
DeleteObject(gdiob->bitmap);
free(gdiob);
}
void
evas_software_gdi_output_buffer_paste(Gdi_Output_Buffer *gdiob,
int x,
int y)
{
HDC dc;
dc = CreateCompatibleDC(gdiob->dc);
if (!dc)
return;
SelectObject(dc, gdiob->bitmap);
BitBlt(gdiob->dc,
x, y,
gdiob->width, gdiob->height,
dc,
0, 0,
SRCCOPY);
DeleteDC(dc);
}
DATA8 *
evas_software_gdi_output_buffer_data(Gdi_Output_Buffer *gdiob,
int *pitch)
{
if (pitch) *pitch = gdiob->pitch;
return gdiob->data;
}
int
evas_software_gdi_output_buffer_depth(Gdi_Output_Buffer *gdiob)
{
return gdiob->depth;
}
|