You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: The {{PaintRenderingContext2D}} implements a subset of the {{CanvasRenderingContext2D}} API.
159
+
Specifically it doesn't implement the {{CanvasHitRegion}}, {{CanvasImageData}} or
160
+
{{CanvasUserInterface}} APIs.
161
+
162
+
A {{PaintRenderingContext2D}} object has a <a>scratch bitmap</a>. This is initialised when the
163
+
object is created. The size of the <a>scratch bitmap</a> is the size of the fragment it is rendering
164
+
plus the size specified by the overflow method.
165
+
166
+
The logical origin (0,0) is not necessarily placed at the origin of the <a>scratch bitmap</a>. If
167
+
the fragment which is being painted has an associated overflow, the logical origin is placed at
168
+
(overflow-left,overflow-top) of the <a>scratch bitmap</a>.
169
+
170
+
Issue: Add image explaining origin vs. logical origin.
171
+
172
+
The size of the <a>scratch bitmap</a> does not necessarily represent the size of the actual bitmap
173
+
that the user agent will use internally or during rendering. For example, if the visual viewport is
174
+
zoomed the user agent may internally use bitmaps which correspond to the number of device pixels in
175
+
the coordinate space, so that the resulting rendering is of high quality.
176
+
177
+
Additionally the user agent may record the sequence of drawing operations which have been applied to
178
+
the <a>scratch bitmap</a> such that the user agent can subsequently draw onto a device bitmap at the
179
+
correct resolution. This also allows user agents to re-use the same output of the <a>scratch
180
+
bitmap</a> repeatably while the visual viewport is being zoomed for example.
181
+
182
+
When the user agent is to <dfn>create a {{PaintRenderingContext2D}} object</dfn> for a given
183
+
|width|, |height| and |overflowOffset| it <em>must</em> run the following steps:
184
+
1. Create a new {{PaintRenderingContext2D}}.
185
+
2. <a>Set bitmap dimensions</a> for the context's <a>scratch bitmap</a> to |width| and |height|.
186
+
3. Set the logical origin of the <a>scratch bitmap</a> to |overflowOffset|.
187
+
4. Return the new {{PaintRenderingContext2D}}.
141
188
189
+
Drawing an image {#drawing-an-image}
190
+
====================================
191
+
192
+
<pre class='idl'>
193
+
[Exposed=Worklet]
142
194
interface Geometry {
143
195
readonly attribute double width;
144
196
readonly attribute double height;
145
197
};
146
198
</pre>
147
199
148
-
Issue: Create a new interface which uses IDL mixins to share methods with CanvasRenderingContext2d.
149
-
150
200
If a <<paint()>> function for a fragment is <a>paint-invalid</a> and the fragment is within the visual viewport,
151
201
then user agent <em>must</em><a>draw an image</a> for the current frame.
152
202
@@ -177,15 +227,10 @@ When the user agent wants to <dfn>draw an image</dfn> of a <<paint()>> for a <va
177
227
Note: User agents may have to compute overflow before entering their paint phase in order to determine which fragments to paint (overflow changes what could be seen on the output device).
178
228
User agents may opt into running the steps up to this point, to determine overflow, then continuing later to determine the drawn image for the fragments which need painting.
179
229
180
-
7. Let <var>renderingContext</var> be a new {{PaintRenderingContext2d}}.
181
-
182
-
The backing size of the |renderingContext| must be the size of the |fragment| plus the size specified by |overflow|.
183
-
184
-
The user agent must ensure to <a>reset the rendering context to its default state</a>.
185
-
186
-
The origin of the |renderingContext| must be offset by the left, top size specified by |overflow|.
187
-
188
-
Note: (0,0) is the top-left of the |fragment|, (-offsetLeft,-offsetTop) is the top-left of the |overflow|.
230
+
7. Let <var>renderingContext</var> be the result of <a>create a {{PaintRenderingContext2D}} object</a> given:
231
+
- "overflowOffset" - The logical offset for the <a>scratch bitmap</a> specified by |overflow|.
232
+
- "width" - The width of the |fragment| plus the additional width specified by |overflow|.
233
+
- "height" - The height of the |fragment| plus the additional height specified by |overflow|.
189
234
190
235
Note: The |renderingContext| must not be re-used between invocations of paint. Implicitly this means that there is no stored data, or state on the |renderingContext| between invocations.
191
236
For example you can't setup a clip on the context, and expect the same clip to be applied next time the paint method is called.
0 commit comments