synkro
0xdeadbeef
How can I speed up things?
/*
* Plasma grafic test
*
*
*
*
*/
#include "gpdef.h"
#include "gpstdlib.h"
#include "gpgraphic.h"
#include "gpmain.h"
#define PI 3.141592654
GPDRAWSURFACE gpDraw[2];
int nflip;
void GpMain(void *arg)
{
int i, j;
unsigned char keydata;
int pos_x, pos_y, color;
int cosinus[256];
unsigned char p1,p2,p3,p4,t1,t2,t3,t4;
for(i = 0 ; i < 2 ; i++)
{
GpLcdSurfaceGet(&gpDraw, i);
}
GpSurfaceSet(&gpDraw[0]);
for (i=0;i<256;i++)
cosinus=30*(cos(i*PI/64));
nflip = 1;
pos_x = 1;
pos_y = 1;
p1 = 0;
p2 = 0;
p3 = 0;
p4 = 0;
while(1)
{
t1 = p1;
t2 = p2;
for (i = 0; i < 240; i++)
{
t3 = p3;
t4 = p4;
for (j = 0; j < 320; j++)
{
color = cosinus[t1]+cosinus[t2]+cosinus[t3]+cosinus[t4];
GpPointSet(&gpDraw[nflip], j, i, color);
t3+=1;
t4+=3;
}
t1+=2;
t2+=1;
}
p1+=1;
p2-=2;
p3+=3;
p4-=4;
// Flip Grafic Buffer
GpSurfaceFlip(&gpDraw[nflip++]);
nflip &= 0x01;
}
}
/*
* Plasma grafic test
*
*
*
*
*/
#include "gpdef.h"
#include "gpstdlib.h"
#include "gpgraphic.h"
#include "gpmain.h"
#define PI 3.141592654
GPDRAWSURFACE gpDraw[2];
int nflip;
void GpMain(void *arg)
{
int i, j;
unsigned char keydata;
int pos_x, pos_y, color;
int cosinus[256];
unsigned char p1,p2,p3,p4,t1,t2,t3,t4;
for(i = 0 ; i < 2 ; i++)
{
GpLcdSurfaceGet(&gpDraw, i);
}
GpSurfaceSet(&gpDraw[0]);
for (i=0;i<256;i++)
cosinus=30*(cos(i*PI/64));
nflip = 1;
pos_x = 1;
pos_y = 1;
p1 = 0;
p2 = 0;
p3 = 0;
p4 = 0;
while(1)
{
t1 = p1;
t2 = p2;
for (i = 0; i < 240; i++)
{
t3 = p3;
t4 = p4;
for (j = 0; j < 320; j++)
{
color = cosinus[t1]+cosinus[t2]+cosinus[t3]+cosinus[t4];
GpPointSet(&gpDraw[nflip], j, i, color);
t3+=1;
t4+=3;
}
t1+=2;
t2+=1;
}
p1+=1;
p2-=2;
p3+=3;
p4-=4;
// Flip Grafic Buffer
GpSurfaceFlip(&gpDraw[nflip++]);
nflip &= 0x01;
}
}