Created attachment 402317 [details] test case Open the attached test case. Result: A 200x200 green rectangle Expected: A 200x200 green rectangle with a 100x100 white hole in the middle.
This is a regression of r256892. Before this change void ImageBuffer::genericConvertToLuminanceMask() { auto srcPixelArray = getUnmultipliedImageData(luminanceRect); ... } RefPtr<Uint8ClampedArray> ImageBuffer::getUnmultipliedImageData(const IntRect& rect, IntSize* pixelArrayDimensions, CoordinateSystem coordinateSystem) const { if (context().isAcceleratedContext()) flushContext(); } After this change: void ConcreteImageBuffer::convertToLuminanceMask() override { if (auto* backend = ensureBackendCreated()) { flushDrawingContext(); backend->convertToLuminanceMask(); } } And ImageBufferBackend::convertToLuminanceMask() does not do any flushing. Notice flushDrawingContext() flushes only the drawing items in the display list if they exist. If the ImageBuffer is backed by an IOSurface, convertToLuminanceMask() will act on non up-to-date backend. So we need to call ConcreteImageBuffer::flushContext() instead.
<rdar://problem/64489419>
Created attachment 402318 [details] Patch
Comment on attachment 402318 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402318&action=review > Source/WebCore/platform/graphics/ConcreteImageBuffer.h:183 > + const_cast<ConcreteImageBuffer&>(*this).flushContext(); This is not a const member function — why is the const_cast needed?
Comment on attachment 402318 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402318&action=review > Source/WebCore/platform/graphics/ConcreteImageBuffer.h:184 > backend->convertToLuminanceMask(); Why doesn't the backend flush inside convertToLuminanceMask()?
Created attachment 402324 [details] Patch
Comment on attachment 402318 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=402318&action=review >> Source/WebCore/platform/graphics/ConcreteImageBuffer.h:183 >> + const_cast<ConcreteImageBuffer&>(*this).flushContext(); > > This is not a const member function — why is the const_cast needed? Copy/paste mistake. Fixed. >> Source/WebCore/platform/graphics/ConcreteImageBuffer.h:184 >> backend->convertToLuminanceMask(); > > Why doesn't the backend flush inside convertToLuminanceMask()? ConcreteImageBuffer::flushContext() may call DisplayList::ImageBuffer::flushDrawingContext() which replays back the display items before calling ImageBufferBackend::flushContext(). If I move the call to flushContext() to ImageBufferBackend::convertToLuminanceMask(), replaying the display items back will not be possible.
Committed r263297: <https://trac.webkit.org/changeset/263297> All reviewed patches have been landed. Closing bug and clearing flags on attachment 402324 [details].