Bug 113657
Summary: | SVGImage::nativeImageForCurrentFrame() does not work if using DontCopyBackingStore | ||
---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> |
Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED CONFIGURATION CHANGED | ||
Severity: | Normal | CC: | ahmad.saleem792, kkinnunen, pdr, sabouhallawa, schenney, senorblanco, simon.fraser, zimmermann |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Bug Depends on: | 113420 | ||
Bug Blocks: |
Chris Dumez
The current implementation of SVGImage::nativeImageForCurrentFrame() creates a temporary ImageBuffer, draw the SVG to it and then returns a pointer to the native image using:
ImageBuffer::copyImage(CopyBackingStore)->nativeImageForCurrentFrame();
Using CopyBackingStore here is suboptimal. However, DontCopyBackingStore does not work in this case, at least with Skia implementation. The reason for this is that the underlying SkBitmap pixels do not get copied when creating the new Image but the pixels get freed when the temporary ImageBuffer gets destroyed. Therefore, the returned native image has no valid pixel data.
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Stephen Chenney
The Skia limitation is obviously not relevant any more, so maybe this can be fixed for other ports.
Even in Chromium, the Skia limitation is no longer a problem.
Ahmad Saleem
https://searchfox.org/wubkat/source/Source/WebCore/svg/graphics/SVGImageForContainer.cpp#57
RefPtr<NativeImage> SVGImageForContainer::nativeImageForCurrentFrame()
{
return m_image->nativeImageForCurrentFrame();
}
Do we need to keep this open?
Kimmo Kinnunen
No, this is already fixed by "sinking" the imagebuffer into the native image, which does not incur a copy.