Skip to content

Commit

Permalink
Change CanvasBitmap to CanvasSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
ccameron-chromium committed Jan 8, 2025
1 parent 8927cc6 commit 4c74124
Showing 1 changed file with 50 additions and 55 deletions.
105 changes: 50 additions & 55 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -65107,7 +65107,7 @@ interface <dfn interface>CanvasRenderingContext2D</dfn> {
// back-reference to the canvas
readonly attribute <span>HTMLCanvasElement</span> <span data-x="dom-context-2d-canvas">canvas</span>;
};
<span>CanvasRenderingContext2D</span> includes <span>CanvasBitmap</span>;
<span>CanvasRenderingContext2D</span> includes <span>CanvasSettings</span>;
<span>CanvasRenderingContext2D</span> includes <span>CanvasState</span>;
<span>CanvasRenderingContext2D</span> includes <span>CanvasTransform</span>;
<span>CanvasRenderingContext2D</span> includes <span>CanvasCompositing</span>;
Expand All @@ -65125,8 +65125,8 @@ interface <dfn interface>CanvasRenderingContext2D</dfn> {
<span>CanvasRenderingContext2D</span> includes <span>CanvasTextDrawingStyles</span>;
<span>CanvasRenderingContext2D</span> includes <span>CanvasPath</span>;

interface mixin <dfn interface>CanvasBitmap</dfn> {
// bitmap
interface mixin <dfn interface>CanvasSettings</dfn> {
// settings
<span>CanvasRenderingContext2DSettings</span> <span data-x="dom-context-2d-canvas-getcontextattributes">getContextAttributes</span>();
};

Expand Down Expand Up @@ -65475,23 +65475,8 @@ interface <dfn interface>Path2D</dfn> {
data-x="attr-canvas-width">width</code> and <code data-x="attr-canvas-height">height</code>
content attributes.</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-alpha">alpha</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span
data-x="concept-canvas-desynchronized">desynchronized</span> to <var>settings</var>["<dfn
dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-desynchronized">desynchronized</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-color-space">color space</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-colorSpace">colorSpace</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span
data-x="concept-canvas-will-read-frequently">will read frequently</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-willReadFrequently">willReadFrequently</code></dfn>"].</p></li>
<li><p>Run the <span>canvas settings output bitmap initialization algorithm</span>,
given <var>context</var> and <var>settings</var>.</li>

<li><p>Return <var>context</var>.</p></li>
</ol>
Expand Down Expand Up @@ -65631,19 +65616,19 @@ context.fillRect(100,0,50,50); // only this square remains</code></pre>
or to enable double buffering so that graphics updates, like page scrolling for example, can be
processed concurrently while canvas draw commands are being executed.</p>

<h6>The canvas bitmap</h6>
<h6>The canvas settings</h6>

<p>A <code>CanvasBitmap</code> object has an <dfn>output bitmap</dfn> that
<p>A <code>CanvasSettings</code> object has an <dfn>output bitmap</dfn> that
is initialized when the object is created.</p>

<p>The <span>output bitmap</span> has an <span
data-x="concept-canvas-origin-clean">origin-clean</span> flag, which can be set to true or false.
Initially, when one of these bitmaps is created, its <span
data-x="concept-canvas-origin-clean">origin-clean</span> flag must be set to true.</p>

<p>The <code>CanvasBitmap</code> object also has an <dfn
<p>The <code>CanvasSettings</code> object also has an <dfn
data-x="concept-canvas-alpha">alpha</dfn> boolean. When a
<code>CanvasBitmap</code> object's <span
<code>CanvasSettings</code> object's <span
data-x="concept-canvas-alpha">alpha</span> 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.</p>
Expand All @@ -65659,9 +65644,9 @@ context.fillRect(100,0,50,50); // only this square remains</code></pre>
created <span>output bitmap</span> with its <span data-x="concept-canvas-alpha">alpha</span> set
to false will result in a fully-opaque gray square.</p>

<p>The <code>CanvasBitmap</code> object also has a <dfn
<p>The <code>CanvasSettings</code> object also has a <dfn
data-x="concept-canvas-desynchronized">desynchronized</dfn> boolean. When a
<code>CanvasBitmap</code> object's <span
<code>CanvasSettings</code> object's <span
data-x="concept-canvas-desynchronized">desynchronized</span> 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
Expand All @@ -65681,9 +65666,9 @@ context.fillRect(100,0,50,50); // only this square remains</code></pre>
can be useful when implementing certain kinds of applications, such as drawing applications,
where the latency between input and rasterization is critical.</p>

<p>The <code>CanvasBitmap</code> object also has a <dfn
<p>The <code>CanvasSettings</code> object also has a <dfn
data-x="concept-canvas-will-read-frequently">will read frequently</dfn> boolean. When a
<code>CanvasBitmap</code> object's <span
<code>CanvasSettings</code> object's <span
data-x="concept-canvas-will-read-frequently">will read frequently</span> is true, the user agent
may optimize the canvas for readback operations.</p>

Expand All @@ -65693,18 +65678,45 @@ context.fillRect(100,0,50,50); // only this square remains</code></pre>
with the major exception being readback with <code
data-x="dom-context-2d-getImageData">getImageData()</code>, <code
data-x="dom-canvas-toDataURL">toDataURL()</code>, or <code
data-x="dom-canvas-toBlob">toBlob()</code>. <code>CanvasBitmap</code> objects with
data-x="dom-canvas-toBlob">toBlob()</code>. <code>CanvasSettings</code> objects with
<span data-x="concept-canvas-will-read-frequently">will read frequently</span> equal to true tell
the user agent that the webpage is likely to perform many readback operations and that it is
advantageous to use a software canvas.</p>

<p>The <code>CanvasBitmap</code> object also has a <dfn
<p>The <code>CanvasSettings</code> object also has a <dfn
data-x="concept-canvas-color-space">color space</dfn> setting of type
<code>PredefinedColorSpace</code>. The <code>CanvasBitmap</code> object's <span
<code>PredefinedColorSpace</code>. The <code>CanvasSettings</code> object's <span
data-x="concept-canvas-color-space">color space</span> indicates the color space for the
<span>output bitmap</span>.</p>

<p>The <dfn method for="CanvasBitmap"><code
<p>
The <dfn>canvas settings output bitmap initialization algorithm</dfn>, which is passed
<var>canvas</var> (a <code>CanvasSettings</code> object) and
<var>settings</var> (a <code>CanvasRenderingContext2DSettings</code> object), consists
of running these steps:
</p>

<ol>
<li><p>Set <var>context</var>'s <span data-x="concept-canvas-alpha">alpha</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span
data-x="concept-canvas-desynchronized">desynchronized</span> to <var>settings</var>["<dfn
dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-desynchronized">desynchronized</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-color-space">color space</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-colorSpace">colorSpace</code></dfn>"].</p></li>

<li><p>Set <var>context</var>'s <span
data-x="concept-canvas-will-read-frequently">will read frequently</span> to
<var>settings</var>["<dfn dict-member for="CanvasRenderingContext2DSettings"><code
data-x="dom-CanvasRenderingContext2DSettings-willReadFrequently">willReadFrequently</code></dfn>"].</p></li>
</ol>

<p>The <dfn method for="CanvasSettings"><code
data-x="dom-context-2d-canvas-getcontextattributes">getContextAttributes()</code></dfn> method
steps are to return «[ "<code data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code>" →
<span>this</span>'s <span data-x="concept-canvas-alpha">alpha</span>, "<code
Expand Down Expand Up @@ -71089,9 +71101,9 @@ interface <dfn interface>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<th>"<dfn><code data-x="offscreen-context-type-2d">2d</code></dfn>"
<td>
<ol>
<li><p>Let <var>context</var> be the result of running the <span
data-x="Offscreen 2D context creation algorithm">offscreen 2D context creation
algorithm</span> given <span>this</span> and <var>options</var>.</p></li>
<li><p>Let <var>context</var> be the result of running the
<span>offscreen 2D context creation algorithm</span> given
<span>this</span> and <var>options</var>.</p></li>

<li><p>Set <span>this</span>'s <span data-x="offscreencanvas-context-mode">context
mode</span> to <span data-x="offscreencanvas-context-2d">2d</span>.</p></li>
Expand Down Expand Up @@ -71377,7 +71389,7 @@ interface <dfn interface>OffscreenCanvasRenderingContext2D</dfn> {
readonly attribute <span>OffscreenCanvas</span> <span data-x="offscreencontext2d-canvas">canvas</span>;
};

<span>OffscreenCanvasRenderingContext2D</span> includes <span>CanvasBitmap</span>;
<span>OffscreenCanvasRenderingContext2D</span> includes <span>CanvasSettings</span>;
<span>OffscreenCanvasRenderingContext2D</span> includes <span>CanvasState</span>;
<span>OffscreenCanvasRenderingContext2D</span> includes <span>CanvasTransform</span>;
<span>OffscreenCanvasRenderingContext2D</span> includes <span>CanvasCompositing</span>;
Expand Down Expand Up @@ -71436,25 +71448,8 @@ interface <dfn interface>OffscreenCanvasRenderingContext2D</dfn> {
<li><p>Set <var>context</var>'s <span>associated <code>OffscreenCanvas</code> object</span> to
<var>target</var>.</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-alpha">alpha</span> to
<var>settings</var>
["<code data-x="dom-CanvasRenderingContext2DSettings-alpha">alpha</code>"].
</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-desynchronized">desynchronized</span> to
<var>settings</var>
["<code data-x="dom-CanvasRenderingContext2DSettings-desynchronized">desynchronized</code>"].
</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-color-space">color space</span>
to <var>settings</var>
["<code data-x="dom-CanvasRenderingContext2DSettings-colorSpace">colorSpace</code>"].
</p></li>

<li><p>Set <var>context</var>'s <span data-x="concept-canvas-will-read-frequently">will read frequently</span> to
<var>settings</var>
["<code data-x="dom-CanvasRenderingContext2DSettings-willReadFrequently">willReadFrequently</code>"].
</p></li>
<li><p>Run the <span>canvas settings output bitmap initialization algorithm</span>,
given <var>context</var> and <var>settings</var>.</li>

<li><p>Set <var>context</var>'s <span>output bitmap</span> to a newly
created bitmap with the dimensions specified by the <code
Expand Down

0 comments on commit 4c74124

Please sign in to comment.