[Scummvm-cvs-logs] SF.net SVN: scummvm: [22486] residual/trunk
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Tue May 16 02:33:54 CEST 2006
Revision: 22486
Author: aquadran
Date: 2006-05-16 02:20:12 -0700 (Tue, 16 May 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22486&view=rev
Log Message:
-----------
removed not needed code
Modified Paths:
--------------
residual/trunk/Makefile.common
residual/trunk/dists/msvc8/residual.vcproj
residual/trunk/tinygl/zbuffer.cpp
residual/trunk/tinygl/zbuffer.h
residual/trunk/tinygl/zgl.h
Removed Paths:
-------------
residual/trunk/tinygl/zdither.cpp
residual/trunk/tinygl/zfeatures.h
Modified: residual/trunk/Makefile.common
===================================================================
--- residual/trunk/Makefile.common 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/Makefile.common 2006-05-16 09:20:12 UTC (rev 22486)
@@ -90,7 +90,6 @@
tinygl/texture.o \
tinygl/vertex.o \
tinygl/zbuffer.o \
- tinygl/zdither.o \
tinygl/zline.o \
tinygl/zmath.o \
tinygl/ztriangle.o
Modified: residual/trunk/dists/msvc8/residual.vcproj
===================================================================
--- residual/trunk/dists/msvc8/residual.vcproj 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/dists/msvc8/residual.vcproj 2006-05-16 09:20:12 UTC (rev 22486)
@@ -4,6 +4,7 @@
Version="8,00"
Name="residual"
ProjectGUID="{44D38F29-303D-4E3D-AF45-B96523BF1F9F}"
+ RootNamespace="residual"
Keyword="Win32Proj"
>
<Platforms>
@@ -65,6 +66,7 @@
LinkIncremental="2"
GenerateManifest="false"
ManifestFile=""
+ IgnoreDefaultLibraryNames="libcmt"
GenerateDebugInformation="true"
SubSystem="1"
TargetMachine="1"
@@ -588,14 +590,6 @@
>
</File>
<File
- RelativePath="..\..\tinygl\zdither.cpp"
- >
- </File>
- <File
- RelativePath="..\..\tinygl\zfeatures.h"
- >
- </File>
- <File
RelativePath="..\..\tinygl\zgl.h"
>
</File>
Modified: residual/trunk/tinygl/zbuffer.cpp
===================================================================
--- residual/trunk/tinygl/zbuffer.cpp 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/tinygl/zbuffer.cpp 2006-05-16 09:20:12 UTC (rev 22486)
@@ -28,22 +28,11 @@
zb->linesize = (xsize * PSZB + 3) & ~3;
switch (mode) {
-#ifdef TGL_FEATURE_8_BITS
- case ZB_MODE_INDEX:
- ZB_initDither(zb, nb_colors, color_indexes, color_table);
- break;
-#endif
-#ifdef TGL_FEATURE_32_BITS
- case ZB_MODE_RGBA:
-#endif
-#ifdef TGL_FEATURE_24_BITS
- case ZB_MODE_RGB24:
-#endif
- case ZB_MODE_5R6G5B:
- zb->nb_colors = 0;
- break;
+ case ZB_MODE_5R6G5B:
+ zb->nb_colors = 0;
+ break;
default:
- goto error;
+ goto error;
}
size = zb->xsize * zb->ysize * sizeof(unsigned short);
@@ -82,11 +71,6 @@
void ZB_close(ZBuffer * zb)
{
-#ifdef TGL_FEATURE_8_BITS
- if (zb->mode == ZB_MODE_INDEX)
- ZB_closeDither(zb);
-#endif
-
if (zb->frame_buffer_allocated)
gl_free(zb->pbuf);
@@ -146,176 +130,18 @@
}
}
-#if TGL_FEATURE_RENDER_BITS == 16
-
-/* 32 bpp copy */
-
-#ifdef TGL_FEATURE_32_BITS
-
-#define RGB16_TO_RGB32(p0,p1,v)\
-{\
- unsigned int g,b,gb;\
- g = (v & 0x07E007E0) << 5;\
- b = (v & 0x001F001F) << 3;\
- gb = g | b;\
- p0 = (gb & 0x0000FFFF) | ((v & 0x0000F800) << 8);\
- p1 = (gb >> 16) | ((v & 0xF8000000) >> 8);\
-}
-
-static void ZB_copyFrameBufferRGB32(ZBuffer * zb,
- void *buf,
- int linesize)
-{
- unsigned short *q;
- unsigned int *p, *p1, v, w0, w1;
- int y, n;
-
- q = zb->pbuf;
- p1 = (unsigned int *) buf;
-
- for (y = 0; y < zb->ysize; y++) {
- p = p1;
- n = zb->xsize >> 2;
- do {
- v = *(unsigned int *) q;
-#if BYTE_ORDER == BIG_ENDIAN
- RGB16_TO_RGB32(w1, w0, v);
-#else
- RGB16_TO_RGB32(w0, w1, v);
-#endif
- p[0] = w0;
- p[1] = w1;
-
- v = *(unsigned int *) (q + 2);
-#if BYTE_ORDER == BIG_ENDIAN
- RGB16_TO_RGB32(w1, w0, v);
-#else
- RGB16_TO_RGB32(w0, w1, v);
-#endif
- p[2] = w0;
- p[3] = w1;
-
- q += 4;
- p += 4;
- } while (--n > 0);
-
- p1 += linesize;
- }
-}
-
-#endif
-
-/* 24 bit packed pixel handling */
-
-#ifdef TGL_FEATURE_24_BITS
-
-/* order: RGBR GBRG BRGB */
-
-/* XXX: packed pixel 24 bit support not tested */
-/* XXX: big endian case not optimised */
-
-#if BYTE_ORDER == BIG_ENDIAN
-
-#define RGB16_TO_RGB24(p0,p1,p2,v1,v2)\
-{\
- unsigned int r1,g1,b1,gb1,g2,b2,gb2;\
- v1 = (v1 << 16) | (v1 >> 16);\
- v2 = (v2 << 16) | (v2 >> 16);\
- r1 = (v1 & 0xF800F800);\
- g1 = (v1 & 0x07E007E0) << 5;\
- b1 = (v1 & 0x001F001F) << 3;\
- gb1 = g1 | b1;\
- p0 = ((gb1 & 0x0000FFFF) << 8) | (r1 << 16) | (r1 >> 24);\
- g2 = (v2 & 0x07E007E0) << 5;\
- b2 = (v2 & 0x001F001F) << 3;\
- gb2 = g2 | b2;\
- p1 = (gb1 & 0xFFFF0000) | (v2 & 0xF800) | ((gb2 >> 8) & 0xff);\
- p2 = (gb2 << 24) | ((v2 & 0xF8000000) >> 8) | (gb2 >> 16);\
-}
-
-#else
-
-#define RGB16_TO_RGB24(p0,p1,p2,v1,v2)\
-{\
- unsigned int r1,g1,b1,gb1,g2,b2,gb2;\
- r1 = (v1 & 0xF800F800);\
- g1 = (v1 & 0x07E007E0) << 5;\
- b1 = (v1 & 0x001F001F) << 3;\
- gb1 = g1 | b1;\
- p0 = ((gb1 & 0x0000FFFF) << 8) | (r1 << 16) | (r1 >> 24);\
- g2 = (v2 & 0x07E007E0) << 5;\
- b2 = (v2 & 0x001F001F) << 3;\
- gb2 = g2 | b2;\
- p1 = (gb1 & 0xFFFF0000) | (v2 & 0xF800) | ((gb2 >> 8) & 0xff);\
- p2 = (gb2 << 24) | ((v2 & 0xF8000000) >> 8) | (gb2 >> 16);\
-}
-
-#endif
-
-static void ZB_copyFrameBufferRGB24(ZBuffer * zb,
- void *buf,
- int linesize)
-{
- unsigned short *q;
- unsigned int *p, *p1, w0, w1, w2, v0, v1;
- int y, n;
-
- q = zb->pbuf;
- p1 = (unsigned int *)buf;
- linesize = linesize * 3;
-
- for (y = 0; y < zb->ysize; y++) {
- p = p1;
- n = zb->xsize >> 2;
- do {
- v0 = *(unsigned int *) q;
- v1 = *(unsigned int *) (q + 2);
- RGB16_TO_RGB24(w0, w1, w2, v0, v1);
- p[0] = w0;
- p[1] = w1;
- p[2] = w2;
-
- q += 4;
- p += 3;
- } while (--n > 0);
- char *t = (char *)p1;
- t += linesize;
- p1 = (unsigned int *)t;
- }
-}
-
-#endif
-
void ZB_copyFrameBuffer(ZBuffer * zb, void *buf,
int linesize)
{
- switch (zb->mode) {
-#ifdef TGL_FEATURE_8_BITS
- case ZB_MODE_INDEX:
- ZB_ditherFrameBuffer(zb, (unsigned char *)buf, linesize >> 1);
- break;
-#endif
-#ifdef TGL_FEATURE_16_BITS
- case ZB_MODE_5R6G5B:
- ZB_copyBuffer(zb, buf, linesize);
- break;
-#endif
-#ifdef TGL_FEATURE_32_BITS
- case ZB_MODE_RGBA:
- ZB_copyFrameBufferRGB32(zb, buf, linesize >> 1);
- break;
-#endif
-#ifdef TGL_FEATURE_24_BITS
- case ZB_MODE_RGB24:
- ZB_copyFrameBufferRGB24(zb, buf, linesize >> 1);
- break;
-#endif
- default:
- assert(0);
+ switch (zb->mode) {
+ case ZB_MODE_5R6G5B:
+ ZB_copyBuffer(zb, buf, linesize);
+ break;
+ default:
+ assert(0);
}
}
-#endif /* TGL_FEATURE_RENDER_BITS == 16 */
/*
* adr must be aligned on an 'int'
Modified: residual/trunk/tinygl/zbuffer.h
===================================================================
--- residual/trunk/tinygl/zbuffer.h 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/tinygl/zbuffer.h 2006-05-16 09:20:12 UTC (rev 22486)
@@ -5,8 +5,6 @@
* Z buffer
*/
-#include "tinygl/zfeatures.h"
-
#define ZB_Z_BITS 16
#define ZB_POINT_Z_FRAC_BITS 14
@@ -25,10 +23,6 @@
/* display modes */
#define ZB_MODE_5R6G5B 1 /* true color 16 bits */
-#define ZB_MODE_INDEX 2 /* color index 8 bits */
-#define ZB_MODE_RGBA 3 /* 32 bit rgba mode */
-#define ZB_MODE_RGB24 4 /* 24 bit rgb mode */
-#define ZB_NB_COLORS 225 /* number of colors for 8 bit display */
/* 16 bit mode */
#define RGB_TO_PIXEL(r,g,b) \
Deleted: residual/trunk/tinygl/zdither.cpp
===================================================================
--- residual/trunk/tinygl/zdither.cpp 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/tinygl/zdither.cpp 2006-05-16 09:20:12 UTC (rev 22486)
@@ -1,159 +0,0 @@
-/*
- * Highly optimised dithering 16 bits -> 8 bits.
- * The formulas were taken in Mesa (Bob Mercier mercier at hollywood.cinenet.net).
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "tinygl/zbuffer.h"
-#include <assert.h>
-
-#if defined(TGL_FEATURE_8_BITS)
-
-#define _R 5
-#define _G 9
-#define _B 5
-#define _DX 4
-#define _DY 4
-#define _D (_DX*_DY)
-#define _MIX(r,g,b) ( ((g)<<6) | ((b)<<3) | (r) )
-
-#define DITHER_TABLE_SIZE (1 << 15)
-
-#define DITHER_INDEX(r,g,b) ((b) + (g) * _B + (r) * (_B * _G))
-
-#define MAXC 256
-static int kernel8[_DY*_DX] = {
- 0 * MAXC, 8 * MAXC, 2 * MAXC, 10 * MAXC,
- 12 * MAXC, 4 * MAXC, 14 * MAXC, 6 * MAXC,
- 3 * MAXC, 11 * MAXC, 1 * MAXC, 9 * MAXC,
- 15 * MAXC, 7 * MAXC, 13 * MAXC, 5 * MAXC,
-};
-
-/* we build the color table and the lookup table */
-
-void ZB_initDither(ZBuffer *zb,int nb_colors,
- unsigned char *color_indexes,int *color_table)
-{
- int c,r,g,b,i,index,r1,g1,b1;
-
- if (nb_colors < (_R * _G * _B)) {
- fprintf(stderr,"zdither: not enough colors\n");
- exit(1);
- }
-
- for(i=0;i<nb_colors;i++) color_table[i]=0;
-
- zb->nb_colors=nb_colors;
- zb->ctable=(int *)gl_malloc(nb_colors * sizeof(int));
-
- for (r = 0; r < _R; r++) {
- for (g = 0; g < _G; g++) {
- for (b = 0; b < _B; b++) {
- r1=(r*255) / (_R - 1);
- g1=(g*255) / (_G - 1);
- b1=(b*255) / (_B - 1);
- index=DITHER_INDEX(r,g,b);
- c=(r1 << 16) | (g1 << 8) | b1;
- zb->ctable[index]=c;
- color_table[index]=c;
- }
- }
- }
-
- zb->dctable=(unsigned char *)gl_malloc( DITHER_TABLE_SIZE );
-
- for(i=0;i<DITHER_TABLE_SIZE;i++) {
- r=(i >> 12) & 0x7;
- g=(i >> 8) & 0xF;
- b=(i >> 3) & 0x7;
- index=DITHER_INDEX(r,g,b);
- zb->dctable[i]=color_indexes[index];
- }
-}
-
-void ZB_closeDither(ZBuffer *zb)
-{
- gl_free(zb->ctable);
- gl_free(zb->dctable);
-}
-
-#if 0
-int ZDither_lookupColor(int r,int g,int b)
-{
- unsigned char *ctable=zdither_color_table;
- return ctable[_MIX(_DITH0(_R, r), _DITH0(_G, g),_DITH0(_B, b))];
-}
-#endif
-
-
-#define DITHER_PIXEL2(a) \
-{ \
- register int v,t,r,g,c; \
- v=*(unsigned int *)(pp+(a)); \
- g=(v & 0x07DF07DF) + g_d; \
- r=(((v & 0xF800F800) >> 2) + r_d) & 0x70007000; \
- t=r | g; \
- c=ctable[t & 0xFFFF] | (ctable[t >> 16] << 8); \
- *(unsigned short *)(dest+(a))=c; \
-}
-
-/* NOTE: all the memory access are 16 bit aligned, so if buf or
- linesize are not multiple of 2, it cannot work efficiently (or
- hang!) */
-
-void ZB_ditherFrameBuffer(ZBuffer *zb,unsigned char *buf,
- int linesize)
-{
- int xk,yk,x,y,c1,c2;
- unsigned char *dest1;
- unsigned short *pp1;
- int r_d,g_d,b_d;
- unsigned char *ctable=zb->dctable;
- register unsigned char *dest;
- register unsigned short *pp;
-
- assert( ((long)buf & 1) == 0 && (linesize & 1) == 0);
-
- for(yk=0;yk<4;yk++) {
- for(xk=0;xk<4;xk+=2) {
-#if BYTE_ORDER == BIG_ENDIAN
- c1=kernel8[yk*4+xk+1];
- c2=kernel8[yk*4+xk];
-#else
- c1=kernel8[yk*4+xk];
- c2=kernel8[yk*4+xk+1];
-#endif
- r_d=((c1 << 2) & 0xF800) >> 2;
- g_d=(c1 >> 4) & 0x07C0;
- b_d=(c1 >> 9) & 0x001F;
-
- r_d|=(((c2 << 2) & 0xF800) >> 2) << 16;
- g_d|=((c2 >> 4) & 0x07C0) << 16;
- b_d|=((c2 >> 9) & 0x001F) << 16;
- g_d=b_d | g_d;
-
- dest1=buf + (yk * linesize) + xk;
- pp1=zb->pbuf + (yk * zb->xsize) + xk;
-
- for(y=yk;y<zb->ysize;y+=4) {
- dest=dest1;
- pp=pp1;
- for(x=xk;x<zb->xsize;x+=16) {
-
- DITHER_PIXEL2(0);
- DITHER_PIXEL2(1*4);
- DITHER_PIXEL2(2*4);
- DITHER_PIXEL2(3*4);
-
- pp+=16;
- dest+=16;
- }
- dest1+=linesize*4;
- pp1+=zb->xsize*4;
- }
- }
- }
-}
-
-#endif
Deleted: residual/trunk/tinygl/zfeatures.h
===================================================================
--- residual/trunk/tinygl/zfeatures.h 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/tinygl/zfeatures.h 2006-05-16 09:20:12 UTC (rev 22486)
@@ -1,40 +0,0 @@
-#ifndef _tgl_features_h_
-#define _tgl_features_h_
-
-/* It is possible to enable/disable (compile time) features in this
- header file. */
-
-#define TGL_FEATURE_ARRAYS 1
-#define TGL_FEATURE_DISPLAYLISTS 1
-#define TGL_FEATURE_POLYGON_OFFSET 1
-
-/*
- * Matrix of internal and external pixel formats supported. 'Y' means
- * supported.
- *
- * External 8 16 24 32
- * Internal
- * 15 . . . .
- * 16 Y Y Y Y
- * 24 . Y Y .
- * 32 . Y . Y
- *
- *
- * 15 bpp does not work yet (although it is easy to add it - ask me if
- * you need it).
- *
- * Internal pixel format: see TGL_FEATURE_RENDER_BITS
- * External pixel format: see TGL_FEATURE_xxx_BITS
- */
-
-/* enable various convertion code from internal pixel format (usually
- 16 bits per pixel) to any external format */
-#define TGL_FEATURE_16_BITS 1
-#define TGL_FEATURE_8_BITS 1
-#define TGL_FEATURE_24_BITS 1
-#define TGL_FEATURE_32_BITS 1
-
-
-#define TGL_FEATURE_RENDER_BITS 16
-
-#endif /* _tgl_features_h_ */
Modified: residual/trunk/tinygl/zgl.h
===================================================================
--- residual/trunk/tinygl/zgl.h 2006-05-16 07:41:48 UTC (rev 22485)
+++ residual/trunk/tinygl/zgl.h 2006-05-16 09:20:12 UTC (rev 22486)
@@ -8,7 +8,6 @@
#include "tinygl/gl.h"
#include "tinygl/zbuffer.h"
#include "tinygl/zmath.h"
-#include "tinygl/zfeatures.h"
#define DEBUG
/* #define NDEBUG */
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