]> git.sesse.net Git - ccbs/blobdiff - bigscreen/fonts.cpp
Fetch the list of auxilliary screens.
[ccbs] / bigscreen / fonts.cpp
index a2ac91b5a91c121cca23e7a8b79f947c65ea617c..8ba809f087c6a03001bcc1140271a9e051483c2e 100644 (file)
@@ -71,11 +71,11 @@ unsigned my_draw_text(const widestring &str, unsigned char *buf, double size, in
 
                                int width = (x + xpos + slot->bitmap_left + bm->width >= 800) ? (799 - x - xpos - slot->bitmap_left) : bm->width;
                                for (xx = 0; xx < width; xx++) {
-                                       *dst = (*dst * (256-*src) + r * *src) >> 8;
+                                       *dst = (*dst * (256-*src) + b * *src) >> 8;
                                        *dst++;
                                        *dst = (*dst * (256-*src) + g * *src) >> 8;
                                        *dst++;
-                                       *dst = (*dst * (256-*src) + b * *src) >> 8;
+                                       *dst = (*dst * (256-*src) + r * *src) >> 8;
                                        *dst++;
                                        *dst++ = 0;
                                        src++;
@@ -88,3 +88,31 @@ unsigned my_draw_text(const widestring &str, unsigned char *buf, double size, in
 
        return x;
 }
+
+void my_draw_text_deferred(std::vector<TextDefer> &td, const widestring &str, double size, int xpos, int ypos)
+{
+       TextDefer newtd;
+       newtd.str = str;
+       newtd.size = size;
+       newtd.xpos = xpos;
+       newtd.ypos = ypos;
+       td.push_back(newtd);
+}
+
+void draw_all_deferred_text(unsigned char *buf, std::vector<TextDefer> &current, std::vector<TextDefer> &old)
+{
+       for (unsigned i = 0; i < current.size(); ++i) {
+               int r, g, b;
+               if (i < old.size() && current[i].str != old[i].str) {
+                       // changed text
+                       r = 255;
+                       g = 0;
+                       b = 0;
+               } else {
+                       r = g = b = 255;
+               }       
+               
+               my_draw_text(current[i].str, buf, current[i].size, current[i].xpos, current[i].ypos, r, g, b);
+       }
+}
+