win32.c
changeset 2062 00f7d339fdcb
parent 2054 e313dd080bd3
child 2073 899419c9b997
equal deleted inserted replaced
2061:f67a12c65223 2062:00f7d339fdcb
    19 #define SMART_PALETTE_ANIM
    19 #define SMART_PALETTE_ANIM
    20 
    20 
    21 static struct {
    21 static struct {
    22 	HWND main_wnd;
    22 	HWND main_wnd;
    23 	HBITMAP dib_sect;
    23 	HBITMAP dib_sect;
    24 	void *bitmap_bits;
    24 	Pixel *bitmap_bits;
    25 	void *buffer_bits;
    25 	Pixel *buffer_bits;
    26 	void *alloced_bits;
    26 	Pixel *alloced_bits;
    27 	HPALETTE gdi_palette;
    27 	HPALETTE gdi_palette;
    28 	int width,height;
    28 	int width,height;
    29 	int width_org, height_org;
    29 	int width_org, height_org;
    30 	bool cursor_visible;
    30 	bool cursor_visible;
    31 	bool switch_driver;
    31 	bool switch_driver;
   566 
   566 
   567 	if (_wnd.dib_sect)
   567 	if (_wnd.dib_sect)
   568 		DeleteObject(_wnd.dib_sect);
   568 		DeleteObject(_wnd.dib_sect);
   569 
   569 
   570 	dc = GetDC(0);
   570 	dc = GetDC(0);
   571 	_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, &_wnd.bitmap_bits, NULL, 0);
   571 	_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (void**)&_wnd.bitmap_bits, NULL, 0);
   572 	if (_wnd.dib_sect == NULL)
   572 	if (_wnd.dib_sect == NULL)
   573 		error("CreateDIBSection failed");
   573 		error("CreateDIBSection failed");
   574 	ReleaseDC(0, dc);
   574 	ReleaseDC(0, dc);
   575 
   575 
   576 	if (!_wnd.double_size)
   576 	if (!_wnd.double_size)
   663 
   663 
   664 // simple upscaler by 2
   664 // simple upscaler by 2
   665 static void filter(int left, int top, int width, int height)
   665 static void filter(int left, int top, int width, int height)
   666 {
   666 {
   667 	uint p = _screen.pitch;
   667 	uint p = _screen.pitch;
   668 	byte *s = (byte*)_wnd.buffer_bits + top * p + left;
   668 	const Pixel *s = _wnd.buffer_bits + top * p + left;
   669 	byte *d = (byte*)_wnd.bitmap_bits + top * p * 4 + left * 2;
   669 	Pixel *d = _wnd.bitmap_bits + top * p * 4 + left * 2;
   670 
   670 
   671 	for (; height > 0; height--) {
   671 	for (; height > 0; height--) {
   672 		int i;
   672 		int i;
   673 
   673 
   674 		for (i = 0; i != width; i++) {
   674 		for (i = 0; i != width; i++) {