[whatwg] I believe source rectangles for HTML5 Canvas drawImage are specified incorrectly

Justin Novosad junov at chromium.org
Mon Sep 10 14:28:18 PDT 2012


On Mon, Sep 10, 2012 at 4:49 PM, Jeff Muizelaar <jmuizelaar at mozilla.com>wrote:

>
> On 2012-09-10, at 3:43 PM, Vladimir Vukicevic wrote:
>
>
> FWIW, there are also negative performance implications to clamping samples
> to the source rect. Many graphics APIs do not support this kind sampling,
> and supporting this behaviour on top of those apis requires a temporary
> copy of the subimage to be made.
>
>
You are referring to the fact that clamping modes only apply to texture
borders in OpenGL and DirectX?  That is not that big of a big deal, you can
implement the clamp in a shader.
I think Vladimir makes a good point that there are valid use cases for both
ways. To summarize the issues:
* clamping to source rect can cause filtering artefacts at boundaries,
especially visible when tiling.
* clamping to source image bounds can cause color bleeding artefacts when
rendering a sprite from a spritemap.



More information about the whatwg mailing list