changeset 168:cf2aa37d2fe7

Delete DrawSpan::get_pixel().
author gongo@localhost.localdomain
date Thu, 11 Dec 2008 10:38:28 +0900
parents c8b868871dce
children cd1c289f952d
files TaskManager/Test/test_render/Makefile.def TaskManager/Test/test_render/spe/DrawSpan.cpp TaskManager/Test/test_render/spe/DrawSpan.h TaskManager/Test/test_render/task/DrawSpan.cpp TaskManager/Test/test_render/task/DrawSpan.h TaskManager/Test/test_render/viewerSDL.cpp TaskManager/Test/test_render/viewer_types.h
diffstat 7 files changed, 15 insertions(+), 52 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/Test/test_render/Makefile.def	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/Makefile.def	Thu Dec 11 10:38:28 2008 +0900
@@ -11,7 +11,7 @@
 #CERIUM = ../../..
 
 CC      = g++
-CFLAGS  = -O0 -g -Wall# -DDEBUG
+CFLAGS  = -O9 -g -Wall# -DDEBUG
 
 INCLUDE = -I$(CERIUM)/include/TaskManager -I.
 LIBS = -L$(CERIUM)/TaskManager
\ No newline at end of file
--- a/TaskManager/Test/test_render/spe/DrawSpan.cpp	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.cpp	Thu Dec 11 10:38:28 2008 +0900
@@ -97,22 +97,12 @@
     return zRow;
 }
 
-
-char*
-DrawSpan::get_pixel(int tx, int ty, uint32 *texture_image)
-{
-    return (char*)(texture_image+((TEXTURE_SPLIT_PIXEL)*ty+tx));
-}
-
 Uint32
 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
 {
     Uint8 red, green, blue, alpha;
     TilePtr tile;
 
-    /**
-     * get,put はオブジェクト(Hashとか?)を作ってアクセスするかな
-     */
     tile = hash->get(addr);
     if (tile == NULL) {
 	if (tileList->size >= MAX_TILE) {
@@ -143,15 +133,7 @@
 	smanager->dma_wait(TEX_LOAD);
     }
 
-    char *p = get_pixel(tx, ty, tile->pixel);
-    
-    alpha = 255;
-    red   = (Uint8) p[0];
-    green = (Uint8) p[1];
-    blue  = (Uint8) p[2];
-
-    return (red & 0xff) * 0x10000 + (green & 0xff) * 0x100
-	+ (blue & 0xff) + (alpha << 24);
+    return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx];
 }
 
 
@@ -277,7 +259,7 @@
 			tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
 			
 			rgb = get_rgb(tex_localx, tex_localy, tex_addr);
-
+		    
 			zRow[localx + (rangex*localy)] = tex_z;
 			linebuf[localy][localx] = rgb;
 		    }
--- a/TaskManager/Test/test_render/spe/DrawSpan.h	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/spe/DrawSpan.h	Thu Dec 11 10:38:28 2008 +0900
@@ -26,7 +26,6 @@
     float* zRow_init(int w, int h);
     void linebuf_init(int *buf, int width, int rgb);
     
-    char* get_pixel(int tx, int ty, uint32 *texture_image);
     Uint32 get_rgb(int tx, int ty, uint32 *addr);
 };
 
--- a/TaskManager/Test/test_render/task/DrawSpan.cpp	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.cpp	Thu Dec 11 10:38:28 2008 +0900
@@ -97,22 +97,12 @@
     return zRow;
 }
 
-
-char*
-DrawSpan::get_pixel(int tx, int ty, uint32 *texture_image)
-{
-    return (char*)(texture_image+((TEXTURE_SPLIT_PIXEL)*ty+tx));
-}
-
 Uint32
 DrawSpan::get_rgb(int tx, int ty, uint32 *addr)
 {
     Uint8 red, green, blue, alpha;
     TilePtr tile;
 
-    /**
-     * get,put はオブジェクト(Hashとか?)を作ってアクセスするかな
-     */
     tile = hash->get(addr);
     if (tile == NULL) {
 	if (tileList->size >= MAX_TILE) {
@@ -143,15 +133,7 @@
 	smanager->dma_wait(TEX_LOAD);
     }
 
-    char *p = get_pixel(tx, ty, tile->pixel);
-    
-    alpha = 255;
-    red   = (Uint8) p[0];
-    green = (Uint8) p[1];
-    blue  = (Uint8) p[2];
-
-    return (red & 0xff) * 0x10000 + (green & 0xff) * 0x100
-	+ (blue & 0xff) + (alpha << 24);
+    return tile->pixel[(TEXTURE_SPLIT_PIXEL)*ty+tx];
 }
 
 
@@ -277,7 +259,7 @@
 			tex_localy = tex_ypos % TEXTURE_SPLIT_PIXEL;
 			
 			rgb = get_rgb(tex_localx, tex_localy, tex_addr);
-
+		    
 			zRow[localx + (rangex*localy)] = tex_z;
 			linebuf[localy][localx] = rgb;
 		    }
--- a/TaskManager/Test/test_render/task/DrawSpan.h	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/task/DrawSpan.h	Thu Dec 11 10:38:28 2008 +0900
@@ -26,7 +26,6 @@
     float* zRow_init(int w, int h);
     void linebuf_init(int *buf, int width, int rgb);
     
-    char* get_pixel(int tx, int ty, uint32 *texture_image);
     Uint32 get_rgb(int tx, int ty, uint32 *addr);
 };
 
--- a/TaskManager/Test/test_render/viewerSDL.cpp	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/viewerSDL.cpp	Thu Dec 11 10:38:28 2008 +0900
@@ -17,7 +17,7 @@
 	exit(1);
     }
 
-    screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE);
+    screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE);
     if (screen == NULL) {
 	fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
 	SDL_Quit();
@@ -27,6 +27,7 @@
     pixels = (Uint32*)screen->pixels;
 
     p = (Uint32*)manager->malloc(sizeof(int)*width*height);
+    pixels = p;
     bitmap = SDL_CreateRGBSurfaceFrom((void *)p, width, height, 32,
 				      width*4, redMask, greenMask,
 				      blueMask, alphaMask);
--- a/TaskManager/Test/test_render/viewer_types.h	Tue Dec 09 15:07:31 2008 +0900
+++ b/TaskManager/Test/test_render/viewer_types.h	Thu Dec 11 10:38:28 2008 +0900
@@ -17,15 +17,15 @@
 };
 
 #if defined(__LITTLE_ENDIAN__) 
-const int redMask   = 0x000000ff;
-const int greenMask = 0x0000ff00;
-const int blueMask  = 0x00ff0000;
-const int alphaMask = 0xff000000;
+const int redMask   = 0x0000ff00;
+const int greenMask = 0x00ff0000;
+const int blueMask  = 0xff000000;
+const int alphaMask = 0x000000ff;
 #else
-const int redMask   = 0xff000000;
-const int greenMask = 0x00ff0000;
-const int blueMask  = 0x0000ff00;
-const int alphaMask = 0x000000ff;
+const int redMask   = 0x00ff0000;
+const int greenMask = 0x0000ff00;
+const int blueMask  = 0x000000ff;
+const int alphaMask = 0xff000000;
 #endif
 
 extern int getLocalX(int x);