| 70 | } |
| 71 | |
| 72 | std::shared_ptr<Data> RecordedContentSerialization::Serialize( |
| 73 | const LayerContent* content, SerializeUtils::ComplexObjSerMap* map, |
| 74 | SerializeUtils::RenderableObjSerMap* rosMap) { |
| 75 | DEBUG_ASSERT(content != nullptr) |
| 76 | flexbuffers::Builder fbb; |
| 77 | size_t startMap; |
| 78 | size_t contentMap; |
| 79 | SerializeUtils::SerializeBegin(fbb, tgfx::inspect::LayerTreeMessage::LayerSubAttribute, startMap, |
| 80 | contentMap); |
| 81 | auto type = Types::Get(content); |
| 82 | SerializeUtils::SetFlexBufferMap(fbb, "type", SerializeUtils::RecordedContentTypeToString(type)); |
| 83 | switch (type) { |
| 84 | case Types::LayerContentType::Default: |
| 85 | SerializeDefaultContentImpl(fbb, content, map, rosMap); |
| 86 | break; |
| 87 | case Types::LayerContentType::Foreground: |
| 88 | SerializeForegroundContentImpl(fbb, content, map, rosMap); |
| 89 | break; |
| 90 | case Types::LayerContentType::Contour: |
| 91 | SerializeContourContentImpl(fbb, content, map, rosMap); |
| 92 | break; |
| 93 | default: |
| 94 | DEBUG_ASSERT(false); |
| 95 | } |
| 96 | SerializeUtils::SerializeEnd(fbb, startMap, contentMap); |
| 97 | return Data::MakeWithCopy(fbb.GetBuffer().data(), fbb.GetBuffer().size()); |
| 98 | } |
| 99 | } // namespace tgfx |
nothing calls this directly
no test coverage detected