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

Side by Side Diff: third_party/WebKit/WebCore/svg/SVGPreserveAspectRatio.cpp

Issue 21184: WebKit merge 40722:40785 (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 10 months 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 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 4
5 This file is part of the KDE project 5 This file is part of the KDE project
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 { 171 {
172 TransformationMatrix temp; 172 TransformationMatrix temp;
173 173
174 if (align() == SVG_PRESERVEASPECTRATIO_UNKNOWN) 174 if (align() == SVG_PRESERVEASPECTRATIO_UNKNOWN)
175 return temp; 175 return temp;
176 176
177 double vpar = logicWidth / logicHeight; 177 double vpar = logicWidth / logicHeight;
178 double svgar = physWidth / physHeight; 178 double svgar = physWidth / physHeight;
179 179
180 if (align() == SVG_PRESERVEASPECTRATIO_NONE) { 180 if (align() == SVG_PRESERVEASPECTRATIO_NONE) {
181 temp.scale(physWidth / logicWidth, physHeight / logicHeight); 181 temp.scaleNonUniform(physWidth / logicWidth, physHeight / logicHeight);
182 temp.translate(-logicX, -logicY); 182 temp.translate(-logicX, -logicY);
183 } else if (vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar > = svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE)) { 183 } else if (vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar > = svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE)) {
184 temp.scale(physHeight / logicHeight, physHeight / logicHeight); 184 temp.scaleNonUniform(physHeight / logicHeight, physHeight / logicHeight) ;
185 185
186 if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESER VEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX) 186 if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESER VEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX)
187 temp.translate(-logicX, -logicY); 187 temp.translate(-logicX, -logicY);
188 else if (align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_P RESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX) 188 else if (align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_P RESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX)
189 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / phy sHeight) / 2, -logicY); 189 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / phy sHeight) / 2, -logicY);
190 else 190 else
191 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / phy sHeight), -logicY); 191 temp.translate(-logicX - (logicWidth - physWidth * logicHeight / phy sHeight), -logicY);
192 } else { 192 } else {
193 temp.scale(physWidth / logicWidth, physWidth / logicWidth); 193 temp.scaleNonUniform(physWidth / logicWidth, physWidth / logicWidth);
194 194
195 if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESER VEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN) 195 if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESER VEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN)
196 temp.translate(-logicX, -logicY); 196 temp.translate(-logicX, -logicY);
197 else if (align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_P RESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID) 197 else if (align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_P RESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID)
198 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicW idth / physWidth) / 2); 198 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicW idth / physWidth) / 2);
199 else 199 else
200 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicW idth / physWidth)); 200 temp.translate(-logicX, -logicY - (logicHeight - physHeight * logicW idth / physWidth));
201 } 201 }
202 202
203 return temp; 203 return temp;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 result += " slice"; 252 result += " slice";
253 break; 253 break;
254 }; 254 };
255 255
256 return result; 256 return result;
257 } 257 }
258 258
259 } 259 }
260 260
261 #endif // ENABLE(SVG) 261 #endif // ENABLE(SVG)
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/svg/SVGAnimateMotionElement.cpp ('k') | third_party/WebKit/WebCore/svg/SVGSVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698