diff options
author | Nicolas Bacca | 2002-10-25 23:44:15 +0000 |
---|---|---|
committer | Nicolas Bacca | 2002-10-25 23:44:15 +0000 |
commit | c65eb3442a9a045f47a3be3fd90c2ceba89dfb5c (patch) | |
tree | a2f964d25869b76352bf9c84d6d1ec19205ec739 | |
parent | cabfdbf1e03ac18c9e17dcbe797a7c5b95096c7d (diff) | |
download | scummvm-rg350-c65eb3442a9a045f47a3be3fd90c2ceba89dfb5c.tar.gz scummvm-rg350-c65eb3442a9a045f47a3be3fd90c2ceba89dfb5c.tar.bz2 scummvm-rg350-c65eb3442a9a045f47a3be3fd90c2ceba89dfb5c.zip |
Fix overlay in portrait mode - better blitting (about time :)) - simon GUI fixes
svn-id: r5313
-rw-r--r-- | backends/wince/pocketpc.cpp | 66 | ||||
-rw-r--r-- | backends/wince/screen.cpp | 194 | ||||
-rw-r--r-- | backends/wince/screen.h | 1 |
3 files changed, 163 insertions, 98 deletions
diff --git a/backends/wince/pocketpc.cpp b/backends/wince/pocketpc.cpp index 7dde9cc016..c74fac0890 100644 --- a/backends/wince/pocketpc.cpp +++ b/backends/wince/pocketpc.cpp @@ -92,6 +92,22 @@ typedef struct pseudoGAPI { int format; } pseudoGAPI; +typedef struct { + int x, y, w, h; +} dirty_square; + +#define MAX_NUMBER_OF_DIRTY_SQUARES 32 + +#define AddDirtyRect(xi,yi,wi,hi) \ + if (num_of_dirty_square < MAX_NUMBER_OF_DIRTY_SQUARES) { \ + ds[num_of_dirty_square].x = xi; \ + ds[num_of_dirty_square].y = yi; \ + ds[num_of_dirty_square].w = wi; \ + ds[num_of_dirty_square].h = hi; \ + num_of_dirty_square++; \ + } + + /* Hardcode the video buffer for some devices for which there is no GAPI */ /* and no GameX support */ @@ -312,6 +328,8 @@ int gameXGXResume() { #endif GameDetector detector; +Engine *engine; +bool is_simon; NewGui *g_gui; extern Scumm *g_scumm; //extern SimonState *g_simon; @@ -553,6 +571,10 @@ bool select_game; bool gfx_mode_switch; +dirty_square ds[MAX_NUMBER_OF_DIRTY_SQUARES]; +int num_of_dirty_square; + + SoundProc *real_soundproc; const char KEYBOARD_MAPPING_ALPHA_HIGH[] = {"ABCDEFGHIJKLM"}; @@ -821,7 +843,7 @@ void runGame(char *game_name) { /* Start the engine */ - Engine *engine = Engine::createFromDetector(&detector, system); + engine = Engine::createFromDetector(&detector, system); keypad_init(); load_key_mapping(); @@ -831,6 +853,8 @@ void runGame(char *game_name) { else hide_cursor = TRUE; + is_simon = (detector._gameId >= GID_SIMON_FIRST); + engine->go(); //return 0; @@ -1106,10 +1130,8 @@ LRESULT CALLBACK OSystem_WINCE3::WndProc(HWND hWnd, UINT message, WPARAM wParam, else { switch(toolbar_selection) { case ToolbarSaveLoad: - if (detector._gameId >= GID_SIMON_FIRST && - detector._gameId <= GID_SIMON_LAST) { + if (is_simon) break; - } /*if (GetScreenMode()) {*/ /* draw_keyboard = true; @@ -1126,15 +1148,8 @@ LRESULT CALLBACK OSystem_WINCE3::WndProc(HWND hWnd, UINT message, WPARAM wParam, toolbar_drawn = false; break; case ToolbarSkip: - if (detector._gameId >= GID_SIMON_FIRST) { - -// !!! FIX SIMON !!! - - //g_simon->_exit_cutscene = true; - - -// !!! FIX SIMON !!! - + if (is_simon) { + ((SimonState*)engine)->_exit_cutscene = true; break; } wm->_event.event_code = EVENT_KEYDOWN; @@ -1489,6 +1504,8 @@ void OSystem_WINCE3::set_palette(const byte *colors, uint start, uint num) { } palette_update(); + + num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES; } void OSystem_WINCE3::load_gfx_mode() { @@ -1509,6 +1526,7 @@ void OSystem_WINCE3::init_size(uint w, uint h) { LimitScreenGeometry(); _screenWidth = w; _screenHeight = h; + num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES; } void OSystem_WINCE3::copy_rect(const byte *buf, int pitch, int x, int y, int w, int h) { @@ -1517,12 +1535,15 @@ void OSystem_WINCE3::copy_rect(const byte *buf, int pitch, int x, int y, int w, if (!hide_cursor && _mouse_drawn) undraw_mouse(); + AddDirtyRect(x, y, w, h); + dst = _gfx_buf + y * 320 + x; do { memcpy(dst, buf, w); dst += 320; buf += pitch; } while (--h); + } void OSystem_WINCE3::update_screen() { @@ -1534,8 +1555,19 @@ void OSystem_WINCE3::update_screen() { Set_565((int16*)_overlay_buf, 320, 0, 0, 320, 200); checkToolbar(); } - else - Blt(_gfx_buf); + else { + if (num_of_dirty_square >= MAX_NUMBER_OF_DIRTY_SQUARES) { + Blt(_gfx_buf); // global redraw + num_of_dirty_square = 0; + } + else { + int i; + for (i=0; i<num_of_dirty_square; i++) { + Blt_part(_gfx_buf + (320 * ds[i].y) + ds[i].x, ds[i].x, ds[i].y, ds[i].w, ds[i].h, 320); + } + num_of_dirty_square = 0; + } + } } bool OSystem_WINCE3::show_mouse(bool visible) { @@ -1593,6 +1625,7 @@ void OSystem_WINCE3::draw_mouse() { return; } + AddDirtyRect(xdraw, ydraw, real_w, real_h); _ms_old.x = xdraw; _ms_old.y = ydraw; _ms_old.w = real_w; @@ -1629,6 +1662,8 @@ void OSystem_WINCE3::undraw_mouse() { int old_h = _ms_old.h; + AddDirtyRect(_ms_old.x, _ms_old.y, _ms_old.w, _ms_old.h); + byte *dst = _gfx_buf + (_ms_old.y * 320) + _ms_old.x; byte *bak = _ms_backup; @@ -1820,6 +1855,7 @@ void OSystem_WINCE3::hide_overlay() { undraw_mouse(); _overlay_visible = false; toolbar_drawn = false; + num_of_dirty_square = MAX_NUMBER_OF_DIRTY_SQUARES; } void OSystem_WINCE3::clear_overlay() { diff --git a/backends/wince/screen.cpp b/backends/wince/screen.cpp index 78b318e254..ec59d46fac 100644 --- a/backends/wince/screen.cpp +++ b/backends/wince/screen.cpp @@ -121,22 +121,22 @@ UBYTE *toolbar = NULL; /* Using vectorized function to save on branches */ typedef void (*tCls)(); typedef void (*tBlt)(UBYTE*); -typedef void (*tBlt_part)(UBYTE*,int, int, int, int, UBYTE*); +typedef void (*tBlt_part)(UBYTE*,int, int, int, int, UBYTE*, int); typedef void (*tSet_565)(INT16 *buffer, int pitch, int x, int y, int width, int height); void mono_Cls(); void mono_Blt(UBYTE*); -void mono_Blt_part(UBYTE*, int, int, int, int, UBYTE*); +void mono_Blt_part(UBYTE*, int, int, int, int, UBYTE*, int); void palette_Cls(); void palette_Blt(UBYTE*); -void palette_Blt_part(UBYTE*, int, int, int, int, UBYTE*); +void palette_Blt_part(UBYTE*, int, int, int, int, UBYTE*, int); void hicolor_Cls(); void hicolor555_Blt(UBYTE*); -void hicolor555_Blt_part(UBYTE*, int, int, int, int, UBYTE*); +void hicolor555_Blt_part(UBYTE*, int, int, int, int, UBYTE*, int); void hicolor565_Blt(UBYTE*); -void hicolor565_Blt_part(UBYTE*, int, int, int, int, UBYTE*); +void hicolor565_Blt_part(UBYTE*, int, int, int, int, UBYTE*, int); void hicolor565_Get_565(INT16*, int, int, int, int, int); void hicolor565_Set_565(INT16*, int, int, int, int, int); void hicolor555_Set_565(INT16*, int, int, int, int, int); @@ -577,14 +577,14 @@ int counter = 0; void drawSoundItem(int x, int y) { if (!sound_activated) - pBlt_part(image_expand(item_soundOn), x, y, 32, 32, item_soundOn_colors); + pBlt_part(image_expand(item_soundOn), x, y, 32, 32, item_soundOn_colors, 0); else - pBlt_part(image_expand(item_soundOff), x, y, 32, 32, item_soundOff_colors); + pBlt_part(image_expand(item_soundOff), x, y, 32, 32, item_soundOff_colors, 0); } void drawWait() { - pBlt_part(image_expand(item_toolbar), 0, 0, 320, 40, item_toolbar_colors); - pBlt_part(image_expand(item_loading), 28, 10, 100, 25, item_loading_colors); + pBlt_part(image_expand(item_toolbar), 0, 0, 320, 40, item_toolbar_colors, 0); + pBlt_part(image_expand(item_loading), 28, 10, 100, 25, item_loading_colors, 0); } void drawBlankGameSelection() { @@ -592,7 +592,7 @@ void drawBlankGameSelection() { image_expand(item_startup); /* Store empty comment */ memcpy(comment_zone, decomp + (206 * 220), 8 * 220); - pBlt_part(decomp, _game_selection_X_offset, _game_selection_Y_offset, 220, 250, item_startup_colors); + pBlt_part(decomp, _game_selection_X_offset, _game_selection_Y_offset, 220, 250, item_startup_colors, 0); } void drawCommentString(char *comment) { @@ -600,27 +600,27 @@ void drawCommentString(char *comment) { memcpy(decomp + (206 * 220), comment_zone, 8 * 220); /* Draw new comment */ printString(comment, 24, 206, 2); - pBlt_part(decomp + (206 * 220), _game_selection_X_offset, _game_selection_Y_offset + 206, 220, 8, item_startup_colors); + pBlt_part(decomp + (206 * 220), _game_selection_X_offset, _game_selection_Y_offset + 206, 220, 8, item_startup_colors, 0); } void drawStandardString(char *game, int index) { printString(game, 24, 70 + (15 * index), 2); //pBlt_part(decomp, GAME_SELECTION_X_OFFSET + 24, GAME_SELECTION_Y_OFFSET + 70 + (12 * index), 220, 8, item_startup_colors); - pBlt_part(decomp + ((70 + (15 * index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * index), 220, 8, item_startup_colors); + pBlt_part(decomp + ((70 + (15 * index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * index), 220, 8, item_startup_colors, 0); } void drawHighlightedString(char *game, int index) { /* Replace former highlighted string */ if (_highlighted_index != -1) { memcpy(decomp + ((70 + (15 * _highlighted_index)) * 220), highlighted_zone, 8 * 220); - pBlt_part(decomp + ((70 + (15 * _highlighted_index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * _highlighted_index), 220, 8, item_startup_colors); + pBlt_part(decomp + ((70 + (15 * _highlighted_index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * _highlighted_index), 220, 8, item_startup_colors, 0); } /* Save non highlighted string */ _highlighted_index = index; memcpy(highlighted_zone, decomp + ((70 + (15 * index)) * 220), 8 * 220); /* Draw new highlighted string */ printString(game, 24, 70 + (15 * index), 2, 3); - pBlt_part(decomp + ((70 + (15 * index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * index), 220, 8, item_startup_colors); + pBlt_part(decomp + ((70 + (15 * index)) * 220), _game_selection_X_offset, _game_selection_Y_offset + 70 + (15 * index), 220, 8, item_startup_colors, 0); } void resetLastHighlighted() { @@ -638,45 +638,45 @@ void drawAllToolbar() { if (currentScreenMode) { if (draw_keyboard) { - pBlt_part(image_expand(item_keyboard), 0, 200, 320, 40, item_keyboard_colors); + pBlt_part(image_expand(item_keyboard), 0, 200, 320, 40, item_keyboard_colors, 0); } else { - pBlt_part(image_expand(item_toolbar), 0, 200, 320, 40, item_toolbar_colors); + pBlt_part(image_expand(item_toolbar), 0, 200, 320, 40, item_toolbar_colors, 0); x = 10; y = 204; - pBlt_part(image_expand(item_disk), x, y, 32, 32, item_disk_colors); + pBlt_part(image_expand(item_disk), x, y, 32, 32, item_disk_colors, 0); x += 40; - pBlt_part(image_expand(item_skip), x, y, 32, 32, item_skip_colors); + pBlt_part(image_expand(item_skip), x, y, 32, 32, item_skip_colors, 0); x += 40; drawSoundItem(x, y); if (_gfx_mode_switch) { x += 40; pBlt_part(image_expand(item_monkeyPortrait), x, y, 32, 32, - item_monkeyPortrait_colors); + item_monkeyPortrait_colors, 0); } } } else { if (draw_keyboard) { pBlt_part(image_expand(item_keyboardPortrait), 0, 240, 320, 80, - item_keyboardPortrait_colors); + item_keyboardPortrait_colors, 0); } else { pBlt_part(image_expand(item_toolbarPortrait), 0, 240, 320, 80, - item_toolbarPortrait_colors); + item_toolbarPortrait_colors, 0); /*drawToolbarItem(item_toolbarPortrait_colors, item_toolbarPortrait, 0, 240, 240, 80);*/ x = 10; y = 240; - pBlt_part(image_expand(item_disk), x, y, 32, 32, item_disk_colors); + pBlt_part(image_expand(item_disk), x, y, 32, 32, item_disk_colors, 0); x += 40; - pBlt_part(image_expand(item_skip), x, y, 32, 32, item_skip_colors); + pBlt_part(image_expand(item_skip), x, y, 32, 32, item_skip_colors, 0); x += 40; drawSoundItem(x, y); if (_gfx_mode_switch) { x += 40; pBlt_part(image_expand(item_monkeyLandscape), x, y, 32, 32, - item_monkeyLandscape_colors); + item_monkeyLandscape_colors, 0); } } } @@ -733,6 +733,14 @@ void Blt(UBYTE * scr_ptr) } +void Blt_part(UBYTE * src_ptr, int x, int y, int width, int height, int pitch) { + pBlt_part(src_ptr, x, y, width, height, NULL, pitch); + + if (toolbar_available && !toolbar_drawn && !hide_toolbar) + drawAllToolbar(); + +} + void checkToolbar() { if (toolbar_available && !toolbar_drawn && !hide_toolbar) drawAllToolbar(); @@ -771,10 +779,12 @@ void mono_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) static long linestep; static UBYTE bitmask; static int bitshift; + static long skipmask; scraddr = (UBYTE*)dynamicGXBeginDraw(); pixelstep = geom[useMode].pixelstep; linestep = (pixelstep > 0) ? -1 : 1; + skipmask = geom[useMode].xSkipMask; bitshift = 0; bitmask = (1<<gxdp.cBPP)-1; @@ -800,13 +810,14 @@ void mono_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) /* Turtle warning !!! */ for (i=0; i<width; i++) { + if (skipmask == 0xffffffff || (long)i & skipmask) { + *dst = ((*dst)&~bitmask)|(COLORCONVMONO( + RED_FROM_565(*(buffer + i)), + GREEN_FROM_565(*(buffer + i)), + BLUE_FROM_565(*(buffer + i))) << bitshift); - *dst = ((*dst)&~bitmask)|(COLORCONVMONO( - RED_FROM_565(*(buffer + i)), - GREEN_FROM_565(*(buffer + i)), - BLUE_FROM_565(*(buffer + i))) << bitshift); - - dst += pixelstep; + dst += pixelstep; + } } ADVANCE_PARTIAL(scraddr, linestep); @@ -821,12 +832,12 @@ void mono_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) void mono_Blt(UBYTE *src_ptr) { - mono_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL); + mono_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL, 0); } void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, - UBYTE * own_palette) + UBYTE * own_palette, int pitch) { // Mono blit routines contain good deal of voodoo static UBYTE *src; @@ -878,7 +889,7 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, /* Update offsets to the current line */ scraddr += y * linestep; - scr_ptr_limit = scr_ptr + width * height; + scr_ptr_limit = scr_ptr + (pitch ? pitch : width) * height; src_limit = scr_ptr + width; @@ -960,8 +971,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, ADVANCE_PARTIAL(scraddr, linestep); - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else if(skipmask != 0xffffffff) @@ -995,8 +1006,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, ADVANCE_PARTIAL(scraddr, linestep); - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1027,8 +1038,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, ADVANCE_PARTIAL(scraddr, linestep); - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } } @@ -1048,7 +1059,7 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, /* Update offsets to the current line */ scraddr += y * linestep; - scr_ptr_limit = scr_ptr + width * height; + scr_ptr_limit = scr_ptr + (pitch ? pitch : width) * height; src_limit = scr_ptr + width; if(skipmask != 0xffffffff) @@ -1088,8 +1099,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1126,8 +1137,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } } @@ -1165,8 +1176,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1201,8 +1212,8 @@ void mono_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } } @@ -1219,6 +1230,7 @@ void palette_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int heig static UBYTE *dst; static long pixelstep; static long linestep; + static long skipmask; unsigned char color_match[500]; memset(color_match, 255, sizeof(color_match)); @@ -1226,6 +1238,7 @@ void palette_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int heig pixelstep = geom[useMode].pixelstep; linestep = geom[useMode].linestep; + skipmask = geom[useMode].xSkipMask; if(scraddr) { @@ -1249,10 +1262,11 @@ void palette_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int heig /* HUGE Turtle warning !!! */ for (i=0; i<width; i++) { - + if (skipmask == 0xffffffff || (long)i & skipmask) { *dst++ = best_match(RED_FROM_565(*(buffer + i)), GREEN_FROM_565(*(buffer + i)), BLUE_FROM_565(*(buffer + i)), 236) + 10; + } } buffer += pitch; @@ -1266,11 +1280,11 @@ void palette_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int heig void palette_Blt(UBYTE *src_ptr) { - palette_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL); + palette_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL, 0); } void palette_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, - UBYTE * own_palette) + UBYTE * own_palette, int pitch) { static UBYTE *src; static UBYTE *dst; @@ -1315,7 +1329,7 @@ void palette_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, /* Update offsets to the current line */ scraddr += y * linestep; - scr_ptr_limit = scr_ptr + width * height; + scr_ptr_limit = scr_ptr + (pitch ? pitch : width) * height; src_limit = scr_ptr + width; /* Internal pixel loops */ @@ -1355,8 +1369,8 @@ void palette_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, src ++; } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1394,8 +1408,8 @@ void palette_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, src ++; } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } @@ -1411,11 +1425,13 @@ void hicolor555_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h static UBYTE *dst; static long pixelstep; static long linestep; - + static long skipmask; + scraddr = (UBYTE*)dynamicGXBeginDraw(); pixelstep = geom[useMode].pixelstep; linestep = geom[useMode].linestep; + skipmask = geom[useMode].xSkipMask; if(scraddr) { @@ -1439,10 +1455,13 @@ void hicolor555_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h /* Turtle warning !!! */ for (i=0; i<width; i++) { - *(unsigned short*)dst = COLORCONV555( - RED_FROM_565(*(buffer + i)), GREEN_FROM_565(*(buffer + i)), BLUE_FROM_565(*(buffer + i)) - ); - dst += 2; + if (skipmask == 0xffffffff || (long)i & skipmask) { + + *(unsigned short*)dst = COLORCONV555( + RED_FROM_565(*(buffer + i)), GREEN_FROM_565(*(buffer + i)), BLUE_FROM_565(*(buffer + i)) + ); + dst += pixelstep; + } } buffer += pitch; @@ -1456,12 +1475,12 @@ void hicolor555_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h void hicolor555_Blt(UBYTE *src_ptr) { - hicolor555_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL); + hicolor555_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL, 0); } void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, - UBYTE * own_palette) + UBYTE * own_palette, int pitch) { static UBYTE *src; static UBYTE *dst; @@ -1500,7 +1519,7 @@ void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, /* Update offsets to the current line */ scraddr += y * linestep; - scr_ptr_limit = scr_ptr + width * height; + scr_ptr_limit = scr_ptr + (pitch ? pitch : width) * height; src_limit = scr_ptr + width; /* Internal pixel loops */ @@ -1577,8 +1596,8 @@ void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, src += 4; } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else if(skipmask != 0xffffffff) @@ -1611,8 +1630,8 @@ void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, src ++; } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1643,8 +1662,8 @@ void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } @@ -1656,7 +1675,7 @@ void hicolor555_Blt_part(UBYTE * scr_ptr,int x, int y, int width, int height, void hicolor565_Blt(UBYTE *src_ptr) { - hicolor565_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL); + hicolor565_Blt_part(src_ptr, 0, 0, _geometry_w, _geometry_h, NULL, 0); } @@ -1666,11 +1685,13 @@ void hicolor565_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h static UBYTE *dst; static long pixelstep; static long linestep; + static long skipmask; scraddr = (UBYTE*)dynamicGXBeginDraw(); pixelstep = geom[useMode].pixelstep; linestep = geom[useMode].linestep; + skipmask = geom[useMode].xSkipMask; if(scraddr) { @@ -1690,10 +1711,17 @@ void hicolor565_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h /* skip non updated pixels for this line */ - for (i=0; i < x; i++) - dst += pixelstep; + for (i=0; i < x; i++) { + dst += pixelstep; + } - memcpy(dst, buffer, width * 2); + for (i=0; i<width; i++) { + if (skipmask == 0xffffffff || (long)i & skipmask) { + *(unsigned short*)dst = buffer[i]; + dst += pixelstep; + } + } + //memcpy(dst, buffer, width * 2); buffer += pitch; scraddr += linestep; @@ -1705,7 +1733,7 @@ void hicolor565_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int h } void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, - UBYTE * own_palette) + UBYTE * own_palette, int pitch) { static UBYTE *src; static UBYTE *dst; @@ -1744,7 +1772,7 @@ void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, /* Update offsets to the current line */ scraddr += y * linestep; - scr_ptr_limit = scr_ptr + width * height; + scr_ptr_limit = scr_ptr + (pitch ? pitch : width) * height; src_limit = scr_ptr + width; /* Internal pixel loops */ @@ -1822,8 +1850,8 @@ void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else if(skipmask != 0xffffffff) @@ -1856,8 +1884,8 @@ void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } else @@ -1887,8 +1915,8 @@ void hicolor565_Blt_part(UBYTE * scr_ptr, int x, int y, int width, int height, } scraddr += linestep; - scr_ptr += width; - src_limit += width; + scr_ptr += (pitch ? pitch : width); + src_limit += (pitch ? pitch : width); } } @@ -1983,7 +2011,7 @@ void Get_565(UBYTE *src, INT16 *buffer, int pitch, int x, int y, int width, int } void Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { - pSet_565(buffer, pitch, x, y, width, height); + pSet_565(buffer, pitch, x, y, width, height); } void NULL_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { diff --git a/backends/wince/screen.h b/backends/wince/screen.h index 7a9f7dac09..17f27dc86a 100644 --- a/backends/wince/screen.h +++ b/backends/wince/screen.h @@ -45,6 +45,7 @@ void GraphicsResume(); void SetPalEntry(int ent, UBYTE r, UBYTE g, UBYTE b); void Blt(UBYTE * scr_ptr); +void Blt_part(UBYTE * src_ptr, int x, int y, int width, int height, int pitch); void checkToolbar(); void Get_565(UBYTE *src, INT16 *buffer, int pitch, int x, int y, int width, int height); |