| 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/PaintChunkProperties.h" |
| 10 #include <ostream> // NOLINT | 10 #include <ostream> // NOLINT |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 void PrintTo(const PaintChunk& chunk, std::ostream* os) | 14 void PrintTo(const PaintChunk& chunk, std::ostream* os) |
| 15 { | 15 { |
| 16 *os << "PaintChunk(begin=" << chunk.beginIndex | 16 *os << "PaintChunk(begin=" << chunk.beginIndex |
| 17 << ", end=" << chunk.endIndex | 17 << ", end=" << chunk.endIndex |
| 18 << ", props="; | 18 << ", props="; |
| 19 PrintTo(chunk.properties, os); | 19 PrintTo(chunk.properties, os); |
| 20 *os << ")"; | 20 *os << ")"; |
| 21 } | 21 } |
| 22 | 22 |
| 23 void PrintTo(const PaintProperties& properties, std::ostream* os) | 23 void PrintTo(const PaintChunkProperties& properties, std::ostream* os) |
| 24 { | 24 { |
| 25 *os << "PaintProperties()"; | 25 *os << "PaintChunkProperties("; |
| 26 if (properties.transform) { |
| 27 *os << "transform="; |
| 28 PrintTo(*properties.transform, os); |
| 29 } |
| 30 *os << ")"; |
| 31 } |
| 32 |
| 33 // TODO(pdr): Create and move this to TransformPrinters.cpp. |
| 34 static void PrintTo(const TransformationMatrix& matrix, std::ostream* os) |
| 35 { |
| 36 TransformationMatrix::DecomposedType decomposition; |
| 37 if (!matrix.decompose(decomposition)) { |
| 38 *os << "TransformationMatrix(degenerate)"; |
| 39 return; |
| 40 } |
| 41 |
| 42 if (matrix.isIdentityOrTranslation()) { |
| 43 *os << "TransformationMatrix(translation=(" << decomposition.translateX
<< "," << decomposition.translateY << "," << decomposition.translateZ << "))"; |
| 44 return; |
| 45 } |
| 46 |
| 47 *os << "TransformationMatrix(" |
| 48 << "translation=(" << decomposition.translateX << "," << decomposition.t
ranslateY << "," << decomposition.translateZ << ")" |
| 49 << ", scale=(" << decomposition.scaleX << "," << decomposition.scaleY <<
"," << decomposition.scaleZ << ")" |
| 50 << ", skew=(" << decomposition.skewXY << "," << decomposition.skewXZ <<
"," << decomposition.skewYZ << ")" |
| 51 << ", quaternion=(" << decomposition.quaternionX << "," << decomposition
.quaternionY << "," << decomposition.quaternionZ << "," << decomposition.quatern
ionW << ")" |
| 52 << ", perspective=(" << decomposition.perspectiveX << "," << decompositi
on.perspectiveY << "," << decomposition.perspectiveZ << "," << decomposition.per
spectiveW << ")" |
| 53 << ")"; |
| 54 } |
| 55 |
| 56 void PrintTo(const TransformPaintPropertyNode& transformPaintProperty, std::ostr
eam* os) |
| 57 { |
| 58 *os << "TransformPaintPropertyNode(matrix="; |
| 59 PrintTo(transformPaintProperty.matrix(), os); |
| 60 *os << ", origin="; |
| 61 PrintTo(transformPaintProperty.origin(), os); |
| 62 *os << ")"; |
| 26 } | 63 } |
| 27 | 64 |
| 28 } // namespace blink | 65 } // namespace blink |
| OLD | NEW |