Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 76 lines (68 sloc) 2.553 kb
e61c024 @DusteDdk Updated copyleft header.
authored
1 /************************************************************************
2 * This file is part of Wizznic. *
3 * Copyright 2009-2012 Jimmy Christensen <dusted@dusted.dk> *
4 * Wizznic is free software: you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation, either version 3 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * Wizznic is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
aa80153 @DusteDdk Nuked all windows newlines.
authored
15 * along with Wizznic. If not, see <http://www.gnu.org/licenses/>. *
e61c024 @DusteDdk Updated copyleft header.
authored
16 ************************************************************************/
17
ae6b8e6 @DusteDdk Adding missing files..
authored
18 #include "swscale.h"
19 #include "settings.h"
20 #include "defs.h"
21 #include "pixel.h"
22
23 static SDL_Surface* scale;
24
25 SDL_Surface* swScaleInit( int sdlVideoModeFlags, int doScale )
26 {
27 scale = SDL_SetVideoMode(SCREENW*doScale,SCREENH*doScale,16, sdlVideoModeFlags);
28 SDL_Surface* screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 320,240,16, scale->format->Rmask,scale->format->Gmask,scale->format->Bmask,0xff000000);
29
30 //Set scaling
31 setting()->scaleFactor= (float)scale->h/240.0;
32
33 return( screen );
34 }
35
36 void swScale( SDL_Surface* screen, int doScale )
37 {
aa80153 @DusteDdk Nuked all windows newlines.
authored
38 if(doScale==2)
39 {
40 int x,xx,y,yy;
41 for(y=0; y< SCREENH; y++)
42 {
43 for(x=0; x < SCREENW; x++)
44 {
45 uint16_t c = freadPixel(screen,x,y);/*SDL_MapRGB(scale->format,r,g,b);*/
46 xx=x*2;
47 yy=y*2;
48 plotPixelu(scale, xx,yy, c);
49 plotPixelu(scale, xx+1,yy, c);
50 plotPixelu(scale, xx,yy+1, c);
51 plotPixelu(scale, xx+1,yy+1, c);
52 }
53 }
54 } else if(doScale>2)
55 {
56 int x,y;
57 SDL_Rect r;
58 for(y=0; y< SCREENH; y++)
59 {
60 for(x=0; x < SCREENW; x++)
61 {
62 r.x=x*doScale;
63 r.y=y*doScale;
64 r.w=doScale;
65 r.h=doScale;
66 SDL_FillRect(scale, &r, freadPixel(screen,x,y));
67 }
68 }
69 }
70
71 if( doScale > -1 )
72 {
73 SDL_Flip(scale);
ae6b8e6 @DusteDdk Adding missing files..
authored
74 }
75 }
Something went wrong with that request. Please try again.