Codechange: Replace color with colour.
This commit is contained in:
@@ -252,9 +252,9 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
|||||||
if (src_px->a == 255) {
|
if (src_px->a == 255) {
|
||||||
src_px += n;
|
src_px += n;
|
||||||
do {
|
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
|
* 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;
|
Colour b = *anim != 0 ? Colour(GetColourBrightness(*dst), 0, 0) : *dst;
|
||||||
*dst = this->MakeTransparent(b, 3, 4);
|
*dst = this->MakeTransparent(b, 3, 4);
|
||||||
anim++;
|
anim++;
|
||||||
@@ -373,9 +373,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);
|
uint8_t *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32_t *)dst - (uint32_t *)_screen.dst_ptr);
|
||||||
|
|
||||||
if (pal == PALETTE_TO_TRANSPARENT) {
|
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
|
* 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 {
|
do {
|
||||||
for (int i = 0; i != width; i++) {
|
for (int i = 0; i != width; i++) {
|
||||||
Colour b = *anim != 0 ? Colour(GetColourBrightness(*udst), 0, 0) : *udst;
|
Colour b = *anim != 0 ? Colour(GetColourBrightness(*udst), 0, 0) : *udst;
|
||||||
|
|||||||
@@ -1098,7 +1098,7 @@ static constexpr std::initializer_list<NWidgetPart> _nested_select_company_liver
|
|||||||
};
|
};
|
||||||
|
|
||||||
static WindowDesc _select_company_livery_desc(
|
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,
|
WC_COMPANY_COLOUR, WC_NONE,
|
||||||
{},
|
{},
|
||||||
_nested_select_company_livery_widgets
|
_nested_select_company_livery_widgets
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ Font::Font(FontSize size, TextColour colour) :
|
|||||||
* @note In case no ParagraphLayouter could be constructed, line.layout will be nullptr.
|
* @note In case no ParagraphLayouter could be constructed, line.layout will be nullptr.
|
||||||
* @param line The cache item to store our layouter in.
|
* @param line The cache item to store our layouter in.
|
||||||
* @param str The string to create a layouter for.
|
* @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.
|
* @tparam T The type of layouter we want.
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ extern LeagueTablePool _league_table_pool;
|
|||||||
struct LeagueTableElement : LeagueTableElementPool::PoolItem<&_league_table_element_pool> {
|
struct LeagueTableElement : LeagueTableElementPool::PoolItem<&_league_table_element_pool> {
|
||||||
LeagueTableID table = LeagueTableID::Invalid(); ///< Id of the table which this element belongs to
|
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)
|
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 text{}; ///< Text of the element
|
||||||
EncodedString score{}; ///< String representation of the score associated with the element
|
EncodedString score{}; ///< String representation of the score associated with the element
|
||||||
Link link{}; ///< What opens when element is clicked
|
Link link{}; ///< What opens when element is clicked
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ std::tuple<CommandCost, LeagueTableID> CmdCreateLeagueTable(DoCommandFlags flags
|
|||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
* @param table Id of the league table this element belongs to
|
* @param table Id of the league table this element belongs to
|
||||||
* @param rating Value that elements are ordered by
|
* @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 text Text of the element
|
||||||
* @param score String representation of the score associated with the element
|
* @param score String representation of the score associated with the element
|
||||||
* @param link_type Type of the referenced object
|
* @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.
|
* Update the attributes of a league table element.
|
||||||
* @param flags type of operation
|
* @param flags type of operation
|
||||||
* @param element Id of the element to update
|
* @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 text Text of the element
|
||||||
* @param link_type Type of the referenced object
|
* @param link_type Type of the referenced object
|
||||||
* @param link_target Id of the referenced object
|
* @param link_target Id of the referenced object
|
||||||
|
|||||||
@@ -902,7 +902,7 @@ static void MakeNewGameDone()
|
|||||||
Company *c = Company::Get(CompanyID::Begin());
|
Company *c = Company::Get(CompanyID::Begin());
|
||||||
c->settings = _settings_client.company;
|
c->settings = _settings_client.company;
|
||||||
|
|
||||||
/* Overwrite color from settings if needed
|
/* Overwrite colour from settings if needed
|
||||||
* COLOUR_END corresponds to Random colour */
|
* COLOUR_END corresponds to Random colour */
|
||||||
|
|
||||||
if (_settings_client.gui.starting_colour != COLOUR_END) {
|
if (_settings_client.gui.starting_colour != COLOUR_END) {
|
||||||
|
|||||||
@@ -190,9 +190,9 @@ static const CTRunDelegateCallbacks _sprite_font_callback = {
|
|||||||
}
|
}
|
||||||
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTFontAttributeName, font_handle);
|
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.
|
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, color);
|
CFAttributedStringSetAttribute(str.get(), CFRangeMake(last, position - last), kCTForegroundColorAttributeName, colour);
|
||||||
CGColorRelease(color);
|
CGColorRelease(colour);
|
||||||
|
|
||||||
/* Install a size callback for our special private-use sprite glyphs in case the font does not provide them. */
|
/* 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++) {
|
for (ssize_t c = last; c < position; c++) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
* Create a new league table element.
|
* Create a new league table element.
|
||||||
* @param table Id of the league table this element belongs to.
|
* @param table Id of the league table this element belongs to.
|
||||||
* @param rating Value that elements are ordered by.
|
* @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 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 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.
|
* @param link_type Type of the referenced object.
|
||||||
@@ -87,7 +87,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Update the attributes of a league table element.
|
* Update the attributes of a league table element.
|
||||||
* @param element Id of the element to update
|
* @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 text Text of the element (can be either a raw string, or ScriptText object).
|
||||||
* @param link_type Type of the referenced object.
|
* @param link_type Type of the referenced object.
|
||||||
* @param link_target Id of the referenced object.
|
* @param link_target Id of the referenced object.
|
||||||
|
|||||||
@@ -219,8 +219,8 @@ struct GUISettings {
|
|||||||
uint8_t missing_strings_threshold; ///< the number of missing strings before showing the warning
|
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 graph_line_thickness; ///< the thickness of the lines in the various graph guis
|
||||||
uint8_t osk_activation; ///< Mouse gesture to trigger the OSK.
|
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; ///< default colour 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_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_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 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
|
bool auto_remove_signals; ///< automatically remove signals when in the way during rail construction
|
||||||
|
|||||||
@@ -1692,6 +1692,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_RED = 1438; ///< Recolour sprite for reddish churches
|
||||||
static const PaletteID PALETTE_CHURCH_CREAM = 1439; ///< Recolour sprite for white 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 */
|
#endif /* SPRITES_H */
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
|
|
||||||
OTTD_CocoaWindow *window; ///< Pointer to window object
|
OTTD_CocoaWindow *window; ///< Pointer to window object
|
||||||
OTTD_CocoaView *cocoaview; ///< Pointer to view 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
|
OTTD_CocoaWindowDelegate *delegate; //!< Window delegate object
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ private:
|
|||||||
uint32_t palette[256]; ///< Colour Palette
|
uint32_t palette[256]; ///< Colour Palette
|
||||||
|
|
||||||
void BlitIndexedToView32(int left, int top, int right, int bottom);
|
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:
|
public:
|
||||||
CGContextRef cgcontext; ///< Context reference for Quartz subdriver
|
CGContextRef cgcontext; ///< Context reference for Quartz subdriver
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ VideoDriver_Cocoa::VideoDriver_Cocoa(bool uses_hardware_acceleration)
|
|||||||
this->cocoaview = nil;
|
this->cocoaview = nil;
|
||||||
this->delegate = nil;
|
this->delegate = nil;
|
||||||
|
|
||||||
this->color_space = nullptr;
|
this->colour_space = nullptr;
|
||||||
|
|
||||||
this->dirty_rect = {};
|
this->dirty_rect = {};
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ void VideoDriver_Cocoa::Stop()
|
|||||||
[ this->cocoaview release ];
|
[ this->cocoaview release ];
|
||||||
[ this->delegate release ];
|
[ this->delegate release ];
|
||||||
|
|
||||||
CGColorSpaceRelease(this->color_space);
|
CGColorSpaceRelease(this->colour_space);
|
||||||
|
|
||||||
_cocoa_video_started = false;
|
_cocoa_video_started = false;
|
||||||
}
|
}
|
||||||
@@ -434,10 +434,10 @@ bool VideoDriver_Cocoa::MakeWindow(int width, int height)
|
|||||||
[ draw_view release ];
|
[ draw_view release ];
|
||||||
|
|
||||||
[ this->window setColorSpace:[ NSColorSpace sRGBColorSpace ] ];
|
[ this->window setColorSpace:[ NSColorSpace sRGBColorSpace ] ];
|
||||||
CGColorSpaceRelease(this->color_space);
|
CGColorSpaceRelease(this->colour_space);
|
||||||
this->color_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
this->colour_space = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||||
if (this->color_space == nullptr) this->color_space = CGColorSpaceCreateDeviceRGB();
|
if (this->colour_space == nullptr) this->colour_space = CGColorSpaceCreateDeviceRGB();
|
||||||
if (this->color_space == nullptr) FatalError("Could not get a valid colour space for drawing.");
|
if (this->colour_space == nullptr) FatalError("Could not get a valid colour space for drawing.");
|
||||||
|
|
||||||
this->setup = false;
|
this->setup = false;
|
||||||
|
|
||||||
@@ -660,7 +660,7 @@ void VideoDriver_CocoaQuartz::AllocateBackingStore(bool)
|
|||||||
this->window_height, // height
|
this->window_height, // height
|
||||||
8, // bits per component
|
8, // bits per component
|
||||||
this->window_pitch * 4, // bytes per row
|
this->window_pitch * 4, // bytes per row
|
||||||
this->color_space, // color space
|
this->colour_space, // colour space
|
||||||
kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
|
kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Host
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -710,11 +710,11 @@ void VideoDriver_CocoaQuartz::BlitIndexedToView32(int left, int top, int right,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Update the palette */
|
/** 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;
|
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;
|
uint32_t clr = 0xff000000;
|
||||||
clr |= (uint32_t)_local_palette.palette[i].r << 16;
|
clr |= (uint32_t)_local_palette.palette[i].r << 16;
|
||||||
clr |= (uint32_t)_local_palette.palette[i].g << 8;
|
clr |= (uint32_t)_local_palette.palette[i].g << 8;
|
||||||
|
|||||||
@@ -177,8 +177,8 @@ static NSImage *NSImageFromSprite(SpriteID sprite_id, ZoomLevel zoom)
|
|||||||
if (!data) return nullptr;
|
if (!data) return nullptr;
|
||||||
|
|
||||||
CGBitmapInfo info = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
|
CGBitmapInfo info = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
|
||||||
CFAutoRelease<CGColorSpaceRef> color_space(CGColorSpaceCreateWithName(kCGColorSpaceSRGB));
|
CFAutoRelease<CGColorSpaceRef> colour_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<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;
|
if (!bitmap) return nullptr;
|
||||||
|
|
||||||
return [ [ [ NSImage alloc ] initWithCGImage:bitmap.get() size:NSZeroSize ] autorelease ];
|
return [ [ [ NSImage alloc ] initWithCGImage:bitmap.get() size:NSZeroSize ] autorelease ];
|
||||||
|
|||||||
@@ -67,22 +67,22 @@ void VideoDriver_SDL_Default::MakePalette()
|
|||||||
|
|
||||||
if (_sdl_surface != _sdl_real_surface) {
|
if (_sdl_surface != _sdl_real_surface) {
|
||||||
/* When using a shadow surface, also set our palette on the real screen. This lets SDL
|
/* 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
|
* 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
|
* right and might allow using better approximations for
|
||||||
* other colors.
|
* other colours.
|
||||||
*
|
*
|
||||||
* Note that colors allocations are tried in-order, so
|
* Note that colours allocations are tried in-order, so
|
||||||
* this favors colors further up into the palette. Also
|
* this favors colours further up into the palette. Also
|
||||||
* note that if two colors from the same animation
|
* note that if two colours from the same animation
|
||||||
* sequence are approximated using the same color, that
|
* sequence are approximated using the same colour, that
|
||||||
* animation will stop working.
|
* animation will stop working.
|
||||||
*
|
*
|
||||||
* Since changing the system palette causes the colours
|
* Since changing the system palette causes the colours
|
||||||
* to change right away, and allocations might
|
* to change right away, and allocations might
|
||||||
* drastically change, we can't use this for animation,
|
* 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
|
* palette change and the blitting below, so we only set
|
||||||
* the real palette during initialisation.
|
* the real palette during initialisation.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user