mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-09 02:44:49 +00:00
Fix clipping when rendering paths
Co-Authored-By: Nathan <nathan@zed.dev>
This commit is contained in:
parent
ea708c50f0
commit
08c4e1abdc
1 changed files with 3 additions and 2 deletions
|
@ -325,7 +325,7 @@ impl MetalRenderer {
|
||||||
.entry(tile.texture_id)
|
.entry(tile.texture_id)
|
||||||
.or_insert(Vec::new())
|
.or_insert(Vec::new())
|
||||||
.extend(path.vertices.iter().map(|vertex| PathVertex {
|
.extend(path.vertices.iter().map(|vertex| PathVertex {
|
||||||
xy_position: vertex.xy_position - path.bounds.origin
|
xy_position: vertex.xy_position - clipped_bounds.origin
|
||||||
+ tile.bounds.origin.map(Into::into),
|
+ tile.bounds.origin.map(Into::into),
|
||||||
st_position: vertex.st_position,
|
st_position: vertex.st_position,
|
||||||
content_mask: ContentMask {
|
content_mask: ContentMask {
|
||||||
|
@ -544,9 +544,10 @@ impl MetalRenderer {
|
||||||
if let Some((path, tile)) = paths_and_tiles.peek() {
|
if let Some((path, tile)) = paths_and_tiles.peek() {
|
||||||
if prev_texture_id.map_or(true, |texture_id| texture_id == tile.texture_id) {
|
if prev_texture_id.map_or(true, |texture_id| texture_id == tile.texture_id) {
|
||||||
prev_texture_id = Some(tile.texture_id);
|
prev_texture_id = Some(tile.texture_id);
|
||||||
|
let origin = path.bounds.intersect(&path.content_mask.bounds).origin;
|
||||||
sprites.push(PathSprite {
|
sprites.push(PathSprite {
|
||||||
bounds: Bounds {
|
bounds: Bounds {
|
||||||
origin: path.bounds.origin.map(|p| p.floor()),
|
origin: origin.map(|p| p.floor()),
|
||||||
size: tile.bounds.size.map(Into::into),
|
size: tile.bounds.size.map(Into::into),
|
||||||
},
|
},
|
||||||
color: path.color,
|
color: path.color,
|
||||||
|
|
Loading…
Reference in a new issue