Sun 22 Jun 2008 02:15:10 AM UTC, comment #9:
This bug item was due to bogus implementation of "m.invert()". It was not an accuracy problem, it was a bug. BTW, this bug should be fixed now.
> And I wonder if gnash::matrix has enough precision to maintain
> accuracy. Perhaps we should use a general purpose matrix for
> AGG.
I think the answer is dependent on the use cases.
(1)The integer matrix is accurate enough for the core. "general purpose matrix" is too accurate and uncompatible for the core.
(2)We might need a general matrix for the renderer and for supporting random transformation from external user's requests.
see explanation below:
> matrix m = fill_styles[fno].get_gradient_matrix();
> m.invert();
> matrix cm = fillstyle_matrix;
> cm.invert();
For matrix::invert(), a 16.16 fixed format should be enough in theory, since the calculation itself is closed in mathematics. "closed" means the result also follows into 16.16 fixed format. (Fine so far, this code means fecthing filling styles from the core, swf specific)
> m.concatenate(cm);
In theroy, matrix::concatenate() is not closed in mathematics, which means the result cann't be represented in another 16.16 fixed format. But according to my tests, being "accurate" here is wrong, which means we do need to truncate the final result of matrix::concatenate() to a 16.16 fixed format. And this is not a special case, cxform truncates the same way. (Fine so far, this code means get the final concatenated transformation matrix from the core, swf specific)
> m.concatenate(inv_stage_matrix);
Now, "truncation" here might not be expected here, since the stage_matrix in Gnash is not swf defined.
eg.
gnash -width 10000000 -height 10000000 input.swf
gnash -width 100.0000001 -height 100.000001 input.swf
This command would affect the stage_matrix in Gnash if I understand correctly. So if we want to maintain the accuracy for the user, we might need a general purpose matrix.
AGG(and all other renderers I guess) does have its own general purpose matrix. In agg, it's defined as agg::trans_affine. It's already used a lot in agg. We can convert the gnash::matrix to agg matrix whenever we needed and do the concatenation and invertion later when accuracy is required.
|