~ubuntu-branches/debian/experimental/mednafen/experimental

« back to all changes in this revision

Viewing changes to src/drivers/logdebugger.cpp

  • Committer: Package Import Robot
  • Author(s): Stephen Kitt
  • Date: 2012-11-19 07:00:37 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20121119070037-jvknrm13zvim88oc
Tags: 0.9.26-1
* New upstream WIP version.
* Change priority to "extra" to match libvorbisidec1's.
* Drop "DM-Upload-Allowed" since it is no longer appropriate.
* Refresh patches, replacing MPC_STATUS_FAIL constant from older mpcdec
  versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 }
106
106
}
107
107
 
108
 
#define MK_COLOR_A(r,g,b,a) ( ((a)<<surface->format->Ashift) | ((r)<<surface->format->Rshift) | ((g) << surface->format->Gshift) | ((b) << surface->format->Bshift))
 
108
#define MK_COLOR_A(r,g,b,a) ( pf_cache.MakeColor(r, g, b, a) )
109
109
 
110
110
// Call this function from the main thread
111
 
void LogDebugger_Draw(SDL_Surface *surface, const SDL_Rect *rect, const SDL_Rect *screen_rect)
 
111
void LogDebugger_Draw(MDFN_Surface *surface, const MDFN_Rect *rect, const MDFN_Rect *screen_rect)
112
112
{
113
113
 if(!IsActive) return;
114
114
 
115
115
 LockGameMutex(1);
116
116
 
117
 
 uint32 * pixels = (uint32 *)surface->pixels;
118
 
 uint32 pitch32 = surface->pitch >> 2;
 
117
 const MDFN_PixelFormat pf_cache = surface->format;
 
118
 uint32 * pixels = surface->pixels;
 
119
 uint32 pitch32 = surface->pitchinpix;
119
120
 char logmessage[256];
120
121
 
121
122
 trio_snprintf(logmessage, 256, "%s (%d messages)", LoggingActive ? (UTF8*)"Logging Enabled" : (UTF8*)"Logging Disabled", (int)WhichLog->entries.size());
122
 
 DrawTextTrans(pixels, surface->pitch, rect->w, (UTF8*)logmessage, MK_COLOR_A(0x20, 0xFF, 0x20, 0xFF), 1, MDFN_FONT_6x13_12x13);
 
123
 DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)logmessage, MK_COLOR_A(0x20, 0xFF, 0x20, 0xFF), 1, MDFN_FONT_6x13_12x13);
123
124
 pixels += 13 * pitch32;
124
125
 
125
126
 std::map<std::string, LogInstance>::iterator dl_iter;
135
136
  if(&dl_iter->second == WhichLog)
136
137
   group_color = MK_COLOR_A(0xFF, 0x80, 0x80, 0xFF);
137
138
 
138
 
  groups_line += 6 + DrawTextTrans(groups_line, surface->pitch, rect->w, (UTF8*)group_string, group_color, 0, MDFN_FONT_6x13_12x13);
 
139
  groups_line += 6 + DrawTextTrans(groups_line, surface->pitchinpix << 2, rect->w, (UTF8*)group_string, group_color, 0, MDFN_FONT_6x13_12x13);
139
140
 
140
141
//  printf("%s\n", dl_iter->first.c_str());
141
142
 }
153
154
  char tmpbuf[64];
154
155
 
155
156
  trio_snprintf(tmpbuf, 64, "%d", i);
156
 
  typelen = DrawTextTrans(pixels, surface->pitch, rect->w, (UTF8*)tmpbuf, MK_COLOR_A(0x80, 0x80, 0xD0, 0xFF), FALSE, MDFN_FONT_5x7);
 
157
  typelen = DrawTextTrans(pixels, surface->pitchinpix << 2, rect->w, (UTF8*)tmpbuf, MK_COLOR_A(0x80, 0x80, 0xD0, 0xFF), FALSE, MDFN_FONT_5x7);
157
158
  typelen += 1;
158
159
 
159
 
  typelen += DrawTextTrans(pixels + typelen, surface->pitch, rect->w - typelen, (UTF8*)WhichLog->entries[i].type, MK_COLOR_A(0xFF, 0x40, 0x40, 0xFF), FALSE, MDFN_FONT_6x13_12x13);
 
160
  typelen += DrawTextTrans(pixels + typelen, surface->pitchinpix << 2, rect->w - typelen, (UTF8*)WhichLog->entries[i].type, MK_COLOR_A(0xFF, 0x40, 0x40, 0xFF), FALSE, MDFN_FONT_6x13_12x13);
160
161
  typelen += 5;
161
 
  DrawTextTrans(pixels + typelen, surface->pitch, rect->w - typelen, (UTF8*)WhichLog->entries[i].text, lifecolors[i & 3], FALSE, MDFN_FONT_6x13_12x13);
 
162
  DrawTextTrans(pixels + typelen, surface->pitchinpix << 2, rect->w - typelen, (UTF8*)WhichLog->entries[i].text, lifecolors[i & 3], FALSE, MDFN_FONT_6x13_12x13);
162
163
  pixels += pitch32 * 13;
163
164
 }
164
165
 LockGameMutex(0);