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

Side by Side Diff: third_party/WebKit/Source/platform/transforms/TransformationMatrix.h

Issue 2265453003: Add platform/transforms pretty printers for logging and testing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update per reviewer comments Created 4 years, 4 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
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 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 387
388 // If this transformation is identity or 2D translation, returns the 388 // If this transformation is identity or 2D translation, returns the
389 // translation. 389 // translation.
390 FloatSize to2DTranslation() const; 390 FloatSize to2DTranslation() const;
391 391
392 typedef float FloatMatrix4[16]; 392 typedef float FloatMatrix4[16];
393 void toColumnMajorFloatArray(FloatMatrix4& result) const; 393 void toColumnMajorFloatArray(FloatMatrix4& result) const;
394 394
395 static SkMatrix44 toSkMatrix44(const TransformationMatrix&); 395 static SkMatrix44 toSkMatrix44(const TransformationMatrix&);
396 396
397 // If |asMatrix|, return the matrix in row-major order. Otherwise, return
398 // the transform's decomposition which shows the translation, scale, etc.
399 String toString(bool asMatrix = false) const;
400
397 private: 401 private:
398 // multiply passed 2D point by matrix (assume z=0) 402 // multiply passed 2D point by matrix (assume z=0)
399 void multVecMatrix(double x, double y, double& dstX, double& dstY) const; 403 void multVecMatrix(double x, double y, double& dstX, double& dstY) const;
400 FloatPoint internalMapPoint(const FloatPoint& sourcePoint) const 404 FloatPoint internalMapPoint(const FloatPoint& sourcePoint) const
401 { 405 {
402 double resultX; 406 double resultX;
403 double resultY; 407 double resultY;
404 multVecMatrix(sourcePoint.x(), sourcePoint.y(), resultX, resultY); 408 multVecMatrix(sourcePoint.x(), sourcePoint.y(), resultX, resultY);
405 return FloatPoint(static_cast<float>(resultX), static_cast<float>(result Y)); 409 return FloatPoint(static_cast<float>(resultX), static_cast<float>(result Y));
406 } 410 }
(...skipping 27 matching lines...) Expand all
434 Matrix4 m_matrix; 438 Matrix4 m_matrix;
435 }; 439 };
436 440
437 // Redeclared here to avoid ODR issues. 441 // Redeclared here to avoid ODR issues.
438 // See platform/testing/TransformPrinters.h. 442 // See platform/testing/TransformPrinters.h.
439 void PrintTo(const TransformationMatrix&, std::ostream*); 443 void PrintTo(const TransformationMatrix&, std::ostream*);
440 444
441 } // namespace blink 445 } // namespace blink
442 446
443 #endif // TransformationMatrix_h 447 #endif // TransformationMatrix_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698