Making the API simpler, scaling is always defined as linear interpolation and should be supported as much as possible on all renderers.

--HG--
extra : rebase_source : 4edac7fd162a2eb37a50159b958db37a03e944a5
This commit is contained in:
Sam Lantinga 2011-01-31 22:44:43 -08:00
parent 9c12618379
commit df1f384c5b
22 changed files with 9 additions and 544 deletions

View file

@ -21,7 +21,6 @@ static SDL_Rect *positions;
static SDL_Rect *velocities;
static int sprite_w, sprite_h;
static SDL_BlendMode blendMode = SDL_BLENDMODE_MASK;
static SDL_ScaleMode scaleMode = SDL_SCALEMODE_NONE;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
@ -89,7 +88,6 @@ LoadSprite(char *file)
return (-1);
}
SDL_SetTextureBlendMode(sprites[i], blendMode);
SDL_SetTextureScaleMode(sprites[i], scaleMode);
}
SDL_FreeSurface(temp);
@ -253,22 +251,6 @@ main(int argc, char *argv[])
consumed = 2;
}
}
} else if (SDL_strcasecmp(argv[i], "--scale") == 0) {
if (argv[i + 1]) {
if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
scaleMode = SDL_SCALEMODE_NONE;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "fast") == 0) {
scaleMode = SDL_SCALEMODE_FAST;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "slow") == 0) {
scaleMode = SDL_SCALEMODE_SLOW;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "best") == 0) {
scaleMode = SDL_SCALEMODE_BEST;
consumed = 2;
}
}
} else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) {
cycle_color = SDL_TRUE;
consumed = 1;
@ -282,7 +264,7 @@ main(int argc, char *argv[])
}
if (consumed < 0) {
fprintf(stderr,
"Usage: %s %s [--blend none|mask|blend|add|mod] [--scale none|fast|slow|best] [--cyclecolor] [--cyclealpha]\n",
"Usage: %s %s [--blend none|mask|blend|add|mod] [--cyclecolor] [--cyclealpha]\n",
argv[0], CommonUsage(state));
quit(1);
}
@ -316,10 +298,6 @@ main(int argc, char *argv[])
quit(2);
}
srand((unsigned int)time(NULL));
if (scaleMode != SDL_SCALEMODE_NONE) {
sprite_w += sprite_w / 2;
sprite_h += sprite_h / 2;
}
for (i = 0; i < num_sprites; ++i) {
positions[i].x = rand() % (state->window_w - sprite_w);
positions[i].y = rand() % (state->window_h - sprite_h);