skia2/experimental/skrive/src/Drawable.cpp
Florin Malita 836c9d83aa [skrive] Rectangle support
... plus assorted fixes

TBR=
Change-Id: Idd4432eecd910b79e25418cef6247888ec1ade5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/299283
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-06-26 15:12:00 +00:00

33 lines
812 B
C++

/*
* Copyright 2020 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "experimental/skrive/include/SkRive.h"
#include "experimental/skrive/src/reader/StreamReader.h"
namespace skrive::internal {
template <typename T>
size_t parse_node(StreamReader*, T*);
template <>
size_t parse_node<Drawable>(StreamReader* sr, Drawable* node) {
const auto parent_id = parse_node<Node>(sr, node);
node->setIsHidden(!sr->readBool("isVisible"));
const auto bm = sr->readUInt8("blendMode");
if (bm <= static_cast<uint8_t>(SkBlendMode::kLastMode)) {
node->setBlendMode(static_cast<SkBlendMode>(bm));
}
node->setDrawOrder(sr->readUInt16("drawOrder"));
return parent_id;
}
} // namespace skrive::internal