From 165a634214a2899587f7d73f230c29c8e91c9e80 Mon Sep 17 00:00:00 2001 From: "hj79.son" Date: Tue, 6 Dec 2011 14:26:43 +0900 Subject: [PATCH] [Title] change about sdl gfx api [Type] Enhancement [Module] Emulator / Display [Priority] Minor [CQ#] [Redmine#] [Problem] [Cause] [Solution] clean up and modify sdl-gfx source in qemu, and use it instead of libsdl-gfx. [TestCase] --- tizen/src/qemu_gtk_widget.c | 1 + ui/sdl_rotate.c | 17 ++++---- ui/sdl_rotate.h | 99 ++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 99 insertions(+), 18 deletions(-) diff --git a/tizen/src/qemu_gtk_widget.c b/tizen/src/qemu_gtk_widget.c index 726552e..8b86412 100644 --- a/tizen/src/qemu_gtk_widget.c +++ b/tizen/src/qemu_gtk_widget.c @@ -39,6 +39,7 @@ #include #include "debug_ch.h" +#include "../ui/sdl_rotate.h" //DEFAULT_DEBUG_CHANNEL(tizen); MULTI_DEBUG_CHANNEL(tizen, qemu_gtk_widget); diff --git a/ui/sdl_rotate.c b/ui/sdl_rotate.c index 22dcc71..3fbc36e 100644 --- a/ui/sdl_rotate.c +++ b/ui/sdl_rotate.c @@ -1,10 +1,10 @@ /* - -SDL_rotozoom.c - rotozoomer, zoomer and shrinker for 32bit or 8bit surfaces - -LGPL (c) A. Schiffler - -*/ + * Derived from: SDL_rotozoom, LGPL (c) A. Schiffler from the SDL_gfx library. + * Modifications by S-Core Co., Ltd + * + * This work is licensed under the terms of the GNU GPL version 2. + * See the COPYING file in the top-level directory. + */ #ifdef WIN32 #include @@ -15,8 +15,7 @@ LGPL (c) A. Schiffler #include "sdl_rotate.h" -#if 0 -#include "SDL_rotozoom.h" +#if 1 /* ---- Internally used structures */ @@ -894,7 +893,7 @@ SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns) } -#if 0 +#if 1 /*! \brief Internal target surface sizing function for rotozooms with trig result return. diff --git a/ui/sdl_rotate.h b/ui/sdl_rotate.h index f845749..4091d53 100644 --- a/ui/sdl_rotate.h +++ b/ui/sdl_rotate.h @@ -1,17 +1,98 @@ /* + * Derived from: SDL_rotozoom, LGPL (c) A. Schiffler from the SDL_gfx library. + * Modifications by S-Core Co., Ltd + * + * This work is licensed under the terms of the GNU GPL version 2. + * See the COPYING file in the top-level directory. + */ -SDL_rotozoom - rotozoomer +#ifndef _SDL_rotate_h +#define _SDL_rotate_h -LGPL (c) A. Schiffler +#include +#include -*/ +/* ---- Prototypes */ -#ifndef _SDL_rotozoom_h -#define _SDL_rotozoom_h +#ifdef WIN32 +# ifdef DLL_EXPORT +# define SDL_ROTOZOOM_SCOPE __declspec(dllexport) +# else +# ifdef LIBSDL_GFX_DLL_IMPORT +# define SDL_ROTOZOOM_SCOPE __declspec(dllimport) +# endif +# endif +#endif +#ifndef SDL_ROTOZOOM_SCOPE +# define SDL_ROTOZOOM_SCOPE extern +#endif -#include -#include +/* + + rotozoomSurface() + + Rotates and zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. + 'angle' is the rotation in degrees. 'zoom' a scaling factor. If 'smooth' is 1 + then the destination 32bit surface is anti-aliased. If the surface is not 8bit + or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. + + */ + +SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurface(SDL_Surface * src, double angle, double zoom, int smooth); + +SDL_ROTOZOOM_SCOPE SDL_Surface *rotozoomSurfaceXY +(SDL_Surface * src, double angle, double zoomx, double zoomy, int smooth); + +/* Returns the size of the target surface for a rotozoomSurface() call */ + +SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSize(int width, int height, double angle, double zoom, int *dstwidth, + int *dstheight); + +SDL_ROTOZOOM_SCOPE void rotozoomSurfaceSizeXY +(int width, int height, double angle, double zoomx, double zoomy, + int *dstwidth, int *dstheight); + +/* + + zoomSurface() + + Zoomes a 32bit or 8bit 'src' surface to newly created 'dst' surface. + 'zoomx' and 'zoomy' are scaling factors for width and height. If 'smooth' is 1 + then the destination 32bit surface is anti-aliased. If the surface is not 8bit + or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. + + */ + +SDL_ROTOZOOM_SCOPE SDL_Surface *zoomSurface(SDL_Surface * src, double zoomx, double zoomy, int smooth); + +/* Returns the size of the target surface for a zoomSurface() call */ + +SDL_ROTOZOOM_SCOPE void zoomSurfaceSize(int width, int height, double zoomx, double zoomy, int *dstwidth, int *dstheight); + + +/* + shrinkSurface() + + Shrinks a 32bit or 8bit 'src' surface ti a newly created 'dst' surface. + 'factorx' and 'factory' are the shrinking ratios (i.e. 2=1/2 the size, + 3=1/3 the size, etc.) The destination surface is antialiased by averaging + the source box RGBA or Y information. If the surface is not 8bit + or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. + */ + +SDL_ROTOZOOM_SCOPE SDL_Surface *shrinkSurface(SDL_Surface * src, int factorx, int factory); + +/* + + Other functions + + */ + +SDL_ROTOZOOM_SCOPE SDL_Surface* rotateSurface90Degrees(SDL_Surface* pSurf, int numClockwiseTurns); -SDL_Surface* rotateSurface90Degrees(SDL_Surface* src, int numClockwiseTurns); +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif -#endif /* _SDL_rotozoom_h */ +#endif /* _SDL_rotate_h */ -- 2.7.4