Mercurial > sdl-ios-xcode
changeset 5141:da10636e5eca
Making the API simpler, scaling is always defined as linear interpolation and should be supported as much as possible on all renderers.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 31 Jan 2011 22:44:43 -0800 |
parents | e594f07297a9 |
children | 57851a238c8f |
files | Makefile.in include/SDL_compat.h include/SDL_scalemode.h include/SDL_surface.h include/SDL_video.h src/video/SDL_renderer_gl.c src/video/SDL_renderer_gles.c src/video/SDL_renderer_sw.c src/video/SDL_surface.c src/video/SDL_sysvideo.h src/video/SDL_video.c src/video/directfb/SDL_DirectFB_render.c src/video/nds/SDL_ndsrender.c src/video/photon/SDL_photon_render.c src/video/qnxgf/SDL_gf_render.c src/video/windows/SDL_ceddrawrender.c src/video/windows/SDL_d3drender.c src/video/windows/SDL_gapirender.c src/video/windows/SDL_windowsvideo.c src/video/x11/SDL_x11video.c test/common.c test/testsprite2.c |
diffstat | 22 files changed, 9 insertions(+), 544 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile.in Mon Jan 31 22:21:29 2011 -0800 +++ b/Makefile.in Mon Jan 31 22:44:43 2011 -0800 @@ -71,7 +71,6 @@ SDL_rect.h \ SDL_revision.h \ SDL_rwops.h \ - SDL_scalemode.h \ SDL_scancode.h \ SDL_shape.h \ SDL_stdinc.h \
--- a/include/SDL_compat.h Mon Jan 31 22:21:29 2011 -0800 +++ b/include/SDL_compat.h Mon Jan 31 22:44:43 2011 -0800 @@ -208,14 +208,6 @@ SDL_GRAB_ON = 1 } SDL_GrabMode; -typedef enum -{ - SDL_TEXTURESCALEMODE_NONE = SDL_SCALEMODE_NONE, - SDL_TEXTURESCALEMODE_FAST = SDL_SCALEMODE_FAST, - SDL_TEXTURESCALEMODE_SLOW = SDL_SCALEMODE_SLOW, - SDL_TEXTURESCALEMODE_BEST = SDL_SCALEMODE_BEST -} SDL_TextureScaleMode; - struct SDL_SysWMinfo; /**
--- a/include/SDL_scalemode.h Mon Jan 31 22:21:29 2011 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997-2010 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - - Sam Lantinga - slouken@libsdl.org -*/ - -/** - * \file SDL_scalemode.h - * - * Header file declaring the SDL_ScaleMode enumeration - */ - -#ifndef _SDL_scalemode_h -#define _SDL_scalemode_h - -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -/** - * \brief The texture scale mode used in SDL_RenderCopy(). - */ -typedef enum -{ - SDL_SCALEMODE_NONE = 0x00000000, /**< No scaling, rectangles must - match dimensions */ - - SDL_SCALEMODE_FAST = 0x00000001, /**< Point sampling or - equivalent algorithm */ - - SDL_SCALEMODE_SLOW = 0x00000002, /**< Linear filtering or - equivalent algorithm */ - - SDL_SCALEMODE_BEST = 0x00000004 /**< Bicubic filtering or - equivalent algorithm */ -} SDL_ScaleMode; - - -/* Ends C function definitions when using C++ */ -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif -#include "close_code.h" - -#endif /* _SDL_video_h */ - -/* vi: set ts=4 sw=4 expandtab: */
--- a/include/SDL_surface.h Mon Jan 31 22:21:29 2011 -0800 +++ b/include/SDL_surface.h Mon Jan 31 22:44:43 2011 -0800 @@ -33,7 +33,6 @@ #include "SDL_pixels.h" #include "SDL_rect.h" #include "SDL_blendmode.h" -#include "SDL_scalemode.h" #include "SDL_rwops.h" #include "begin_code.h" @@ -318,37 +317,6 @@ SDL_BlendMode *blendMode); /** - * \brief Set the scale mode used for blit operations. - * - * \param surface The surface to update. - * \param scaleMode ::SDL_ScaleMode to use for blit scaling. - * - * \return 0 on success, or -1 if the surface is not valid or the scale mode is - * not supported. - * - * \note If the scale mode is not supported, the closest supported mode is - * chosen. Currently only ::SDL_TEXTURESCALEMODE_FAST is supported on - * surfaces. - * - * \sa SDL_GetSurfaceScaleMode() - */ -extern DECLSPEC int SDLCALL SDL_SetSurfaceScaleMode(SDL_Surface * surface, - SDL_ScaleMode scaleMode); - -/** - * \brief Get the scale mode used for blit operations. - * - * \param surface The surface to query. - * \param scaleMode A pointer filled in with the current scale mode. - * - * \return 0 on success, or -1 if the surface is not valid. - * - * \sa SDL_SetSurfaceScaleMode() - */ -extern DECLSPEC int SDLCALL SDL_GetSurfaceScaleMode(SDL_Surface * surface, - SDL_ScaleMode *scaleMode); - -/** * Sets the clipping rectangle for the destination surface in a blit. * * If the clip rectangle is NULL, clipping will be disabled.
--- a/include/SDL_video.h Mon Jan 31 22:21:29 2011 -0800 +++ b/include/SDL_video.h Mon Jan 31 22:44:43 2011 -0800 @@ -33,7 +33,6 @@ #include "SDL_pixels.h" #include "SDL_rect.h" #include "SDL_blendmode.h" -#include "SDL_scalemode.h" #include "SDL_surface.h" #include "begin_code.h" @@ -189,7 +188,6 @@ Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 mod_modes; /**< A mask of supported channel modulation */ Uint32 blend_modes; /**< A mask of supported blend modes */ - Uint32 scale_modes; /**< A mask of supported scale modes */ Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 texture_formats[50]; /**< The available texture formats */ int max_texture_width; /**< The maximimum texture width */ @@ -969,36 +967,6 @@ SDL_BlendMode *blendMode); /** - * \brief Set the scale mode used for texture copy operations. - * - * \param texture The texture to update. - * \param scaleMode ::SDL_ScaleMode to use for texture scaling. - * - * \return 0 on success, or -1 if the texture is not valid or the scale mode is - * not supported. - * - * \note If the scale mode is not supported, the closest supported mode is - * chosen. - * - * \sa SDL_GetTextureScaleMode() - */ -extern DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture * texture, - SDL_ScaleMode scaleMode); - -/** - * \brief Get the scale mode used for texture copy operations. - * - * \param texture The texture to query. - * \param scaleMode A pointer filled in with the current scale mode. - * - * \return 0 on success, or -1 if the texture is not valid. - * - * \sa SDL_SetTextureScaleMode() - */ -extern DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture * texture, - SDL_ScaleMode *scaleMode); - -/** * \brief Update the given texture rectangle with new pixel data. * * \param texture The texture to update
--- a/src/video/SDL_renderer_gl.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_renderer_gl.c Mon Jan 31 22:44:43 2011 -0800 @@ -85,8 +85,6 @@ SDL_Texture * texture); static int GL_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int GL_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -126,7 +124,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 15, { SDL_PIXELFORMAT_INDEX1LSB, @@ -159,7 +156,6 @@ SDL_bool GL_MESA_ycbcr_texture_supported; SDL_bool GL_ARB_fragment_program_supported; int blendMode; - int scaleMode; /* OpenGL functions */ #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; @@ -303,7 +299,6 @@ renderer->SetTextureColorMod = GL_SetTextureColorMod; renderer->SetTextureAlphaMod = GL_SetTextureAlphaMod; renderer->SetTextureBlendMode = GL_SetTextureBlendMode; - renderer->SetTextureScaleMode = GL_SetTextureScaleMode; renderer->UpdateTexture = GL_UpdateTexture; renderer->LockTexture = GL_LockTexture; renderer->UnlockTexture = GL_UnlockTexture; @@ -422,7 +417,6 @@ /* Set up parameters for rendering */ data->blendMode = -1; - data->scaleMode = -1; data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_CULL_FACE); /* This ended up causing video discrepancies between OpenGL and Direct3D */ @@ -842,9 +836,9 @@ renderdata->glEnable(data->type); renderdata->glBindTexture(data->type, data->texture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); + GL_LINEAR); renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); + GL_LINEAR); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, @@ -1001,25 +995,6 @@ } static int -GL_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - case SDL_SCALEMODE_SLOW: - return 0; - case SDL_SCALEMODE_BEST: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_SLOW; - return -1; - default: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; - } -} - -static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { @@ -1363,26 +1338,6 @@ } } - if (texture->scaleMode != data->scaleMode) { - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); - break; - case SDL_SCALEMODE_SLOW: - case SDL_SCALEMODE_BEST: - data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, - GL_LINEAR); - data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, - GL_LINEAR); - break; - } - data->scaleMode = texture->scaleMode; - } - if (shader) { data->glEnable(GL_FRAGMENT_PROGRAM_ARB); data->glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, shader);
--- a/src/video/SDL_renderer_gles.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_renderer_gles.c Mon Jan 31 22:44:43 2011 -0800 @@ -73,8 +73,6 @@ SDL_Texture * texture); static int GLES_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int GLES_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -112,7 +110,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | SDL_SCALEMODE_SLOW), 6, { /* OpenGL ES 1.x supported formats list */ SDL_PIXELFORMAT_RGBA4444, @@ -241,7 +238,6 @@ renderer->SetTextureColorMod = GLES_SetTextureColorMod; renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod; renderer->SetTextureBlendMode = GLES_SetTextureBlendMode; - renderer->SetTextureScaleMode = GLES_SetTextureScaleMode; renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; renderer->UnlockTexture = GLES_UnlockTexture; @@ -449,9 +445,9 @@ data->formattype = type; renderdata->glBindTexture(data->type, data->texture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); + GL_LINEAR); renderdata->glTexParameteri(data->type, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); + GL_LINEAR); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, @@ -535,25 +531,6 @@ } static int -GLES_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - case SDL_SCALEMODE_SLOW: - return 0; - case SDL_SCALEMODE_BEST: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_SLOW; - return -1; - default: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; - } -} - -static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { @@ -878,23 +855,6 @@ GLES_SetBlendMode(data, texture->blendMode, 0); - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, - GL_NEAREST); - data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, - GL_NEAREST); - break; - case SDL_SCALEMODE_SLOW: - case SDL_SCALEMODE_BEST: - data->glTexParameteri(texturedata->type, GL_TEXTURE_MIN_FILTER, - GL_LINEAR); - data->glTexParameteri(texturedata->type, GL_TEXTURE_MAG_FILTER, - GL_LINEAR); - break; - } - if (data->GL_OES_draw_texture_supported && data->useDrawTexture) { /* this code is a little funny because the viewport is upside down vs SDL's coordinate system */ SDL_Window *window = renderer->window;
--- a/src/video/SDL_renderer_sw.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_renderer_sw.c Mon Jan 31 22:44:43 2011 -0800 @@ -51,8 +51,6 @@ SDL_Texture * texture); static int SW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int SW_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -90,7 +88,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST), 14, { SDL_PIXELFORMAT_INDEX8, @@ -180,7 +177,6 @@ renderer->SetTextureColorMod = SW_SetTextureColorMod; renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod; renderer->SetTextureBlendMode = SW_SetTextureBlendMode; - renderer->SetTextureScaleMode = SW_SetTextureScaleMode; renderer->UpdateTexture = SW_UpdateTexture; renderer->LockTexture = SW_LockTexture; renderer->UnlockTexture = SW_UnlockTexture; @@ -188,7 +184,6 @@ renderer->info.mod_modes = SW_RenderDriver.info.mod_modes; renderer->info.blend_modes = SW_RenderDriver.info.blend_modes; - renderer->info.scale_modes = SW_RenderDriver.info.scale_modes; renderer->info.num_texture_formats = SW_RenderDriver.info.num_texture_formats; SDL_memcpy(renderer->info.texture_formats, @@ -396,7 +391,6 @@ texture->b); SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a); SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode); - SDL_SetSurfaceScaleMode(texture->driverdata, texture->scaleMode); if (texture->access == SDL_TEXTUREACCESS_STATIC) { SDL_SetSurfaceRLE(texture->driverdata, 1); @@ -480,13 +474,6 @@ } static int -SW_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - SDL_Surface *surface = (SDL_Surface *) texture->driverdata; - return SDL_SetSurfaceScaleMode(surface, texture->scaleMode); -} - -static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) {
--- a/src/video/SDL_surface.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_surface.c Mon Jan 31 22:44:43 2011 -0800 @@ -518,64 +518,6 @@ return 0; } -int -SDL_SetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode scaleMode) -{ - int flags, status; - - if (!surface) { - return -1; - } - - status = 0; - flags = surface->map->info.flags; - surface->map->info.flags &= ~(SDL_COPY_NEAREST); - switch (scaleMode) { - case SDL_SCALEMODE_NONE: - break; - case SDL_SCALEMODE_FAST: - surface->map->info.flags |= SDL_COPY_NEAREST; - break; - case SDL_SCALEMODE_SLOW: - case SDL_SCALEMODE_BEST: - SDL_Unsupported(); - surface->map->info.flags |= SDL_COPY_NEAREST; - status = -1; - break; - default: - SDL_Unsupported(); - status = -1; - break; - } - - if (surface->map->info.flags != flags) { - SDL_InvalidateMap(surface->map); - } - return status; -} - -int -SDL_GetSurfaceScaleMode(SDL_Surface * surface, SDL_ScaleMode *scaleMode) -{ - if (!surface) { - return -1; - } - - if (!scaleMode) { - return 0; - } - - switch (surface->map->info.flags & SDL_COPY_NEAREST) { - case SDL_COPY_NEAREST: - *scaleMode = SDL_SCALEMODE_FAST; - break; - default: - *scaleMode = SDL_SCALEMODE_NONE; - break; - } - return 0; -} - SDL_bool SDL_SetClipRect(SDL_Surface * surface, const SDL_Rect * rect) {
--- a/src/video/SDL_sysvideo.h Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_sysvideo.h Mon Jan 31 22:44:43 2011 -0800 @@ -47,7 +47,6 @@ int h; /**< The height of the texture */ int modMode; /**< The texture modulation mode */ SDL_BlendMode blendMode; /**< The texture blend mode */ - SDL_ScaleMode scaleMode; /**< The texture scale mode */ Uint8 r, g, b, a; /**< Texture modulation values */ SDL_Renderer *renderer; @@ -78,8 +77,6 @@ SDL_Texture * texture); int (*SetTextureBlendMode) (SDL_Renderer * renderer, SDL_Texture * texture); - int (*SetTextureScaleMode) (SDL_Renderer * renderer, - SDL_Texture * texture); int (*UpdateTexture) (SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch);
--- a/src/video/SDL_video.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/SDL_video.c Mon Jan 31 22:44:43 2011 -0800 @@ -1961,7 +1961,6 @@ { Uint8 r, g, b, a; SDL_BlendMode blendMode; - SDL_ScaleMode scaleMode; SDL_GetSurfaceColorMod(surface, &r, &g, &b); SDL_SetTextureColorMod(texture, r, g, b); @@ -1976,9 +1975,6 @@ SDL_GetSurfaceBlendMode(surface, &blendMode); SDL_SetTextureBlendMode(texture, blendMode); } - - SDL_GetSurfaceScaleMode(surface, &scaleMode); - SDL_SetTextureScaleMode(texture, scaleMode); } if (SDL_ISPIXELFORMAT_INDEXED(format) && fmt->palette) { @@ -2162,33 +2158,6 @@ } int -SDL_SetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode scaleMode) -{ - SDL_Renderer *renderer; - - CHECK_TEXTURE_MAGIC(texture, -1); - - renderer = texture->renderer; - if (!renderer->SetTextureScaleMode) { - SDL_Unsupported(); - return -1; - } - texture->scaleMode = scaleMode; - return renderer->SetTextureScaleMode(renderer, texture); -} - -int -SDL_GetTextureScaleMode(SDL_Texture * texture, SDL_ScaleMode *scaleMode) -{ - CHECK_TEXTURE_MAGIC(texture, -1); - - if (scaleMode) { - *scaleMode = texture->scaleMode; - } - return 0; -} - -int SDL_UpdateTexture(SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) {
--- a/src/video/directfb/SDL_DirectFB_render.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/directfb/SDL_DirectFB_render.c Mon Jan 31 22:44:43 2011 -0800 @@ -57,8 +57,6 @@ SDL_Texture * texture); static int DirectFB_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int DirectFB_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, @@ -104,8 +102,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | - SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST), 14, { SDL_PIXELFORMAT_INDEX4LSB, @@ -298,7 +294,6 @@ renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod; renderer->SetTextureColorMod = DirectFB_SetTextureColorMod; renderer->SetTextureBlendMode = DirectFB_SetTextureBlendMode; - renderer->SetTextureScaleMode = DirectFB_SetTextureScaleMode; renderer->UpdateTexture = DirectFB_UpdateTexture; renderer->LockTexture = DirectFB_LockTexture; renderer->UnlockTexture = DirectFB_UnlockTexture;
--- a/src/video/nds/SDL_ndsrender.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/nds/SDL_ndsrender.c Mon Jan 31 22:44:43 2011 -0800 @@ -56,8 +56,6 @@ SDL_Texture * texture); static int NDS_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int NDS_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -82,7 +80,6 @@ (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */ (SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */ (SDL_BLENDMODE_MASK), /* u32 blend_modes */ - (SDL_SCALEMODE_FAST), /* u32 scale_modes */ 3, /* u32 num_texture_formats */ { SDL_PIXELFORMAT_INDEX8, @@ -184,7 +181,6 @@ renderer->SetTextureColorMod = NDS_SetTextureColorMod; renderer->SetTextureAlphaMod = NDS_SetTextureAlphaMod; renderer->SetTextureBlendMode = NDS_SetTextureBlendMode; - renderer->SetTextureScaleMode = NDS_SetTextureScaleMode; renderer->UpdateTexture = NDS_UpdateTexture; renderer->LockTexture = NDS_LockTexture; renderer->UnlockTexture = NDS_UnlockTexture; @@ -192,7 +188,6 @@ renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes; renderer->info.blend_modes = NDS_RenderDriver.info.blend_modes; - renderer->info.scale_modes = NDS_RenderDriver.info.scale_modes; renderer->info.num_texture_formats = NDS_RenderDriver.info.num_texture_formats; SDL_memcpy(renderer->info.texture_formats, @@ -588,11 +583,4 @@ return 0; } -static int -NDS_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - /* stub! (note: NDS hardware scaling is nearest neighbor.) */ - return 0; -} - /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/photon/SDL_photon_render.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/photon/SDL_photon_render.c Mon Jan 31 22:44:43 2011 -0800 @@ -104,7 +104,6 @@ (SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_SLOW | SDL_SCALEMODE_FAST), 10, {SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_RGB555, @@ -153,7 +152,6 @@ renderer->SetTextureAlphaMod = photon_settexturealphamod; renderer->SetTextureColorMod = photon_settexturecolormod; renderer->SetTextureBlendMode = photon_settextureblendmode; - renderer->SetTextureScaleMode = photon_settexturescalemode; renderer->UpdateTexture = photon_updatetexture; renderer->LockTexture = photon_locktexture; renderer->UnlockTexture = photon_unlocktexture; @@ -250,22 +248,6 @@ /* Initialize surfaces */ _photon_recreate_surfaces(renderer); - /* Set current scale blitting capabilities */ - if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_OFFSCREEN) - { - renderer->info.scale_modes=SDL_SCALEMODE_NONE | SDL_SCALEMODE_SLOW; - if ((didata->mode_2dcaps & SDL_VIDEO_PHOTON_CAP_SCALED_BLIT)==SDL_VIDEO_PHOTON_CAP_SCALED_BLIT) - { - /* This video mode supports hardware scaling */ - renderer->info.scale_modes|=SDL_SCALEMODE_FAST; - } - } - else - { - /* PhImage blit functions do not support scaling */ - renderer->info.scale_modes=SDL_SCALEMODE_NONE; - } - return renderer; } @@ -977,53 +959,6 @@ } static int -photon_settexturescalemode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata; - - switch (texture->scaleMode) - { - case SDL_SCALEMODE_NONE: - return 0; - case SDL_SCALEMODE_FAST: - if ((renderer->info.scale_modes & SDL_SCALEMODE_FAST)==SDL_SCALEMODE_FAST) - { - return 0; - } - else - { - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_FAST; - return -1; - } - break; - case SDL_SCALEMODE_SLOW: - if ((renderer->info.scale_modes & SDL_SCALEMODE_SLOW)==SDL_SCALEMODE_SLOW) - { - return 0; - } - else - { - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_SLOW; - return -1; - } - break; - case SDL_SCALEMODE_BEST: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_SLOW; - return -1; - default: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; - } - - SDL_Unsupported(); - return -1; -} - -static int photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) {
--- a/src/video/qnxgf/SDL_gf_render.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/qnxgf/SDL_gf_render.c Mon Jan 31 22:44:43 2011 -0800 @@ -87,7 +87,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_SLOW), 13, { SDL_PIXELFORMAT_INDEX8, @@ -149,7 +148,6 @@ renderer->SetTextureAlphaMod = gf_settexturealphamod; renderer->SetTextureColorMod = gf_settexturecolormod; renderer->SetTextureBlendMode = gf_settextureblendmode; - renderer->SetTextureScaleMode = gf_settexturescalemode; renderer->UpdateTexture = gf_updatetexture; renderer->LockTexture = gf_locktexture; renderer->UnlockTexture = gf_unlocktexture;
--- a/src/video/windows/SDL_ceddrawrender.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/windows/SDL_ceddrawrender.c Mon Jan 31 22:44:43 2011 -0800 @@ -51,8 +51,6 @@ SDL_Texture * texture); static int DDRAW_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int DDRAW_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int DDRAW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -85,7 +83,6 @@ SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED), (SDL_TEXTUREMODULATE_NONE), (SDL_BLENDMODE_NONE), - (SDL_SCALEMODE_NONE), 0, {0}, 0, @@ -468,7 +465,6 @@ renderer->SetTextureColorMod = DDRAW_SetTextureColorMod; renderer->SetTextureAlphaMod = DDRAW_SetTextureAlphaMod; renderer->SetTextureBlendMode = DDRAW_SetTextureBlendMode; - renderer->SetTextureScaleMode = DDRAW_SetTextureScaleMode; renderer->UpdateTexture = DDRAW_UpdateTexture; renderer->LockTexture = DDRAW_LockTexture; renderer->UnlockTexture = DDRAW_UnlockTexture; @@ -663,19 +659,6 @@ } static int -DDRAW_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - default: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; - } - return 0; -} - -static int DDRAW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) {
--- a/src/video/windows/SDL_d3drender.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/windows/SDL_d3drender.c Mon Jan 31 22:44:43 2011 -0800 @@ -107,8 +107,6 @@ SDL_Texture * texture); static int D3D_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture); -static int D3D_SetTextureScaleMode(SDL_Renderer * renderer, - SDL_Texture * texture); static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch); @@ -150,8 +148,6 @@ SDL_TEXTUREMODULATE_ALPHA), (SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD), - (SDL_SCALEMODE_NONE | SDL_SCALEMODE_FAST | - SDL_SCALEMODE_SLOW | SDL_SCALEMODE_BEST), 0, {0}, 0, @@ -461,7 +457,6 @@ renderer->SetTextureColorMod = D3D_SetTextureColorMod; renderer->SetTextureAlphaMod = D3D_SetTextureAlphaMod; renderer->SetTextureBlendMode = D3D_SetTextureBlendMode; - renderer->SetTextureScaleMode = D3D_SetTextureScaleMode; renderer->UpdateTexture = D3D_UpdateTexture; renderer->LockTexture = D3D_LockTexture; renderer->UnlockTexture = D3D_UnlockTexture; @@ -804,23 +799,6 @@ } static int -D3D_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) -{ - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - case SDL_SCALEMODE_SLOW: - case SDL_SCALEMODE_BEST: - return 0; - default: - SDL_Unsupported(); - texture->scaleMode = SDL_SCALEMODE_NONE; - return -1; - } - return 0; -} - -static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, int pitch) { @@ -1342,27 +1320,10 @@ shader = data->ps_mask; } - switch (texture->scaleMode) { - case SDL_SCALEMODE_NONE: - case SDL_SCALEMODE_FAST: - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MINFILTER, - D3DTEXF_POINT); - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MAGFILTER, - D3DTEXF_POINT); - break; - case SDL_SCALEMODE_SLOW: - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MINFILTER, - D3DTEXF_LINEAR); - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MAGFILTER, - D3DTEXF_LINEAR); - break; - case SDL_SCALEMODE_BEST: - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MINFILTER, - D3DTEXF_GAUSSIANQUAD); - IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MAGFILTER, - D3DTEXF_GAUSSIANQUAD); - break; - } + IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MINFILTER, + D3DTEXF_LINEAR); + IDirect3DDevice9_SetSamplerState(data->device, 0, D3DSAMP_MAGFILTER, + D3DTEXF_LINEAR); result = IDirect3DDevice9_SetTexture(data->device, 0, (IDirect3DBaseTexture9 *)
--- a/src/video/windows/SDL_gapirender.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/windows/SDL_gapirender.c Mon Jan 31 22:44:43 2011 -0800 @@ -210,7 +210,6 @@ (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD), (SDL_TEXTUREMODULATE_NONE), (SDL_BLENDMODE_NONE), - (SDL_SCALEMODE_NONE), 7, { SDL_PIXELFORMAT_RGB555, @@ -233,7 +232,6 @@ (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD), (SDL_TEXTUREMODULATE_NONE), (SDL_BLENDMODE_NONE), - (SDL_SCALEMODE_NONE), 7, { SDL_PIXELFORMAT_RGB555,
--- a/src/video/windows/SDL_windowsvideo.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/windows/SDL_windowsvideo.c Mon Jan 31 22:44:43 2011 -0800 @@ -30,7 +30,6 @@ #include "SDL_windowsvideo.h" #include "SDL_windowsshape.h" #include "SDL_d3drender.h" -#include "SDL_gdirender.h" #include "SDL_gapirender.h" /* Initialization/Query functions */
--- a/src/video/x11/SDL_x11video.c Mon Jan 31 22:21:29 2011 -0800 +++ b/src/video/x11/SDL_x11video.c Mon Jan 31 22:44:43 2011 -0800 @@ -29,7 +29,6 @@ #include "../SDL_pixels_c.h" #include "SDL_x11video.h" -#include "SDL_x11render.h" #include "SDL_x11shape.h" #include "SDL_x11touch.h"
--- a/test/common.c Mon Jan 31 22:21:29 2011 -0800 +++ b/test/common.c Mon Jan 31 22:44:43 2011 -0800 @@ -382,28 +382,6 @@ } static void -PrintScaleMode(Uint32 flag) -{ - switch (flag) { - case SDL_SCALEMODE_NONE: - fprintf(stderr, "None"); - break; - case SDL_SCALEMODE_FAST: - fprintf(stderr, "Fast"); - break; - case SDL_SCALEMODE_SLOW: - fprintf(stderr, "Slow"); - break; - case SDL_SCALEMODE_BEST: - fprintf(stderr, "Best"); - break; - default: - fprintf(stderr, "0x%8.8x", flag); - break; - } -} - -static void PrintPixelFormat(Uint32 format) { switch (format) { @@ -540,21 +518,6 @@ } fprintf(stderr, ")\n"); - fprintf(stderr, " Scale: 0x%8.8X", info->scale_modes); - fprintf(stderr, " ("); - count = 0; - for (i = 0; i < sizeof(info->scale_modes) * 8; ++i) { - Uint32 flag = (1 << i); - if (info->scale_modes & flag) { - if (count > 0) { - fprintf(stderr, " | "); - } - PrintScaleMode(flag); - ++count; - } - } - fprintf(stderr, ")\n"); - fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats); for (i = 0; i < (int) info->num_texture_formats; ++i) { if (i > 0) {
--- a/test/testsprite2.c Mon Jan 31 22:21:29 2011 -0800 +++ b/test/testsprite2.c Mon Jan 31 22:44:43 2011 -0800 @@ -21,7 +21,6 @@ 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 @@ return (-1); } SDL_SetTextureBlendMode(sprites[i], blendMode); - SDL_SetTextureScaleMode(sprites[i], scaleMode); } SDL_FreeSurface(temp); @@ -253,22 +251,6 @@ 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 @@ } 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 @@ 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);