Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google LLC |
| 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 "SkReflected.h" |
| 9 | |
Brian Osman | bdcdf1a | 2019-03-04 10:55:22 -0500 | [diff] [blame^] | 10 | #include "SkCurve.h" |
| 11 | |
Brian Osman | 7c979f5 | 2019-02-12 13:27:51 -0500 | [diff] [blame] | 12 | SkSTArray<16, const SkReflected::Type*, true> SkReflected::gTypes; |
| 13 | |
| 14 | void SkReflected::VisitTypes(std::function<void(const Type*)> visitor, const Type* baseType) { |
| 15 | for (const Type* type : gTypes) { |
| 16 | if (type->isDerivedFrom(baseType)) { |
| 17 | visitor(type); |
| 18 | } |
| 19 | } |
| 20 | } |
Brian Osman | bdcdf1a | 2019-03-04 10:55:22 -0500 | [diff] [blame^] | 21 | |
| 22 | void SkFieldVisitor::visit(const char* name, SkCurve& c) { |
| 23 | this->enterObject(name); |
| 24 | c.visitFields(this); |
| 25 | this->exitObject(); |
| 26 | } |