Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 8d95a77

Browse files
committed
[[ CleanupMCColor ]] Remove references to MCcolor.flags field
1 parent dd0ee01 commit 8d95a77

6 files changed

Lines changed: 23 additions & 50 deletions

File tree

engine/src/exec-dialog.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -752,13 +752,8 @@ void MCDialogGetColorDialogColors(MCExecContext& ctxt, uindex_t& r_count, MCStri
752752

753753
for (uindex_t i = 0; t_success && i < t_count; i++)
754754
{
755-
if (t_list[i] . flags != 0)
756-
{
757-
MCStringRef t_color;
758-
t_success = MCStringFormat(t_color, "%d,%d,%d", t_list[i] . red, t_list[i] . green, t_list[i] . blue) && t_colors . Push(t_color);
759-
}
760-
else
761-
t_colors . Push(kMCEmptyString);
755+
MCStringRef t_color;
756+
t_success = MCStringFormat(t_color, "%d,%d,%d", t_list[i] . red, t_list[i] . green, t_list[i] . blue) && t_colors . Push(t_color);
762757
}
763758

764759
t_colors . Take(r_color_list, r_count);
@@ -775,12 +770,11 @@ void MCDialogSetColorDialogColors(MCExecContext& ctxt, uindex_t p_count, MCStrin
775770
MCColor t_color;
776771
if (i >= p_count || MCStringIsEmpty(p_color_list[i]))
777772
{
778-
t_color . flags = 0;
773+
t_color = MCzerocolor;
779774
t_success = t_list . Push(t_color);
780775
}
781776
else
782777
{
783-
t_color . flags = DoRed | DoGreen | DoBlue;
784778
t_success = MCscreen -> parsecolor(p_color_list[i], t_color) && t_list . Push(t_color);
785779
}
786780
}

engine/src/exec-interface-object.cpp

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,33 +2385,25 @@ void MCObject::SetColors(MCExecContext& ctxt, MCStringRef p_input)
23852385
}
23862386
if (!getcindex(index, i))
23872387
{
2388-
if (t_color . color . flags)
2389-
{
2390-
i = createcindex(index);
2391-
colors[i] = t_color . color;
2392-
if (opened)
2393-
MCscreen->alloccolor(colors[i]);
2394-
colornames[i] = t_color . name == nil ? nil : MCValueRetain(t_color . name);
2395-
}
2388+
i = createcindex(index);
2389+
colors[i] = t_color . color;
2390+
if (opened)
2391+
MCscreen->alloccolor(colors[i]);
2392+
colornames[i] = t_color . name == nil ? nil : MCValueRetain(t_color . name);
23962393
}
23972394
else
23982395
{
2399-
if (t_color . color . flags)
2396+
if (colornames[i] != nil)
24002397
{
2401-
if (colornames[i] != nil)
2402-
{
2403-
MCValueRelease(colornames[i]);
2404-
colornames[i] = nil;
2405-
}
2406-
if (opened)
2407-
{
2408-
colors[i] = t_color . color;
2409-
MCscreen->alloccolor(colors[i]);
2410-
}
2411-
colornames[i] = t_color . name == nil ? nil : MCValueRetain(t_color . name);
2398+
MCValueRelease(colornames[i]);
2399+
colornames[i] = nil;
2400+
}
2401+
if (opened)
2402+
{
2403+
colors[i] = t_color . color;
2404+
MCscreen->alloccolor(colors[i]);
24122405
}
2413-
else
2414-
destroycindex(index, i);
2406+
colornames[i] = t_color . name == nil ? nil : MCValueRetain(t_color . name);
24152407
}
24162408
MCInterfaceNamedColorFree(ctxt, t_color);
24172409
}

engine/src/exec-interface2.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ void MCInterfaceNamedColorParse(MCExecContext& ctxt, MCStringRef p_input, MCInte
366366
}
367367

368368
r_output . color = t_color;
369-
r_output . color . flags = DoRed | DoGreen | DoBlue;
370369
r_output . name = t_color_name;
371370
}
372371

engine/src/fieldh.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,6 @@ bool MCField::converttoparagraphs(void *p_context, const MCTextParagraph *p_para
983983
t_color . red = ((p_block -> foreground_color & 0xff) << 8) | (p_block -> foreground_color & 0xff);
984984
t_color . green = (p_block -> foreground_color & 0xff00) | ((p_block -> foreground_color & 0xff00) >> 8);
985985
t_color . blue = ((p_block -> foreground_color & 0xff0000) >> 8) | ((p_block -> foreground_color & 0xff0000) >> 16);
986-
t_color . flags = 0xff;
987986
t_block -> setcolor(&t_color);
988987
}
989988

@@ -994,7 +993,6 @@ bool MCField::converttoparagraphs(void *p_context, const MCTextParagraph *p_para
994993
t_color . red = ((p_block -> background_color & 0xff) << 8) | (p_block -> background_color & 0xff);
995994
t_color . green = (p_block -> background_color & 0xff00) | ((p_block -> background_color & 0xff00) >> 8);
996995
t_color . blue = ((p_block -> background_color & 0xff0000) >> 8) | ((p_block -> background_color & 0xff0000) >> 16);
997-
t_color . flags = 0xff;
998996
t_block -> setbackcolor(&t_color);
999997
}
1000998

engine/src/uidc.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,6 @@ Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
16661666
}
16671667
shiftbits -= goodbits;
16681668
}
1669-
color->flags = DoRed | DoGreen | DoBlue;
16701669
return True;
16711670
}
16721671
char *tptr = sptr;
@@ -1692,7 +1691,6 @@ Boolean MCUIDC::lookupcolor(MCStringRef s, MCColor *color)
16921691
color->red = (color_table[mid].red << 8) + color_table[mid].red;
16931692
color->green = (color_table[mid].green << 8) + color_table[mid].green;
16941693
color->blue = (color_table[mid].blue << 8) + color_table[mid].blue;
1695-
color->flags = DoRed | DoGreen | DoBlue;
16961694
return True;
16971695
}
16981696
}

engine/src/w32ans.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,12 @@ void MCA_getcolordialogcolors(MCColor*& r_colors, uindex_t& r_count)
10751075

10761076
for(int i = 0; i < 16; i++)
10771077
{
1078-
MCColor t_color;
1079-
if (s_colordialogcolors[i] != 0)
1080-
{
1081-
t_color . red = GetRValue(s_colordialogcolors[i]);
1082-
t_color . green = GetGValue(s_colordialogcolors[i]);
1083-
t_color . blue = GetBValue(s_colordialogcolors[i]);
1084-
t_color . flags = DoRed | DoGreen | DoBlue;
1085-
t_list . Push(t_color);
1086-
}
1087-
else
1088-
{
1089-
t_color . flags = 0;
1090-
t_list . Push(t_color);
1091-
}
1078+
MCColor t_color;
1079+
t_color . red = GetRValue(s_colordialogcolors[i]);
1080+
t_color . green = GetGValue(s_colordialogcolors[i]);
1081+
t_color . blue = GetBValue(s_colordialogcolors[i]);
1082+
t_color . flags = DoRed | DoGreen | DoBlue;
1083+
t_list . Push(t_color);
10921084
}
10931085

10941086
t_list . Take(r_colors, r_count);

0 commit comments

Comments
 (0)