Some optimizations to bilinear scaling

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@464 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2002-12-22 17:38:22 +00:00
parent cc588aaf71
commit caca450519
+34 -18
View File
@@ -254,21 +254,27 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
src_p2 = src_p; src_p2 = src_p;
j = i; j = i;
for (x = 0; x < w; ++x)
{
p[0] = src_p[0]; p[0] = src_p[0];
if (y < h - 2) if (y < h - 2)
{
p[2] = src_p[src->w]; p[2] = src_p[src->w];
else
p[2] = 0;
for (x = 0; x < w; ++x)
{
if (j == i)
{
if (y < h - 2)
{
if (x < w - 2) if (x < w - 2)
{ {
p[1] = src_p[1];
p[3] = src_p[src->w + 1]; p[3] = src_p[src->w + 1];
p[1] = src_p[1];
} }
else else
{ {
p[3] = p[2]; p[1] = 0;
p[1] = p[0]; p[3] = 0;
} }
} }
else else
@@ -276,9 +282,9 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
if (x < w - 2) if (x < w - 2)
p[1] = src_p[1]; p[1] = src_p[1];
else else
p[1] = p[0]; p[1] = 0;
p[2] = p[0]; p[3] = 0;
p[3] = p[1]; }
} }
fa = bilinear_table[j][0]; fa = bilinear_table[j][0];
@@ -304,6 +310,8 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
{ {
j = i; j = i;
src_p++; src_p++;
p[0] = p[1];
p[2] = p[3];
} }
else else
{ {
@@ -336,21 +344,27 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
src_p2 = src_p; src_p2 = src_p;
j = i; j = i;
for (x = 0; x < w; ++x)
{
p[0] = src_p[0]; p[0] = src_p[0];
if (y < h - 2) if (y < h - 2)
{
p[2] = src_p[src->w]; p[2] = src_p[src->w];
else
p[2] = 0;
for (x = 0; x < w; ++x)
{
if (j == i)
{
if (y < h - 2)
{
if (x < w - 2) if (x < w - 2)
{ {
p[1] = src_p[1];
p[3] = src_p[src->w + 1]; p[3] = src_p[src->w + 1];
p[1] = src_p[1];
} }
else else
{ {
p[3] = p[2]; p[1] = 0;
p[1] = p[0]; p[3] = 0;
} }
} }
else else
@@ -358,9 +372,9 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
if (x < w - 2) if (x < w - 2)
p[1] = src_p[1]; p[1] = src_p[1];
else else
p[1] = p[0]; p[1] = 0;
p[2] = p[0]; p[3] = 0;
p[3] = p[1]; }
} }
fa = bilinear_table[j][0]; fa = bilinear_table[j][0];
@@ -386,6 +400,8 @@ static void Scale_Bilinear (SDL_Surface *src, SDL_Surface *dst)
{ {
j = i; j = i;
src_p++; src_p++;
p[0] = p[1];
p[2] = p[3];
} }
else else
{ {