| 76 | } |
| 77 | |
| 78 | void LayerSerialization::SerializeBasicLayerImpl(flexbuffers::Builder& fbb, const Layer* layer, |
| 79 | SerializeUtils::ComplexObjSerMap* map, |
| 80 | SerializeUtils::RenderableObjSerMap* rosMap) { |
| 81 | SerializeUtils::SetFlexBufferMap(fbb, "type", SerializeUtils::LayerTypeToString(layer->type())); |
| 82 | SerializeUtils::SetFlexBufferMap(fbb, "visible", layer->visible()); |
| 83 | SerializeUtils::SetFlexBufferMap(fbb, "shouldRasterize", layer->shouldRasterize()); |
| 84 | SerializeUtils::SetFlexBufferMap(fbb, "allowsEdgeAntialiasing", layer->allowsEdgeAntialiasing()); |
| 85 | SerializeUtils::SetFlexBufferMap(fbb, "allowsGroupOpacity", layer->allowsGroupOpacity()); |
| 86 | SerializeUtils::SetFlexBufferMap(fbb, "excludeChildEffectsInLayerStyle", |
| 87 | layer->excludeChildEffectsInLayerStyle()); |
| 88 | SerializeUtils::SetFlexBufferMap(fbb, "blendMode", |
| 89 | SerializeUtils::BlendModeToString(layer->blendMode())); |
| 90 | SerializeUtils::SetFlexBufferMap(fbb, "name", layer->name()); |
| 91 | SerializeUtils::SetFlexBufferMap(fbb, "alpha", layer->alpha()); |
| 92 | |
| 93 | auto matID = SerializeUtils::GetObjID(); |
| 94 | auto matrix = layer->matrix(); |
| 95 | SerializeUtils::SetFlexBufferMap(fbb, "matrix", "", false, true, matID); |
| 96 | SerializeUtils::FillComplexObjSerMap(matrix, matID, map); |
| 97 | |
| 98 | auto posID = SerializeUtils::GetObjID(); |
| 99 | auto position = layer->position(); |
| 100 | SerializeUtils::SetFlexBufferMap(fbb, "position", "", false, true, posID); |
| 101 | SerializeUtils::FillComplexObjSerMap(position, posID, map); |
| 102 | |
| 103 | SerializeUtils::SetFlexBufferMap(fbb, "rasterizationScale", layer->rasterizationScale()); |
| 104 | |
| 105 | auto filters = layer->filters(); |
| 106 | auto filterSize = static_cast<unsigned int>(filters.size()); |
| 107 | auto filtersID = SerializeUtils::GetObjID(); |
| 108 | SerializeUtils::SetFlexBufferMap(fbb, "filters", filterSize, false, filterSize, filtersID); |
| 109 | SerializeUtils::FillComplexObjSerMap(filters, filtersID, map); |
| 110 | |
| 111 | auto mask = layer->mask(); |
| 112 | auto maskID = SerializeUtils::GetObjID(); |
| 113 | SerializeUtils::SetFlexBufferMap(fbb, "mask", reinterpret_cast<uint64_t>(mask.get()), true, |
| 114 | mask != nullptr, maskID); |
| 115 | SerializeUtils::FillComplexObjSerMap(mask, maskID, map, rosMap); |
| 116 | |
| 117 | auto scrollRectID = SerializeUtils::GetObjID(); |
| 118 | auto scrollRect = layer->scrollRect(); |
| 119 | SerializeUtils::SetFlexBufferMap(fbb, "scrollRect", "", false, true, scrollRectID); |
| 120 | SerializeUtils::FillComplexObjSerMap(scrollRect, scrollRectID, map); |
| 121 | |
| 122 | auto rootID = SerializeUtils::GetObjID(); |
| 123 | std::shared_ptr<Layer> root = layer->root() ? layer->root()->shared_from_this() : nullptr; |
| 124 | SerializeUtils::SetFlexBufferMap(fbb, "root", reinterpret_cast<uint64_t>(root.get()), true, |
| 125 | root != nullptr, rootID); |
| 126 | SerializeUtils::FillComplexObjSerMap(root, rootID, map, rosMap); |
| 127 | |
| 128 | auto parentID = SerializeUtils::GetObjID(); |
| 129 | auto parent = layer->parent(); |
| 130 | SerializeUtils::SetFlexBufferMap(fbb, "parent", reinterpret_cast<uint64_t>(parent), true, |
| 131 | parent != nullptr, parentID); |
| 132 | SerializeUtils::FillComplexObjSerMap(parent ? parent->shared_from_this() : nullptr, parentID, map, |
| 133 | rosMap); |
| 134 | |
| 135 | auto childrenID = SerializeUtils::GetObjID(); |
nothing calls this directly
no test coverage detected