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

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: add constant values to header 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 | « Source/platform/graphics/filters/FEGaussianBlur.cpp ('k') | Source/wtf/MathExtras.h » ('j') | 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 this->decompose(srB); 315 this->decompose(srB);
316 316
317 // If x-axis of one is flipped, and y-axis of the other, convert to an unfli pped rotation. 317 // If x-axis of one is flipped, and y-axis of the other, convert to an unfli pped rotation.
318 if ((srA.scaleX < 0 && srB.scaleY < 0) || (srA.scaleY < 0 && srB.scaleX < 0 )) { 318 if ((srA.scaleX < 0 && srB.scaleY < 0) || (srA.scaleY < 0 && srB.scaleX < 0 )) {
319 srA.scaleX = -srA.scaleX; 319 srA.scaleX = -srA.scaleX;
320 srA.scaleY = -srA.scaleY; 320 srA.scaleY = -srA.scaleY;
321 srA.angle += srA.angle < 0 ? piDouble : -piDouble; 321 srA.angle += srA.angle < 0 ? piDouble : -piDouble;
322 } 322 }
323 323
324 // Don't rotate the long way around. 324 // Don't rotate the long way around.
325 srA.angle = fmod(srA.angle, 2 * piDouble); 325 srA.angle = fmod(srA.angle, twoPiDouble);
326 srB.angle = fmod(srB.angle, 2 * piDouble); 326 srB.angle = fmod(srB.angle, twoPiDouble);
327 327
328 if (fabs(srA.angle - srB.angle) > piDouble) { 328 if (fabs(srA.angle - srB.angle) > piDouble) {
329 if (srA.angle > srB.angle) 329 if (srA.angle > srB.angle)
330 srA.angle -= piDouble * 2; 330 srA.angle -= twoPiDouble;
331 else 331 else
332 srB.angle -= piDouble * 2; 332 srB.angle -= twoPiDouble;
333 } 333 }
334 334
335 srA.scaleX += progress * (srB.scaleX - srA.scaleX); 335 srA.scaleX += progress * (srB.scaleX - srA.scaleX);
336 srA.scaleY += progress * (srB.scaleY - srA.scaleY); 336 srA.scaleY += progress * (srB.scaleY - srA.scaleY);
337 srA.angle += progress * (srB.angle - srA.angle); 337 srA.angle += progress * (srB.angle - srA.angle);
338 srA.remainderA += progress * (srB.remainderA - srA.remainderA); 338 srA.remainderA += progress * (srB.remainderA - srA.remainderA);
339 srA.remainderB += progress * (srB.remainderB - srA.remainderB); 339 srA.remainderB += progress * (srB.remainderB - srA.remainderB);
340 srA.remainderC += progress * (srB.remainderC - srA.remainderC); 340 srA.remainderC += progress * (srB.remainderC - srA.remainderC);
341 srA.remainderD += progress * (srB.remainderD - srA.remainderD); 341 srA.remainderD += progress * (srB.remainderD - srA.remainderD);
342 srA.translateX += progress * (srB.translateX - srA.translateX); 342 srA.translateX += progress * (srB.translateX - srA.translateX);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 this->setB(decomp.remainderB); 398 this->setB(decomp.remainderB);
399 this->setC(decomp.remainderC); 399 this->setC(decomp.remainderC);
400 this->setD(decomp.remainderD); 400 this->setD(decomp.remainderD);
401 this->setE(decomp.translateX); 401 this->setE(decomp.translateX);
402 this->setF(decomp.translateY); 402 this->setF(decomp.translateY);
403 this->rotateRadians(decomp.angle); 403 this->rotateRadians(decomp.angle);
404 this->scale(decomp.scaleX, decomp.scaleY); 404 this->scale(decomp.scaleX, decomp.scaleY);
405 } 405 }
406 406
407 } 407 }
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/FEGaussianBlur.cpp ('k') | Source/wtf/MathExtras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698