22
22
static uint32 VirtualTime[128], DrawnTime[128], BlittedTime[128];
23
23
static uint32 VirtualIndex, DrawnIndex, BlittedIndex;
24
static SDL_Surface *FPSSurface = NULL;
25
static SDL_Rect FPSRect;
24
static MDFN_Surface *FPSSurface = NULL;
25
static MDFN_Rect FPSRect;
27
27
void FPS_Init(void)
144
144
DrawTextTrans(target->pixels + xpos + (ypos + 7 * 2) * target->pitch32, target->pitch32 << 2, box_width, (UTF8*)blitfps, text_color, FALSE, TRUE);
147
#define MK_COLOR_A(surface, r,g,b,a) ( ((a)<<surface->format->Ashift) | ((r)<<surface->format->Rshift) | ((g) << surface->format->Gshift) |((b) << surface->format->Bshift))
147
#define MK_COLOR_A(surface, r,g,b,a) ( surface->MakeColor(r, g, b, a))
148
148
void FPS_DrawToScreen(SDL_Surface *screen, int rs, int gs, int bs, int as)
154
SDL_FreeSurface(FPSSurface);
155
155
FPSSurface = NULL;
162
FPSSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, box_width, box_height, 32, 0xFF << rs, 0xFF << gs, 0xFF << bs, 0xFF << as);
162
FPSSurface = new MDFN_Surface(NULL, box_width, box_height, box_width, MDFN_PixelFormat(MDFN_COLORSPACE_RGB, rs, gs, bs, as));
163
163
FPSRect.w = box_width;
164
164
FPSRect.h = box_height;
165
165
FPSRect.x = FPSRect.y = 0;
170
170
CalcFramerates(virtfps, drawnfps, blitfps, 64);
172
SDL_FillRect(FPSSurface, NULL, MK_COLOR_A(FPSSurface, 0, 0, 0, 0x80));
173
DrawTextTrans((uint32 *)FPSSurface->pixels, FPSSurface->pitch, FPSSurface->w, (UTF8*)virtfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
174
DrawTextTrans((uint32 *)FPSSurface->pixels + 7 * (FPSSurface->pitch >> 2), FPSSurface->pitch, FPSSurface->w, (UTF8*)drawnfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
175
DrawTextTrans((uint32 *)FPSSurface->pixels + 7 * 2 * (FPSSurface->pitch >> 2), FPSSurface->pitch, FPSSurface->w, (UTF8*)blitfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
172
FPSSurface->Fill(0, 0, 0, 0x80);
174
DrawTextTrans(FPSSurface->pixels, FPSSurface->pitchinpix << 2, FPSSurface->w, (UTF8*)virtfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
175
DrawTextTrans(FPSSurface->pixels + 7 * FPSSurface->pitchinpix, FPSSurface->pitchinpix << 2, FPSSurface->w, (UTF8*)drawnfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
176
DrawTextTrans(FPSSurface->pixels + 7 * 2 * FPSSurface->pitchinpix, FPSSurface->pitchinpix << 2, FPSSurface->w, (UTF8*)blitfps, MK_COLOR_A(FPSSurface, 0xFF, 0xFF, 0xFF, 0xFF), FALSE, TRUE);
180
181
drect.w = FPSRect.w;
181
182
drect.h = FPSRect.h;
183
BlitRaw(FPSSurface, &FPSRect, &drect);
184
BlitRaw(FPSSurface, &FPSRect, &drect, -1);