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 { 13 14 namespace internal { 15 16 template <typename T> 17 size_t parse_node(StreamReader*, T*); 18 19 extern void parse_fill_stroke(StreamReader*, Paint*); 20 21 template <> parse_node(StreamReader * sr,ColorPaint * node)22size_t parse_node<ColorPaint>(StreamReader* sr, ColorPaint* node) { 23 const auto parent_id = parse_node<Paint>(sr, node); 24 25 node->setColor(sr->readColor("color")); 26 27 parse_fill_stroke(sr, node); 28 29 return parent_id; 30 } 31 32 } // namespace internal 33 onRevalidate()34void ColorPaint::onRevalidate() {} 35 onApply(SkPaint * paint) const36void ColorPaint::onApply(SkPaint* paint) const { 37 this->INHERITED::onApply(paint); 38 paint->setColor4f(fColor); 39 } 40 41 } // namespace skrive 42