Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Side by Side Diff: Source/core/svg/SVGGraphicsElement.cpp

Issue 701433002: Lazily allocate svg shape transforms, shrink RenderSVGShape by 44B (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address reviewer comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2014 Google, Inc. 4 * Copyright (C) 2014 Google, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getCTMFromJavascript() 115 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getCTMFromJavascript()
116 { 116 {
117 return SVGMatrixTearOff::create(getCTM()); 117 return SVGMatrixTearOff::create(getCTM());
118 } 118 }
119 119
120 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript() 120 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript()
121 { 121 {
122 return SVGMatrixTearOff::create(getScreenCTM()); 122 return SVGMatrixTearOff::create(getScreenCTM());
123 } 123 }
124 124
125 bool SVGGraphicsElement::hasAnimatedLocalTransform() const
126 {
127 RenderStyle* style = renderer() ? renderer()->style() : 0;
128
129 // Each of these is used in SVGGraphicsElement::calculateAnimatedLocalTransf orm to create an animated local transform.
130 return (style && style->hasTransform()) || !m_transform->currentValue()->isE mpty() || hasSVGRareData();
131 }
132
125 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const 133 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const
126 { 134 {
127 AffineTransform matrix; 135 AffineTransform matrix;
128 RenderStyle* style = renderer() ? renderer()->style() : 0; 136 RenderStyle* style = renderer() ? renderer()->style() : 0;
129 137
130 // If CSS property was set, use that, otherwise fallback to attribute (if se t). 138 // If CSS property was set, use that, otherwise fallback to attribute (if se t).
131 if (style && style->hasTransform()) { 139 if (style && style->hasTransform()) {
132 TransformationMatrix transform; 140 TransformationMatrix transform;
133 float zoom = style->effectiveZoom(); 141 float zoom = style->effectiveZoom();
134 142
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 return new RenderSVGPath(this); 265 return new RenderSVGPath(this);
258 } 266 }
259 267
260 void SVGGraphicsElement::toClipPath(Path& path) 268 void SVGGraphicsElement::toClipPath(Path& path)
261 { 269 {
262 updatePathFromGraphicsElement(this, path); 270 updatePathFromGraphicsElement(this, path);
263 path.transform(calculateAnimatedLocalTransform()); 271 path.transform(calculateAnimatedLocalTransform());
264 } 272 }
265 273
266 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698