Opened 10 years ago

Closed 9 years ago

#16454 closed enhancement (fixed)

[patch][CCLA]Expand Batch API to Canvas Renderer

Reported by: Patrick Ruzand Owned by: Patrick Ruzand
Priority: low Milestone: 1.9
Component: DojoX GFX Version: 1.8.1
Keywords: Cc: Eugene Lazutkin
Blocked By: Blocking:


Expand the current SVG-specific batch() api to canvas renderer.

Attachments (1)

16454.patch (8.7 KB) - added by Patrick Ruzand 9 years ago.
patch by pruzand (IBM, CCLA)

Download all attachments as: .zip

Change History (8)

comment:1 Changed 10 years ago by Patrick Ruzand

Milestone: tbd1.9
Owner: changed from Eugene Lazutkin to Patrick Ruzand
Priority: undecidedlow
Status: newassigned

comment:2 Changed 9 years ago by Patrick Ruzand

The way the current batch API is implemented (and documented) is that it batches updates to the DOM hierarchy, by creating a temporary fragment that will be used during add/remove operations. Of course, the canvas use case is slightly different. A batch mechanism would in this case batch the redraw() operations, not the (non-existing) dom hierarchy update.
So, as it is, there would be 2 different kinds of batch, depending on the renderer, under the same API umbrella...
Unless... :
It happens that the SVG spec defines the suspendRedraw() API (, which is (almost) exactly what the canvas batch impl. would be.

So, a solution that would be both back-compatible and would preserve consistency across renderer would be that the current batch API (openBatch/closeBatch) be modified as:

  • openBatch would take a new optional parameter that indicates whether redraw operations should be suspended too (in addition to hiearchy updates):
        openBatch(/*Boolean*/ suspendRedraw)

which implies that existing code that invokes openBatch() with no parameters would not get the redraw() batching by default on canvas (on purpose, as it could have some unexpected side effects in svg).

comment:3 Changed 9 years ago by Patrick Ruzand

Another way to introduce this "suspend redraw" batching would be to introduce a new API like suspendRedraw() that will activate the redraw batching, and openBatch(/*Boolean*/suspendRedraw) would call this new api depending on the parameter value.
It allows to make the clear distinction between the hierarchy vs redraw batchings, but allows to use one independently.

comment:4 Changed 9 years ago by Patrick Ruzand

It happens the SVG suspendRedraw API has been dropped by implementers (1) and SVG WG it self (2). So let's forget about it.

But it would still be a valuable feature in the canvas renderer. To avoid to add a new API for this, the canvas renderer could implement openBatch/closeBatch for this purpose.


Changed 9 years ago by Patrick Ruzand

Attachment: 16454.patch added

patch by pruzand (IBM, CCLA)

comment:5 Changed 9 years ago by Patrick Ruzand

Summary: Expand Batch API to Canvas Renderer[patch][CCLA]Expand Batch API to Canvas Renderer

comment:6 Changed 9 years ago by Eugene Lazutkin

Cc: Eugene Lazutkin added

Looks good.

comment:7 Changed 9 years ago by Patrick Ruzand

Resolution: fixed
Status: assignedclosed

In [30899]:

add batch API support to canvas, fixes #16454

Note: See TracTickets for help on using tickets.