[webkit-dev] New web-facing canvas feature: "opaque" attribute

Gregg Tavares gman at google.com
Wed Mar 13 15:54:23 PDT 2013


On Wed, Mar 13, 2013 at 1:02 PM, Maciej Stachowiak <mjs at apple.com> wrote:

>
> An attribute on the canvas element would presumably be equally applicable
> to all contexts. Is there a reason that it's better to have opaqueness
> specified at context creation time instead of on the canvas?
>

Changing opaque requires recreating the backingstore for a canvas and
destroying all state on the 2D context object, same as changing width or
height. It's preferable to do such heavy operations once. Especially since
it doesn't seem likely apps will change this often.


> Also, I think "opaque" is easier to understand than "alpha: false".
>
>  - Maciej
>
> On Mar 13, 2013, at 9:57 AM, Gregg Tavares <gman at google.com> wrote:
>
> It would be nice if this was the same as WebGL instead of different.
> Especially because 2d canvas and WebGL need to inter-operate in the near
> future.
>
> In WebGL to create a canvas with no alpha (an opaque canvas) you do this
>
>    gl = canvas.getContext("experimental-webgl", { alpha: false });
>
> Why can't 2D canvas be this
>
>    ctx = canvas.getContext("2d", {alpha: false});
>
> As for why this is important to be the same see the proposal for Canvas in
> Workers here (http://wiki.whatwg.org/wiki/CanvasInWorkers)
>
> In that proposal the "backingstore" of a canvas can be moved to/from a
> worker. That solution may or many not be the final solution but it points
> out that whatever solution is chosen we need the solution to work for both
> canvas 2d and WebGL and as such needs a common way to create backing stores
> with no alpha.
>
>
>
> On Wed, Mar 13, 2013 at 9:30 AM, Dirk Schulze <dschulze at adobe.com> wrote:
>
>> This is a very long thread and I did not see any conclusions or agreement
>> on this thread. Can you summarize the topic and the status on the
>> acceptance level please?
>>
>> Greetings,
>> Dirk
>>
>> On Mar 13, 2013, at 9:15 AM, Stephen White <senorblanco at chromium.org>
>> wrote:
>>
>> > Hi WebKittens,
>> >
>> > I'm planning to implement the canvas "opaque" attribute, as proposed
>> here:
>> http://lists.w3.org/Archives/Public/public-whatwg-archive/2013Mar/0109.html
>> .
>> >
>> > This is an attribute that causes the allocation of an opaque backing
>> store for <canvas>, allowing optimizations at the time the canvas is
>> composited into the page, such as disabling blending and culling obscured
>> content.  It is based on the moz-opaque attribute currently shipping in
>> Firefox.
>> >
>> > I'll be placing the feature behind the build-time flag
>> ENABLE(OPAQUE_CANVAS).
>> >
>> > Let me know if you have any comments or concerns.
>> >
>> > Stephen
>> > _______________________________________________
>> > webkit-dev mailing list
>> > webkit-dev at lists.webkit.org
>> > https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130313/97f9a4a6/attachment.html>


More information about the webkit-dev mailing list