[Scummvm-cvs-logs] SF.net SVN: scummvm: [27517] scummvm/trunk/backends/platform/ds/arm9/source

tramboi at users.sourceforge.net tramboi at users.sourceforge.net
Mon Jun 18 09:06:24 CEST 2007


Revision: 27517
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27517&view=rev
Author:   tramboi
Date:     2007-06-18 00:06:24 -0700 (Mon, 18 Jun 2007)

Log Message:
-----------
NDS : Suppressed unneccessary complications regarding the backbuffer when CPU-scaled, basically it has the same stride than the regular one (512b) so most code doesn't have to change

Modified Paths:
--------------
    scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
    scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp

Modified: scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-06-18 06:12:54 UTC (rev 27516)
+++ scummvm/trunk/backends/platform/ds/arm9/source/dsmain.cpp	2007-06-18 07:06:24 UTC (rev 27517)
@@ -333,49 +333,25 @@
 void saveGameBackBuffer() {
 #ifdef DISABLE_SCUMM
 	if (savedBuffer == NULL) savedBuffer = new u8[gameWidth * gameHeight];
-	if(isCpuScalerEnabled())
-	{
-		memcpy(savedBuffer, get8BitBackBuffer(), gameWidth * gameHeight);
-	}
-	else
-	{
-		for (int r = 0; r < gameHeight; r++) {
-			memcpy(savedBuffer + (r * gameWidth), ((u8 *) (get8BitBackBuffer())) + (r * 512), gameWidth);
-		}
-	}	
+    for (int r = 0; r < gameHeight; r++) {
+		memcpy(savedBuffer + (r * gameWidth), ((u8 *) (get8BitBackBuffer())) + (r * 512), gameWidth);
 #endif
 }
 
 void restoreGameBackBuffer() {
 #ifdef DISABLE_SCUMM
 	if (savedBuffer) {
-		if(isCpuScalerEnabled())
-		{
-			memcpy(get8BitBackBuffer(), savedBuffer, gameWidth * gameHeight);
-			// TODO Synchronize with framebuffer if necessary
-		}		
-		else
-		{
-			for (int r = 0; r < gameHeight; r++) {
-				memcpy(((u8 *) (BG_GFX_SUB)) + (r * 512), savedBuffer + (r * gameWidth), gameWidth);
-				memcpy(((u8 *) (get8BitBackBuffer())) + (r * 512), savedBuffer + (r * gameWidth), gameWidth);
-			}
-		}		
+        for (int r = 0; r < gameHeight; r++) {
+            memcpy(((u8 *) (BG_GFX_SUB)) + (r * 512), savedBuffer + (r * gameWidth), gameWidth);
+            memcpy(((u8 *) (get8BitBackBuffer())) + (r * 512), savedBuffer + (r * gameWidth), gameWidth);
+        }
 		
 		delete savedBuffer;
 		savedBuffer = NULL;
 	}
 #else
-	if(isCpuScalerEnabled())
-	{
-		memset(get8BitBackBuffer(), 0, 320 * 200);
-		// TODO Synchronize with framebuffer if necessary
-	}
-	else
-	{
-		memset(get8BitBackBuffer(), 0, 512 * 256);
-		memset(BG_GFX_SUB, 0, 512 * 256);
-	}
+    memset(get8BitBackBuffer(), 0, 512 * 256);
+    memset(BG_GFX_SUB, 0, 512 * 256);
 	if (Scumm::g_scumm) {
 		Scumm::g_scumm->markRectAsDirty(Scumm::kMainVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1);
 		Scumm::g_scumm->markRectAsDirty(Scumm::kTextVirtScreen, 0, gameWidth - 1, 0, gameHeight - 1, 1);
@@ -1019,18 +995,9 @@
 			// the same.
 			u16* buffer = get8BitBackBuffer();
             
-            if(isCpuScalerEnabled())
-            {
-                for (int y = 0; y < gameHeight; ++y)
-                    for (int x = 0; x < gameWidth / 2; ++x)
-                        BG_GFX_SUB[y*256 + x] = buffer[y*gameWidth/2 + x];
-            }
-            else
-            {
-                for (int r = 0; r < (512 * 256) >> 1; r++) {
-                    BG_GFX_SUB[r] = buffer[r];
-                }
-            }			
+            for (int r = 0; r < (512 * 256) >> 1; r++)
+                BG_GFX_SUB[r] = buffer[r];
+                
 			SUB_DISPLAY_CR &= ~DISPLAY_BG1_ACTIVE;	// Turn off keyboard layer
 			SUB_DISPLAY_CR |= DISPLAY_BG3_ACTIVE;	// Turn on game layer
 		} else {

Modified: scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-06-18 06:12:54 UTC (rev 27516)
+++ scummvm/trunk/backends/platform/ds/arm9/source/osystem_ds.cpp	2007-06-18 07:06:24 UTC (rev 27517)
@@ -173,8 +173,8 @@
 	u16* src = (u16 *) buf;
 	
 	if (DS::getKeyboardEnable()) {
-	
-		for (int dy = y; dy < y + h; dy++) {
+		for (int dy = y; dy < y + h; dy++)
+        {
 			u16* dest = bg + (dy << 8) + (x >> 1);
 		
 			DC_FlushRange(src, w << 1);
@@ -185,7 +185,8 @@
 		}
 	
 	} else {
-		for (int dy = y; dy < y + h; dy++) {
+		for (int dy = y; dy < y + h; dy++)
+        {
 			u16* dest1 = bg + (dy << 8) + (x >> 1);
 			u16* dest2 = bgSub + (dy << 8) + (x >> 1);
 			
@@ -478,16 +479,14 @@
 
 	// Ensure we copy using 16 bit quantities due to limitation of VRAM addressing
 	
-    size_t imageStrideInBytes = DS::isCpuScalerEnabled() ? DS::getGameWidth() : 512;
-    size_t imageStrideInWords = imageStrideInBytes / 2;
 
 	u16* image = (u16 *) DS::get8BitBackBuffer();
 	for (int y = 0; y <  DS::getGameHeight(); y++)
 	{
-		DC_FlushRange(image + (y * imageStrideInWords), DS::getGameWidth());
+		DC_FlushRange(image + (y << 8), DS::getGameWidth());
 		for (int x = 0; x < DS::getGameWidth() >> 1; x++)
 		{
-			*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y * imageStrideInWords + x];
+			*(((u16 *) (surf->pixels)) + y * (DS::getGameWidth() >> 1) + x) = image[y << 8 + x];
 		}
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list