1 /* 2 * Copyright 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef PATH_PATH_H 18 #define PATH_PATH_H 19 20 #include <stdint.h> 21 22 // The following structures declare the minimum we need + a marker (generationId) to 23 // validate the data during debugging. There may be more fields in the Skia structures 24 // but we just ignore them for now. Some fields declared in older API levels (isFinite 25 // for instance) may not show up in the declarations for newer API levels if the field 26 // still exist but was moved after the data we need. 27 28 enum class Verb : uint8_t { 29 Move, 30 Line, 31 Quadratic, 32 Conic, 33 Cubic, 34 Close, 35 Done 36 }; 37 38 struct Point { 39 float x; 40 float y; 41 }; 42 43 struct PathRef21 { 44 __unused intptr_t pointer; // Virtual tables 45 __unused int32_t refCount; 46 __unused float left; 47 __unused float top; 48 __unused float right; 49 __unused float bottom; 50 __unused uint8_t segmentMask; // Some of the unused fields are in a different order in 22/23 51 __unused uint8_t boundsIsDirty; 52 __unused uint8_t isFinite; 53 __unused uint8_t isOval; 54 Point* points; 55 Verb* verbs; 56 int verbCount; 57 __unused int pointCount; 58 __unused size_t freeSpace; 59 float* conicWeights; 60 __unused int conicWeightsReserve; 61 __unused int conicWeightsCount; 62 __unused uint32_t generationId; 63 }; 64 65 struct PathRef24 { 66 __unused intptr_t pointer; 67 __unused int32_t refCount; 68 __unused float left; 69 __unused float top; 70 __unused float right; 71 __unused float bottom; 72 Point* points; 73 Verb* verbs; 74 int verbCount; 75 __unused int pointCount; 76 __unused size_t freeSpace; 77 float* conicWeights; 78 __unused int conicWeightsReserve; 79 __unused int conicWeightsCount; 80 __unused uint32_t generationId; 81 }; 82 83 struct PathRef26 { 84 __unused int32_t refCount; 85 __unused float left; 86 __unused float top; 87 __unused float right; 88 __unused float bottom; 89 Point* points; 90 Verb* verbs; 91 int verbCount; 92 __unused int pointCount; 93 __unused size_t freeSpace; 94 float* conicWeights; 95 __unused int conicWeightsReserve; 96 __unused int conicWeightsCount; 97 __unused uint32_t generationId; 98 }; 99 100 struct PathRef30 { 101 __unused int32_t refCount; 102 __unused float left; 103 __unused float top; 104 __unused float right; 105 __unused float bottom; 106 Point* points; 107 __unused int pointReserve; 108 __unused int pointCount; 109 Verb* verbs; 110 __unused int verbReserve; 111 int verbCount; 112 float* conicWeights; 113 __unused int conicWeightsReserve; 114 __unused int conicWeightsCount; 115 __unused uint32_t generationId; 116 }; 117 118 struct Path { 119 PathRef21* pathRef; 120 }; 121 122 #endif //PATH_PATH_H 123