|
3767 | 3767 | 5. If `destination.byteLength` is less than |combinedLayout|'s [=combined |
3768 | 3768 | buffer layout/allocationSize=], return a promise rejected with a |
3769 | 3769 | {{TypeError}}. |
3770 | | - 6. If |options|.{{VideoFrameCopyToOptions/format}} does not equal to |
| 3770 | + 6. If |options|.{{VideoFrameCopyToOptions/format}} does not equal |
3771 | 3771 | {{VideoFrame/[[format]]}} and |options|.{{VideoFrameCopyToOptions/format}} |
3772 | 3772 | is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} then: |
3773 | 3773 | 1. Let |newOptions| be the result of running the <a>Clone Configuration</a> |
|
4214 | 4214 | 2. Let |canvasSettings| be a new {{CanvasRenderingContext2DSettings}} with |
4215 | 4215 | {{CanvasRenderingContext2DSettings/colorSpace}} set to |colorSpace|. |
4216 | 4216 | 3. Let |context| be the result of calling {{OffscreenCanvas/getContext()}} |
4217 | | - on |canvas| with `"2d"` and |canvasSettings| |
| 4217 | + on |canvas| with `"2d"` and |canvasSettings|. |
4218 | 4218 | 3. Call {{CanvasDrawImage/drawImage()}} on |context| with |
4219 | 4219 | `rect.x`, `rect.y`, `rect.width`, `rect.height`, `0`, `0`, `rect.width`, |
4220 | 4220 | `rect.height`. |
4221 | 4221 | 4. Let |imageData| be the result of calling {{CanvasImageData/getImageData()}} with |
4222 | 4222 | `0`, `0`, |rect.width|, |rect.height|. |
4223 | 4223 | 5. If |format| is equal to {{BGRA}} or {{BGRX}}: |
4224 | | - 1. Let |pixelIndex| be `0` |
| 4224 | + 1. Let |pixelIndex| be `0`. |
4225 | 4225 | 2. While |pixelIndex| is less than `rect.width` multiplied by `rect.height`: |
4226 | 4226 | 1. Swap elements in |imageData|.{{ImageData/data}} at indexes `4 * pixelIndex` |
4227 | 4227 | and `4 * pixelIndex + 2`. |
4228 | | - 2. Increment |pixelIndex| by `1` |
| 4228 | + 2. Increment |pixelIndex| by `1`. |
4229 | 4229 | 6. Let |init| be a new {{VideoFrameBufferInit}} constructed with |
4230 | 4230 | {{VideoFrameBufferInit/format}} = |format|, |
4231 | 4231 | {{VideoFrameBufferInit/codedWidth}} = `rect.width`, |
4232 | | - {{VideoFrameBufferInit/codedHeight}} = `rect.height` |
| 4232 | + {{VideoFrameBufferInit/codedHeight}} = `rect.height`. |
4233 | 4233 | 7. Let |convertedFrame| be a new {{VideoFrame}} constructed with |
4234 | | - |imageData|.{{ImageData/data}} and |init| |
4235 | | - 8. Return |convertedFrame| |
| 4234 | + |imageData|.{{ImageData/data}} and |init|. |
| 4235 | + 8. Return |convertedFrame|. |
4236 | 4236 |
|
4237 | 4237 | : <dfn for=VideoFrame>Copy VideoFrame metadata</dfn> (with |metadata|) |
4238 | 4238 | :: 1. Let |metadataCopySerialized| be [$StructuredSerialize$](|metadata|). |
|
4290 | 4290 |
|
4291 | 4291 | VideoFrame CopyTo() Options {#videoframe-copyto-options} |
4292 | 4292 | ------------------------------------------------------------ |
4293 | | -Options to specify a rectangle of pixels to copy, their format and the offset |
| 4293 | +Options to specify a rectangle of pixels to copy, their format, and the offset |
4294 | 4294 | and stride of planes in the destination buffer. |
4295 | 4295 |
|
4296 | 4296 | <xmp class='idl'> |
|
4332 | 4332 | {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} and values of {{VideoFrame/format}}. |
4333 | 4333 | If unspecified or `null`, the {{VideoFrame/format}} is used. |
4334 | 4334 | : <dfn dict-member for=VideoFrameCopyToOptions>colorSpace</dfn> |
4335 | | -:: A {{PredefinedColorSpace}} that <em class="rfc2119">SHALL</em> be used to as |
4336 | | - a target color space for for the pixel data in the destination |
| 4335 | +:: A {{PredefinedColorSpace}} that <em class="rfc2119">SHALL</em> be used as |
| 4336 | + a target color space for the pixel data in the destination |
4337 | 4337 | {{BufferSource}}, but only if {{VideoFrameCopyToOptions/format}} is one of |
4338 | 4338 | {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}, otherwise it is ignored. |
4339 | 4339 | If unspecified or `null`, {{srgb}} is used. |
|
0 commit comments