Bug 11797

Summary: replace SVGMatrix by AffineTransform
Product: WebKit Reporter: Rob Buis <rwlbuis>
Component: SVGAssignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Normal CC: sam
Priority: P2    
Version: 420+   
Hardware: All   
OS: OS X 10.4   
Attachments:
Description Flags
First attempt
none
This one compiles
none
Updated patch
none
Updated patch II
sam: review-
Final patch
none
Updated final patch rwlbuis: review+

Rob Buis
Reported 2006-12-10 12:47:18 PST
SVGMatrix is not needed, it is just the wrappers that need to add this API. Use AffineTransform internally.
Attachments
First attempt (102.04 KB, patch)
2006-12-11 04:13 PST, Rob Buis
no flags
This one compiles (103.04 KB, patch)
2006-12-11 04:48 PST, Rob Buis
no flags
Updated patch (104.89 KB, patch)
2006-12-11 15:55 PST, Nikolas Zimmermann
no flags
Updated patch II (109.33 KB, patch)
2006-12-11 17:07 PST, Nikolas Zimmermann
sam: review-
Final patch (109.82 KB, patch)
2006-12-12 03:15 PST, Nikolas Zimmermann
no flags
Updated final patch (109.60 KB, patch)
2006-12-12 03:26 PST, Nikolas Zimmermann
rwlbuis: review+
Rob Buis
Comment 1 2006-12-11 04:13:40 PST
Created attachment 11799 [details] First attempt This patch causes no regressions, but reapplying and regenerating it gives compile problems... Cheers, Rob.
Rob Buis
Comment 2 2006-12-11 04:48:33 PST
Created attachment 11800 [details] This one compiles This one compiles, thnx WildFox! Waiting for the automatic POD generation before reviewing is needed though. Cheers, Rob.
Nikolas Zimmermann
Comment 3 2006-12-11 15:55:19 PST
Created attachment 11811 [details] Updated patch Patch updated against POD generation.
Nikolas Zimmermann
Comment 4 2006-12-11 17:07:19 PST
Created attachment 11812 [details] Updated patch II Incorporated some of weinig's comments.
Sam Weinig
Comment 5 2006-12-11 19:18:33 PST
Comment on attachment 11812 [details] Updated patch II -- CodeGeneratorObjC.pm Move these up into CodeGenerator.pm +my %podTypeHash = ("RGBColor" => 1, "SVGPoint" => 1, "SVGRect" => 1, "SVGNumber" => 1, "SVGMatrix" => 1); +sub IsPodType +{ + my $type = shift; + + return 1 if $podTypeHash{$type}; + return 0; +} Please use more descriptive Variable names here and put a comment/FIXME stating that the [Custom] support is needed to fix it. There also seem to be quite a few unneeded spaces after the first line. + my $exceptionOne = ($podType and $podType eq "AffineTransform" and $functionName eq "rotateFromVector"); + my $exceptionTwo = ($podType and $podType eq "AffineTransform" and $functionName eq "inverse"); -- SVGAnimateTransformElement.cpp Either remove the commented out code or at least put a comment in about why it is commented out. +/* + if (m_transformMatrix) m_transformMatrix = new SVGMatrix(); else { - m_transformMatrix->reset(); + m_transformMatrix.reset(); if (isAccumulated() && repeations() != 0.0 && m_lastMatrix) m_transformMatrix->multiply(m_lastMatrix.get()); } - + */ Are style, although undocumented, is to use 1.0 instead of just 1. - m_transformMatrix->skewX(sx); + m_transformMatrix.shear(sx, 1.); and - m_transformMatrix->skewY(sy); + m_transformMatrix.shear(1., sy); Is there a more efficient way to do this? - m_transformMatrix = new SVGMatrix(); + m_transformMatrix = AffineTransform(); -- SVGPreserveAspectRatio.cpp Nitpick, re-align function arguments -SVGMatrix* SVGPreserveAspectRatio::getCTM(float logicX, float logicY, +AffineTransform SVGPreserveAspectRatio::getCTM(float logicX, float logicY, float logicWidth, float logicHeight, float /*physX*/, float /*physY*/, float physWidth, float physHeight) -- SVGTransform.cpp Another nitpick, we tend to use the lowercase 'f' for float (I don't know that it makes a difference though) + m_matrix.shear(tan(SVGAngle::torad(angle)), 0.0F); and + m_matrix.shear(0.0F, tan(SVGAngle::torad(angle))); -- AffineTransformCG.cpp Why not just set the variable directly in the struct, instead of creating a new one. Same goes for other platforms. +void AffineTransform::setA(double a) +{ + m_transform = CGAffineTransformMake(a, b(), c(), d(), e(), f()); +} -- SVGRenderTreeAsText.cpp Curly braces go on the same line as the else else { - ts << "{m=((" << m.m11() << "," << m.m12() << ")(" << m.m21() << "," << m.m22() << "))"; - ts << " t=(" << m.dx() << "," << m.dy() << ")}"; + ts << "{m=((" << m.a() << "," << m.b() << ")(" << m.c() << "," << m.d() << "))"; + ts << " t=(" << m.e() << "," << m.f() << ")}"; }
Nikolas Zimmermann
Comment 6 2006-12-12 03:08:32 PST
> Move these up into CodeGenerator.pm Fixed. > Please use more descriptive Variable names here and put a comment/FIXME stating > that the [Custom] support is needed to fix it. There also seem to be quite a > few unneeded spaces after the first line. Fixed. > -- SVGAnimateTransformElement.cpp > > Either remove the commented out code or at least put a comment in about why it > is commented out. Fixed. > Are style, although undocumented, is to use 1.0 instead of just 1. > - m_transformMatrix->skewX(sx); > + m_transformMatrix.shear(sx, 1.); > and > - m_transformMatrix->skewY(sy); > + m_transformMatrix.shear(1., sy); Fixed. > Is there a more efficient way to do this? > - m_transformMatrix = new SVGMatrix(); > + m_transformMatrix = AffineTransform(); Yes, .reset(), fixed. > -- SVGPreserveAspectRatio.cpp > > Nitpick, re-align function arguments Fixed. > -- SVGTransform.cpp > > Another nitpick, we tend to use the lowercase 'f' for float (I don't know that > it makes a difference though) > + m_matrix.shear(tan(SVGAngle::torad(angle)), 0.0F); > and > + m_matrix.shear(0.0F, tan(SVGAngle::torad(angle))); Fixed. > -- AffineTransformCG.cpp > > Why not just set the variable directly in the struct, instead of creating a new > one. Same goes for other platforms. I've done that for all platforms except Qt, where that is not possible. > > -- SVGRenderTreeAsText.cpp > > Curly braces go on the same line as the else Fixed. Attaching new patch soon...
Nikolas Zimmermann
Comment 7 2006-12-12 03:15:26 PST
Created attachment 11816 [details] Final patch Adressed all of Sam's comments.
Nikolas Zimmermann
Comment 8 2006-12-12 03:26:30 PST
Created attachment 11817 [details] Updated final patch Mention the bug report also in LayoutTests/ChangeLog, as suggested by Rob and remove a typo.
Nikolas Zimmermann
Comment 9 2006-12-12 03:32:39 PST
Landed in r18177.
Note You need to log in before you can comment on or make changes to this bug.