Repository: alacritty/alacritty
File: alacritty/src/renderer/text/builtin_font.rs (Rust)

Code before:
            *offset += 1.;
        }

        let radius_i = (smaller + stroke_size + 1) / 2;
        for y in 0..radius_i {
            for x in 0..radius_i {
                let y = y as f32;
                let x = x as f32;
                let d = (x * x + y * y).sqrt() + d_bias;
                let v = if d < r - w - 1. {
                    // Inside the ring
                    0.
                } else if d < r - w {
                    // On the inner border
                    1. + d - (r - w)
                } else if d < r - 1. {
                    // Inside the stroke
                    1.
                } else if d < r {
                    // On the outer border
                    r - d
                } else {
                    // Outside of the ring
                    0.
                };
                self.put_pixel(
                    x + x_offset,
                    y + y_offset,
                    Pixel::gray((COLOR_FILL._r as f32 * v) as u8),
                );
            }
        }

        if self.height > self.width {
            self.draw_rect(self.x_center() - w * 0.5, 0., w, y_offset, COLOR_FILL);
        } else {
            self.draw_rect(0., self.y_center() - w * 0.5, x_offset, w, COLOR_FILL);
        }
    }

    /// Fills the `Canvas` with the given `Color`.
    fn fill(&mut self, color: Pixel) {
        self.buffer.fill(color);
    }

    /// Consumes `Canvas` and returns its underlying storage as raw byte vector.
    fn into_raw(self) -> Vec<u8> {
        // SAFETY This is safe since we use `repr(packed)` on `Pixel` struct for underlying storage
        // of the `Canvas` buffer which consists of three u8 values.
        unsafe {
            let capacity = self.buffer.capacity() * mem::size_of::<Pixel>();

Review comment (suggestion):
```suggestion
                };
                
                self.put_pixel(
```

Code after:
            *offset += 1.;
        }

        let radius_i = (short_side + stroke_size + 1) / 2;
        for y in 0..radius_i {
            for x in 0..radius_i {
                let y = y as f32;
                let x = x as f32;
                let distance = x.hypot(y) + distance_bias;
                let value = if distance < radius - stroke_size_f - 1. {
                    // Inside the circle.
                    0.
                } else if distance < radius - stroke_size_f {
                    // On the inner border.
                    1. + distance - (radius - stroke_size_f)
                } else if distance < radius - 1. {
                    // Inside the stroke.
                    1.
                } else if distance < radius {
                    // On the outer border.
                    radius - distance
                } else {
                    // Outside of the circle.
                    0.
                };

                self.put_pixel(
                    x + x_offset,
                    y + y_offset,
                    Pixel::gray((COLOR_FILL._r as f32 * value) as u8),
                );
            }
        }

        if self.height > self.width {
            self.draw_rect(
                self.x_center() - stroke_size_f * 0.5,
                0.,
                stroke_size_f,
                y_offset,
                COLOR_FILL,
            );
        } else {
            self.draw_rect(
                0.,
                self.y_center() - stroke_size_f * 0.5,
                x_offset,
                stroke_size_f,
                COLOR_FILL,
            );
        }