From b6a70ecba9f72f2350e95e8060ecf72b45183448 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Mon, 23 Jul 2012 10:16:37 -0400 Subject: [PATCH] ProcessController: fix display of CPU bars for systems having 3 cores Generalize the drawing of separator lines for every number of cores requesting them. Fix the layout for 3 cores systems. Should fix #8763. --- src/apps/processcontroller/ProcessController.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/apps/processcontroller/ProcessController.cpp b/src/apps/processcontroller/ProcessController.cpp index d70c7361a0..1a5d5d20cc 100644 --- a/src/apps/processcontroller/ProcessController.cpp +++ b/src/apps/processcontroller/ProcessController.cpp @@ -124,7 +124,7 @@ layoutT layout[] = { { 1, 1, 1 }, { 5, 1, 5 }, // 1 { 3, 1, 4 }, // 2 - { 1, 1, 1 }, + { 2, 1, 3 }, { 2, 0, 3 }, // 4 { 1, 1, 1 }, { 1, 1, 1 }, @@ -542,16 +542,17 @@ ProcessController::DoDraw(bool force) float right = left + gCPUcount * (barWidth + layout[gCPUcount].cpu_inter) - layout[gCPUcount].cpu_inter; // right of CPU frame... if (force && Parent()) { - SetHighColor(Parent()->ViewColor ()); + SetHighColor(Parent()->ViewColor()); FillRect(BRect(right + 1, top - 1, right + 2, bottom + 1)); } if (force) { SetHighColor(frame_color); StrokeRect(BRect(left - 1, top - 1, right, bottom + 1)); - if (gCPUcount == 2) { - StrokeLine(BPoint(left + barWidth, top), BPoint(left + barWidth, - bottom)); + if (gCPUcount > 1 && layout[gCPUcount].cpu_inter == 1) { + for (int x = 1; x < gCPUcount; x++) + StrokeLine(BPoint(left + x * barWidth + x - 1, top), + BPoint(left + x * barWidth + x - 1, bottom)); } } float leftMem = bounds.Width() - layout[gCPUcount].mem_width; @@ -592,9 +593,9 @@ ProcessController::DoDraw(bool force) fLastBarHeight[x] = barHeight; } - float rightMem = bounds.Width () - 1; + float rightMem = bounds.Width() - 1; float rem = fMemoryUsage * (h + 1); - float barHeight = floorf (rem); + float barHeight = floorf(rem); rem -= barHeight; rgb_color used_memory_color;