Re: Rounding with #xywh=percent:25,25,50,50

On Tue, 03 Jan 2012 13:28:47 +0100, Raphaël Troncy  
<raphael.troncy@eurecom.fr> wrote:

>> Thanks! Where is the spec being maintained right now? Neither
>> http://www.w3.org/TR/media-frags/
>
> This is the latest version of the spec that has been published after a  
> group vote (in this case, the CR version of the spec).
>
>> nor
>> http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/ seem
>> to have been updated for over a month.
>
> http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/ has  
> been updated today for example. Don't look at the date of the document  
> which is wrong. I'm modifying it at the moment.
> Look at  
> http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/#valid-uri-spatial  
> to see the paragraph which has been edited.

Found it:

xywh=percent:a,b,c,d with a+c <= 100, b+d <= 100: the UA displays a  
spatial fragment with coordinates (in pixel xywh format) floor(a/w*100),  
floor(b/h*100), ceil(c/w*100), ceil(d/h*100) (the normal percent case).

Unfortunately, the formula is wrong for the right and bottom edge, as  
ceil(w) != ceil(x+w) - floor(x), try e.g. x=12.5 and w=50:

ceil(50) = 50
ceil(12.5+50) - floor(12.5) = 63 - 12 = 51

In other words, it is the right/bottom edge that must be ceil'd, not the  
width/height.

-- 
Philip Jägenstedt
Core Developer
Opera Software

Received on Tuesday, 3 January 2012 13:04:44 UTC