1 /* 2 * Copyright 2020 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #include "experimental/skrive/include/SkRive.h" 9 10 #include "experimental/skrive/src/reader/StreamReader.h" 11 12 namespace skrive::internal { 13 template <typename T> 14 size_t parse_node(StreamReader*, T*); 15 16 template <> parse_node(StreamReader * sr,Drawable * node)17size_t parse_node<Drawable>(StreamReader* sr, Drawable* node) { 18 const auto parent_id = parse_node<Node>(sr, node); 19 20 node->setIsHidden(!sr->readBool("isVisible")); 21 22 const auto bm = sr->readUInt8("blendMode"); 23 if (bm <= static_cast<uint8_t>(SkBlendMode::kLastMode)) { 24 node->setBlendMode(static_cast<SkBlendMode>(bm)); 25 } 26 27 node->setDrawOrder(sr->readUInt16("drawOrder")); 28 29 return parent_id; 30 } 31 32 } // namespace skrive::internal 33