diff --git a/source b/source index d557d6bedb9..1d179a3c075 100644 --- a/source +++ b/source @@ -60200,6 +60200,7 @@ enum CanvasFillRule { "CanvasRenderingContext2DSettings { boolean alpha = true; + boolean desynchronized = false; }; enum ImageSmoothingQuality { "low", "medium", "high" }; @@ -60452,36 +60453,38 @@ interface Path2D { objects.
getContext
('2d' [, { [ alpha
: false ] } ] )getContext
('2d' [, { [ alpha
: true ] [, desynchronized
: false ] } ] )Returns a CanvasRenderingContext2D
object that is permanently bound to a
particular canvas
element.
If the alpha
setting is
- provided and set to false, then the canvas is forced to always be opaque.
If the alpha
member is
+ false, then the context is forced to always be opaque.
If the desynchronized
member is
+ true, then the context might be desynchronized.
canvas
Returns the canvas
element.
getContextAttributes
()Returns an object whose:
-Returns an object whose alpha
member is true if
- the context has an alpha channel, or false if it was forced to be opaque.
alpha
member is true if the context has an alpha
+ channel, or false if it was forced to be opaque.desynchronized
+ member is true if the context can be desynchronized.The CanvasRenderingContext2D
object also has an alpha flag, which can be set to true or false. Initially,
- when the context is created, its alpha flag must be
- set to true. When a CanvasRenderingContext2D
object has its alpha flag set to false, then its alpha channel must be
- fixed to 1.0 (fully opaque) for all pixels, and attempts to change the alpha component of any
- pixel must be silently ignored.
CanvasRenderingContext2D
object's alpha is false, then its alpha channel must be fixed to 1.0
+ (fully opaque) for all pixels, and attempts to change the alpha component of any pixel must be
+ silently ignored.
Thus, the bitmap of such a context starts off as opaque black instead
of transparent black; clearRect()
@@ -60512,14 +60514,43 @@ interface Path2D {
fourth byte in its input, and so on. However, the alpha component of styles and images drawn
onto the canvas are still honoured up to the point where they would impact the output
bitmap's alpha channel; for instance, drawing a 50% transparent white square on a freshly
- created output bitmap with its alpha
- flag set to false will result in a fully-opaque gray square.
The CanvasRenderingContext2D
object also has a desynchronized boolean. When a
+ CanvasRenderingContext2D
object's desynchronized is true, then the user agent may
+ optimize the rendering of the canvas to reduce the latency, as measured from input events to
+ rasterization, by desynchronizing the canvas paint cycle from the event loop, bypassing the
+ ordinary user agent rendering algorithm, or both. Insofar as this mode involves bypassing the
+ usual paint mechanisms, rasterization, or both, it might introduce visible tearing artifacts.
The user agent usually renders on a buffer which is not being displayed, quickly + swapping it and the one being scanned out for presentation; the former buffer is called + back buffer and the latter front buffer. A popular technique for reducing latency is called + front buffer rendering, also known as single buffer rendering, where rendering happens in + parallel and racily with the scanning out process. This technique reduces the latency at the price + of potentially introducing tearing artifacts and can be used to implement in total or part of the + desynchronized boolean.
+ +The desynchronized boolean + can be useful when implementing certain kinds of applications, such as drawing applications, + where the latency between input and rasterization is critical.
The getContextAttributes()
method,
- when invoked, must return a CanvasRenderingContext2DSettings
dictionary whose alpha
member is set to true if this context's alpha flag is set, and false otherwise.
CanvasRenderingContext2DSettings
dictionary containing
+ the following members:
+
+ alpha
, set to this context's alpha.
desynchronized
, set to this context's
+ desynchronized.
height
content attributes.
- Process each of the members of settings as follows:
+Set context's alpha to
+ settings's alpha
.
alpha
Set context's desynchronized to settings's desynchronized
.
Return context.