Jonah Williams 6467d5c3c5
[Impeller] optimize drawImageRect with blend and matrix color filter. (#165998)
Fixes https://github.com/flutter/flutter/issues/165959

Flame uses a lot of individual calls to drawImageRect w/ blend color
filters to color the sprites. This is much slower with Impeller today,
because we convert this into:

```
saveLayer(color filter)
drawImageRect
restore
```

Instead, we can detect this case and convert to a call to drawAtlas.
drawAtlas will use the porter-duff shader which removes the saveLayer
entirely. We could do this optimization while recording, but for now its
fine to do in dispatch.

We do have a snapshot optimization that catches "normal" image usage,
but it doesn't apply in the flame case as the source rects are sampling
from a larger texture and we don't have a way to pass those through the
snapshot system.

## Before

<img
src="https://github.com/user-attachments/assets/faada042-843f-4f15-af20-9baf862f66fd"
width="200"/>


## After

<img
src="https://github.com/user-attachments/assets/c83e061c-190f-4613-a725-88e16b776c04"
width="200"/>

---------

Co-authored-by: gaaclarke <30870216+gaaclarke@users.noreply.github.com>
2025-03-29 01:33:08 +00:00
..

Flutter Engine

Setting up the Engine development environment

See here

gclient bootstrap

Flutter engine uses gclient to manage dependencies.

If you've already cloned the flutter repository:

  1. Copy one of the engine/scripts/*.gclient to the root folder as .gclient:
    1. Googlers: copy rbe.gclient to enable faster builds with RBE
    2. Everyone else: copy standard.gclient
  2. run gclient sync from the root folder