# gpui: Fix images not being drawn with rounded corners when using ObjectFit::Cover \(\#61383\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 58df5a14ce946fa27b14194d9d2fce8f87b1c331

Requested commit: 58df5a14ce946fa27b14194d9d2fce8f87b1c331

Commit: 58df5a14ce946fa27b14194d9d2fce8f87b1c331

Tree: 4b4128de7ca49415d7fff666058c988c7cb26295

Author: Pingy

Committer: GitHub

## Message

```
gpui: Fix images not being drawn with rounded corners when using ObjectFit::Cover (#61383)

# Objective

Fixes #44339

## Solution

The issue was taking place as image bounds where larger than the view
bounds. Hence, the rounding of the image happened outside the view
bounds, hence the corners where not rounded.
This solution changed the paint_image function in window.rs. Now, it
takes in 2 parameters, image bounds and bounds of the area to be draw.
Then, the function creates the tile field of PolychromeSprite by
cropping the image to fit the area to be drawn. This ensures that the
rounding happens correctly.

## Testing
Testing was done as per the issue and results where verified visually.

## Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

## Showcase

<img width="1409" height="1030" alt="image"
src="https://github.com/user-attachments/assets/3645b36d-f182-4853-bdfe-d66a4132d273"
/>


## Release Notes:

Fixed rounded corners not rendering on images when using
ObjectFit::Cover

---------

Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
```

## Parents

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

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