| 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 "platform/testing/PaintPrinters.h" | 5 #include "platform/testing/PaintPrinters.h" |
| 6 | 6 |
| 7 #include "platform/graphics/paint/PaintChunk.h" | 7 #include "platform/graphics/paint/PaintChunk.h" |
| 8 #include "platform/graphics/paint/PaintChunkProperties.h" | 8 #include "platform/graphics/paint/PaintChunkProperties.h" |
| 9 #include <iomanip> // NOLINT | 9 #include <iomanip> // NOLINT |
| 10 #include <ostream> // NOLINT | 10 #include <ostream> // NOLINT |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // basic_ostream::operator<<(const void*) is drunk. | 25 // basic_ostream::operator<<(const void*) is drunk. |
| 26 static void PrintPointer(const void* ptr, std::ostream& os) | 26 static void PrintPointer(const void* ptr, std::ostream& os) |
| 27 { | 27 { |
| 28 StreamStateSaver saver(os); | 28 StreamStateSaver saver(os); |
| 29 uintptr_t intPtr = reinterpret_cast<uintptr_t>(ptr); | 29 uintptr_t intPtr = reinterpret_cast<uintptr_t>(ptr); |
| 30 os << "0x" << std::setfill('0') << std::setw(sizeof(uintptr_t) * 2) << std::
hex << intPtr; | 30 os << "0x" << std::setfill('0') << std::setw(sizeof(uintptr_t) * 2) << std::
hex << intPtr; |
| 31 } | 31 } |
| 32 | 32 |
| 33 void PrintTo(const ClipPaintPropertyNode& node, std::ostream* os) | 33 void PrintTo(const ClipPaintPropertyNode& node, std::ostream* os) |
| 34 { | 34 { |
| 35 *os << "ClipPaintPropertyNode(clip="; | 35 *os << "ClipPaintPropertyNode(clip=" << node.clipRect(); |
| 36 PrintTo(node.clipRect(), os); | |
| 37 *os << ", localTransformSpace="; | 36 *os << ", localTransformSpace="; |
| 38 PrintPointer(node.localTransformSpace(), *os); | 37 PrintPointer(node.localTransformSpace(), *os); |
| 39 *os << ", parent="; | 38 *os << ", parent="; |
| 40 PrintPointer(node.parent(), *os); | 39 PrintPointer(node.parent(), *os); |
| 41 *os << ")"; | 40 *os << ")"; |
| 42 } | 41 } |
| 43 | 42 |
| 44 void PrintTo(const PaintChunk& chunk, std::ostream* os) | 43 void PrintTo(const PaintChunk& chunk, std::ostream* os) |
| 45 { | 44 { |
| 46 *os << "PaintChunk(begin=" << chunk.beginIndex | 45 *os << "PaintChunk(begin=" << chunk.beginIndex |
| 47 << ", end=" << chunk.endIndex | 46 << ", end=" << chunk.endIndex |
| 48 << ", id="; | 47 << ", id="; |
| 49 if (!chunk.id) { | 48 if (!chunk.id) { |
| 50 *os << "null"; | 49 *os << "null"; |
| 51 } else { | 50 } else { |
| 52 *os << "(" << &chunk.id->client << ", "; | 51 *os << "(" << &chunk.id->client << ", "; |
| 53 #ifndef NDEBUG | 52 #ifndef NDEBUG |
| 54 *os << DisplayItem::typeAsDebugString(chunk.id->type); | 53 *os << DisplayItem::typeAsDebugString(chunk.id->type); |
| 55 #else | 54 #else |
| 56 *os << static_cast<int>(chunk.id->type); | 55 *os << static_cast<int>(chunk.id->type); |
| 57 #endif | 56 #endif |
| 58 *os << ")"; | 57 *os << ")"; |
| 59 } | 58 } |
| 60 *os << ", props="; | 59 *os << ", props="; |
| 61 PrintTo(chunk.properties, os); | 60 PrintTo(chunk.properties, os); |
| 62 *os << ", bounds="; | 61 *os << ", bounds=" << chunk.bounds << ", knownToBeOpaque=" << chunk.knownToB
eOpaque << ")"; |
| 63 PrintTo(chunk.bounds, os); | |
| 64 *os << ", knownToBeOpaque=" << chunk.knownToBeOpaque << ")"; | |
| 65 } | 62 } |
| 66 | 63 |
| 67 void PrintTo(const PaintChunkProperties& properties, std::ostream* os) | 64 void PrintTo(const PaintChunkProperties& properties, std::ostream* os) |
| 68 { | 65 { |
| 69 *os << "PaintChunkProperties("; | 66 *os << "PaintChunkProperties("; |
| 70 bool printedProperty = false; | 67 bool printedProperty = false; |
| 71 if (properties.transform) { | 68 if (properties.transform) { |
| 72 *os << "transform="; | 69 *os << "transform="; |
| 73 PrintTo(*properties.transform, os); | 70 PrintTo(*properties.transform, os); |
| 74 printedProperty = true; | 71 printedProperty = true; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 | 89 |
| 93 if (printedProperty) | 90 if (printedProperty) |
| 94 *os << ", "; | 91 *os << ", "; |
| 95 *os << "backfaceHidden=" << properties.backfaceHidden; | 92 *os << "backfaceHidden=" << properties.backfaceHidden; |
| 96 | 93 |
| 97 *os << ")"; | 94 *os << ")"; |
| 98 } | 95 } |
| 99 | 96 |
| 100 void PrintTo(const TransformPaintPropertyNode& transformPaintProperty, std::ostr
eam* os) | 97 void PrintTo(const TransformPaintPropertyNode& transformPaintProperty, std::ostr
eam* os) |
| 101 { | 98 { |
| 102 *os << "TransformPaintPropertyNode(matrix="; | 99 *os << "TransformPaintPropertyNode(matrix=" << transformPaintProperty.matrix
() |
| 103 PrintTo(transformPaintProperty.matrix(), os); | 100 << ", origin=" << transformPaintProperty.origin() << ")"; |
| 104 *os << ", origin="; | |
| 105 PrintTo(transformPaintProperty.origin(), os); | |
| 106 *os << ")"; | |
| 107 } | 101 } |
| 108 | 102 |
| 109 void PrintTo(const EffectPaintPropertyNode& effect, std::ostream* os) | 103 void PrintTo(const EffectPaintPropertyNode& effect, std::ostream* os) |
| 110 { | 104 { |
| 111 *os << "EffectPaintPropertyNode(opacity=" << effect.opacity() << ")"; | 105 *os << "EffectPaintPropertyNode(opacity=" << effect.opacity() << ")"; |
| 112 } | 106 } |
| 113 | 107 |
| 114 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |