[Webkit-unassigned] [Bug 217377] New: Implement ANGLE version of WebGL layer snapshot copyImageSnapshotWithColorSpace
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 6 04:47:43 PDT 2020
https://bugs.webkit.org/show_bug.cgi?id=217377
Bug ID: 217377
Summary: Implement ANGLE version of WebGL layer snapshot
copyImageSnapshotWithColorSpace
Product: WebKit
Version: WebKit Local Build
Hardware: Macintosh
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: WebGL
Assignee: webkit-unassigned at lists.webkit.org
Reporter: kkinnunen at apple.com
CC: dino at apple.com
Blocks: 217213
To understand: Should the function snapshot the back buffer or the front buffer?
Old CGL implementation (not sure if this is correct implementation)
#if USE(OPENGL)
CGLContextObj cglContext = static_cast<CGLContextObj>(_context->platformGraphicsContextGL());
CGLSetCurrentContext(cglContext);
RetainPtr<CGColorSpaceRef> imageColorSpace = colorSpace;
if (!imageColorSpace)
imageColorSpace = WebCore::sRGBColorSpaceRef();
CGRect layerBounds = CGRectIntegral([self bounds]);
size_t width = layerBounds.size.width * _devicePixelRatio;
size_t height = layerBounds.size.height * _devicePixelRatio;
size_t rowBytes = (width * 4 + 15) & ~15;
size_t dataSize = rowBytes * height;
void* data = fastMalloc(dataSize);
if (!data)
return nullptr;
glPixelStorei(GL_PACK_ROW_LENGTH, rowBytes / 4);
glReadPixels(0, 0, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
WebCore::verifyImageBufferIsBigEnough((uint8_t*)data, dataSize);
CGDataProviderRef provider = CGDataProviderCreateWithData(0, data, dataSize, freeData);
CGImageRef image = CGImageCreate(width, height, 8, 32, rowBytes, imageColorSpace.get(),
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, provider, 0, true, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);
return image;
#else
Referenced Bugs:
https://bugs.webkit.org/show_bug.cgi?id=217213
[Bug 217213] Refactor WebGL implementation to use only GraphicsContextGL
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20201006/6d2323fe/attachment.htm>
More information about the webkit-unassigned
mailing list