On 14/7/09 10:07 AM, Ryo Kawaguchi wrote:
Regarding the -moz-image-rect() function, I am wondering where is the best 
place to extract a sub image from an original image.

The existing CSS properties such as border-image extract sub images at the last 
moment right before calling nsLayoutUtils::DrawImage() and thus each time a 
frame is trigger to be painted, temporary surfaces are created and disposed to 
paint the sub image (bug 444658). This is also the approach I used for the 
work-in-progress patch that I attached to bug 113577.

An alternative is to extract a sub image as soon as the original image is 
loaded and store it somewhere (imgSubImageRequest?) as long as it is being 
referenced. This way, extraction is performed only once for a single sub image, 
and also the extracted sub image can be cached by imgLoader. A drawback is that 
both the original image and the sub images coexist in the memory for a while.

Thank you very much for any feedback.

Just extract the subimage at the last moment, as you are currently doing.

We shouldn't really have to extract an image at all. We only do it to get the right repeat/pad behaviour. At some point that will be fixed in the graphics layer; we'll still extract an image, but it will be a "virtual" image and in some/most cases we won't need to actually copy the data.

Rob
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to