Skip to content

Commit

Permalink
[Skia] Animation on images motion mark test doesn't work on the CPU
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271319

Reviewed by Nikolas Zimmermann.

Use SkSurface::peekPixels() instead of SkSurface::makeImageSnapshot()
when creating a NativeImage reference.

* Source/WebCore/platform/graphics/skia/ImageBufferSkiaUnacceleratedBackend.cpp:
(WebCore::ImageBufferSkiaUnacceleratedBackend::createNativeImageReference):

Canonical link: https://commits.webkit.org/276448@main
  • Loading branch information
carlosgcampos committed Mar 21, 2024
1 parent 82fe811 commit f349ceb
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ RefPtr<NativeImage> ImageBufferSkiaUnacceleratedBackend::copyNativeImage()

RefPtr<NativeImage> ImageBufferSkiaUnacceleratedBackend::createNativeImageReference()
{
return NativeImage::create(m_surface->makeImageSnapshot());
SkPixmap pixmap;
if (m_surface->peekPixels(&pixmap)) {
return NativeImage::create(SkImages::RasterFromPixmap(pixmap, [](const void*, void* context) {
static_cast<SkSurface*>(context)->unref();
}, SkSafeRef(m_surface.get())));
}
return nullptr;
}

void ImageBufferSkiaUnacceleratedBackend::getPixelBuffer(const IntRect& srcRect, PixelBuffer& destination)
Expand Down

0 comments on commit f349ceb

Please sign in to comment.