The Pedigree Project  0.1
modules/system/splash/main.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "font.h"
21 #include "image.h"
22 #include "modules/Module.h"
23 #include "modules/system/config/Config.h"
24 #include "pedigree/kernel/BootstrapInfo.h"
25 #include "pedigree/kernel/LockGuard.h"
26 #include "pedigree/kernel/Log.h"
27 #include "pedigree/kernel/Service.h"
28 #include "pedigree/kernel/ServiceFeatures.h"
29 #include "pedigree/kernel/ServiceManager.h"
30 #include "pedigree/kernel/core/BootIO.h"
31 #include "pedigree/kernel/graphics/Graphics.h"
32 #include "pedigree/kernel/graphics/GraphicsService.h"
33 #include "pedigree/kernel/machine/Display.h"
34 #include "pedigree/kernel/machine/Framebuffer.h"
35 #include "pedigree/kernel/machine/InputManager.h"
36 #include "pedigree/kernel/process/Mutex.h"
37 #include "pedigree/kernel/processor/types.h"
38 #include "pedigree/kernel/utilities/Cord.h"
39 #include "pedigree/kernel/utilities/StaticString.h"
40 #include "pedigree/kernel/utilities/String.h"
41 #include "pedigree/kernel/utilities/Vector.h"
42 #include "pedigree/kernel/utilities/assert.h"
43 #include "pedigree/kernel/utilities/utility.h"
44 
45 static Framebuffer *g_pFramebuffer = 0;
46 
47 static uint8_t *g_pBuffer = 0;
48 static Graphics::Buffer *g_pFont = 0;
49 static size_t g_Width = 0;
50 static size_t g_Height = 0;
51 
52 static uint32_t g_BackgroundColour = 0x000000;
53 static uint32_t g_ForegroundColour = 0xFFFFFF;
54 static uint32_t g_ProgressBorderColour = 0x965000;
55 static uint32_t g_ProgressColour = 0x966400;
56 
57 static Graphics::PixelFormat g_ColorFormat = Graphics::Bits24_Rgb;
58 
59 static size_t g_ProgressX, g_ProgressY;
60 static size_t g_ProgressW, g_ProgressH;
61 static size_t g_LogBoxX, g_LogBoxY;
62 static size_t g_LogX, g_LogY;
63 static size_t g_LogW, g_LogH;
64 
65 static GraphicsService::GraphicsParameters g_GraphicsParams;
66 
67 static size_t g_Previous = 0;
68 static bool g_LogMode = false;
69 
70 static bool g_NoGraphics = false;
71 
72 static Mutex g_PrintLock(false);
73 
74 static void printChar(char c, size_t x, size_t y)
75 {
76  assert(!g_PrintLock.getValue());
77 
78  if (!g_pFramebuffer)
79  return;
80 
81  g_pFramebuffer->blit(
82  g_pFont, 0, c * FONT_HEIGHT, x, y, FONT_WIDTH, FONT_HEIGHT);
83 }
84 
85 static void printChar(char c)
86 {
87  assert(!g_PrintLock.getValue());
88 
89  if (!g_pFramebuffer)
90  return;
91 
92  if (!c)
93  return;
94 
95  if (c == '\t')
96  g_LogX = (g_LogX + 8) & ~7;
97  else if (c == '\r')
98  g_LogX = 0;
99  else if (c == '\n')
100  {
101  g_LogX = 0;
102  g_LogY++;
103 
104  g_pFramebuffer->redraw(g_LogBoxX, g_LogBoxY, g_LogW, g_LogH, true);
105  }
106  else if (c >= ' ')
107  {
108  g_pFramebuffer->blit(
109  g_pFont, 0, c * FONT_HEIGHT, g_LogBoxX + (g_LogX * FONT_WIDTH),
110  g_LogBoxY + (g_LogY * FONT_HEIGHT), FONT_WIDTH, FONT_HEIGHT);
111  g_LogX++;
112  }
113 
114  if (g_LogX >= g_LogW / FONT_WIDTH)
115  {
116  g_LogX = 0;
117  g_LogY++;
118 
119  g_pFramebuffer->redraw(g_LogBoxX, g_LogBoxY, g_LogW, g_LogH, true);
120  }
121 
122  // Overflowed the view?
123  if (g_LogY >= (g_LogH / FONT_HEIGHT))
124  {
125  // By how much?
126  size_t diff = g_LogY - (g_LogH / FONT_HEIGHT) + 1;
127 
128  // Scroll up
129  g_pFramebuffer->copy(
130  g_LogBoxX, g_LogBoxY + (diff * FONT_HEIGHT), g_LogBoxX, g_LogBoxY,
131  g_LogW - g_LogBoxX, ((g_LogH / FONT_HEIGHT) - diff) * FONT_HEIGHT);
132  g_pFramebuffer->rect(
133  g_LogBoxX,
134  g_LogBoxY + ((g_LogH / FONT_HEIGHT) - diff) * FONT_HEIGHT,
135  g_LogW - g_LogBoxX, diff * FONT_HEIGHT, g_BackgroundColour,
136  g_ColorFormat);
137 
138  g_LogY = (g_LogH / FONT_HEIGHT) - diff;
139 
140  g_pFramebuffer->redraw(g_LogBoxX, g_LogBoxY, g_LogW, g_LogH, true);
141  }
142 }
143 
144 static void printString(const char *str, size_t len=0)
145 {
146  LockGuard<Mutex> guard(g_PrintLock);
147 
148  if (len == 0)
149  {
150  len = StringLength(str);
151  }
152 
153  if (!g_NoGraphics)
154  {
155  for (size_t i = 0; i < len; i++)
156  printChar(str[i]);
157  }
158  else
159  {
160  static HugeStaticString s;
161  s += str;
162 
163  // Truncate the string if we need to.
166  if (s.length() >= 79)
167  {
168  s.truncate(75);
169  s += "...>\n";
170  }
171 
172  BootIO::Colour c = BootIO::LightGrey;
173  if (str[1] == 'W')
174  c = BootIO::Orange;
175  else if (str[1] == 'E' || str[1] == 'F')
176  c = BootIO::Red;
177  else if (str[1] == 'D')
178  c = BootIO::DarkGrey;
179 
180  bootIO.write(s, c, BootIO::Black);
181  s.clear();
182  }
183 }
184 
185 static void printStringAt(const char *str, size_t x, size_t y)
186 {
188  for (size_t i = 0; i < StringLength(str); i++)
189  {
190  printChar(str[i], x, y);
191  x += FONT_WIDTH;
192  }
193 }
194 
195 static void centerStringAt(const char *str, size_t midX, size_t midY)
196 {
198  size_t stringWidth = StringLength(str) * FONT_WIDTH;
199  size_t stringHeight = FONT_HEIGHT;
200 
201  size_t x = midX - (stringWidth / 2);
202  size_t y = midY - (stringHeight / 2);
203  printStringAt(str, x, y);
204 }
205 
207 {
208  public:
209  virtual ~StreamingScreenLogger();
210 
213  void callback(const LogCord &cord)
214  {
215 #ifdef DEBUGGER
216  if (g_LogMode)
217  {
218  LockGuard<Mutex> guard(g_PrintLock);
219  printString(cord.toString(), cord.length());
220  }
221 #endif
222  }
223 };
224 
225 StreamingScreenLogger::~StreamingScreenLogger() = default;
226 
227 static StreamingScreenLogger g_StreamLogger;
228 
229 static void keyCallback(InputManager::InputNotification &note)
230 {
231  if (note.type != InputManager::Key)
232  return;
233 
234  uint64_t key = note.data.key.key;
235  if (key == '\033')
236  {
237  // Because we edit the dimensions of the screen, we can't let a print
238  // continue while we run here.
239  LockGuard<Mutex> guard(g_PrintLock);
240 
241  if (!g_LogMode)
242  {
243  g_LogMode = true;
244  }
245  else
246  {
247  g_LogY += (g_LogBoxY / FONT_HEIGHT);
248  g_LogX = (g_LogBoxX / FONT_WIDTH);
249  g_LogBoxX = g_LogBoxY = 0;
250  g_LogW = g_Width;
251  g_LogH = g_Height;
252  }
253  }
254 }
255 
256 static void progress(const char *text)
257 {
258  LockGuard<Mutex> guard(g_PrintLock);
259 
260  // Calculate percentage.
261  if (g_BootProgressTotal == 0)
262  return;
263 
264  bool bFinished = false;
265  if ((g_BootProgressCurrent + 1) >= g_BootProgressTotal)
266  {
267  Log::instance().removeCallback(&g_StreamLogger);
268 
269 #ifdef DEBUGGER
270  if (!g_NoGraphics)
271  {
272  InputManager::instance().removeCallback(keyCallback);
273  }
274 #endif
275 
276  bFinished = true;
277  }
278 
279  if (g_LogMode && (g_LogH == g_Height))
280  return;
281 
282  if (g_NoGraphics)
283  {
284  // Prepare to center the progress bar (22 characters wide).
286  s = " ";
287  for (size_t i = 0; i < (80 / 2) - 11; ++i)
288  {
289  bootIO.write(s, BootIO::Black, BootIO::Black);
290  }
291 
292  // Render progress bar - style: [###---]
293  s = "[";
294  size_t pos = (20 * g_BootProgressCurrent) / g_BootProgressTotal;
295  for (size_t i = 0; i < 20; ++i)
296  {
297  if (i <= pos)
298  s += '#';
299  else
300  s += '-';
301  }
302  s += "]\r";
303  bootIO.write(s, BootIO::White, BootIO::Black);
304  }
305  else if (g_pFramebuffer)
306  {
307  size_t w = (g_ProgressW * g_BootProgressCurrent) / g_BootProgressTotal;
308  if (g_Previous <= g_BootProgressCurrent)
309  g_pFramebuffer->rect(
310  g_ProgressX, g_ProgressY, w, g_ProgressH, g_ProgressColour,
311  g_ColorFormat);
312  else
313  g_pFramebuffer->rect(
314  g_ProgressX + w, g_ProgressY, g_ProgressW - w, g_ProgressH,
315  g_BackgroundColour, g_ColorFormat);
316  g_Previous = g_BootProgressCurrent;
317 
318  char buf[80];
319  StringFormat(
320  buf, "%d%%", ((g_BootProgressCurrent * 100) / g_BootProgressTotal));
321  centerStringAt(
322  buf, g_ProgressX + (g_ProgressW / 2), g_ProgressY - FONT_HEIGHT);
323 
324  g_pFramebuffer->redraw(
325  g_ProgressX, g_ProgressY - (FONT_HEIGHT * 2), g_ProgressW,
326  g_ProgressH + (FONT_HEIGHT * 2), true);
327 
328  if (bFinished)
329  {
330  // Clean up font
331  NOTICE("splash: destroying font pixel buffer");
332  g_pFramebuffer->destroyBuffer(g_pFont);
333  NOTICE("splash: destroying font heap buffer");
334  delete[] g_pBuffer;
335 
336  // Destroy the framebuffer now that we're done
337  NOTICE("splash: destroying framebuffer");
338  Graphics::destroyFramebuffer(g_pFramebuffer);
339  NOTICE("splash: destroyed framebuffer");
340  g_pFramebuffer = 0;
341 
342  // No longer wanting any progress callback.
343  g_BootProgressUpdate = 0;
344  }
345  }
346 }
347 
348 static void getColor(const char *colorName, uint32_t &color)
349 {
350  // The query string
351  String sQuery;
352 
353  // Create the query string
354  sQuery += "select r,g,b from 'colour_scheme' where name='";
355  sQuery += colorName;
356  sQuery += "';";
357 
358  // Query the database
359  Config::Result *pResult = Config::instance().query(sQuery);
360 
361  // Did the query fail?
362  if (!pResult)
363  {
364  ERROR("Splash: Error looking up '" << colorName << "' colour.");
365  return;
366  }
367 
368  if (!pResult->succeeded())
369  {
370  ERROR(
371  "Splash: Error looking up '"
372  << colorName << "' colour: " << pResult->errorMessage());
373  delete pResult;
374  return;
375  }
376 
377  // Get the color from the query result
378  color = Graphics::createRgb(
379  pResult->getNum(0, "r"), pResult->getNum(0, "g"),
380  pResult->getNum(0, "b"));
381 
382  // Dispose of the query result
383  delete pResult;
384 }
385 
386 static void
387 getDesiredMode(size_t &modeWidth, size_t &modeHeight, size_t &modeBpp)
388 {
389  // Query the database
390  Config::Result *pResult = Config::instance().query(
391  "select width,height,bpp from 'desired_display_mode';");
392 
393  // Did the query fail?
394  if (!pResult)
395  return;
396 
397  if (!pResult->succeeded())
398  {
399  delete pResult;
400  return;
401  }
402 
403  // Get the mode details from the query result
404  modeWidth = pResult->getNum(0, "width");
405  modeHeight = pResult->getNum(0, "height");
406  modeBpp = pResult->getNum(0, "bpp");
407 
408  // Dispose of the query result
409  delete pResult;
410 }
411 
412 static bool handleNoSplash()
413 {
414  g_NoGraphics = true;
415 
416  const String title("Pedigree is Loading...\n");
417 
418  // Prepare to render by making some space between the current BootIO output
419  // and the progress bar we're about to add.
421  s = "\n";
422  for (size_t i = 0; i < 2; ++i)
423  {
424  bootIO.write(s, BootIO::Black, BootIO::Black);
425  }
426 
427  // Prepare to center text.
428  s = " ";
429  for (size_t i = 0; i < (80 / 2) - (title.length() / 2); ++i)
430  {
431  bootIO.write(s, BootIO::Black, BootIO::Black);
432  }
433 
434  // Render the system title.
435  s = title;
436  bootIO.write(s, BootIO::White, BootIO::Black);
437 
438  g_BootProgressUpdate = &progress;
439 
440  return true;
441 }
442 
443 static bool handleSplash()
444 {
445  g_NoGraphics = false;
446 
447  getColor("splash-background", g_BackgroundColour);
448  getColor("splash-foreground", g_ForegroundColour);
449  getColor("border", g_ProgressBorderColour);
450  getColor("fill", g_ProgressColour);
451 
452  // No text mode for us - we're the splash screen!
453  g_GraphicsParams.wantTextMode = false;
454 
455  // Grab the current graphics provider for the system, use it to display the
456  // splash screen to the user.
458  ServiceFeatures *pFeatures =
459  ServiceManager::instance().enumerateOperations(String("graphics"));
460  Service *pService =
461  ServiceManager::instance().getService(String("graphics"));
462  bool bSuccess = false;
463  if (pFeatures && pFeatures->provides(ServiceFeatures::probe))
464  if (pService)
465  bSuccess = pService->serve(
467  reinterpret_cast<void *>(&g_GraphicsParams),
468  sizeof(g_GraphicsParams));
469 
470  if (!(bSuccess && g_GraphicsParams.providerFound))
471  {
472  NOTICE("splash: this system does not support graphics, using fallback "
473  "log callback");
474  return handleNoSplash();
475  }
476 
477  Display *pDisplay = g_GraphicsParams.providerResult.pDisplay;
478 
479  // Get the desired mode from the database
480  size_t nDesiredWidth = 0, nDesiredHeight = 0, nDesiredBpp = 0;
481  getDesiredMode(nDesiredWidth, nDesiredHeight, nDesiredBpp);
482 
483  // Set up the mode we want
484  if (!(nDesiredWidth && nDesiredHeight && nDesiredBpp) ||
485  !pDisplay->setScreenMode(nDesiredWidth, nDesiredHeight, nDesiredBpp))
486  {
487  bool bModeFound = true;
488 
489  // 24-bit mode fallbacks
490  NOTICE("splash: Falling back to 1024x768x24");
491  if (!pDisplay->setScreenMode(1024, 768, 24))
492  {
493  // Attempt to fall back to 800x600
494  NOTICE("splash: Falling back to 800x600x24");
495  if (!pDisplay->setScreenMode(800, 600, 24))
496  {
497  // Finally try and fall back to 640x480
498  NOTICE("splash: Falling back to 640x480x24");
499  if (!pDisplay->setScreenMode(640, 480, 24))
500  {
501  bModeFound = false;
502  }
503  }
504  }
505 
506  if (!bModeFound)
507  {
508  // 16-bit mode fallbacks
509  NOTICE("splash: Falling back to 1024x768x16");
510  if (!pDisplay->setScreenMode(1024, 768, 16))
511  {
512  // Attempt to fall back to 800x600
513  NOTICE("splash: Falling back to 800x600x16");
514  if (!pDisplay->setScreenMode(800, 600, 16))
515  {
516  // Finally try and fall back to 640x480
517  NOTICE("splash: Falling back to 640x480x16");
518  if (!pDisplay->setScreenMode(640, 480, 16))
519  {
520  ERROR("splash: Couldn't find a suitable display mode "
521  "for this system (tried: 1024x768, 800x600, "
522  "640x480).");
523  g_NoGraphics = true;
524  }
525  }
526  }
527  }
528  }
529 
530  if (g_NoGraphics)
531  {
532  NOTICE("splash: this system does not support graphics, using fallback "
533  "log callback");
534  return handleNoSplash();
535  }
536 
537  Framebuffer *pParentFramebuffer =
538  g_GraphicsParams.providerResult.pFramebuffer;
539 
540  g_Width = pParentFramebuffer->getWidth();
541  g_Height = pParentFramebuffer->getHeight();
542 
543  g_pFramebuffer = Graphics::createFramebuffer(
544  pParentFramebuffer, 0, 0, g_Width, g_Height);
545  g_ColorFormat = g_pFramebuffer->getFormat();
546 
547  g_pFramebuffer->rect(
548  0, 0, g_Width, g_Height, g_BackgroundColour, g_ColorFormat);
549 
550  // Create the logo buffer
551  uint8_t *data = header_data;
552  g_pBuffer = new uint8_t[width * height * 3]; // 24-bit, hardcoded...
553  for (size_t i = 0; i < (width * height); i++)
554  HEADER_PIXEL(data, &g_pBuffer[i * 3]); // 24-bit, hardcoded
555 
556  size_t origx = (g_Width - width) / 2;
557  size_t origy = (g_Height - height) / 3;
558 
559  g_pFramebuffer->draw(
560  g_pBuffer, 0, 0, origx, origy, width, height, Graphics::Bits24_Bgr);
561 
562  delete[] g_pBuffer;
563 
564  // Create the font buffer
565  g_pBuffer = new uint8_t[(FONT_WIDTH * FONT_HEIGHT * 3) * 256]; // 24-bit
566  ByteSet(g_pBuffer, 0, (FONT_WIDTH * FONT_HEIGHT * 3) * 256);
567  size_t offset = 0;
568 
569  // For each character
570  for (size_t character = 0; character < 255; character++)
571  {
572  // For each character row
573  for (size_t row = 0; row < FONT_HEIGHT; row++)
574  {
575  // For each character row bit
576  for (size_t col = 0; col <= FONT_WIDTH; col++)
577  {
578  // Is this bit set?
579  size_t fontRow = (character * FONT_HEIGHT) + row;
580  if (font_data[fontRow] & (1 << (FONT_WIDTH - col)))
581  {
582  // x: col
583  // y: fontRow
584  size_t bytesPerPixel = 3;
585  size_t bytesPerLine = FONT_WIDTH * bytesPerPixel;
586  size_t pixelOffset =
587  (fontRow * bytesPerLine) + (col * bytesPerPixel);
588  size_t bufferOffset = pixelOffset;
589 
590  uint32_t *p = reinterpret_cast<uint32_t *>(
591  adjust_pointer(g_pBuffer, bufferOffset));
592  *p = g_ForegroundColour;
593  }
594  }
595  }
596  }
597 
598  g_pFont = g_pFramebuffer->createBuffer(
599  g_pBuffer, Graphics::Bits24_Rgb, FONT_WIDTH, FONT_HEIGHT * 256);
600 
601  g_ProgressX = (g_Width / 2) - 200;
602  g_ProgressW = 400;
603  g_ProgressY = (g_Height / 3) * 2;
604  g_ProgressH = 15;
605 
606  g_LogBoxX = 0;
607  g_LogBoxY = (g_Height / 4) * 3;
608  g_LogW = g_Width;
609  g_LogH = g_Height - g_LogBoxY;
610  g_LogX = g_LogY = 0;
611 
612  // Yay text!
613  centerStringAt(
614  "Please wait, Pedigree is loading...", g_Width / 2,
615  g_ProgressY - (FONT_HEIGHT * 3));
616 
617 #ifdef DEBUGGER
618  // Draw a border around the log area
619  centerStringAt(
620  "< Kernel Log >", g_LogW / 2,
621  g_LogBoxY - 2 - (FONT_HEIGHT / 2) - FONT_HEIGHT);
622  centerStringAt(
623  "(you can push ESCAPE to view the kernel log, and again to make the "
624  "log fill the screen)",
625  g_LogW / 2, g_LogBoxY - 2 - (FONT_HEIGHT / 2));
626 #endif
627 
628  // Draw empty progress bar. Easiest way to draw a nonfilled rect? Draw two
629  // filled rects.
630  g_pFramebuffer->rect(
631  g_ProgressX - 2, g_ProgressY - 2, g_ProgressW + 4, g_ProgressH + 4,
632  g_ProgressBorderColour, g_ColorFormat);
633  g_pFramebuffer->rect(
634  g_ProgressX - 1, g_ProgressY - 1, g_ProgressW + 2, g_ProgressH + 2,
635  g_BackgroundColour, g_ColorFormat);
636 
637  g_pFramebuffer->redraw(0, 0, g_Width, g_Height, true);
638 
639  Log::instance().installCallback(&g_StreamLogger, true);
640 
641  g_BootProgressUpdate = &progress;
642 
643 #ifdef DEBUGGER
645 #endif
646 
647  return true;
648 }
649 
650 static bool init()
651 {
652  LockGuard<Mutex> guard(g_PrintLock);
653 
654  g_NoGraphics = false;
655  char *cmdline = g_pBootstrapInfo->getCommandLine();
656  if (cmdline)
657  {
658  Vector<String> cmds = String(cmdline).tokenise(' ');
659  for (auto it = cmds.begin(); it != cmds.end(); it++)
660  {
661  auto cmd = *it;
662  if (cmd == String("nosplash"))
663  {
664  g_NoGraphics = true;
665  break;
666  }
667  }
668  }
669 
670  if (g_NoGraphics)
671  {
672  return handleNoSplash();
673  }
674  else
675  {
676  return handleSplash();
677  }
678 }
679 
680 static void destroy()
681 {
682  LockGuard<Mutex> guard(g_PrintLock);
683 
684  Log::instance().removeCallback(&g_StreamLogger);
685 
686 #ifdef DEBUGGER
687  if (!g_NoGraphics)
688  {
689  InputManager::instance().removeCallback(keyCallback);
690  }
691 #endif
692 
693  g_BootProgressUpdate = 0;
694 }
695 
696 MODULE_INFO("splash", &init, &destroy, "config");
697 // If no graphics drivers loaded, we can handle that still. But we still need
698 // to run after the gfx-deps metamodule.
699 MODULE_OPTIONAL_DEPENDS("gfx-deps");
Iterator begin()
Definition: Vector.h:148
static const int Key
Definition: InputManager.h:40
Iterator end()
Definition: Vector.h:160
virtual void copy(size_t srcx, size_t srcy, size_t destx, size_t desty, size_t w, size_t h, bool bLowestCall=true)
Definition: Framebuffer.cc:190
Definition: cmd.h:30
virtual void blit(Graphics::Buffer *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, bool bLowestCall=true)
Definition: Framebuffer.cc:156
A vector / dynamic array.
EXPORTED_PUBLIC void write(T &str, Colour foreColour, Colour backColour)
void installCallback(CallbackType filter, callback_t callback, void *meta=0, Thread *pThread=0, uintptr_t param=0)
Installs a callback.
virtual void destroyBuffer(Graphics::Buffer *pBuffer)
Definition: Framebuffer.cc:104
Definition: Mutex.h:58
Colour
Definition: BootIO.h:42
Definition: String.h:49
virtual bool provides(Type service)
virtual void rect(size_t x, size_t y, size_t width, size_t height, uint32_t colour, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true)
Definition: Framebuffer.cc:179
void removeCallback(callback_t callback, void *meta=0, Thread *pThread=0)
Removes a callback.
ssize_t getValue()
Definition: Semaphore.cc:318
void redraw(size_t x=~0UL, size_t y=~0UL, size_t w=~0UL, size_t h=~0UL, bool bChild=false)
Definition: Framebuffer.cc:112
size_t getNum(size_t row, size_t col)
Returns the value in column &#39;col&#39; of the result, in number form.
Result * query(const char *sql)
#define NOTICE(text)
Definition: Log.h:74
bool succeeded()
Returns true if the result is valid, false if there was an error.
EXPORTED_PUBLIC void removeCallback(LogCallback *pCallback)
Definition: Log.cc:209
#define assert(x)
Definition: assert.h:37
virtual void draw(void *pBuffer, size_t srcx, size_t srcy, size_t destx, size_t desty, size_t width, size_t height, Graphics::PixelFormat format=Graphics::Bits32_Argb, bool bLowestCall=true)
Definition: Framebuffer.cc:168
Abstracts the system&#39;s framebuffer offering.
static EXPORTED_PUBLIC Log & instance()
Definition: Log.cc:108
Service * getService(const String &serviceName)
static InputManager & instance()
Singleton design.
Definition: InputManager.h:107
virtual bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)=0
#define ERROR(text)
Definition: Log.h:82
std::string errorMessage(size_t buffSz=256)
Returns the error message.
ServiceFeatures * enumerateOperations(const String &serviceName)
virtual Graphics::Buffer * createBuffer(const void *srcData, Graphics::PixelFormat srcFormat, size_t width, size_t height, uint32_t *pPalette=0)
Definition: Framebuffer.cc:94
EXPORTED_PUBLIC void installCallback(LogCallback *pCallback, bool bSkipBacklog=false)
Definition: Log.cc:146
void callback(const LogCord &cord)
virtual bool setScreenMode(ScreenMode sm)
Definition: Display.cc:110