-
Notifications
You must be signed in to change notification settings - Fork 6k
[impeller] Convert drawImageNine into drawImageRect #35173
[impeller] Convert drawImageNine into drawImageRect #35173
Conversation
| return desc; | ||
| } | ||
|
|
||
| static impeller::SamplerDescriptor ToSamplerDescriptor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBD: What is the difference between the flutter::DlFilterMode and flutter::DlImageSampling ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Here I just convert the DlFilterMode into an impeller::SamplerDescriptor like we would for flutter::DlImageSampling
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More importantly, the DLCanvasRecorder converts the calls back to drawImageNine after Skia converted them to a lattice...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added that detail too...
flar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is even more confusing because the middle slice is split between the first and second rows...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.