Changeset 279424 in webkit
- Timestamp:
- Jun 30, 2021 11:29:02 AM (13 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/TestExpectations
r279414 r279424 3503 3503 webgl/1.0.x [ Skip ] 3504 3504 3505 # Explicitly enable tests which we have fixed and do not have corresponding 1.0.3 test functionality. 3506 webgl/1.0.x/conformance/canvas/to-data-url-test.html [ Pass ] 3507 3505 3508 # WebGL conformance test suite 2.0.1 is skipped until 2.0.0 is retired. 3506 3509 webgl/2.0.y [ Skip ] 3510 3511 # Explicitly enable tests which we have fixed and do not have corresponding 2.0.y test functionality. 3512 webgl/2.0.y/conformance/canvas/to-data-url-test.html [ Pass ] 3507 3513 3508 3514 # pre-wrap progression. Other rendering engines agree with the result. -
trunk/Source/WebCore/ChangeLog
r279420 r279424 1 2021-06-30 Kimmo Kinnunen <kkinnunen@apple.com> 2 3 toDataURL image upside down if premultipliedAlpha=false 4 https://bugs.webkit.org/show_bug.cgi?id=156129 5 <rdar://problem/53942867> 6 7 Reviewed by Kenneth Russell. 8 9 Flip the result `PixelBuffer` of `GraphicsContextGL::paintRenderingResultsToPixelBuffer()` 10 along the y-axis manually with memcpy. 11 ReadPixels returns the pixels upside down. 12 The `PixelBuffer` code-path is only used for reading unpremultiplied 13 image contents so that `toDataURL()` can encode the premultipliedAlpha=false 14 WebGL content as was rendered. 15 16 Other code-paths, such as Context2D.drawImage and drawing to the document, 17 use `GraphicsContextGL::paintRenderingResultsToCanvas()`. 18 In those cases y-flip is done by constructing a `ImageBuffer` for the PixelBuffer 19 and then using y-flip transform to draw the `ImageBuffer` to the target `ImageBuffer` 20 using `GraphicsContext`. 21 22 Fixes webgl/1.0.x/conformance/canvas/to-data-url-test.html 23 24 * platform/graphics/opengl/GraphicsContextGLOpenGL.cpp: 25 (WebCore::GraphicsContextGLOpenGL::paintRenderingResultsToPixelBuffer): 26 1 27 2021-06-30 Antoine Quint <graouts@webkit.org> 2 28 -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContextGLOpenGL.cpp
r278253 r279424 40 40 #include "GraphicsContextGLCV.h" 41 41 #endif 42 43 #include <memory> 42 44 43 45 namespace WebCore { … … 233 235 if (contextAttributes().premultipliedAlpha) 234 236 return std::nullopt; 235 return readRenderingResultsForPainting(); 237 auto results = readRenderingResultsForPainting(); 238 if (results && !results->size().isEmpty()) { 239 ASSERT(results->format().pixelFormat == PixelFormat::RGBA8 || results->format().pixelFormat == PixelFormat::BGRA8); 240 // FIXME: Make PixelBufferConversions support negative rowBytes and in-place conversions. 241 const auto size = results->size(); 242 const size_t rowStride = size.width() * 4; 243 uint8_t* top = results->data().data(); 244 uint8_t* bottom = top + (size.height() - 1) * rowStride; 245 std::unique_ptr<uint8_t[]> temp(new uint8_t[rowStride]); 246 for (; top < bottom; top += rowStride, bottom -= rowStride) { 247 memcpy(temp.get(), bottom, rowStride); 248 memcpy(bottom, top, rowStride); 249 memcpy(top, temp.get(), rowStride); 250 } 251 } 252 return results; 236 253 } 237 254
Note: See TracChangeset
for help on using the changeset viewer.