Re: [whatwg] High-density canvases

On Fri, Jun 27, 2014 at 6:42 PM, Robert O'Callahan <robert@ocallahan.org>
wrote:

> On Sat, Jun 28, 2014 at 3:41 AM, Justin Novosad <junov@google.com> wrote:
>
>> Example of a problematic renderedsizechange event listener:
>>
>> canvas.width = Math.floor(canvas.renderedPixelWidth * myPixelScale);
>> canvas.height = Math.floor(canvas.renderedPixelHeight * myPixelScale);
>>
>
> I don't know why anyone would actually want to do this.
>

Could be performance, saving memory, retro game pixelated look, who knows.
For sure people are going to end up doing stuff like this if the API allows
it. The scary part is that web-developpers may test their page and
everything will seem OK, but then some clients that have a full page zoom
at a specific ratio or

If we don't want to bother supporting cases like this, then we should
constrain the API. For example we could implement an auto-resize option
instead of exposing renderedPixelWidth/Height, that way the browser stays
in charge of the resizing.

>
> This behavior seems sound at first glance, but because that arithmetic may
>> induce a change to the intrinsic aspect ratio due to rounding, step 3) may
>> not jump out of the loop during the second iteration, thus allowing the
>> feedback loop to keep spinning.
>>
>
> What are the specified values of CSS 'width' and 'height' on the canvas in
> your example?
>

Anything but 'auto'.


>
> Rob
> --
> Jtehsauts  tshaei dS,o n" Wohfy  Mdaon  yhoaus  eanuttehrotraiitny  eovni
> le atrhtohu gthot sf oirng iyvoeu rs ihnesa.r"t sS?o  Whhei csha iids  teoa
> stiheer :p atroa lsyazye,d  'mYaonu,r  "sGients  uapr,e  tfaokreg iyvoeunr,
> 'm aotr  atnod  sgaoy ,h o'mGee.t"  uTph eann dt hwea lmka'n?  gBoutt  uIp
> waanndt  wyeonut  thoo mken.o w
>

Received on Wednesday, 2 July 2014 15:03:53 UTC