# Reduce overdraw for border-only quads \(\#61274\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/0c51c7fd2481859e9da5c490ef8e41ddbcf1a341)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 0c51c7fd2481859e9da5c490ef8e41ddbcf1a341

Requested commit: 0c51c7fd2481859e9da5c490ef8e41ddbcf1a341

Commit: 0c51c7fd2481859e9da5c490ef8e41ddbcf1a341

Tree: 070db9e0466a7962a702f024dc49b69a62a41120

Author: John Tur

Committer: GitHub

## Message

```
Reduce overdraw for border-only quads (#61274)

Restore an optimization that I mistakenly removed in
https://github.com/zed-industries/zed/pull/54728.

Drawing a quad with a border but no fill color will run the quad
fragment shader for every transparent interior pixel, which is
especially costly when the quad is large. Instead, split these quads
into four non-overlapping strips that cover the regions where borders
are painted. The side strips own the straight left and right edges,
while the top and bottom strips own the horizontal edges and the rounded
corners.

Previously, this optimization only applied to borders drawn by the Taffy
layout. I've decided to reinstate the logic directly in `paint_quad` so
that the optimization can be applied more generally... though if this
feels like too much policy, we can move it back.

This reduces the GPU time spent painting a representative Zed scene by
about 20% or so.

Release Notes:

- N/A
```

## Parents

- [ac5538b7239196b7413da76a6258bc9ac4a017fe](https://git.cafe/gitcafe/zed/commit/ac5538b7239196b7413da76a6258bc9ac4a017fe?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/0c51c7fd2481859e9da5c490ef8e41ddbcf1a341?format=markdown)
