🎉 Disable antialias for small shapes

This commit is contained in:
Alejandro Alonso 2025-03-24 12:54:41 +01:00
parent a80f114d66
commit 85b24e1e8d
8 changed files with 119 additions and 64 deletions

View file

@ -43,6 +43,7 @@ use crate::math;
use crate::math::{Bounds, Matrix, Point};
const MIN_VISIBLE_SIZE: f32 = 2.0;
const ANTIALIAS_THRESHOLD: f32 = 15.0;
#[derive(Debug, Clone, PartialEq)]
pub enum Type {
@ -512,6 +513,11 @@ impl Shape {
|| self.selrect.height() * scale < MIN_VISIBLE_SIZE
}
pub fn should_use_antialias(&self, scale: f32) -> bool {
self.selrect.width() * scale > ANTIALIAS_THRESHOLD
|| self.selrect.height() * scale > ANTIALIAS_THRESHOLD
}
// TODO: Maybe store this inside the shape
pub fn bounds(&self) -> Bounds {
let mut bounds = Bounds::new(