[whatwg] Canvas performance issue: setting colors

2009-04-30 Thread Ian Hickson
On Tue, 30 Sep 2008, Sjoerd Visscher wrote: > > I think the canvas api should get 2 new methods: > > CanvasColor createRGBAColor(in float r, in float g, in float b, in float a) > CanvasColor createHSLAColor(in float h, in float s, in float l, in float a) On Mon, 29 Sep 2008, Oliver Hunt wrot

Re: [whatwg] Canvas performance issue: setting colors

2008-11-10 Thread Vladimir Vukicevic
On 10/3/08 4:37 PM, Oliver Hunt wrote: Just had a thought (no idea how original) -- how about if fillStyle were able to accept a 3 or 4 number array? eg. fillStyle = [0, 0.3, 0.6, 1.0] ? That might work well if people are using arrays as vectors/colours I actually have a patch sitting around

Re: [whatwg] Canvas performance issue: setting colors

2008-10-04 Thread Kristof Zelechovski
: Re: [whatwg] Canvas performance issue: setting colors > > > Just had a thought (no idea how original) -- how about if fillStyle were > able to accept a 3 or 4 number array? eg. fillStyle = [0, 0.3, 0.6, 1.0] ? > > That might work well if people are using arrays as vectors/colo

Re: [whatwg] Canvas performance issue: setting colors

2008-10-04 Thread Philipp Serafin
> > > Just had a thought (no idea how original) -- how about if fillStyle were > able to accept a 3 or 4 number array? eg. fillStyle = [0, 0.3, 0.6, 1.0] ? > > That might work well if people are using arrays as vectors/colours > Instead of an array, we could also use a generic, "duck-typed" java

Re: [whatwg] Canvas performance issue: setting colors

2008-10-04 Thread Anne van Kesteren
On Sat, 04 Oct 2008 02:55:36 +0200, Greg Houston <[EMAIL PROTECTED]> wrote: Note that also like your example the Mootools color plugin does not have separate rgb and rgba methods. It is smart enough to recognize that if there is a fourth value in the array it refers to the alpha. I never quite g

Re: [whatwg] Canvas performance issue: setting colors

2008-10-03 Thread Greg Houston
On Fri, Oct 3, 2008 at 6:37 PM, Oliver Hunt <[EMAIL PROTECTED]> wrote: > > Just had a thought (no idea how original) -- how about if fillStyle were > able to accept a 3 or 4 number array? eg. fillStyle = [0, 0.3, 0.6, 1.0] ? > > That might work well if people are using arrays as vectors/colours >

Re: [whatwg] Canvas performance issue: setting colors

2008-10-03 Thread Oliver Hunt
I did some basic testing, and it looks like a significant amount of the difference is due to this (based on the frame rate that ToT webkit could kick out, the timeout difference corresponds to around a 30% on its own). However it's difficult to be entirely sure as VMWare (from memory) thro

Re: [whatwg] Canvas performance issue: setting colors

2008-10-03 Thread Robert Sayre
On Mon, Sep 29, 2008 at 6:24 PM, Sjoerd Visscher <[EMAIL PROTECTED]> wrote: > > A large percentage of the time goes into building color strings for setting > the strokeStyle, which the browser then has to take apart again. This is a > very unnecessary performance hit. (Btw, on my Mac this runs fast

Re: [whatwg] Canvas performance issue: setting colors

2008-09-30 Thread Oliver Hunt
On Sep 30, 2008, at 1:09 AM, Sjoerd Visscher wrote: I guess this applies to the other methods and attributes of canvas as well. The majority of canvas methods are constructed in a way that allows an almost direct mapping to a C/C++ call. So when all the canvas code is perfectly optimized,

Re: [whatwg] Canvas performance issue: setting colors

2008-09-30 Thread Sjoerd Visscher
I guess this applies to the other methods and attributes of canvas as well. The majority of canvas methods are constructed in a way that allows an almost direct mapping to a C/C++ call. So when all the canvas code is perfectly optimized, the color code will probably still be the bottleneck.

Re: [whatwg] Canvas performance issue: setting colors

2008-09-29 Thread Oliver Hunt
I think the canvas api should get 2 new methods: CanvasColor createRGBAColor(in float r, in float g, in float b, in float a) CanvasColor createHSLAColor(in float h, in float s, in float l, in float a) WebKit already has a non-standard function -- setFillColor(r, g, b, a) -- that pro

[whatwg] Canvas performance issue: setting colors

2008-09-29 Thread Sjoerd Visscher
Hi, With the increasing speed of javascript engines, some other performance issues are starting to become apparent. Take this demo for example: http://playground.q42.nl/animatie/blobs/sjoerd/blobscolor.html A large percentage of the time goes into building color strings for setting the s