Overview
Comment: | Fix a mistake |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1e31248216d23687c6a50953df984584 |
User & Date: | user on 2018-04-02 23:54:39 |
Other Links: | manifest | tags |
Context
2018-04-06
| ||
21:00 | Add init_screen() and starting the type defintions for classes, and fix the picture loader to work with zoomed pictures check-in: 88e748ef6d user: user tags: trunk | |
2018-04-02
| ||
23:54 | Fix a mistake check-in: 1e31248216 user: user tags: trunk | |
18:22 | Split picture reading codes into a separate file check-in: 016ea5365e user: user tags: trunk | |
Changes
Modified main.c from [d2f05c125d] to [9e50e0dd98].
︙ | ︙ | |||
38 39 40 41 42 43 44 | typedef struct { UserCommand m[16]; } KeyBinding; static const char schema[]= "PRAGMA APPLICATION_ID(1296388936);" "PRAGMA RECURSIVE_TRIGGERS(1);" | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | typedef struct { UserCommand m[16]; } KeyBinding; static const char schema[]= "PRAGMA APPLICATION_ID(1296388936);" "PRAGMA RECURSIVE_TRIGGERS(1);" "CREATE TABLE IF NOT EXISTS `USERCACHEINDEX`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `TIME` INT);" "CREATE TEMPORARY TABLE `PICTURES`(`ID` INTEGER PRIMARY KEY, `NAME` TEXT, `OFFSET` INT);" ; sqlite3*userdb; xrm_db*resourcedb; const char*basefilename; xrm_quark optionquery[16]; |
︙ | ︙ |
Modified picture.c from [55b874cfd0] to [c46d8e64e4].
︙ | ︙ | |||
54 55 56 57 58 59 60 | static void init_palette(void) { double gamma; int usegamma=1; int i,j; SDL_Color pal[256]; FILE*fp=0; const char*v; | | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | static void init_palette(void) { double gamma; int usegamma=1; int i,j; SDL_Color pal[256]; FILE*fp=0; const char*v; optionquery[1]=Q_gamma; gamma=strtod(xrm_get_resource(resourcedb,optionquery,optionquery,2)?:"0",0); if(gamma<=0.0 || gamma==1.0) usegamma=0; optionquery[1]=Q_palette; v=xrm_get_resource(resourcedb,optionquery,optionquery,2); if(v && *v) { fp=fopen(v,"r"); if(!fp) fatal("Unable to load palette file '%s'\n%m",v); } for(i=0;i<256;i++) { if(fp) { |
︙ | ︙ | |||
266 267 268 269 270 271 272 | break; } if(!curpic) fatal("Allocation failed\n"); for(i=0;i<256;i++) havesize[i]=(havesize[i]==n)?1:0; picture_size=decide_picture_size(nwantsize,wantsize,havesize); if(sqlite3_prepare_v2(userdb,"SELECT `ID`, `OFFSET` FROM `PICTURES`;",-1,&st,0)) fatal("Unable to prepare SQL statement while loading pictures: %s\n",sqlite3_errmsg(userdb)); | | | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | break; } if(!curpic) fatal("Allocation failed\n"); for(i=0;i<256;i++) havesize[i]=(havesize[i]==n)?1:0; picture_size=decide_picture_size(nwantsize,wantsize,havesize); if(sqlite3_prepare_v2(userdb,"SELECT `ID`, `OFFSET` FROM `PICTURES`;",-1,&st,0)) fatal("Unable to prepare SQL statement while loading pictures: %s\n",sqlite3_errmsg(userdb)); optionquery[1]=Q_screenFlags; v=xrm_get_resource(resourcedb,optionquery,optionquery,2); i=v&&strchr(v,'h'); picts=SDL_CreateRGBSurface((i?SDL_HWSURFACE:SDL_SWSURFACE)|SDL_SRCCOLORKEY,picture_size<<4,picture_size*((n+15)>>4),8,0,0,0,0); if(!picts) fatal("Error allocating surface for pictures: %s\n",SDL_GetError()); init_palette(); for(i=0;i<n;i++) { if((j=sqlite3_step(st))!=SQLITE_ROW) fatal("SQL error (%d): %s\n",j,j==SQLITE_DONE?"Incorrect number of rows in a temporary table":sqlite3_errmsg(userdb)); |
︙ | ︙ |