From 477a6b7bfb793e1f9842907cc47bcb7213ea8840 Mon Sep 17 00:00:00 2001 From: Ryan Leavengood Date: Fri, 3 Aug 2012 00:09:08 -0400 Subject: [PATCH] What if Magnify displayed a hex color instead of a useless index? Well now it does. The code needs much more love, but I fixed the coding violations in this code I touched. --- src/apps/magnify/Magnify.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/apps/magnify/Magnify.cpp b/src/apps/magnify/Magnify.cpp index 979e1a4cf7..2c72130d00 100644 --- a/src/apps/magnify/Magnify.cpp +++ b/src/apps/magnify/Magnify.cpp @@ -909,17 +909,14 @@ TInfoView::Draw(BRect updateRect) strcpy(fInfoStr, dimensionsInfo); DrawString(fInfoStr); - rgb_color c = { 0,0,0, 255 }; - uchar index = 0; - if (fMagView) { - c = fMagView->SelectionColor(); - BScreen s; - index = s.IndexForColor(c); - } - MovePenTo(10, fFontHeight*2+5); + rgb_color color = { 0, 0, 0, 255 }; + if (fMagView) + color = fMagView->SelectionColor(); char str[64]; - sprintf(str, "R: %i G: %i B: %i (0x%x)", - c.red, c.green, c.blue, index); + snprintf(str, sizeof(str), "R: %i G: %i B: %i (#%02x%02x%02x)", + color.red, color.green, color.blue, color.red, color.green, color.red); + + MovePenTo(10, fFontHeight*2+5); invalRect.Set(10, fFontHeight+7, 10 + StringWidth(fRGBStr), fFontHeight*2+7); SetHighColor(ViewColor()); FillRect(invalRect);