[haiku-commits] Re: BRANCH midar-github.master - src/apps/terminal

  • From: Axel DÃrfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 17 Nov 2012 22:23:53 +0100

On 11/17/2012 10:48 AM, midar-github.master wrote:
+#define BRIGHT_ADD 64
+#define SATTURATED_ADD(var, add)       \
+       do {                                                    \
+               if (255 - var >= add)                \
+                       var += add;                             \
+               else                                            \
+                       var = 255;                              \
+       } while (0)
+
+               rgb_color bright = rgb_fore;
+
+               SATTURATED_ADD(bright.red, BRIGHT_ADD);
+               SATTURATED_ADD(bright.green, BRIGHT_ADD);
+               SATTURATED_ADD(bright.blue, BRIGHT_ADD);

Just as a hint: we try to avoid macros in normal code flow; in this case, you can easily add a function that does it without losing anything.

Bye,
   Axel.


Other related posts: