Changeset 284439 in webkit
- Timestamp:
- Oct 19, 2021 1:35:40 AM (9 months ago)
- Location:
- trunk
- Files:
-
- 22 added
- 2 deleted
- 66 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (4 diffs)
-
LayoutTests/fast/canvas/canvas-createPattern-video-loading-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-createPattern-video-loading.html (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-createPattern-video-modify-expected.txt (modified) (1 diff)
-
LayoutTests/fast/canvas/canvas-createPattern-video-modify.html (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video-expected.txt (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.mp4 (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.webm (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.mp4 (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.webm (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.mp4 (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.webm (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.mp4 (added)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.webm (added)
-
LayoutTests/media/video-canvas-createPattern-expected.txt (modified) (1 diff)
-
LayoutTests/media/video-canvas-createPattern.html (modified) (1 diff)
-
LayoutTests/media/video-canvas-drawing-output-expected.txt (modified) (1 diff)
-
LayoutTests/media/video-canvas-drawing-output.html (modified) (1 diff)
-
LayoutTests/media/video-orientation-canvas-expected.txt (modified) (1 diff)
-
LayoutTests/media/video-orientation-canvas.html (modified) (1 diff)
-
LayoutTests/platform/glib/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/ios-14/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/ios-device/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/ios/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/ios/webgl/1.0.x (added)
-
LayoutTests/platform/ios/webgl/1.0.x/conformance (added)
-
LayoutTests/platform/ios/webgl/1.0.x/conformance/textures (added)
-
LayoutTests/platform/ios/webgl/1.0.x/conformance/textures/misc (added)
-
LayoutTests/platform/ios/webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos-expected.txt (added)
-
LayoutTests/platform/ios/webgl/2.0.y (added)
-
LayoutTests/platform/ios/webgl/2.0.y/conformance (added)
-
LayoutTests/platform/ios/webgl/2.0.y/conformance/textures (added)
-
LayoutTests/platform/ios/webgl/2.0.y/conformance/textures/misc (added)
-
LayoutTests/platform/ios/webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos-expected.txt (added)
-
LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-wk2/TestExpectations (modified) (1 diff)
-
LayoutTests/platform/mac/TestExpectations (modified) (2 diffs)
-
LayoutTests/platform/mac/media/video-canvas-createPattern-expected.png (deleted)
-
LayoutTests/platform/wpe/media/video-canvas-createPattern-expected.png (deleted)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/PlatformHave.h (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLVideoElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLVideoElement.h (modified) (1 diff)
-
Source/WebCore/html/ImageBitmap.cpp (modified) (1 diff)
-
Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (modified) (5 diffs)
-
Source/WebCore/html/canvas/WebGLRenderingContextBase.h (modified) (1 diff)
-
Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp (modified) (3 diffs)
-
Source/WebCore/platform/cocoa/CoreVideoSoftLink.h (modified) (3 diffs)
-
Source/WebCore/platform/graphics/MediaPlayer.cpp (modified) (2 diffs)
-
Source/WebCore/platform/graphics/MediaPlayer.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/MediaPlayerPrivate.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (modified) (2 diffs)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (modified) (1 diff)
-
Source/WebCore/platform/graphics/cg/ColorSpaceCG.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/cv/CVUtilities.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/cv/CVUtilities.mm (modified) (1 diff)
-
Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp (modified) (3 diffs)
-
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h (modified) (1 diff)
-
Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp (modified) (1 diff)
-
Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h (modified) (1 diff)
-
Source/WebCore/svg/graphics/SVGImage.cpp (modified) (1 diff)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp (modified) (2 diffs)
-
Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h (modified) (1 diff)
-
Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h (modified) (1 diff)
-
Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in (modified) (1 diff)
-
Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm (modified) (4 diffs)
-
Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h (modified) (1 diff)
-
Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284434 r284439 1 2021-10-19 Cameron McCormack <heycam@apple.com> 2 3 Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space 4 https://bugs.webkit.org/show_bug.cgi?id=229025 5 <rdar://problem/81828490> 6 7 Reviewed by Sam Weinig. 8 9 * TestExpectations: 10 texture-corner-case-videos.html relies on incorrect color space handling 11 with drawImage() on a 2D canvas and so now fails. 12 13 * platform/glib/TestExpectations: 14 * platform/ios-14/TestExpectations: 15 * platform/ios-device/TestExpectations: 16 * platform/ios/TestExpectations: 17 * platform/mac-wk2/TestExpectations: 18 * platform/mac/TestExpectations: 19 New tests pass only on macOS Monterey+ and iOS 15+. 20 21 * fast/canvas/canvas-createPattern-video-loading-expected.txt: 22 * fast/canvas/canvas-createPattern-video-loading.html: 23 * fast/canvas/canvas-createPattern-video-modify-expected.txt: 24 * fast/canvas/canvas-createPattern-video-modify.html: 25 * media/video-canvas-createPattern-expected.txt: 26 * media/video-canvas-createPattern.html: 27 * media/video-canvas-drawing-output-expected.txt: 28 * media/video-canvas-drawing-output.html: 29 * media/video-orientation-canvas-expected.txt: 30 * media/video-orientation-canvas.html: 31 Update some tests to check for correctly converted color values. 32 33 * platform/mac/media/video-canvas-createPattern-expected.png: Removed. 34 * platform/wpe/media/video-canvas-createPattern-expected.png: Removed. 35 36 * platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt: 37 An existing failure that changed a bit. This is 38 https://bugs.webkit.org/show_bug.cgi?id=231001. 39 1 40 2021-10-18 Jean-Yves Avenard <jya@apple.com> 2 41 -
trunk/LayoutTests/TestExpectations
r284397 r284439 3526 3526 webgl/1.0.x/conformance/misc/invalid-passed-params.html [ Pass ] 3527 3527 webgl/1.0.x/conformance/glsl/bugs/character-set.html [ Pass ] 3528 webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]3529 3528 webgl/1.0.x/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ] 3530 3529 webgl/1.0.x/conformance/context/constants-and-properties.html [ Pass ] … … 3538 3537 webgl/2.0.y/conformance/misc/invalid-passed-params.html [ Pass ] 3539 3538 webgl/2.0.y/conformance/glsl/bugs/character-set.html [ Pass ] 3540 webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html [ Pass ]3541 3539 webgl/2.0.y/conformance/glsl/misc/fragcolor-fragdata-invariant.html [ Pass ] 3542 3540 webgl/2.0.y/conformance2/context/constants-and-properties-2.html [ Pass ] … … 3556 3554 webgl/2.0.0/conformance/glsl/misc/shader-with-define-line-continuation.frag.html [ Skip ] 3557 3555 webgl/2.0.0/conformance/misc/invalid-passed-params.html [ Skip ] 3556 3557 # https://github.com/KhronosGroup/WebGL/issues/3341 3558 webgl/1.0.x/conformance/textures/misc/texture-corner-case-videos.html [ Failure ] 3559 webgl/2.0.y/conformance/textures/misc/texture-corner-case-videos.html [ Failure ] 3558 3560 3559 3561 # pre-wrap progression. Other rendering engines agree with the result. … … 5055 5057 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ] 5056 5058 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ] 5059 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Failure ] 5060 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Failure ] 5057 5061 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ] 5058 5062 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ] -
trunk/LayoutTests/fast/canvas/canvas-createPattern-video-loading-expected.txt
r201724 r284439 5 5 6 6 PASS document.createElement('canvas').getContext('2d').createPattern(video, 'repeat') is null 7 PASS buffer[0] is within 2 of 194 8 PASS buffer[1] is within 2 of 193 9 PASS buffer[2] is within 2 of 14 10 PASS buffer[0] is within 2 of 194 11 PASS buffer[1] is within 2 of 193 12 PASS buffer[2] is within 2 of 14 13 PASS buffer[0] is within 2 of 194 14 PASS buffer[1] is within 2 of 193 15 PASS buffer[2] is within 2 of 14 16 PASS buffer[0] is within 2 of 194 17 PASS buffer[1] is within 2 of 193 18 PASS buffer[2] is within 2 of 14 19 PASS buffer[0] is within 2 of 17 20 PASS buffer[1] is within 2 of 197 21 PASS buffer[2] is within 2 of 195 22 PASS buffer[0] is within 2 of 17 23 PASS buffer[1] is within 2 of 197 24 PASS buffer[2] is within 2 of 195 25 PASS buffer[0] is within 2 of 17 26 PASS buffer[1] is within 2 of 197 27 PASS buffer[2] is within 2 of 195 28 PASS buffer[0] is within 2 of 17 29 PASS buffer[1] is within 2 of 197 30 PASS buffer[2] is within 2 of 195 31 PASS buffer[0] is within 2 of 20 7 PASS buffer[0] is within 2 of 200 32 8 PASS buffer[1] is within 2 of 200 33 PASS buffer[2] is within 2 of 1834 PASS buffer[0] is within 2 of 20 9 PASS buffer[2] is within 2 of 0 10 PASS buffer[0] is within 2 of 200 35 11 PASS buffer[1] is within 2 of 200 36 PASS buffer[2] is within 2 of 1837 PASS buffer[0] is within 2 of 20 12 PASS buffer[2] is within 2 of 0 13 PASS buffer[0] is within 2 of 200 38 14 PASS buffer[1] is within 2 of 200 39 PASS buffer[2] is within 2 of 1840 PASS buffer[0] is within 2 of 20 15 PASS buffer[2] is within 2 of 0 16 PASS buffer[0] is within 2 of 200 41 17 PASS buffer[1] is within 2 of 200 42 PASS buffer[2] is within 2 of 1843 PASS buffer[0] is within 2 of 19444 PASS buffer[1] is within 2 of 19345 PASS buffer[2] is within 2 of 1446 PASS buffer[0] is within 2 of 19447 PASS buffer[1] is within 2 of 19348 PASS buffer[2] is within 2 of 1449 PASS buffer[0] is within 2 of 19450 PASS buffer[1] is within 2 of 19351 PASS buffer[2] is within 2 of 1452 PASS buffer[0] is within 2 of 19453 PASS buffer[1] is within 2 of 19354 PASS buffer[2] is within 2 of 1455 PASS buffer[0] is within 2 of 1756 PASS buffer[1] is within 2 of 19757 PASS buffer[2] is within 2 of 19558 PASS buffer[0] is within 2 of 1759 PASS buffer[1] is within 2 of 19760 PASS buffer[2] is within 2 of 19561 PASS buffer[0] is within 2 of 1762 PASS buffer[1] is within 2 of 19763 PASS buffer[2] is within 2 of 19564 PASS buffer[0] is within 2 of 1765 PASS buffer[1] is within 2 of 19766 PASS buffer[2] is within 2 of 19567 PASS buffer[0] is within 2 of 20 18 PASS buffer[2] is within 2 of 0 19 PASS buffer[0] is within 2 of 57 20 PASS buffer[1] is within 2 of 202 21 PASS buffer[2] is within 2 of 203 22 PASS buffer[0] is within 2 of 57 23 PASS buffer[1] is within 2 of 202 24 PASS buffer[2] is within 2 of 203 25 PASS buffer[0] is within 2 of 57 26 PASS buffer[1] is within 2 of 202 27 PASS buffer[2] is within 2 of 203 28 PASS buffer[0] is within 2 of 57 29 PASS buffer[1] is within 2 of 202 30 PASS buffer[2] is within 2 of 203 31 PASS buffer[0] is within 2 of 53 32 PASS buffer[1] is within 2 of 203 33 PASS buffer[2] is within 2 of 9 34 PASS buffer[0] is within 2 of 53 35 PASS buffer[1] is within 2 of 203 36 PASS buffer[2] is within 2 of 9 37 PASS buffer[0] is within 2 of 53 38 PASS buffer[1] is within 2 of 203 39 PASS buffer[2] is within 2 of 9 40 PASS buffer[0] is within 2 of 53 41 PASS buffer[1] is within 2 of 203 42 PASS buffer[2] is within 2 of 9 43 PASS buffer[0] is within 2 of 200 68 44 PASS buffer[1] is within 2 of 200 69 PASS buffer[2] is within 2 of 1870 PASS buffer[0] is within 2 of 20 45 PASS buffer[2] is within 2 of 0 46 PASS buffer[0] is within 2 of 200 71 47 PASS buffer[1] is within 2 of 200 72 PASS buffer[2] is within 2 of 1873 PASS buffer[0] is within 2 of 20 48 PASS buffer[2] is within 2 of 0 49 PASS buffer[0] is within 2 of 200 74 50 PASS buffer[1] is within 2 of 200 75 PASS buffer[2] is within 2 of 1876 PASS buffer[0] is within 2 of 20 51 PASS buffer[2] is within 2 of 0 52 PASS buffer[0] is within 2 of 200 77 53 PASS buffer[1] is within 2 of 200 78 PASS buffer[2] is within 2 of 18 54 PASS buffer[2] is within 2 of 0 55 PASS buffer[0] is within 2 of 57 56 PASS buffer[1] is within 2 of 202 57 PASS buffer[2] is within 2 of 203 58 PASS buffer[0] is within 2 of 57 59 PASS buffer[1] is within 2 of 202 60 PASS buffer[2] is within 2 of 203 61 PASS buffer[0] is within 2 of 57 62 PASS buffer[1] is within 2 of 202 63 PASS buffer[2] is within 2 of 203 64 PASS buffer[0] is within 2 of 57 65 PASS buffer[1] is within 2 of 202 66 PASS buffer[2] is within 2 of 203 67 PASS buffer[0] is within 2 of 53 68 PASS buffer[1] is within 2 of 203 69 PASS buffer[2] is within 2 of 9 70 PASS buffer[0] is within 2 of 53 71 PASS buffer[1] is within 2 of 203 72 PASS buffer[2] is within 2 of 9 73 PASS buffer[0] is within 2 of 53 74 PASS buffer[1] is within 2 of 203 75 PASS buffer[2] is within 2 of 9 76 PASS buffer[0] is within 2 of 53 77 PASS buffer[1] is within 2 of 203 78 PASS buffer[2] is within 2 of 9 79 79 PASS successfullyParsed is true 80 80 -
trunk/LayoutTests/fast/canvas/canvas-createPattern-video-loading.html
r203777 r284439 13 13 var expectedResults = [ 14 14 // Each entry is formatted as [x, y, r, g, b]. 15 [40, 165, 194, 193, 14], // Represents yellow north west tile.16 [355, 165, 194, 193, 14], // Represents yellow north east tile.17 [40, 403, 194, 193, 14], // Represents yellow south west tile.18 [355, 403, 194, 193, 14], // Represents yellow south east tile.15 [40, 165, 200, 200, 0], // Represents yellow north west tile. 16 [355, 165, 200, 200, 0], // Represents yellow north east tile. 17 [40, 403, 200, 200, 0], // Represents yellow south west tile. 18 [355, 403, 200, 200, 0], // Represents yellow south east tile. 19 19 20 [56, 165, 17, 197, 195], // Represents blue/cyan north west tile.21 [371, 165, 17, 197, 195], // Represents blue/cyan north east tile.22 [56, 403, 17, 197, 195], // Represents blue/cyan south west tile.23 [371, 403, 17, 197, 195], // Represents blue/cyan south east tile.20 [56, 165, 57, 202, 203], // Represents blue/cyan north west tile. 21 [371, 165, 57, 202, 203], // Represents blue/cyan north east tile. 22 [56, 403, 57, 202, 203], // Represents blue/cyan south west tile. 23 [371, 403, 57, 202, 203], // Represents blue/cyan south east tile. 24 24 25 [73, 165, 20, 200, 18], // Represents green north west tile.26 [388, 165, 20, 200, 18], // Represents green north east tile.27 [73, 403, 20, 200, 18], // Represents green south west tile.28 [388, 403, 20, 200, 18], // Represents green south east tile.25 [73, 165, 53, 203, 9], // Represents green north west tile. 26 [388, 165, 53, 203, 9], // Represents green north east tile. 27 [73, 403, 53, 203, 9], // Represents green south west tile. 28 [388, 403, 53, 203, 9], // Represents green south east tile. 29 29 ]; 30 30 -
trunk/LayoutTests/fast/canvas/canvas-createPattern-video-modify-expected.txt
r201724 r284439 4 4 5 5 6 PASS buffer[0] is within 2 of 1947 PASS buffer[1] is within 2 of 1938 PASS buffer[2] is within 2 of 149 PASS buffer[0] is within 2 of 19410 PASS buffer[1] is within 2 of 19311 PASS buffer[2] is within 2 of 1412 PASS buffer[0] is within 2 of 19413 PASS buffer[1] is within 2 of 19314 PASS buffer[2] is within 2 of 1415 PASS buffer[0] is within 2 of 19416 PASS buffer[1] is within 2 of 19317 PASS buffer[2] is within 2 of 146 PASS buffer[0] is within 2 of 200 7 PASS buffer[1] is within 2 of 200 8 PASS buffer[2] is within 2 of 0 9 PASS buffer[0] is within 2 of 200 10 PASS buffer[1] is within 2 of 200 11 PASS buffer[2] is within 2 of 0 12 PASS buffer[0] is within 2 of 200 13 PASS buffer[1] is within 2 of 200 14 PASS buffer[2] is within 2 of 0 15 PASS buffer[0] is within 2 of 200 16 PASS buffer[1] is within 2 of 200 17 PASS buffer[2] is within 2 of 0 18 18 PASS successfullyParsed is true 19 19 -
trunk/LayoutTests/fast/canvas/canvas-createPattern-video-modify.html
r203777 r284439 15 15 var expectedResults = [ 16 16 // Each entry is formatted as [x, y, r, g, b]. 17 [40, 165, 194, 193, 14], // Represents yellow north west tile.18 [355, 165, 194, 193, 14], // Represents yellow north east tile.19 [40, 403, 194, 193, 14], // Represents yellow south west tile.20 [355, 403, 194, 193, 14], // Represents yellow south east tile.17 [40, 165, 200, 200, 0], // Represents yellow north west tile. 18 [355, 165, 200, 200, 0], // Represents yellow north east tile. 19 [40, 403, 200, 200, 0], // Represents yellow south west tile. 20 [355, 403, 200, 200, 0], // Represents yellow south east tile. 21 21 ]; 22 22 -
trunk/LayoutTests/imported/w3c/ChangeLog
r284437 r284439 1 2021-10-19 Cameron McCormack <heycam@apple.com> 2 3 Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space 4 https://bugs.webkit.org/show_bug.cgi?id=229025 5 <rdar://problem/81828490> 6 7 Reviewed by Sam Weinig. 8 9 Add some new WPTs for drawImage(video). 10 11 * web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html: 12 * web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html: 13 Updated tests to check that video color space conversion is done 14 correctly. 15 16 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video-expected.txt: Added. 17 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html: Added. 18 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video-expected.txt: Added. 19 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html: Added. 20 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js: 21 (pixelsApproximatelyEqual): Tweaked threshold to pass video tests on iOS. 22 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.mp4: Added. 23 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-222000000.webm: Added. 24 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.mp4: Added. 25 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/Rec2020-3FF000000.webm: Added. 26 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.mp4: Added. 27 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-BB0000.webm: Added. 28 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.mp4: Added. 29 * web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/resources/sRGB-FF0100.webm: Added. 30 1 31 2021-10-18 Antoine Quint <graouts@webkit.org> 2 32 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html
r282203 r284439 10 10 <body> 11 11 <script> 12 function testCanvasDisplayingPattern(canvas, width, height )12 function testCanvasDisplayingPattern(canvas, width, height, sourceIsVideo) 13 13 { 14 var tolerance = 10; // for creating ImageBitmap from a video, the tolerance needs to be high 15 const check = (x, y, r, g, b, a) => 14 var tolerance = 1; 15 let topLeft = [255, 0, 0, 255]; 16 let topRight = [0, 255, 0, 255]; 17 let bottomLeft = [0, 0, 255, 255]; 18 let bottomRight = [0, 0, 0, 255]; 19 if (sourceIsVideo) { 20 // The source video uses colors in the Rec.601 color space whose 21 // values are close to full red, full green, full blue, and black, 22 // but when converted to sRGB, are somewhat different. 23 topLeft = [247, 37, 0, 255]; 24 topRight = [63, 251, 0, 255]; 25 bottomLeft = [28, 35, 255, 255]; 26 bottomRight = [5, 0, 2, 255]; 27 } 28 const check = (x, y, [r, g, b, a]) => 16 29 _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance); 17 check(1 * width / 4, 1 * height / 4, 255,0,0,255);18 check(3 * width / 4, 1 * height / 4, 0,255,0,255);19 check(1 * width / 4, 3 * height / 4, 0,0,255,255);20 check(3 * width / 4, 3 * height / 4, 0,0,0,255);30 check(1 * width / 4, 1 * height / 4, topLeft); 31 check(3 * width / 4, 1 * height / 4, topRight); 32 check(1 * width / 4, 3 * height / 4, bottomLeft); 33 check(3 * width / 4, 3 * height / 4, bottomRight); 21 34 } 22 35 23 36 function testDrawImageBitmap(source, args = [], { resizeWidth = 20, resizeHeight = 20 } = {}) 24 37 { 38 let sourceIsVideo = source instanceof HTMLVideoElement; 25 39 var canvas = document.createElement("canvas"); 26 40 canvas.width = resizeWidth; … … 31 45 assert_equals(imageBitmap.height, resizeHeight); 32 46 ctx.drawImage(imageBitmap, 0, 0); 33 testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight );47 testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, sourceIsVideo); 34 48 }); 35 49 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html
r282203 r284439 10 10 <body> 11 11 <script> 12 function testCanvasDisplayingPattern(canvas, width, height, flipped)12 function testCanvasDisplayingPattern(canvas, width, height, sourceIsVideo, flipped) 13 13 { 14 var tolerance = 10; // for creating ImageBitmap from a video, the tolerance needs to be high 15 const check = (x, y, r, g, b, a) => 14 var tolerance = 1; 15 let topLeft = [255, 0, 0, 255]; 16 let topRight = [0, 255, 0, 255]; 17 let bottomLeft = [0, 0, 255, 255]; 18 let bottomRight = [0, 0, 0, 255]; 19 if (sourceIsVideo) { 20 // The source video uses colors in the Rec.601 color space whose 21 // values are close to full red, full green, full blue, and black, 22 // but when converted to sRGB, are somewhat different. 23 topLeft = [247, 37, 0, 255]; 24 topRight = [63, 251, 0, 255]; 25 bottomLeft = [28, 35, 255, 255]; 26 bottomRight = [5, 0, 2, 255]; 27 } 28 if (flipped) { 29 [topLeft, bottomLeft] = [bottomLeft, topLeft]; 30 [topRight, bottomRight] = [bottomRight, topRight]; 31 } 32 const check = (x, y, [r, g, b, a]) => 16 33 _assertPixelApprox(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`, tolerance); 17 if (flipped) { 18 check(1 * width / 4, 3 * height / 4, 255,0,0,255); 19 check(3 * width / 4, 3 * height / 4, 0,255,0,255); 20 check(1 * width / 4, 1 * height / 4, 0,0,255,255); 21 check(3 * width / 4, 1 * height / 4, 0,0,0,255); 22 } else { 23 check(1 * width / 4, 1 * height / 4, 255,0,0,255); 24 check(3 * width / 4, 1 * height / 4, 0,255,0,255); 25 check(1 * width / 4, 3 * height / 4, 0,0,255,255); 26 check(3 * width / 4, 3 * height / 4, 0,0,0,255); 27 } 34 check(1 * width / 4, 1 * height / 4, topLeft); 35 check(3 * width / 4, 1 * height / 4, topRight); 36 check(1 * width / 4, 3 * height / 4, bottomLeft); 37 check(3 * width / 4, 3 * height / 4, bottomRight); 28 38 } 29 39 30 40 function testDrawImageBitmap(source, args = [], flipped, { resizeWidth = 20, resizeHeight = 20 } = {}) 31 41 { 42 let sourceIsVideo = source instanceof HTMLVideoElement; 32 43 var canvas = document.createElement("canvas"); 33 44 canvas.width = resizeWidth; … … 38 49 assert_equals(imageBitmap.height, resizeHeight); 39 50 ctx.drawImage(imageBitmap, 0, 0); 40 testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, flipped);51 testCanvasDisplayingPattern(canvas, resizeWidth, resizeHeight, sourceIsVideo, flipped); 41 52 }); 42 53 } -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3.js
r283531 r284439 208 208 }; 209 209 210 // Each video: 211 // * is 300x200 and has a single color 212 // * has a filename base that indicates its contents: 213 // 214 // <color-space>-<8-or-10-bit-color-value> 215 // 216 // * was generated using commands like: 217 // 218 // W=300 H=200 Y=3F Cb=66 Cr=F0 ; \ 219 // perl -e "print pack('c', 0x$Y) x ($W * $H), pack('c', 0x$Cb) x ($W * $H / 4), pack('c', 0x$Cr) x ($W * $H / 4)" | \ 220 // ffmpeg -f rawvideo -pix_fmt yuv420p -s:v ${W}x$H -r 25 -i - -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc iec61966_2_1 sRGB-FF0100.webm 221 // 222 // W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \ 223 // perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \ 224 // ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -c:v libx265 -vtag hvc1 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.mp4 225 // 226 // W=300 H=200 Y=0BB Cb=1BD Cr=2EF ; \ 227 // perl -e "print pack('s', 0x$Y) x ($W * $H), pack('s', 0x$Cb) x ($W * $H / 4), pack('s', 0x$Cr) x ($W * $H / 4)" | \ 228 // ffmpeg -f rawvideo -pix_fmt yuv420p10le -s:v ${W}x$H -r 25 -i - -vcodec libvpx-vp9 -profile:v 2 -pix_fmt yuv420p10le -colorspace bt2020nc -color_primaries bt2020 -color_trc bt2020-10 Rec2020-222000000.webm 229 // 230 // where the Y'CbCr values were computed using https://jdashg.github.io/misc/colors/from-coeffs.html. 231 const videoTests = { 232 // Rec.709 Y'CbCr (0x3F, 0x66, 0xF0) = sRGB (0xFF, 0x01, 0x00) 233 "sRGB-FF0100": { 234 "srgb srgb": [255, 1, 0, 255], 235 "srgb display-p3": [234, 51, 35, 255], 236 "display-p3 srgb": [255, 0, 0, 255], 237 "display-p3 display-p3": [234, 51, 35, 255], 238 }, 239 // Rec.709 Y'CbCr (0x32, 0x6D, 0xD2) = sRGB (0xBB, 0x00, 0x00) 240 "sRGB-BB0000": { 241 "srgb srgb": [187, 0, 0, 255], 242 "srgb display-p3": [171, 35, 23, 255], 243 "display-p3 srgb": [187, 1, 0, 255], 244 "display-p3 display-p3": [171, 35, 23, 255], 245 }, 246 247 // 10 bit Rec.2020 Y'CbCr (0x126, 0x183, 0x3C0) = Rec.2020 (0x3FF, 0x000, 0x000) 248 "Rec2020-3FF000000": { 249 "srgb srgb": [255, 0, 0, 255], 250 "srgb display-p3": [234, 51, 35, 255], 251 "display-p3 srgb": [255, 0, 0, 255], 252 "display-p3 display-p3": [255, 0, 9, 255], 253 }, 254 // 10 bit Rec.2020 Y'CbCr (0x0BB, 0x1BD, 0x2EF) = Rec.2020 (0x222, 0x000, 0x000) 255 "Rec2020-222000000": { 256 "srgb srgb": [186, 0, 0, 255], 257 "srgb display-p3": [170, 34, 23, 255], 258 "display-p3 srgb": [186, 0, 0, 255], 259 "display-p3 display-p3": [169, 0, 3, 255], 260 }, 261 }; 262 210 263 const fromSRGBToDisplayP3 = { 211 264 "255,0,0,255": [234, 51, 35, 255], … … 224 277 function pixelsApproximatelyEqual(p1, p2) { 225 278 for (let i = 0; i < 4; ++i) { 226 if (Math.abs(p1[i] - p2[i]) > 2)279 if (Math.abs(p1[i] - p2[i]) > 3) 227 280 return false; 228 281 } -
trunk/LayoutTests/media/video-canvas-createPattern-expected.txt
r201724 r284439 2 2 EVENT(canplaythrough) 3 3 EVENT(seeked) 4 Saw close enough to ( 194, 193, 14) at (40, 165) OK5 Saw close enough to ( 194, 193, 14) at (355, 165) OK6 Saw close enough to ( 194, 193, 14) at (40, 403) OK7 Saw close enough to ( 194, 193, 14) at (355, 403) OK8 Saw close enough to ( 17, 197, 195) at (56, 165) OK9 Saw close enough to ( 17, 197, 195) at (371, 165) OK10 Saw close enough to ( 17, 197, 195) at (56, 403) OK11 Saw close enough to ( 17, 197, 195) at (371, 403) OK12 Saw close enough to ( 20, 200, 18) at (73, 165) OK13 Saw close enough to ( 20, 200, 18) at (388, 165) OK14 Saw close enough to ( 20, 200, 18) at (73, 403) OK15 Saw close enough to ( 20, 200, 18) at (388, 403) OK4 Saw close enough to (200, 200, 0) at (40, 165) OK 5 Saw close enough to (200, 200, 0) at (355, 165) OK 6 Saw close enough to (200, 200, 0) at (40, 403) OK 7 Saw close enough to (200, 200, 0) at (355, 403) OK 8 Saw close enough to (57, 202, 203) at (56, 165) OK 9 Saw close enough to (57, 202, 203) at (371, 165) OK 10 Saw close enough to (57, 202, 203) at (56, 403) OK 11 Saw close enough to (57, 202, 203) at (371, 403) OK 12 Saw close enough to (53, 203, 9) at (73, 165) OK 13 Saw close enough to (53, 203, 9) at (388, 165) OK 14 Saw close enough to (53, 203, 9) at (73, 403) OK 15 Saw close enough to (53, 203, 9) at (388, 403) OK 16 16 EVENT(seeked) 17 Saw close enough to ( 194, 193, 14) at (40, 165) OK18 Saw close enough to ( 194, 193, 14) at (355, 165) OK19 Saw close enough to ( 194, 193, 14) at (40, 403) OK20 Saw close enough to ( 194, 193, 14) at (355, 403) OK21 Saw close enough to ( 17, 197, 195) at (56, 165) OK22 Saw close enough to ( 17, 197, 195) at (371, 165) OK23 Saw close enough to ( 17, 197, 195) at (56, 403) OK24 Saw close enough to ( 17, 197, 195) at (371, 403) OK25 Saw close enough to ( 20, 200, 18) at (73, 165) OK26 Saw close enough to ( 20, 200, 18) at (388, 165) OK27 Saw close enough to ( 20, 200, 18) at (73, 403) OK28 Saw close enough to ( 20, 200, 18) at (388, 403) OK17 Saw close enough to (200, 200, 0) at (40, 165) OK 18 Saw close enough to (200, 200, 0) at (355, 165) OK 19 Saw close enough to (200, 200, 0) at (40, 403) OK 20 Saw close enough to (200, 200, 0) at (355, 403) OK 21 Saw close enough to (57, 202, 203) at (56, 165) OK 22 Saw close enough to (57, 202, 203) at (371, 165) OK 23 Saw close enough to (57, 202, 203) at (56, 403) OK 24 Saw close enough to (57, 202, 203) at (371, 403) OK 25 Saw close enough to (53, 203, 9) at (73, 165) OK 26 Saw close enough to (53, 203, 9) at (388, 165) OK 27 Saw close enough to (53, 203, 9) at (73, 403) OK 28 Saw close enough to (53, 203, 9) at (388, 403) OK 29 29 EVENT(seeked) 30 Saw close enough to ( 194, 193, 14) at (40, 165) OK31 Saw close enough to ( 194, 193, 14) at (355, 165) OK32 Saw close enough to ( 194, 193, 14) at (40, 403) OK33 Saw close enough to ( 194, 193, 14) at (355, 403) OK34 Saw close enough to ( 17, 197, 195) at (56, 165) OK35 Saw close enough to ( 17, 197, 195) at (371, 165) OK36 Saw close enough to ( 17, 197, 195) at (56, 403) OK37 Saw close enough to ( 17, 197, 195) at (371, 403) OK38 Saw close enough to ( 20, 200, 18) at (73, 165) OK39 Saw close enough to ( 20, 200, 18) at (388, 165) OK40 Saw close enough to ( 20, 200, 18) at (73, 403) OK41 Saw close enough to ( 20, 200, 18) at (388, 403) OK30 Saw close enough to (200, 200, 0) at (40, 165) OK 31 Saw close enough to (200, 200, 0) at (355, 165) OK 32 Saw close enough to (200, 200, 0) at (40, 403) OK 33 Saw close enough to (200, 200, 0) at (355, 403) OK 34 Saw close enough to (57, 202, 203) at (56, 165) OK 35 Saw close enough to (57, 202, 203) at (371, 165) OK 36 Saw close enough to (57, 202, 203) at (56, 403) OK 37 Saw close enough to (57, 202, 203) at (371, 403) OK 38 Saw close enough to (53, 203, 9) at (73, 165) OK 39 Saw close enough to (53, 203, 9) at (388, 165) OK 40 Saw close enough to (53, 203, 9) at (73, 403) OK 41 Saw close enough to (53, 203, 9) at (388, 403) OK 42 42 EVENT(seeked) 43 Saw close enough to ( 194, 193, 14) at (40, 165) OK44 Saw close enough to ( 194, 193, 14) at (355, 165) OK45 Saw close enough to ( 194, 193, 14) at (40, 403) OK46 Saw close enough to ( 194, 193, 14) at (355, 403) OK47 Saw close enough to ( 17, 197, 195) at (56, 165) OK48 Saw close enough to ( 17, 197, 195) at (371, 165) OK49 Saw close enough to ( 17, 197, 195) at (56, 403) OK50 Saw close enough to ( 17, 197, 195) at (371, 403) OK51 Saw close enough to ( 20, 200, 18) at (73, 165) OK52 Saw close enough to ( 20, 200, 18) at (388, 165) OK53 Saw close enough to ( 20, 200, 18) at (73, 403) OK54 Saw close enough to ( 20, 200, 18) at (388, 403) OK43 Saw close enough to (200, 200, 0) at (40, 165) OK 44 Saw close enough to (200, 200, 0) at (355, 165) OK 45 Saw close enough to (200, 200, 0) at (40, 403) OK 46 Saw close enough to (200, 200, 0) at (355, 403) OK 47 Saw close enough to (57, 202, 203) at (56, 165) OK 48 Saw close enough to (57, 202, 203) at (371, 165) OK 49 Saw close enough to (57, 202, 203) at (56, 403) OK 50 Saw close enough to (57, 202, 203) at (371, 403) OK 51 Saw close enough to (53, 203, 9) at (73, 165) OK 52 Saw close enough to (53, 203, 9) at (388, 165) OK 53 Saw close enough to (53, 203, 9) at (73, 403) OK 54 Saw close enough to (53, 203, 9) at (388, 403) OK 55 55 END OF TEST 56 56 -
trunk/LayoutTests/media/video-canvas-createPattern.html
r203777 r284439 11 11 var expectedResults = [ 12 12 // Each entry is formatted as [x, y, r, g, b]. 13 [40, 165, 194, 193, 14], // Represents yellow north west tile.14 [355, 165, 194, 193, 14], // Represents yellow north east tile.15 [40, 403, 194, 193, 14], // Represents yellow south west tile.16 [355, 403, 194, 193, 14], // Represents yellow south east tile.13 [40, 165, 200, 200, 0], // Represents yellow north west tile. 14 [355, 165, 200, 200, 0], // Represents yellow north east tile. 15 [40, 403, 200, 200, 0], // Represents yellow south west tile. 16 [355, 403, 200, 200, 0], // Represents yellow south east tile. 17 17 18 [56, 165, 17, 197, 195], // Represents blue/cyan north west tile.19 [371, 165, 17, 197, 195], // Represents blue/cyan north east tile.20 [56, 403, 17, 197, 195], // Represents blue/cyan south west tile.21 [371, 403, 17, 197, 195], // Represents blue/cyan south east tile.18 [56, 165, 57, 202, 203], // Represents blue/cyan north west tile. 19 [371, 165, 57, 202, 203], // Represents blue/cyan north east tile. 20 [56, 403, 57, 202, 203], // Represents blue/cyan south west tile. 21 [371, 403, 57, 202, 203], // Represents blue/cyan south east tile. 22 22 23 [73, 165, 20, 200, 18], // Represents green north west tile.24 [388, 165, 20, 200, 18], // Represents green north east tile.25 [73, 403, 20, 200, 18], // Represents green south west tile.26 [388, 403, 20, 200, 18], // Represents green south east tile.23 [73, 165, 53, 203, 9], // Represents green north west tile. 24 [388, 165, 53, 203, 9], // Represents green north east tile. 25 [73, 403, 53, 203, 9], // Represents green south west tile. 26 [388, 403, 53, 203, 9], // Represents green south east tile. 27 27 ] 28 28 -
trunk/LayoutTests/media/video-canvas-drawing-output-expected.txt
r180441 r284439 2 2 EVENT(canplaythrough) 3 3 EVENT(seeked) 4 Saw close enough to ( 194, 193, 14) at (40, 165) OK5 Saw close enough to ( 17, 197, 195) at (56, 165) OK6 Saw close enough to ( 20, 200, 18) at (73, 165) OK4 Saw close enough to (200, 200, 0) at (40, 165) OK 5 Saw close enough to (57, 202, 203) at (56, 165) OK 6 Saw close enough to (53, 203, 9) at (73, 165) OK 7 7 EVENT(seeked) 8 Saw close enough to ( 194, 193, 14) at (40, 165) OK9 Saw close enough to ( 17, 197, 195) at (56, 165) OK10 Saw close enough to ( 20, 200, 18) at (73, 165) OK8 Saw close enough to (200, 200, 0) at (40, 165) OK 9 Saw close enough to (57, 202, 203) at (56, 165) OK 10 Saw close enough to (53, 203, 9) at (73, 165) OK 11 11 EVENT(seeked) 12 Saw close enough to ( 194, 193, 14) at (40, 165) OK13 Saw close enough to ( 17, 197, 195) at (56, 165) OK14 Saw close enough to ( 20, 200, 18) at (73, 165) OK12 Saw close enough to (200, 200, 0) at (40, 165) OK 13 Saw close enough to (57, 202, 203) at (56, 165) OK 14 Saw close enough to (53, 203, 9) at (73, 165) OK 15 15 EVENT(seeked) 16 Saw close enough to ( 194, 193, 14) at (40, 165) OK17 Saw close enough to ( 17, 197, 195) at (56, 165) OK18 Saw close enough to ( 20, 200, 18) at (73, 165) OK16 Saw close enough to (200, 200, 0) at (40, 165) OK 17 Saw close enough to (57, 202, 203) at (56, 165) OK 18 Saw close enough to (53, 203, 9) at (73, 165) OK 19 19 END OF TEST 20 20 -
trunk/LayoutTests/media/video-canvas-drawing-output.html
r221591 r284439 9 9 var expectedResults = [ 10 10 // [x, y, r, g, b] 11 [40, 165, 194, 193, 14], // yellow12 [56, 165, 17, 197, 195], // blue/cyan13 [73, 165, 20, 200, 18], // green11 [40, 165, 200, 200, 0], // yellow 12 [56, 165, 57, 202, 203], // blue/cyan 13 [73, 165, 53, 203, 9], // green 14 14 ]; 15 15 -
trunk/LayoutTests/media/video-orientation-canvas-expected.txt
r267644 r284439 1 1 2 EXPECTED (context.getImageData(88, 115, 1, 1).data == [208, 0,0,255] with tolerance 5 OK3 EXPECTED (context.getImageData(237, 88, 1, 1).data == [208, 0,0,255] with tolerance 5 OK4 EXPECTED (context.getImageData(200, 237, 1, 1).data == [208, 0,0,255] with tolerance 5 OK2 EXPECTED (context.getImageData(88, 115, 1, 1).data == [208,30,0,255] with tolerance 5 OK 3 EXPECTED (context.getImageData(237, 88, 1, 1).data == [208,30,0,255] with tolerance 5 OK 4 EXPECTED (context.getImageData(200, 237, 1, 1).data == [208,30,0,255] with tolerance 5 OK 5 5 END OF TEST 6 6 -
trunk/LayoutTests/media/video-orientation-canvas.html
r274076 r284439 5 5 <script src="video-test.js"></script> 6 6 <script> 7 let redColor = new Uint8ClampedArray([208, 0, 0, 255]);7 let redColor = new Uint8ClampedArray([208, 30, 0, 255]); 8 8 var context; 9 9 -
trunk/LayoutTests/platform/glib/TestExpectations
r284368 r284439 233 233 media/media-controller-unpause.html [ Pass ] 234 234 media/mediacapabilities/mediacapabilities-types.html [ Pass ] 235 media/video-canvas-createPattern.html [ Pass ]236 media/video-canvas-drawing-output.html [ Pass ]237 235 media/video-controller-currentTime-rate.html [ Pass ] 238 236 webaudio/codec-tests/aac/vbr-128kbps-44khz.html [ Pass ] -
trunk/LayoutTests/platform/ios-14/TestExpectations
r283531 r284439 73 73 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Failure ] 74 74 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Failure ] 75 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Failure ] 76 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Failure ] 75 77 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Failure ] 76 78 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Failure ] -
trunk/LayoutTests/platform/ios-device/TestExpectations
r280375 r284439 100 100 loader/go-back-to-different-window-size.html [ Crash ] 101 101 102 media/video-canvas-createPattern.html [ Failure ]103 media/video-canvas-drawing-output.html [ Failure ]104 102 media/video-load-preload-metadata.html [ Failure ] 105 103 media/video-played-collapse.html [ Failure ] -
trunk/LayoutTests/platform/ios/TestExpectations
r284287 r284439 3489 3489 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ] 3490 3490 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ] 3491 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Pass ] 3492 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Pass ] 3491 3493 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ] 3492 3494 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ] -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-flipY-expected.txt
r282203 r284439 9 9 PASS createImageBitmap from a bitmap HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap 10 10 PASS createImageBitmap from a vector HTMLImageElement imageOrientation: "none", and drawImage on the created ImageBitmap 11 FAIL createImageBitmap from a vector HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 15) expected 255 +/- 10 but got 011 FAIL createImageBitmap from a vector HTMLImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 1 but got 255 12 12 FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "none", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error" 13 13 FAIL createImageBitmap from a bitmap SVGImageElement imageOrientation: "flipY", and drawImage on the created ImageBitmap promise_test: Unhandled rejection with value: object "TypeError: Type error" -
trunk/LayoutTests/platform/mac-wk2/TestExpectations
r284328 r284439 1217 1217 [ arm64 ] imported/w3c/web-platform-tests/html/canvas/element/path-objects/2d.path.arc.shape.3.html [ Failure ] 1218 1218 [ arm64 ] inspector/canvas/memory.html [ Failure ] 1219 [ arm64 ] media/video-canvas-createPattern.html [ Failure ]1220 1219 1221 1220 webkit.org/b/229671 [ BigSur+ Debug arm64 ] imported/w3c/web-platform-tests/html/rendering/replaced-elements/svg-embedded-sizing/svg-in-img-auto.html [ Pass Crash ] -
trunk/LayoutTests/platform/mac/TestExpectations
r284415 r284439 1931 1931 webkit.org/b/227891 http/tests/appcache/fail-on-update.html [ Pass Timeout DumpJSConsoleLogInStdErr ] 1932 1932 1933 # rdar://66660680 (REGRESSION (20A2327a-20A2348b): media/video-canvas-createPattern.html is failing)1934 [ BigSur+ ] media/video-canvas-createPattern.html [ Failure ]1935 1936 1933 # Remove this once <rdar://problem/66734187> hits the bots 1937 1934 [ BigSur+ ] fast/text/locale-shaping.html [ Pass ImageOnlyFailure ] … … 2366 2363 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-cloned.html [ Pass ] 2367 2364 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-image.html [ Pass ] 2365 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html [ Pass ] 2366 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html [ Pass ] 2368 2367 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-canvas.html [ Pass ] 2369 2368 [ Monterey+ ] imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-pattern-image.html [ Pass ] -
trunk/Source/WTF/ChangeLog
r284428 r284439 1 2021-10-19 Cameron McCormack <heycam@apple.com> 2 3 Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space 4 https://bugs.webkit.org/show_bug.cgi?id=229025 5 <rdar://problem/81828490> 6 7 Reviewed by Sam Weinig. 8 9 * wtf/PlatformHave.h: Add HAVE_CVBUFFERCOPYATTACHMENTS. 10 1 11 2021-10-18 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Source/WTF/wtf/PlatformHave.h
r284418 r284439 1066 1066 #define HAVE_PUACTIVITYPROGRESSCONTROLLER 1 1067 1067 #endif 1068 1069 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000) \ 1070 || (((PLATFORM(IOS) && !PLATFORM(IOS_FAMILY_SIMULATOR)) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 150000) \ 1071 || (PLATFORM(WATCHOS) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __WATCH_OS_VERSION_MIN_REQUIRED >= 80000) \ 1072 || (PLATFORM(APPLETV) && !PLATFORM(IOS_FAMILY_SIMULATOR) && __TV_OS_VERSION_MIN_REQUIRED >= 150000) 1073 #define HAVE_CVBUFFERCOPYATTACHMENTS 1 1074 #endif -
trunk/Source/WebCore/ChangeLog
r284438 r284439 1 2021-10-19 Cameron McCormack <heycam@apple.com> 2 3 Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space 4 https://bugs.webkit.org/show_bug.cgi?id=229025 5 <rdar://problem/81828490> 6 7 Reviewed by Sam Weinig. 8 9 When GPU process media handling is disabled (and in the GPU process 10 when it is handling a NativeImageForCurrentTime message), 11 MediaPlayer::nativeImageForCurrentTime is used to get the video frame 12 image. We make this return an image with the right color space on 13 Apple platforms in PixelBufferConformerCV::createImageFromPixelBuffer. 14 15 For now, we avoid using the correct color space when passing 16 HTMLVideoElements to WebGLRenderingContext.texImage2D. The 17 specification is unclear about what color space the texture data 18 should be in, and implementations are currently interoperable in not 19 converting the RGB color space of the video (such as Rec.601, Rec.709, 20 etc.) into sRGB. To avoid the conversion, and effectively reinterpret 21 the video RGB colors as sRGB, we make the ImageBuffer the video is 22 drawn into have a matching color space, as it's the raw RGB values 23 from the ImageBuffer that are uploade as the texture. 24 25 (An alternative to this could be passing an argument through 26 nativeImageForCurrentTime and paintCurrentFrameInContext, which says 27 to avoid doing the conversion from video RGB to sRGB, but that needs a 28 fair amount of plumbing.) 29 30 If https://github.com/KhronosGroup/WebGL/issues/2165 is resolved, the 31 changes to LRUImageBufferCache in this commit can be reverted, so that 32 video frames are drawn into sRGB ImageBuffers again. (We'd also need 33 something to make the copyToPlatformTexture() call in 34 texImageSourceHelper do the correct color conversion somehow.) 35 36 The now differing behavior between CanvasRenderingContext2D.drawImage 37 and WebGLRenderingContext.texImage2D means that the WebGL conformance 38 suite textures/misc/texture-corner-case-videos.html test fails, since 39 it checks for incorrect 2D canvas video frame color conversion. 40 41 Tests: imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-ImageBitmap-video.html 42 imported/w3c/web-platform-tests/html/canvas/element/manual/wide-gamut-canvas/canvas-display-p3-drawImage-video.html 43 44 * html/HTMLVideoElement.cpp: 45 (WebCore::HTMLVideoElement::colorSpace const): New function that 46 exposes the color space of the current frame of the video. 47 * html/HTMLVideoElement.h: 48 * html/ImageBitmap.cpp: 49 (WebCore::ImageBitmap::createPromise): Create the ImageBuffer in a 50 color space that matches the video, not always sRGB. 51 * html/canvas/WebGLRenderingContextBase.cpp: 52 (WebCore::WebGLRenderingContextBase::drawImageIntoBuffer): 53 (WebCore::WebGLRenderingContextBase::videoFrameToImage): Use an 54 ImageBuffer whose color space matches the video frame's color space. 55 (WebCore::WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer): 56 Add a DestinationColorSpace argument, so that the LRU cache is keyed 57 off both size and color space. 58 * html/canvas/WebGLRenderingContextBase.h: 59 * platform/cocoa/CoreVideoSoftLink.cpp: 60 * platform/cocoa/CoreVideoSoftLink.h: Add SPIs that let us get or 61 compute a CGColorSpace from a CVPixelBuffer. Remove 62 CVImageBufferGetColorSpace, which is unsused. 63 * platform/graphics/MediaPlayer.cpp: 64 (WebCore::MediaPlayer::colorSpace): 65 * platform/graphics/MediaPlayer.h: 66 * platform/graphics/MediaPlayerPrivate.h: 67 (WebCore::MediaPlayerPrivateInterface::colorSpace): 68 * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h: 69 * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: 70 (WebCore::MediaPlayerPrivateAVFoundationCF::colorSpace): 71 * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h: 72 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h: 73 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 74 (WebCore::MediaPlayerPrivateAVFoundationObjC::colorSpace): Expose the 75 color space of the current image. While we strictly only need the pixel 76 buffer to be up to date, we call updateLastImage() since it has the 77 UpdateSynchronously behavior, and the caller to colorSpace() will use 78 the image soon anyway. 79 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h: 80 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 81 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::colorSpace): 82 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h: 83 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: 84 (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::colorSpace): 85 * platform/graphics/cg/ColorSpaceCG.h: 86 * platform/graphics/cv/CVUtilities.h: 87 * platform/graphics/cv/CVUtilities.mm: 88 (WebCore::createCGColorSpaceForCVPixelBuffer): New function to produce 89 a CGColorSpace for a CVPixelBuffer. On macOS, this is stored as an 90 attachment on the CVPixelBuffer. On iOS, we must call SPI to create a 91 CGColorSpace based on the other color space information in the 92 attachments. (It's possible we should cache the results of this 93 function for a given set of color space attachments, since 94 CVImageBufferCreateColorSpaceFromAttachments can end up creating a new 95 CGColorSpace object every time it's called.) 96 * platform/graphics/cv/PixelBufferConformerCV.cpp: 97 (WebCore::PixelBufferConformerCV::createImageFromPixelBuffer): Create 98 the CGImage in a color space matching the CVPixelBuffer. 99 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: 100 (WebCore::MediaPlayerPrivateGStreamer::colorSpace): 101 * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h: 102 * platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h: 103 * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp: 104 (WebCore::MediaPlayerPrivateMediaFoundation::colorSpace): 105 * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: 106 * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp: 107 (WebCore::MockMediaPlayerMediaSource::colorSpace): 108 * platform/mock/mediasource/MockMediaPlayerMediaSource.h: 109 * svg/graphics/SVGImage.cpp: 110 (WebCore::SVGImage::drawInternal): 111 1 112 2021-10-19 Kyle Piddington <kpiddington@apple.com> 2 113 Query EGL_BIND_TO_TEXTURE_TARGET_ANGLE to determine 2D/rectangular texture usage -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r283851 r284439 285 285 } 286 286 287 std::optional<DestinationColorSpace> HTMLVideoElement::colorSpace() const 288 { 289 RefPtr<MediaPlayer> player = HTMLMediaElement::player(); 290 if (!player) 291 return std::nullopt; 292 293 return player->colorSpace(); 294 } 295 287 296 RefPtr<ImageBuffer> HTMLVideoElement::createBufferForPainting(const FloatSize& size, RenderingMode renderingMode, const DestinationColorSpace& colorSpace, PixelFormat pixelFormat) const 288 297 { -
trunk/Source/WebCore/html/HTMLVideoElement.h
r282740 r284439 79 79 80 80 WEBCORE_EXPORT RefPtr<NativeImage> nativeImageForCurrentTime(); 81 std::optional<DestinationColorSpace> colorSpace() const; 81 82 82 83 WEBCORE_EXPORT bool shouldDisplayPosterImage() const; -
trunk/Source/WebCore/html/ImageBitmap.cpp
r284436 r284439 510 510 auto outputSize = outputSizeForSourceRectangle(sourceRectangle, options); 511 511 512 // FIXME: Add support for color spaces / pixel formats to ImageBitmap. 513 auto bitmapData = video->createBufferForPainting(outputSize, bufferRenderingMode, DestinationColorSpace::SRGB(), PixelFormat::BGRA8); 512 auto colorSpace = video->colorSpace(); 513 if (!colorSpace) 514 colorSpace = DestinationColorSpace::SRGB(); 515 516 // FIXME: Add support for pixel formats to ImageBitmap. 517 auto bitmapData = video->createBufferForPainting(outputSize, bufferRenderingMode, *colorSpace, PixelFormat::BGRA8); 514 518 if (!bitmapData) { 515 519 resolveWithBlankImageBuffer(scriptExecutionContext, !taintsOrigin(scriptExecutionContext.securityOrigin(), *video), WTFMove(promise)); -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r284095 r284439 5886 5886 IntSize size(width, height); 5887 5887 size.scale(deviceScaleFactor); 5888 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size );5888 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size, DestinationColorSpace::SRGB()); 5889 5889 if (!buf) { 5890 5890 synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory"); … … 5902 5902 RefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement* video, BackingStoreCopy backingStoreCopy, const char* functionName) 5903 5903 { 5904 // FIXME: When texImage2D is passed an HTMLVideoElement, implementations 5905 // interoperably use the native RGB color values of the video frame (e.g. 5906 // Rec.601 color space values) for the texture. But nativeImageForCurrentTime 5907 // and paintCurrentFrameInContext return and use an image with its color space 5908 // correctly matching the video. 5909 // 5910 // https://github.com/KhronosGroup/WebGL/issues/2165 is open on converting 5911 // the video element image source to sRGB instead of leaving it in its 5912 // native RGB color space. For now, we make sure to paint into an 5913 // ImageBuffer with a matching color space, to avoid the conversion. 5904 5914 #if USE(AVFOUNDATION) 5905 5915 auto nativeImage = video->nativeImageForCurrentTime(); … … 5914 5924 } 5915 5925 FloatRect imageRect { { }, imageSize }; 5916 ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(imageSize, CompositeOperator::Copy);5926 ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(imageSize, nativeImage->colorSpace(), CompositeOperator::Copy); 5917 5927 if (!imageBuffer) { 5918 5928 synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory"); … … 5925 5935 // once all platforms implement nativeImageForCurrentTime(). 5926 5936 IntSize videoSize { static_cast<int>(video->videoWidth()), static_cast<int>(video->videoHeight()) }; 5927 ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(videoSize); 5937 auto colorSpace = video->colorSpace(); 5938 if (!colorSpace) 5939 colorSpace = DestinationColorSpace::SRGB(); 5940 ImageBuffer* imageBuffer = m_generatedImageCache.imageBuffer(videoSize, *colorSpace); 5928 5941 if (!imageBuffer) { 5929 5942 synthesizeGLError(GraphicsContextGL::OUT_OF_MEMORY, functionName, "out of memory"); … … 7779 7792 } 7780 7793 7781 ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size, CompositeOperator fillOperator)7794 ImageBuffer* WebGLRenderingContextBase::LRUImageBufferCache::imageBuffer(const IntSize& size, DestinationColorSpace colorSpace, CompositeOperator fillOperator) 7782 7795 { 7783 7796 size_t i; 7784 7797 for (i = 0; i < m_buffers.size(); ++i) { 7785 ImageBuffer* buf = m_buffers[i].get(); 7786 if (!buf) 7798 if (!m_buffers[i]) 7787 7799 break; 7788 if (buf->logicalSize() != size) 7800 ImageBuffer& buf = m_buffers[i]->second.get(); 7801 if (m_buffers[i]->first != colorSpace || buf.logicalSize() != size) 7789 7802 continue; 7790 7803 bubbleToFront(i); 7791 7804 if (fillOperator != CompositeOperator::Copy && fillOperator != CompositeOperator::Clear) 7792 buf ->context().clearRect({ { }, size });7793 return buf;7805 buf.context().clearRect({ { }, size }); 7806 return &buf; 7794 7807 } 7795 7808 7796 7809 // FIXME (149423): Should this ImageBuffer be unconditionally unaccelerated? 7797 auto temp = ImageBuffer::create(size, RenderingMode::Unaccelerated, 1, DestinationColorSpace::SRGB(), PixelFormat::BGRA8);7810 auto temp = ImageBuffer::create(size, RenderingMode::Unaccelerated, 1, colorSpace, PixelFormat::BGRA8); 7798 7811 if (!temp) 7799 7812 return nullptr; 7800 7813 ASSERT(m_buffers.size() > 0); 7801 7814 i = std::min(m_buffers.size() - 1, i); 7802 m_buffers[i] = WTFMove(temp);7803 7804 ImageBuffer * buf = m_buffers[i].get();7815 m_buffers[i] = { colorSpace, temp.releaseNonNull() }; 7816 7817 ImageBuffer& buf = m_buffers[i]->second.get(); 7805 7818 bubbleToFront(i); 7806 return buf;7819 return &buf; 7807 7820 } 7808 7821 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r284075 r284439 622 622 // Returns pointer to a cleared image buffer that is owned by the cache. The pointer is valid until next call. 623 623 // Using fillOperator == CompositeOperator::Copy can be used to omit the clear of the buffer. 624 ImageBuffer* imageBuffer(const IntSize&, CompositeOperator fillOperator = CompositeOperator::SourceOver);624 ImageBuffer* imageBuffer(const IntSize&, DestinationColorSpace, CompositeOperator fillOperator = CompositeOperator::SourceOver); 625 625 private: 626 626 void bubbleToFront(size_t idx); 627 Vector< RefPtr<ImageBuffer>> m_buffers;627 Vector<std::optional<std::pair<DestinationColorSpace, Ref<ImageBuffer>>>> m_buffers; 628 628 }; 629 629 LRUImageBufferCache m_generatedImageCache { 0 }; -
trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.cpp
r279221 r284439 33 33 SOFT_LINK_FRAMEWORK_FOR_SOURCE(WebCore, CoreVideo) 34 34 35 #if HAVE(CVBUFFERCOPYATTACHMENTS) 36 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferCopyAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode)) 37 #endif 35 38 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode)) 39 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVBufferGetAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode)) 36 40 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ()) 37 41 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferGetWidth, size_t, (CVPixelBufferRef pixelBuffer), (pixelBuffer)) … … 47 51 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVPixelBufferPoolCreatePixelBuffer, CVReturn, (CFAllocatorRef allocator, CVPixelBufferPoolRef pixelBufferPool, CVPixelBufferRef* pixelBufferOut), (allocator, pixelBufferPool, pixelBufferOut)) 48 52 SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, CVPixelBufferGetIOSurface, IOSurfaceRef, (CVPixelBufferRef pixelBuffer), (pixelBuffer), WEBCORE_EXPORT) 49 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVImageBuffer GetColorSpace, CGColorSpaceRef, (CVImageBufferRef pixelBuffer), (pixelBuffer))53 SOFT_LINK_FUNCTION_FOR_SOURCE(WebCore, CoreVideo, CVImageBufferCreateColorSpaceFromAttachments, CGColorSpaceRef, (CFDictionaryRef attachments), (attachments)) 50 54 51 55 SOFT_LINK_CONSTANT_FOR_SOURCE_WITH_EXPORT(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef, WEBCORE_EXPORT) … … 73 77 SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_P3_D65, CFStringRef) 74 78 SOFT_LINK_CONSTANT_MAY_FAIL_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferYCbCrMatrix_ITU_R_2020, CFStringRef) 79 SOFT_LINK_CONSTANT_FOR_SOURCE(WebCore, CoreVideo, kCVImageBufferCGColorSpaceKey, CFStringRef) 75 80 76 81 #if USE(OPENGL_ES) -
trunk/Source/WebCore/platform/cocoa/CoreVideoSoftLink.h
r273568 r284439 33 33 SOFT_LINK_FRAMEWORK_FOR_HEADER(WebCore, CoreVideo) 34 34 35 #if HAVE(CVBUFFERCOPYATTACHMENTS) 36 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferCopyAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode)) 37 #define CVBufferCopyAttachments softLink_CoreVideo_CVBufferCopyAttachments 38 #endif 35 39 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferGetAttachment, CFTypeRef, (CVBufferRef buffer, CFStringRef key, CVAttachmentMode* attachmentMode), (buffer, key, attachmentMode)) 36 40 #define CVBufferGetAttachment softLink_CoreVideo_CVBufferGetAttachment 41 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVBufferGetAttachments, CFDictionaryRef, (CVBufferRef buffer, CVAttachmentMode mode), (buffer, mode)) 42 #define CVBufferGetAttachments softLink_CoreVideo_CVBufferGetAttachments 37 43 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferGetTypeID, CFTypeID, (), ()) 38 44 #define CVPixelBufferGetTypeID softLink_CoreVideo_CVPixelBufferGetTypeID … … 63 69 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVPixelBufferPoolGetPixelBufferAttributes, CFDictionaryRef, (CVPixelBufferPoolRef pool), (pool)) 64 70 #define CVPixelBufferPoolGetPixelBufferAttributes softLink_CoreVideo_CVPixelBufferPoolGetPixelBufferAttributes 65 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVImageBuffer GetColorSpace, CGColorSpaceRef, (CVImageBufferRef pixelBuffer), (pixelBuffer))66 #define CVImageBuffer GetColorSpace softLink_CoreVideo_CVImageBufferGetColorSpace71 SOFT_LINK_FUNCTION_FOR_HEADER(WebCore, CoreVideo, CVImageBufferCreateColorSpaceFromAttachments, CGColorSpaceRef, (CFDictionaryRef attachments), (attachments)) 72 #define CVImageBufferCreateColorSpaceFromAttachments softLink_CoreVideo_CVImageBufferCreateColorSpaceFromAttachments 67 73 68 74 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVPixelBufferPixelFormatTypeKey, CFStringRef) … … 112 118 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferTransferFunction_SMPTE_240M_1995, CFStringRef) 113 119 #define kCVImageBufferTransferFunction_SMPTE_240M_1995 get_CoreVideo_kCVImageBufferTransferFunction_SMPTE_240M_1995() 120 SOFT_LINK_CONSTANT_FOR_HEADER(WebCore, CoreVideo, kCVImageBufferCGColorSpaceKey, CFStringRef) 121 #define kCVImageBufferCGColorSpaceKey get_CoreVideo_kCVImageBufferCGColorSpaceKey() 114 122 115 123 #if USE(OPENGL_ES) -
trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp
r284080 r284439 158 158 159 159 void paint(GraphicsContext&, const FloatRect&) final { } 160 DestinationColorSpace colorSpace() final { return DestinationColorSpace::SRGB(); } 160 161 161 162 bool hasSingleSecurityOrigin() const final { return true; } … … 1074 1075 } 1075 1076 1077 DestinationColorSpace MediaPlayer::colorSpace() 1078 { 1079 return m_private->colorSpace(); 1080 } 1081 1076 1082 MediaPlayer::SupportsType MediaPlayer::supportsType(const MediaEngineSupportParameters& parameters) 1077 1083 { -
trunk/Source/WebCore/platform/graphics/MediaPlayer.h
r283605 r284439 470 470 471 471 RefPtr<NativeImage> nativeImageForCurrentTime(); 472 DestinationColorSpace colorSpace(); 472 473 473 474 using MediaPlayerEnums::NetworkState; -
trunk/Source/WebCore/platform/graphics/MediaPlayerPrivate.h
r283237 r284439 183 183 #endif 184 184 virtual RefPtr<NativeImage> nativeImageForCurrentTime() { return nullptr; } 185 virtual DestinationColorSpace colorSpace() = 0; 185 186 186 187 virtual void setPreload(MediaPlayer::Preload) { } -
trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h
r284093 r284439 192 192 bool didLoadingProgress() const override; 193 193 void paint(GraphicsContext&, const FloatRect&) override = 0; 194 DestinationColorSpace colorSpace() override = 0; 194 195 void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override = 0; 195 196 void setPreload(MediaPlayer::Preload) override; -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
r280776 r284439 906 906 907 907 m_videoFrameHasDrawn = true; 908 } 909 910 DestinationColorSpace MediaPlayerPrivateAVFoundationCF::colorSpace() 911 { 912 return DestinationColorSpace::SRGB(); 908 913 } 909 914 -
trunk/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h
r268607 r284439 77 77 void setClosedCaptionsVisible(bool) override; 78 78 virtual void paint(GraphicsContext&, const FloatRect&); 79 DestinationColorSpace colorSpace() override; 79 80 virtual void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&); 80 81 virtual PlatformLayer* platformLayer() const; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h
r283585 r284439 260 260 void paintWithVideoOutput(GraphicsContext&, const FloatRect&); 261 261 RefPtr<NativeImage> nativeImageForCurrentTime() final; 262 DestinationColorSpace colorSpace() final; 262 263 void waitForVideoOutputMediaDataWillChange(); 263 264 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r284093 r284439 37 37 #import "CDMInstanceFairPlayStreamingAVFObjC.h" 38 38 #import "CDMSessionAVFoundationObjC.h" 39 #import "CVUtilities.h" 39 40 #import "ColorSpaceCG.h" 40 41 #import "Cookie.h" … … 2592 2593 } 2593 2594 2595 DestinationColorSpace MediaPlayerPrivateAVFoundationObjC::colorSpace() 2596 { 2597 updateLastImage(UpdateType::UpdateSynchronously); 2598 if (!m_lastPixelBuffer) 2599 return DestinationColorSpace::SRGB(); 2600 2601 return DestinationColorSpace(createCGColorSpaceForCVPixelBuffer(m_lastPixelBuffer.get())); 2602 } 2603 2594 2604 void MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange() 2595 2605 { -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
r281227 r284439 223 223 void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override; 224 224 RetainPtr<CVPixelBufferRef> pixelBufferForCurrentTime() final; 225 DestinationColorSpace colorSpace() final; 225 226 226 227 bool supportsAcceleratedRendering() const override; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r284093 r284439 732 732 } 733 733 734 DestinationColorSpace MediaPlayerPrivateMediaSourceAVFObjC::colorSpace() 735 { 736 updateLastImage(); 737 return m_lastImage ? m_lastImage->colorSpace() : DestinationColorSpace::SRGB(); 738 } 739 734 740 bool MediaPlayerPrivateMediaSourceAVFObjC::hasAvailableVideoFrame() const 735 741 { -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
r281227 r284439 143 143 void paint(GraphicsContext&, const FloatRect&) override; 144 144 void paintCurrentFrameInContext(GraphicsContext&, const FloatRect&) override; 145 DestinationColorSpace colorSpace() override; 145 146 bool metaDataAvailable() const { return m_mediaStreamPrivate && m_readyState >= MediaPlayer::ReadyState::HaveMetadata; } 146 147 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
r284057 r284439 1008 1008 } 1009 1009 1010 DestinationColorSpace MediaPlayerPrivateMediaStreamAVFObjC::colorSpace() 1011 { 1012 updateCurrentFrameImage(); 1013 return m_imagePainter.cgImage ? m_imagePainter.cgImage->colorSpace() : DestinationColorSpace::SRGB(); 1014 } 1015 1010 1016 void MediaPlayerPrivateMediaStreamAVFObjC::updateLayersAsNeeded() 1011 1017 { -
trunk/Source/WebCore/platform/graphics/cg/ColorSpaceCG.h
r281470 r284439 27 27 28 28 #include "ColorSpace.h" 29 #include <CoreGraphics/CoreGraphics.h> 29 30 #include <optional> 31 #include <wtf/cf/TypeCastsCF.h> 30 32 31 typedef struct CGColorSpace *CGColorSpaceRef;33 WTF_DECLARE_CF_TYPE_TRAIT(CGColorSpace); 32 34 33 35 namespace WebCore { -
trunk/Source/WebCore/platform/graphics/cv/CVUtilities.h
r283036 r284439 31 31 #include <wtf/RetainPtr.h> 32 32 33 using CGColorSpaceRef = struct CGColorSpace*; 33 34 using CVPixelBufferPoolRef = struct __CVPixelBufferPool*; 34 35 using CVPixelBufferRef = struct __CVBuffer*; … … 44 45 WEBCORE_EXPORT Expected<RetainPtr<CVPixelBufferRef>, CVReturn> createCVPixelBuffer(IOSurfaceRef); 45 46 47 RetainPtr<CGColorSpaceRef> createCGColorSpaceForCVPixelBuffer(CVPixelBufferRef); 46 48 } -
trunk/Source/WebCore/platform/graphics/cv/CVUtilities.mm
r283036 r284439 108 108 } 109 109 110 RetainPtr<CGColorSpaceRef> createCGColorSpaceForCVPixelBuffer(CVPixelBufferRef buffer) 111 { 112 if (CGColorSpaceRef colorSpace = dynamic_cf_cast<CGColorSpaceRef>(CVBufferGetAttachment(buffer, kCVImageBufferCGColorSpaceKey, nullptr))) 113 return colorSpace; 114 115 RetainPtr<CFDictionaryRef> attachments; 116 #if HAVE(CVBUFFERCOPYATTACHMENTS) 117 attachments = adoptCF(CVBufferCopyAttachments(buffer, kCVAttachmentMode_ShouldPropagate)); 118 #else 119 attachments = CVBufferGetAttachments(buffer, kCVAttachmentMode_ShouldPropagate); 120 #endif 121 if (auto colorSpace = adoptCF(CVImageBufferCreateColorSpaceFromAttachments(attachments.get()))) 122 return colorSpace; 123 124 // We should only get here with content that has a broken embedded ICC 125 // profile; in all other cases VideoToolbox should have put either known 126 // accurate or guessed color space attachments on the pixel buffer. Content 127 // that requires an embedded ICC profile is unlikely to be presented 128 // correctly with any particular fallback color space we choose, so we 129 // choose sRGB for ease. 130 return sRGBColorSpaceRef(); 110 131 } 132 133 } -
trunk/Source/WebCore/platform/graphics/cv/PixelBufferConformerCV.cpp
r261460 r284439 27 27 #include "PixelBufferConformerCV.h" 28 28 29 #include "CVUtilities.h" 29 30 #include "GraphicsContextCG.h" 30 31 #include "ImageBufferUtilitiesCG.h" … … 166 167 return nullptr; 167 168 169 auto colorSpace = createCGColorSpaceForCVPixelBuffer(rawBuffer); 170 168 171 CVPixelBufferInfo* info = new CVPixelBufferInfo(); 169 172 info->pixelBuffer = WTFMove(buffer); … … 173 176 RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateDirect(info, byteLength, &providerCallbacks)); 174 177 175 return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, sRGBColorSpaceRef(), bitmapInfo, provider.get(), nullptr, false, kCGRenderingIntentDefault));178 return adoptCF(CGImageCreate(width, height, 8, 32, bytesPerRow, colorSpace.get(), bitmapInfo, provider.get(), nullptr, false, kCGRenderingIntentDefault)); 176 179 } 177 180 -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp
r284368 r284439 3283 3283 } 3284 3284 3285 DestinationColorSpace MediaPlayerPrivateGStreamer::colorSpace() 3286 { 3287 return DestinationColorSpace::SRGB(); 3288 } 3289 3285 3290 #if USE(GSTREAMER_GL) 3286 3291 bool MediaPlayerPrivateGStreamer::copyVideoTextureToPlatformTexture(GraphicsContextGL* context, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY) -
trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h
r284368 r284439 182 182 #endif 183 183 void paint(GraphicsContext&, const FloatRect&) final; 184 DestinationColorSpace colorSpace() final; 184 185 bool supportsFullscreen() const final; 185 186 MediaPlayer::MovieLoadType movieLoadType() const final; -
trunk/Source/WebCore/platform/graphics/holepunch/MediaPlayerPrivateHolePunch.h
r281227 r284439 88 88 void paint(GraphicsContext&, const FloatRect&) final { }; 89 89 90 DestinationColorSpace colorSpace() final { return DestinationColorSpace::SRGB(); } 91 90 92 bool supportsAcceleratedRendering() const final { return true; } 91 93 -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp
r284093 r284439 359 359 } 360 360 361 DestinationColorSpace MediaPlayerPrivateMediaFoundation::colorSpace() 362 { 363 return DestinationColorSpace::SRGB(); 364 } 365 361 366 bool MediaPlayerPrivateMediaFoundation::createSession() 362 367 { -
trunk/Source/WebCore/platform/graphics/win/MediaPlayerPrivateMediaFoundation.h
r281227 r284439 100 100 101 101 void paint(GraphicsContext&, const FloatRect&) final; 102 103 DestinationColorSpace colorSpace() final; 102 104 103 105 private: -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.cpp
r284057 r284439 299 299 } 300 300 301 DestinationColorSpace MockMediaPlayerMediaSource::colorSpace() 302 { 303 return DestinationColorSpace::SRGB(); 304 } 305 301 306 } 302 307 -
trunk/Source/WebCore/platform/mock/mediasource/MockMediaPlayerMediaSource.h
r281227 r284439 90 90 void seekWithTolerance(const MediaTime&, const MediaTime&, const MediaTime&) override; 91 91 std::optional<VideoPlaybackQualityMetrics> videoPlaybackQualityMetrics() override; 92 DestinationColorSpace colorSpace() override; 92 93 93 94 MediaPlayer* m_player; -
trunk/Source/WebCore/svg/graphics/SVGImage.cpp
r283851 r284439 321 321 } 322 322 323 // FIXME: We should honor options.orientation(), since ImageBitmap's flipY handling relies on it. https://bugs.webkit.org/show_bug.cgi?id=231001 323 324 FloatSize scale(dstRect.size() / srcRect.size()); 324 325 -
trunk/Source/WebKit/ChangeLog
r284429 r284439 1 2021-10-19 Cameron McCormack <heycam@apple.com> 2 3 Ensure CanvasRenderingContext2D.drawImage(video) uses the right color space 4 https://bugs.webkit.org/show_bug.cgi?id=229025 5 <rdar://problem/81828490> 6 7 Reviewed by Sam Weinig. 8 9 When GPU process media handling is enabled, ctx.drawImage(video) 10 calls work by sending a NativeImageForCurrentTime message to the GPU 11 process, which returns an IOSurface around which a CGImage is created. 12 There's no good way to get the color space off the IOSurface, so we 13 add a second return argument to NativeImageForCurrentTime to indicate 14 the color space used. 15 16 ImageBitmap creates an ImageBuffer for that image to be painted into, 17 and for that we also need to know the color space of the video. The 18 code that sends NativeImageForCurrentTime and then paints the 19 resulting image into the GraphicsContext is further down. So we add 20 a separate IPC message that gets the color space of the video's 21 current frame. (It would be better if we could avoid a second 22 synchronous IPC message call, but either ImageBitmap's scaling and 23 cropping code, or the ImageBuffer creation call, would need to be moved 24 down into MediaPlayerPrivateRemote::paintCurrentFrameInContext, which 25 doesn't seem like the right place for it.) 26 27 * GPUProcess/media/RemoteImageDecoderAVFProxy.cpp: 28 (WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex): 29 * GPUProcess/media/RemoteImageDecoderAVFProxy.h: 30 * GPUProcess/media/RemoteMediaPlayerProxy.h: 31 * GPUProcess/media/RemoteMediaPlayerProxy.messages.in: 32 * GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm: 33 (WebKit::RemoteMediaPlayerProxy::nativeImageForCurrentTime): 34 (WebKit::RemoteMediaPlayerProxy::colorSpace): 35 * WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: 36 (WebKit::MediaPlayerPrivateRemote::colorSpace): 37 * WebProcess/GPU/media/MediaPlayerPrivateRemote.h: 38 * WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm: 39 (WebKit::MediaPlayerPrivateRemote::nativeImageForCurrentTime): Add a 40 second return argument to NativeImageForCurrentTime to indicate the 41 color space of the returned IOSurface. 42 (WebKit::MediaPlayerPrivateRemote::colorSpace): Add a new IPC message to 43 get the color space of a video's current frame. 44 1 45 2021-10-18 Commit Queue <commit-queue@webkit.org> 2 46 -
trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
r284142 r284439 114 114 } 115 115 116 void RemoteImageDecoderAVFProxy::createFrameImageAtIndex(ImageDecoderIdentifier identifier, size_t index, CompletionHandler<void(std::optional<WTF::MachSendRight>&&, std::optional<WebCore::DestinationColorSpace>&&)>&& completionHandler)116 void RemoteImageDecoderAVFProxy::createFrameImageAtIndex(ImageDecoderIdentifier identifier, size_t index, CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&& completionHandler) 117 117 { 118 118 ASSERT(m_imageDecoders.contains(identifier)); 119 std::optional<WTF::MachSendRight> sendRight;120 std::optional<WebCore::DestinationColorSpace> colorSpace;121 119 if (!m_imageDecoders.contains(identifier)) { 122 completionHandler( WTFMove(sendRight), WTFMove(colorSpace));120 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 123 121 return; 124 122 } … … 126 124 auto frameImage = m_imageDecoders.get(identifier)->createFrameImageAtIndex(index); 127 125 if (!frameImage) { 128 completionHandler( WTFMove(sendRight), WTFMove(colorSpace));126 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 129 127 return; 130 128 } 131 129 132 if (auto surface = IOSurface::createFromImage(frameImage.get())) { 133 sendRight = surface->createSendRight(); 134 colorSpace = surface->colorSpace(); 130 auto surface = IOSurface::createFromImage(frameImage.get()); 131 if (!surface) { 132 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 133 return; 135 134 } 136 135 137 completionHandler( WTFMove(sendRight), WTFMove(colorSpace));136 completionHandler(surface->createSendRight(), surface->colorSpace()); 138 137 } 139 138 -
trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h
r278253 r284439 57 57 void setExpectedContentSize(WebCore::ImageDecoderIdentifier, long long expectedContentSize); 58 58 void setData(WebCore::ImageDecoderIdentifier, const IPC::DataReference&, bool allDataReceived, CompletionHandler<void(size_t frameCount, const WebCore::IntSize& size, bool hasTrack, std::optional<Vector<WebCore::ImageDecoder::FrameInfo>>&&)>&&); 59 void createFrameImageAtIndex(WebCore::ImageDecoderIdentifier, size_t index, CompletionHandler<void(std::optional<WTF::MachSendRight>&&, std::optional<WebCore::DestinationColorSpace>&&)>&&);59 void createFrameImageAtIndex(WebCore::ImageDecoderIdentifier, size_t index, CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&&); 60 60 void clearFrameBufferCache(WebCore::ImageDecoderIdentifier, size_t index); 61 61 -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h
r284294 r284439 312 312 313 313 #if PLATFORM(COCOA) 314 void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&)>&&); 314 void nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&&); 315 void colorSpace(CompletionHandler<void(WebCore::DestinationColorSpace)>&&); 315 316 #endif 316 317 #if USE(AVFOUNDATION) -
trunk/Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.messages.in
r284294 r284439 124 124 125 125 #if PLATFORM(COCOA) 126 NativeImageForCurrentTime() -> (std::optional<MachSendRight> sendRight) Synchronous 126 NativeImageForCurrentTime() -> (std::optional<MachSendRight> sendRight, WebCore::DestinationColorSpace colorSpace) Synchronous 127 ColorSpace() -> (WebCore::DestinationColorSpace colorSpace) Synchronous 127 128 #endif 128 129 #if USE(AVFOUNDATION) -
trunk/Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm
r284102 r284439 84 84 } 85 85 86 void RemoteMediaPlayerProxy::nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&& )>&& completionHandler)86 void RemoteMediaPlayerProxy::nativeImageForCurrentTime(CompletionHandler<void(std::optional<WTF::MachSendRight>&&, WebCore::DestinationColorSpace)>&& completionHandler) 87 87 { 88 88 if (!m_player) { 89 completionHandler(std::nullopt );89 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 90 90 return; 91 91 } … … 93 93 auto nativeImage = m_player->nativeImageForCurrentTime(); 94 94 if (!nativeImage) { 95 completionHandler(std::nullopt );95 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 96 96 return; 97 97 } … … 99 99 auto platformImage = nativeImage->platformImage(); 100 100 if (!platformImage) { 101 completionHandler(std::nullopt );101 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 102 102 return; 103 103 } … … 105 105 auto surface = WebCore::IOSurface::createFromImage(platformImage.get()); 106 106 if (!surface) { 107 completionHandler(std::nullopt );107 completionHandler(std::nullopt, DestinationColorSpace::SRGB()); 108 108 return; 109 109 } 110 110 111 completionHandler(surface->createSendRight()); 111 completionHandler(surface->createSendRight(), nativeImage->colorSpace()); 112 } 113 114 void RemoteMediaPlayerProxy::colorSpace(CompletionHandler<void(WebCore::DestinationColorSpace)>&& completionHandler) 115 { 116 if (!m_player) { 117 completionHandler(DestinationColorSpace::SRGB()); 118 return; 119 } 120 121 completionHandler(m_player->colorSpace()); 112 122 } 113 123 -
trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
r284294 r284439 997 997 return nullptr; 998 998 } 999 1000 DestinationColorSpace MediaPlayerPrivateRemote::colorSpace() 1001 { 1002 notImplemented(); 1003 return DestinationColorSpace::SRGB(); 1004 } 999 1005 #endif 1000 1006 -
trunk/Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h
r284102 r284439 291 291 #endif 292 292 RefPtr<WebCore::NativeImage> nativeImageForCurrentTime() final; 293 WebCore::DestinationColorSpace colorSpace() final; 293 294 294 295 WebCore::MediaPlayerIdentifier identifier() const final; -
trunk/Source/WebKit/WebProcess/GPU/media/cocoa/MediaPlayerPrivateRemoteCocoa.mm
r284102 r284439 50 50 { 51 51 std::optional<MachSendRight> sendRight; 52 if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime(), Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime::Reply(sendRight), m_id)) 52 auto colorSpace = DestinationColorSpace::SRGB(); 53 if (!connection().sendSync(Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime(), Messages::RemoteMediaPlayerProxy::NativeImageForCurrentTime::Reply(sendRight, colorSpace), m_id)) 53 54 return nullptr; 54 55 … … 56 57 return nullptr; 57 58 58 auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(*sendRight), WebCore::DestinationColorSpace::SRGB());59 auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(*sendRight), colorSpace); 59 60 if (!surface) 60 61 return nullptr; … … 65 66 66 67 return NativeImage::create(WTFMove(platformImage)); 68 } 69 70 WebCore::DestinationColorSpace MediaPlayerPrivateRemote::colorSpace() 71 { 72 auto colorSpace = DestinationColorSpace::SRGB(); 73 connection().sendSync(Messages::RemoteMediaPlayerProxy::ColorSpace(), Messages::RemoteMediaPlayerProxy::ColorSpace::Reply(colorSpace), m_id); 74 return colorSpace; 67 75 } 68 76
Note: See TracChangeset
for help on using the changeset viewer.