[impeller] Convert drawImageNine into drawImageRect#35173
[impeller] Convert drawImageNine into drawImageRect#35173auto-submit[bot] merged 8 commits intoflutter:mainfrom
Conversation
| return desc; | ||
| } | ||
|
|
||
| static impeller::SamplerDescriptor ToSamplerDescriptor( |
There was a problem hiding this comment.
TBD: What is the difference between the flutter::DlFilterMode and flutter::DlImageSampling ?
There was a problem hiding this comment.
(Here I just convert the DlFilterMode into an impeller::SamplerDescriptor like we would for flutter::DlImageSampling
There was a problem hiding this comment.
ImageSampling represents more options than FilterMode. I haven't investigated why, but Skia only allows this subset for drawImageNine so we parallel what they allow in our DL API.
| flutter::DlFilterMode filter, | ||
| bool render_with_attributes) { | ||
| // Needs https://github.com/flutter/flutter/issues/95434 | ||
| // Don't implement this one since it is not exposed by flutter, |
There was a problem hiding this comment.
A note for myself since I actually spent some time searching for usages of this in the engine.
There was a problem hiding this comment.
More importantly, the DLCanvasRecorder converts the calls back to drawImageNine after Skia converted them to a lattice...
There was a problem hiding this comment.
Added that detail too...
flar
left a comment
There was a problem hiding this comment.
LGTM, just formatting nits...
| // which is 8 values | ||
| auto dstC = dst0 + destDim * edge0Dim / edgesDim; | ||
| return { | ||
| img0, dst0, imgC0, dstC, imgC1, dstC, img1, dst1, |
There was a problem hiding this comment.
If these return vectors could be initialized 4 values at a time it is easier to read the slices out and see how they relate.
| auto dstC0 = dst0 + edge0Dim; | ||
| auto dstC1 = dst1 - edge1Dim; | ||
| return {img0, dst0, imgC0, dstC0, imgC0, dstC0, | ||
| imgC1, dstC1, imgC1, dstC1, img1, dst1}; |
There was a problem hiding this comment.
This one is even more confusing because the middle slice is split between the first and second rows...
| flutter::DlFilterMode filter, | ||
| bool render_with_attributes) { | ||
| // Needs https://github.com/flutter/flutter/issues/95434 | ||
| // Don't implement this one since it is not exposed by flutter, |
There was a problem hiding this comment.
More importantly, the DLCanvasRecorder converts the calls back to drawImageNine after Skia converted them to a lattice...
| return desc; | ||
| } | ||
|
|
||
| static impeller::SamplerDescriptor ToSamplerDescriptor( |
There was a problem hiding this comment.
ImageSampling represents more options than FilterMode. I haven't investigated why, but Skia only allows this subset for drawImageNine so we parallel what they allow in our DL API.
|
FWIW, I wrote this interactive test app when I was working on the version of this code in the web source base... Nine-slice interactive scaler |
|
👍 |
I adopted the code added in flutter/flutter#78068 to the html render via @flar to convert drawImageNine calls into drawImageRect calls.