From 9f3558397c77917addd838b06680f5c8a2aecb53 Mon Sep 17 00:00:00 2001 From: Nicolas Bacca Date: Sun, 11 May 2003 17:42:02 +0000 Subject: The new (Jornada 820 inspired) GDI rendering crashes on a Jornada 680 - further investigation needed. For the moment I'll leave both, define NEW_GAPI_CODE if you want to compile a version (HPC ARM) for the Jornada 820 svn-id: r7460 --- backends/wince/screen.cpp | 176 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 161 insertions(+), 15 deletions(-) (limited to 'backends') diff --git a/backends/wince/screen.cpp b/backends/wince/screen.cpp index 6cbc076909..6ad2df2cbf 100644 --- a/backends/wince/screen.cpp +++ b/backends/wince/screen.cpp @@ -21,7 +21,7 @@ #ifdef _WIN32_WCE -#define POCKETSCUMM_VERSION "PPC pre 0.4.0-1" +#define POCKETSCUMM_VERSION "PPC 0.4.0" /* Original GFX code by Vasyl Tsvirkunov */ @@ -137,14 +137,21 @@ int toolbar_available; UBYTE *toolbar = NULL; -//UBYTE *noGAPI_video_buffer = NULL; -//HDC noGAPI_compat; +#ifndef NEW_GAPI_CODE + +UBYTE *noGAPI_video_buffer = NULL; +HDC noGAPI_compat; + +#else + UBYTE *noGAPI_buffer; HBITMAP noGAPI_bitmap; BITMAPINFOHEADER noGAPI_bitmap_header; HDC noGAPI_compat; +#endif + char noGAPI = 0; /* Using vectorized function to save on branches */ @@ -429,35 +436,33 @@ int GraphicsOn(HWND hWndMain_param, bool gfx_mode_switch) toolbar_available = 1; - // Init GDI - //noGAPI_video_buffer = (UBYTE*)malloc(320 * 240 * 2); - hdc = GetDC(hWndMain); noGAPI_compat = CreateCompatibleDC(hdc); ReleaseDC(hWndMain, hdc); + +#ifndef NEW_GAPI_CODE + // Init GDI + noGAPI_video_buffer = (UBYTE*)malloc(320 * 240 * 2); +#else + memset(&noGAPI_bitmap_header, 0, sizeof(BITMAPINFOHEADER)); noGAPI_bitmap_header.biSize = sizeof(BITMAPINFOHEADER); - - /* - noGAPI_bitmap_header.biWidth = (currentScreenMode || wide_screen ? width : height); - noGAPI_bitmap_header.biHeight = -(currentScreenMode || wide_screen ? height : width); - */ noGAPI_bitmap_header.biWidth = GetSystemMetrics(SM_CXSCREEN); noGAPI_bitmap_header.biHeight = -GetSystemMetrics(SM_CYSCREEN); /* origin = top */ - - //noGAPI_bitmap_header.biWidth = 240; - //noGAPI_bitmap_header.biHeight = -320; - + noGAPI_bitmap_header.biPlanes = 1; noGAPI_bitmap_header.biBitCount = 24; noGAPI_bitmap_header.biCompression = BI_RGB; /* paletted fixme Jornada 820 ? */ + noGAPI_bitmap = CreateDIBSection(noGAPI_compat, (BITMAPINFO*)&noGAPI_bitmap_header, DIB_RGB_COLORS, (void**)&noGAPI_buffer, NULL, 0); if (!noGAPI_bitmap) exit(1); + SelectObject(noGAPI_compat, noGAPI_bitmap); +#endif _gfx_device = DEVICE_GDI; _gfx_option = VIDEO_DONT_CARE; @@ -2591,6 +2596,146 @@ void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, /* ********************************* NO GAPI DISPLAY ********************************* */ +#ifndef NEW_GAPI_CODE + +void noGAPI_Cls() { + HBITMAP old; + RECT rc; + HDC hdc = GetDC(hWndMain); + HBITMAP hb; + + GetWindowRect(hWndMain, &rc); + memset(noGAPI_video_buffer, 0x00, sizeof(noGAPI_video_buffer)); + if (currentScreenMode || wide_screen) + hb = CreateBitmap(320, 240, 1, 16, noGAPI_video_buffer); + else + hb = CreateBitmap(240, 320, 1, 16, noGAPI_video_buffer); + old = (HBITMAP)SelectObject(noGAPI_compat, hb); + if (currentScreenMode || wide_screen) + BitBlt(hdc, 0, 0, 320, 240, noGAPI_compat, 0, 0, SRCCOPY); + else + BitBlt(hdc, 0, 0, 240, 320, noGAPI_compat, 0, 0, SRCCOPY); + SelectObject(noGAPI_compat, old); + ReleaseDC(hWndMain, hdc); + DeleteObject(hb); +} + +void noGAPI_Blt(UBYTE *src_ptr) { + noGAPI_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL, 0); +} + +void noGAPI_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { + HBITMAP old; + RECT rc; + HDC hdc = GetDC(hWndMain); + HBITMAP hb; + UBYTE *work_buffer; + int i; + int j; + //long skipmask; + + //skipmask = geom[useMode].xSkipMask; + + + GetWindowRect(hWndMain, &rc); + + work_buffer = noGAPI_video_buffer; + unsigned short *work_buffer_2 = (unsigned short*)work_buffer; + if (currentScreenMode && !wide_screen) { + + for (i=0; i