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

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

Issue 170453004: Add constant twoPiDouble/twoPiFloat to MathExtras.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 from.decompose(srA); 310 from.decompose(srA);
311 this->decompose(srB); 311 this->decompose(srB);
312 312
313 // If x-axis of one is flipped, and y-axis of the other, convert to an unfli pped rotation. 313 // If x-axis of one is flipped, and y-axis of the other, convert to an unfli pped rotation.
314 if ((srA.scaleX < 0 && srB.scaleY < 0) || (srA.scaleY < 0 && srB.scaleX < 0 )) { 314 if ((srA.scaleX < 0 && srB.scaleY < 0) || (srA.scaleY < 0 && srB.scaleX < 0 )) {
315 srA.scaleX = -srA.scaleX; 315 srA.scaleX = -srA.scaleX;
316 srA.scaleY = -srA.scaleY; 316 srA.scaleY = -srA.scaleY;
317 srA.angle += srA.angle < 0 ? piDouble : -piDouble; 317 srA.angle += srA.angle < 0 ? piDouble : -piDouble;
318 } 318 }
319 319
320 const double twoPiDouble = piDouble * 2;
Justin Novosad 2014/02/20 19:38:05 Does this really accomplish anything that the comp
321
320 // Don't rotate the long way around. 322 // Don't rotate the long way around.
321 srA.angle = fmod(srA.angle, 2 * piDouble); 323 srA.angle = fmod(srA.angle, twoPiDouble);
322 srB.angle = fmod(srB.angle, 2 * piDouble); 324 srB.angle = fmod(srB.angle, twoPiDouble);
323 325
324 if (fabs(srA.angle - srB.angle) > piDouble) { 326 if (fabs(srA.angle - srB.angle) > piDouble) {
325 if (srA.angle > srB.angle) 327 if (srA.angle > srB.angle)
326 srA.angle -= piDouble * 2; 328 srA.angle -= twoPiDouble;
327 else 329 else
328 srB.angle -= piDouble * 2; 330 srB.angle -= twoPiDouble;
329 } 331 }
330 332
331 srA.scaleX += progress * (srB.scaleX - srA.scaleX); 333 srA.scaleX += progress * (srB.scaleX - srA.scaleX);
332 srA.scaleY += progress * (srB.scaleY - srA.scaleY); 334 srA.scaleY += progress * (srB.scaleY - srA.scaleY);
333 srA.angle += progress * (srB.angle - srA.angle); 335 srA.angle += progress * (srB.angle - srA.angle);
334 srA.remainderA += progress * (srB.remainderA - srA.remainderA); 336 srA.remainderA += progress * (srB.remainderA - srA.remainderA);
335 srA.remainderB += progress * (srB.remainderB - srA.remainderB); 337 srA.remainderB += progress * (srB.remainderB - srA.remainderB);
336 srA.remainderC += progress * (srB.remainderC - srA.remainderC); 338 srA.remainderC += progress * (srB.remainderC - srA.remainderC);
337 srA.remainderD += progress * (srB.remainderD - srA.remainderD); 339 srA.remainderD += progress * (srB.remainderD - srA.remainderD);
338 srA.translateX += progress * (srB.translateX - srA.translateX); 340 srA.translateX += progress * (srB.translateX - srA.translateX);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 this->setB(decomp.remainderB); 396 this->setB(decomp.remainderB);
395 this->setC(decomp.remainderC); 397 this->setC(decomp.remainderC);
396 this->setD(decomp.remainderD); 398 this->setD(decomp.remainderD);
397 this->setE(decomp.translateX); 399 this->setE(decomp.translateX);
398 this->setF(decomp.translateY); 400 this->setF(decomp.translateY);
399 this->rotate(rad2deg(decomp.angle)); 401 this->rotate(rad2deg(decomp.angle));
400 this->scale(decomp.scaleX, decomp.scaleY); 402 this->scale(decomp.scaleX, decomp.scaleY);
401 } 403 }
402 404
403 } 405 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698