Преглед на файлове

pstatserver: Fix compilation error with STDFLOAT_DOUBLE=1

Regression in 7da70cf9399e2703ac9cacbb6977edeb173de159

Fixes #1259
rdb преди 3 години
родител
ревизия
5bb616dca7

+ 6 - 6
pandatool/src/gtk-stats/gtkStatsGraph.cxx

@@ -274,13 +274,13 @@ get_collector_pattern(int collector_index, bool highlight) {
   // Ask the monitor what color this guy should be.
   LRGBColor rgb = _monitor->get_collector_color(collector_index);
   cairo_pattern_t *pattern = cairo_pattern_create_rgb(
-    encode_sRGB_float(rgb[0]),
-    encode_sRGB_float(rgb[1]),
-    encode_sRGB_float(rgb[2]));
+    encode_sRGB_float((float)rgb[0]),
+    encode_sRGB_float((float)rgb[1]),
+    encode_sRGB_float((float)rgb[2]));
   cairo_pattern_t *hpattern = cairo_pattern_create_rgb(
-    encode_sRGB_float(rgb[0] * 0.75f),
-    encode_sRGB_float(rgb[1] * 0.75f),
-    encode_sRGB_float(rgb[2] * 0.75f));
+    encode_sRGB_float((float)rgb[0] * 0.75f),
+    encode_sRGB_float((float)rgb[1] * 0.75f),
+    encode_sRGB_float((float)rgb[2] * 0.75f));
 
   _brushes[collector_index] = std::make_pair(pattern, hpattern);
   return highlight ? hpattern : pattern;

+ 6 - 6
pandatool/src/gtk-stats/gtkStatsLabel.cxx

@@ -55,14 +55,14 @@ GtkStatsLabel(GtkStatsMonitor *monitor, GtkStatsGraph *graph,
   // Set the fg and bg colors on the label.
   LRGBColor rgb = _monitor->get_collector_color(_collector_index);
   _bg_color = LRGBColor(
-    encode_sRGB_float(rgb[0]),
-    encode_sRGB_float(rgb[1]),
-    encode_sRGB_float(rgb[2]));
+    encode_sRGB_float((float)rgb[0]),
+    encode_sRGB_float((float)rgb[1]),
+    encode_sRGB_float((float)rgb[2]));
 
   _highlight_bg_color = LRGBColor(
-    encode_sRGB_float(rgb[0] * 0.75f),
-    encode_sRGB_float(rgb[1] * 0.75f),
-    encode_sRGB_float(rgb[2] * 0.75f));
+    encode_sRGB_float((float)rgb[0] * 0.75f),
+    encode_sRGB_float((float)rgb[1] * 0.75f),
+    encode_sRGB_float((float)rgb[2] * 0.75f));
 
   // Should our foreground be black or white?
   PN_stdfloat bright = _bg_color.dot(LRGBColor(0.2126, 0.7152, 0.0722));

+ 6 - 6
pandatool/src/win-stats/winStatsGraph.cxx

@@ -242,14 +242,14 @@ get_collector_brush(int collector_index, bool highlight) {
 
   // Ask the monitor what color this guy should be.
   LRGBColor rgb = _monitor->get_collector_color(collector_index);
-  int r = (int)encode_sRGB_uchar(rgb[0]);
-  int g = (int)encode_sRGB_uchar(rgb[1]);
-  int b = (int)encode_sRGB_uchar(rgb[2]);
+  int r = (int)encode_sRGB_uchar((float)rgb[0]);
+  int g = (int)encode_sRGB_uchar((float)rgb[1]);
+  int b = (int)encode_sRGB_uchar((float)rgb[2]);
   HBRUSH brush = CreateSolidBrush(RGB(r, g, b));
 
-  int hr = (int)encode_sRGB_uchar(rgb[0] * 0.75f);
-  int hg = (int)encode_sRGB_uchar(rgb[1] * 0.75f);
-  int hb = (int)encode_sRGB_uchar(rgb[2] * 0.75f);
+  int hr = (int)encode_sRGB_uchar((float)rgb[0] * 0.75f);
+  int hg = (int)encode_sRGB_uchar((float)rgb[1] * 0.75f);
+  int hb = (int)encode_sRGB_uchar((float)rgb[2] * 0.75f);
   HBRUSH hbrush = CreateSolidBrush(RGB(hr, hg, hb));
 
   _brushes[collector_index] = std::make_pair(brush, hbrush);

+ 6 - 6
pandatool/src/win-stats/winStatsLabel.cxx

@@ -44,15 +44,15 @@ WinStatsLabel(WinStatsMonitor *monitor, WinStatsGraph *graph,
   update_text(use_fullname);
 
   LRGBColor rgb = _monitor->get_collector_color(_collector_index);
-  int r = (int)encode_sRGB_uchar(rgb[0]);
-  int g = (int)encode_sRGB_uchar(rgb[1]);
-  int b = (int)encode_sRGB_uchar(rgb[2]);
+  int r = (int)encode_sRGB_uchar((float)rgb[0]);
+  int g = (int)encode_sRGB_uchar((float)rgb[1]);
+  int b = (int)encode_sRGB_uchar((float)rgb[2]);
   _bg_brush = CreateSolidBrush(RGB(r, g, b));
 
   // Calculate the color when it is highlighted.
-  int hr = (int)encode_sRGB_uchar(rgb[0] * 0.75f);
-  int hg = (int)encode_sRGB_uchar(rgb[1] * 0.75f);
-  int hb = (int)encode_sRGB_uchar(rgb[2] * 0.75f);
+  int hr = (int)encode_sRGB_uchar((float)rgb[0] * 0.75f);
+  int hg = (int)encode_sRGB_uchar((float)rgb[1] * 0.75f);
+  int hb = (int)encode_sRGB_uchar((float)rgb[2] * 0.75f);
   _highlight_bg_brush = CreateSolidBrush(RGB(hr, hg, hb));
 
   // Should our foreground be black or white?