| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/testing/PaintPrinters.h" | 6 #include "platform/testing/PaintPrinters.h" |
| 7 | 7 |
| 8 #include "platform/graphics/paint/PaintChunk.h" | 8 #include "platform/graphics/paint/PaintChunk.h" |
| 9 #include "platform/graphics/paint/PaintProperties.h" | 9 #include "platform/graphics/paint/PaintProperties.h" |
| 10 #include "platform/graphics/paint/TransformPaintProperty.h" |
| 11 |
| 10 #include <ostream> // NOLINT | 12 #include <ostream> // NOLINT |
| 11 | 13 |
| 12 namespace blink { | 14 namespace blink { |
| 13 | 15 |
| 14 void PrintTo(const PaintChunk& chunk, std::ostream* os) | 16 void PrintTo(const PaintChunk& chunk, std::ostream* os) |
| 15 { | 17 { |
| 16 *os << "PaintChunk(begin=" << chunk.beginIndex | 18 *os << "PaintChunk(begin=" << chunk.beginIndex |
| 17 << ", end=" << chunk.endIndex | 19 << ", end=" << chunk.endIndex |
| 18 << ", props="; | 20 << ", props="; |
| 19 PrintTo(chunk.properties, os); | 21 PrintTo(chunk.properties, os); |
| 20 *os << ")"; | 22 *os << ")"; |
| 21 } | 23 } |
| 22 | 24 |
| 23 void PrintTo(const PaintProperties& properties, std::ostream* os) | 25 void PrintTo(const PaintProperties& properties, std::ostream* os) |
| 24 { | 26 { |
| 25 *os << "PaintProperties()"; | 27 *os << "PaintProperties(transformIndex=" << properties.transformIndex << ")"
; |
| 28 } |
| 29 |
| 30 // TODO(pdr): Create and move this to TransformPrinters.cpp. |
| 31 static void PrintTo(const TransformationMatrix& matrix, std::ostream* os) |
| 32 { |
| 33 TransformationMatrix::DecomposedType decomposition; |
| 34 if (!matrix.decompose(decomposition)) { |
| 35 *os << "TransformationMatrix(degenerate)"; |
| 36 return; |
| 37 } |
| 38 |
| 39 if (matrix.isIdentityOrTranslation()) { |
| 40 *os << "TransformationMatrix(translation=(" << decomposition.translateX
<< "," << decomposition.translateY << "," << decomposition.translateZ << "))"; |
| 41 return; |
| 42 } |
| 43 |
| 44 *os << "TransformationMatrix(" |
| 45 << "translation=(" << decomposition.translateX << "," << decomposition.t
ranslateY << "," << decomposition.translateZ << ")" |
| 46 << ", scale=(" << decomposition.scaleX << "," << decomposition.scaleY <<
"," << decomposition.scaleZ << ")" |
| 47 << ", skew=(" << decomposition.skewXY << "," << decomposition.skewXZ <<
"," << decomposition.skewYZ << ")" |
| 48 << ", quaternion=(" << decomposition.quaternionX << "," << decomposition
.quaternionY << "," << decomposition.quaternionZ << "," << decomposition.quatern
ionW << ")" |
| 49 << ", perspective=(" << decomposition.perspectiveX << "," << decompositi
on.perspectiveY << "," << decomposition.perspectiveZ << "," << decomposition.per
spectiveW << ")" |
| 50 << ")"; |
| 51 } |
| 52 |
| 53 void PrintTo(const TransformPaintProperty& transformPaintProperty, std::ostream*
os) |
| 54 { |
| 55 *os << "TransformPaintProperty(matrix="; |
| 56 PrintTo(transformPaintProperty.matrix(), os); |
| 57 *os << ", origin="; |
| 58 PrintTo(transformPaintProperty.origin(), os); |
| 59 *os << ")"; |
| 26 } | 60 } |
| 27 | 61 |
| 28 } // namespace blink | 62 } // namespace blink |
| OLD | NEW |