Changeset - r28038:cee5bc8943d9
[Not reviewed]
master
0 1 0
Peter Nelson - 8 months ago 2023-10-25 13:08:07
peter1138@openttd.org
Cleanup: No need to cast `const Font *` to itself. (#11395)
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/gfx.cpp
Show inline comments
 
@@ -512,25 +512,25 @@ static int DrawLayoutLine(const Paragrap
 

	
 
	truncation &= max_w < w;         // Whether we need to do truncation.
 
	int dot_width = 0;               // Cache for the width of the dot.
 
	const Sprite *dot_sprite = nullptr; // Cache for the sprite of the dot.
 

	
 
	if (truncation) {
 
		/*
 
		 * Assumption may be made that all fonts of a run are of the same size.
 
		 * In any case, we'll use these dots for the abbreviation, so even if
 
		 * another size would be chosen it won't have truncated too little for
 
		 * the truncation dots.
 
		 */
 
		FontCache *fc = ((const Font*)line.GetVisualRun(0).GetFont())->fc;
 
		FontCache *fc = line.GetVisualRun(0).GetFont()->fc;
 
		GlyphID dot_glyph = fc->MapCharToGlyph('.');
 
		dot_width = fc->GetGlyphWidth(dot_glyph);
 
		dot_sprite = fc->GetGlyph(dot_glyph);
 

	
 
		if (_current_text_dir == TD_RTL) {
 
			min_x += 3 * dot_width;
 
			offset_x = w - 3 * dot_width - max_w;
 
		} else {
 
			max_x -= 3 * dot_width;
 
		}
 

	
 
		w = max_w;
 
@@ -561,25 +561,25 @@ static int DrawLayoutLine(const Paragrap
 
			break;
 

	
 
		default:
 
			NOT_REACHED();
 
	}
 

	
 
	const uint shadow_offset = ScaleGUITrad(1);
 

	
 
	TextColour colour = TC_BLACK;
 
	bool draw_shadow = false;
 
	for (int run_index = 0; run_index < line.CountRuns(); run_index++) {
 
		const ParagraphLayouter::VisualRun &run = line.GetVisualRun(run_index);
 
		const Font *f = (const Font*)run.GetFont();
 
		const Font *f = run.GetFont();
 

	
 
		FontCache *fc = f->fc;
 
		colour = f->colour;
 
		SetColourRemap(colour);
 

	
 
		DrawPixelInfo *dpi = _cur_dpi;
 
		int dpi_left  = dpi->left;
 
		int dpi_right = dpi->left + dpi->width - 1;
 

	
 
		draw_shadow = fc->GetDrawGlyphShadow() && (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
 

	
 
		for (int i = 0; i < run.GetGlyphCount(); i++) {
0 comments (0 inline, 0 general)