Fix color preview drawing bug in Appearance. Fixes #9501
Also updated to use color constants intead of hardcoding colors. This draws a nice 3d-ish bevelled border around the color preview box.
This commit is contained in:
@@ -45,25 +45,39 @@ ColorPreview::Draw(BRect update)
|
|||||||
|
|
||||||
if (is_rect) {
|
if (is_rect) {
|
||||||
if (is_enabled) {
|
if (is_enabled) {
|
||||||
BRect r(Bounds());
|
rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
SetHighColor(184, 184, 184);
|
rgb_color shadow = tint_color(background, B_DARKEN_1_TINT);
|
||||||
StrokeRect(r);
|
rgb_color darkShadow = tint_color(background, B_DARKEN_3_TINT);
|
||||||
|
rgb_color light = tint_color(background, B_LIGHTEN_MAX_TINT);
|
||||||
|
|
||||||
SetHighColor(255, 255, 255);
|
BRect bounds(Bounds());
|
||||||
StrokeLine(BPoint(r.right, r.top + 1), r.RightBottom());
|
|
||||||
|
|
||||||
r.InsetBy(1, 1);
|
BeginLineArray(4);
|
||||||
|
AddLine(BPoint(bounds.left, bounds.bottom),
|
||||||
|
BPoint(bounds.left, bounds.top), shadow);
|
||||||
|
AddLine(BPoint(bounds.left + 1.0, bounds.top),
|
||||||
|
BPoint(bounds.right, bounds.top), shadow);
|
||||||
|
AddLine(BPoint(bounds.right, bounds.top + 1.0),
|
||||||
|
BPoint(bounds.right, bounds.bottom), light);
|
||||||
|
AddLine(BPoint(bounds.right - 1.0, bounds.bottom),
|
||||||
|
BPoint(bounds.left + 1.0, bounds.bottom), light);
|
||||||
|
EndLineArray();
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
SetHighColor(216, 216, 216);
|
BeginLineArray(4);
|
||||||
StrokeLine(r.RightTop(), r.RightBottom());
|
AddLine(BPoint(bounds.left, bounds.bottom),
|
||||||
|
BPoint(bounds.left, bounds.top), darkShadow);
|
||||||
|
AddLine(BPoint(bounds.left + 1.0, bounds.top),
|
||||||
|
BPoint(bounds.right, bounds.top), darkShadow);
|
||||||
|
AddLine(BPoint(bounds.right, bounds.top + 1.0),
|
||||||
|
BPoint(bounds.right, bounds.bottom), background);
|
||||||
|
AddLine(BPoint(bounds.right - 1.0, bounds.bottom),
|
||||||
|
BPoint(bounds.left + 1.0, bounds.bottom), background);
|
||||||
|
EndLineArray();
|
||||||
|
bounds.InsetBy(1.0, 1.0);
|
||||||
|
|
||||||
SetHighColor(96, 96, 96);
|
|
||||||
StrokeLine(r.LeftTop(), r.RightTop());
|
|
||||||
StrokeLine(r.LeftTop(), r.LeftBottom());
|
|
||||||
|
|
||||||
r.InsetBy(1, 1);
|
|
||||||
SetHighColor(color);
|
SetHighColor(color);
|
||||||
FillRect(r);
|
FillRect(bounds);
|
||||||
} else {
|
} else {
|
||||||
SetHighColor(color);
|
SetHighColor(color);
|
||||||
FillRect(Bounds());
|
FillRect(Bounds());
|
||||||
|
|||||||
Reference in New Issue
Block a user