Codechange: Replace color with colour.

This commit is contained in:
Peter Nelson
2025-11-17 22:07:59 +00:00
committed by dP
parent f97ad14f0f
commit 427ab4dd24
14 changed files with 39 additions and 39 deletions

View File

@@ -240,9 +240,9 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
if (src_px->a == 255) {
src_px += n;
do {
/* If the anim buffer contains a color value, the image composition will
/* If the anim buffer contains a colour value, the image composition will
* only look at the RGB brightness value. As such, we can simply darken the
* RGB value to darken the anim color. */
* RGB value to darken the anim colour. */
Colour b = *anim != 0 ? Colour(GetColourBrightness(*dst), 0, 0) : *dst;
*dst = this->MakeTransparent(b, 3, 4);
anim++;
@@ -360,9 +360,9 @@ void Blitter_40bppAnim::DrawColourMappingRect(void *dst, int width, int height,
uint8_t *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32_t *)dst - (uint32_t *)_screen.dst_ptr);
if (pal == PALETTE_TO_TRANSPARENT) {
/* If the anim buffer contains a color value, the image composition will
/* If the anim buffer contains a colour value, the image composition will
* only look at the RGB brightness value. As such, we can simply darken the
* RGB value to darken the anim color. */
* RGB value to darken the anim colour. */
do {
for (int i = 0; i != width; i++) {
Colour b = *anim != 0 ? Colour(GetColourBrightness(*udst), 0, 0) : *udst;

View File

@@ -1095,7 +1095,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_select_company_liver
};
static WindowDesc _select_company_livery_desc(
WDP_AUTO, "company_color_scheme", 0, 0,
WDP_AUTO, "company_colour_scheme", 0, 0,
WC_COMPANY_COLOUR, WC_NONE,
{},
_nested_select_company_livery_widgets

View File

@@ -58,7 +58,7 @@ Font::Font(FontSize size, TextColour colour) :
* @note In case no ParagraphLayouter could be constructed, line.layout will be nullptr.
* @param line The cache item to store our layouter in.
* @param str The string to create a layouter for.
* @param state The state of the font and color.
* @param state The state of the font and colour.
* @tparam T The type of layouter we want.
*/
template <typename T>

View File

@@ -32,7 +32,7 @@ extern LeagueTablePool _league_table_pool;
struct LeagueTableElement : LeagueTableElementPool::PoolItem<&_league_table_element_pool> {
LeagueTableID table = LeagueTableID::Invalid(); ///< Id of the table which this element belongs to
int64_t rating = 0; ///< Value that determines ordering of elements in the table (higher=better)
CompanyID company = CompanyID::Invalid(); ///< Company Id to show the color blob for or CompanyID::Invalid()
CompanyID company = CompanyID::Invalid(); ///< Company Id to show the colour blob for or CompanyID::Invalid()
EncodedString text{}; ///< Text of the element
EncodedString score{}; ///< String representation of the score associated with the element
Link link{}; ///< What opens when element is clicked

View File

@@ -73,7 +73,7 @@ std::tuple<CommandCost, LeagueTableID> CmdCreateLeagueTable(DoCommandFlags flags
* @param flags type of operation
* @param table Id of the league table this element belongs to
* @param rating Value that elements are ordered by
* @param company Company to show the color blob for or CompanyID::Invalid()
* @param company Company to show the colour blob for or CompanyID::Invalid()
* @param text Text of the element
* @param score String representation of the score associated with the element
* @param link_type Type of the referenced object
@@ -100,7 +100,7 @@ std::tuple<CommandCost, LeagueTableElementID> CmdCreateLeagueTableElement(DoComm
* Update the attributes of a league table element.
* @param flags type of operation
* @param element Id of the element to update
* @param company Company to show the color blob for or CompanyID::Invalid()
* @param company Company to show the colour blob for or CompanyID::Invalid()
* @param text Text of the element
* @param link_type Type of the referenced object
* @param link_target Id of the referenced object

View File

@@ -878,7 +878,7 @@ static void MakeNewGameDone()
Company *c = Company::Get(CompanyID::Begin());
c->settings = _settings_client.company;
/* Overwrite color from settings if needed
/* Overwrite colour from settings if needed
* COLOUR_END corresponds to Random colour */
if (_settings_client.gui.starting_colour != COLOUR_END) {

View File

@@ -190,9 +190,9 @@ static const CTRunDelegateCallbacks _sprite_font_callback = {
}
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTFontAttributeName, font_handle);
CGColorRef color = CGColorCreateGenericGray((uint8_t)font->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTForegroundColorAttributeName, color);
CGColorRelease(color);
CGColorRef colour = CGColorCreateGenericGray((uint8_t)font->colour / 255.0f, 1.0f); // We don't care about the real colours, just that they are different.
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTForegroundColorAttributeName, colour);
CGColorRelease(colour);
/* Install a size callback for our special private-use sprite glyphs in case the font does not provide them. */
for (ssize_t c = last; c < position; c++) {

View File

@@ -70,7 +70,7 @@ public:
* Create a new league table element.
* @param table Id of the league table this element belongs to.
* @param rating Value that elements are ordered by.
* @param company Company to show the color blob for or COMPANY_INVALID.
* @param company Company to show the colour blob for or COMPANY_INVALID.
* @param text Text of the element (can be either a raw string, or ScriptText object).
* @param score String representation of the score associated with the element (can be either a raw string, or ScriptText object).
* @param link_type Type of the referenced object.
@@ -87,7 +87,7 @@ public:
/**
* Update the attributes of a league table element.
* @param element Id of the element to update
* @param company Company to show the color blob for or COMPANY_INVALID.
* @param company Company to show the colour blob for or COMPANY_INVALID.
* @param text Text of the element (can be either a raw string, or ScriptText object).
* @param link_type Type of the referenced object.
* @param link_target Id of the referenced object.

View File

@@ -219,8 +219,8 @@ struct GUISettings {
uint8_t missing_strings_threshold; ///< the number of missing strings before showing the warning
uint8_t graph_line_thickness; ///< the thickness of the lines in the various graph guis
uint8_t osk_activation; ///< Mouse gesture to trigger the OSK.
Colours starting_colour; ///< default color scheme for the company to start a new game with
Colours starting_colour_secondary; ///< default secondary color scheme for the company to start a new game with
Colours starting_colour; ///< default colour scheme for the company to start a new game with
Colours starting_colour_secondary; ///< default secondary colour scheme for the company to start a new game with
bool show_newgrf_name; ///< Show the name of the NewGRF in the build vehicle window
bool show_cargo_in_vehicle_lists; ///< Show the cargoes the vehicles can carry in the list windows
bool auto_remove_signals; ///< automatically remove signals when in the way during rail construction

View File

@@ -1622,6 +1622,6 @@ static const PaletteID PALETTE_CRASH = 804; ///< Recolour sprite
static const PaletteID PALETTE_CHURCH_RED = 1438; ///< Recolour sprite for reddish churches
static const PaletteID PALETTE_CHURCH_CREAM = 1439; ///< Recolour sprite for white churches
static const PaletteID PALETTE_ALL_BLACK = SPR_PALETTE_BASE; ///< Exchange any color by black, needed for painting fictive tiles outside map
static const PaletteID PALETTE_ALL_BLACK = SPR_PALETTE_BASE; ///< Exchange any colour by black, needed for painting fictive tiles outside map
#endif /* SPRITES_H */

View File

@@ -30,7 +30,7 @@ public:
OTTD_CocoaWindow *window; ///< Pointer to window object
OTTD_CocoaView *cocoaview; ///< Pointer to view object
CGColorSpaceRef color_space; ///< Window color space
CGColorSpaceRef colour_space; ///< Window colour space
OTTD_CocoaWindowDelegate *delegate; //!< Window delegate object
@@ -101,7 +101,7 @@ private:
uint32_t palette[256]; ///< Colour Palette
void BlitIndexedToView32(int left, int top, int right, int bottom);
void UpdatePalette(uint first_color, uint num_colors);
void UpdatePalette(uint first_colour, uint num_colours);
public:
CGContextRef cgcontext; ///< Context reference for Quartz subdriver

View File

@@ -99,7 +99,7 @@ VideoDriver_Cocoa::VideoDriver_Cocoa(bool uses_hardware_acceleration)
this->cocoaview = nil;
this->delegate = nil;
this->color_space = nullptr;
this->colour_space = nullptr;
this->dirty_rect = {};
}
@@ -116,7 +116,7 @@ void VideoDriver_Cocoa::Stop()
[ this->cocoaview release ];
[ this->delegate release ];
CGColorSpaceRelease(this->color_space);
CGColorSpaceRelease(this->colour_space);
_cocoa_video_started = false;
}
@@ -432,10 +432,10 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height)
[ draw_view release ];
[ this->window setColorSpace:[ NSColorSpace sRGBColorSpace ] ];
CGColorSpaceRelease(this->color_space);
this->color_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
if (this->color_space == nullptr) this->color_space = CGColorSpaceCreateDeviceRGB();
if (this->color_space == nullptr) FatalError("Could not get a valid colour space for drawing.");
CGColorSpaceRelease(this->colour_space);
this->colour_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
if (this->colour_space == nullptr) this->colour_space = CGColorSpaceCreateDeviceRGB();
if (this->colour_space == nullptr) FatalError("Could not get a valid colour space for drawing.");
this->setup = false;
@@ -654,7 +654,7 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool)
this->window_height, // height
8, // bits per component
this->window_pitch * 4, // bytes per row
this->color_space, // color space
this->colour_space, // colour space
kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
);
@@ -704,11 +704,11 @@ void VideoDriver_CocoaQuartz::BlitIndexedToView32(int left, int top, int right,
}
/** Update the palette */
void VideoDriver_CocoaQuartz::UpdatePalette(uint first_color, uint num_colors)
void VideoDriver_CocoaQuartz::UpdatePalette(uint first_colour, uint num_colours)
{
if (this->buffer_depth != 8) return;
for (uint i = first_color; i < first_color + num_colors; i++) {
for (uint i = first_colour; i < first_colour + num_colours; i++) {
uint32_t clr = 0xff000000;
clr |= (uint32_t)_local_palette.palette[i].r << 16;
clr |= (uint32_t)_local_palette.palette[i].g << 8;

View File

@@ -177,8 +177,8 @@ static NSImage *NSImageFromSprite(SpriteID sprite_id, ZoomLevel zoom)
if (!data) return nullptr;
CGBitmapInfo info = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
CFAutoRelease<CGColorSpaceRef> color_space(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
CFAutoRelease<CGImage> bitmap(CGImageCreate(dim.width, dim.height, 8, 32, dim.width * 4, color_space.get(), info, data.get(), nullptr, false, kCGRenderingIntentDefault));
CFAutoRelease<CGColorSpaceRef> colour_space(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
CFAutoRelease<CGImage> bitmap(CGImageCreate(dim.width, dim.height, 8, 32, dim.width * 4, colour_space.get(), info, data.get(), nullptr, false, kCGRenderingIntentDefault));
if (!bitmap) return nullptr;
return [ [ [ NSImage alloc ] initWithCGImage:bitmap.get() size:NSZeroSize ] autorelease ];

View File

@@ -67,22 +67,22 @@ void VideoDriver_SDL_Default::MakePalette()
if (_sdl_surface != _sdl_real_surface) {
/* When using a shadow surface, also set our palette on the real screen. This lets SDL
* allocate as many colors (or approximations) as
* allocate as many colours (or approximations) as
* possible, instead of using only the default SDL
* palette. This allows us to get more colors exactly
* palette. This allows us to get more colours exactly
* right and might allow using better approximations for
* other colors.
* other colours.
*
* Note that colors allocations are tried in-order, so
* this favors colors further up into the palette. Also
* note that if two colors from the same animation
* sequence are approximated using the same color, that
* Note that colours allocations are tried in-order, so
* this favors colours further up into the palette. Also
* note that if two colours from the same animation
* sequence are approximated using the same colour, that
* animation will stop working.
*
* Since changing the system palette causes the colours
* to change right away, and allocations might
* drastically change, we can't use this for animation,
* since that could cause weird coloring between the
* since that could cause weird colouring between the
* palette change and the blitting below, so we only set
* the real palette during initialisation.
*/