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

Side by Side Diff: Source/platform/transforms/AffineTransform.h

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) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * 2010 Dirk Schulze <krit@webkit.org> 3 * 2010 Dirk Schulze <krit@webkit.org>
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 AffineTransform result = *this; 149 AffineTransform result = *this;
150 result *= t; 150 result *= t;
151 return result; 151 return result;
152 } 152 }
153 153
154 static AffineTransform translation(double x, double y) 154 static AffineTransform translation(double x, double y)
155 { 155 {
156 return AffineTransform(1, 0, 0, 1, x, y); 156 return AffineTransform(1, 0, 0, 1, x, y);
157 } 157 }
158 158
159 AffineTransform& operator =(const AffineTransform &t)
fs 2014/11/10 11:36:43 Hmm, why was this needed? Worrying about self-assi
160 {
161 setMatrix(t.m_transform);
162 return *this;
163 }
164
159 // decompose the matrix into its component parts 165 // decompose the matrix into its component parts
160 typedef struct { 166 typedef struct {
161 double scaleX, scaleY; 167 double scaleX, scaleY;
162 double angle; 168 double angle;
163 double remainderA, remainderB, remainderC, remainderD; 169 double remainderA, remainderB, remainderC, remainderD;
164 double translateX, translateY; 170 double translateX, translateY;
165 } DecomposedType; 171 } DecomposedType;
166 172
167 bool decompose(DecomposedType&) const; 173 bool decompose(DecomposedType&) const;
168 void recompose(const DecomposedType&); 174 void recompose(const DecomposedType&);
169 175
170 private: 176 private:
171 void setMatrix(const Transform m) 177 void setMatrix(const Transform m)
172 { 178 {
173 if (m && m != m_transform) 179 if (m && m != m_transform)
174 memcpy(m_transform, m, sizeof(Transform)); 180 memcpy(m_transform, m, sizeof(Transform));
175 } 181 }
176 182
177 Transform m_transform; 183 Transform m_transform;
178 }; 184 };
179 185
180 } 186 }
181 187
182 #endif 188 #endif
OLDNEW
« Source/core/rendering/svg/RenderSVGShape.cpp ('K') | « Source/core/svg/SVGGraphicsElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698