File: android_graphics_drawable_VectorDrawable.cpp

package info (click to toggle)
android-platform-frameworks-base 1%3A14~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 326,092 kB
  • sloc: java: 2,032,373; xml: 343,016; cpp: 304,181; python: 3,683; ansic: 2,090; sh: 1,871; makefile: 117; sed: 19
file content (423 lines) | stat: -rw-r--r-- 19,615 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "GraphicsJNI.h"

#include "PathParser.h"
#include "VectorDrawable.h"

#include <hwui/Paint.h>

namespace android {
using namespace uirenderer;
using namespace uirenderer::VectorDrawable;

/**
 * VectorDrawable's pre-draw construction.
 */
static jlong createTree(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    VectorDrawable::Tree* tree = new VectorDrawable::Tree(rootGroup);
    return reinterpret_cast<jlong>(tree);
}

static jlong createTreeFromCopy(JNIEnv*, jobject, jlong treePtr, jlong groupPtr) {
    VectorDrawable::Group* rootGroup = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    VectorDrawable::Tree* treeToCopy = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    VectorDrawable::Tree* tree = new VectorDrawable::Tree(treeToCopy, rootGroup);
    return reinterpret_cast<jlong>(tree);
}

static jlong createEmptyFullPath(JNIEnv*, jobject) {
    VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath();
    return reinterpret_cast<jlong>(newPath);
}

static jlong createFullPath(JNIEnv*, jobject, jlong srcFullPathPtr) {
    VectorDrawable::FullPath* srcFullPath =
            reinterpret_cast<VectorDrawable::FullPath*>(srcFullPathPtr);
    VectorDrawable::FullPath* newPath = new VectorDrawable::FullPath(*srcFullPath);
    return reinterpret_cast<jlong>(newPath);
}

static jlong createEmptyClipPath(JNIEnv*, jobject) {
    VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath();
    return reinterpret_cast<jlong>(newPath);
}

static jlong createClipPath(JNIEnv*, jobject, jlong srcClipPathPtr) {
    VectorDrawable::ClipPath* srcClipPath =
            reinterpret_cast<VectorDrawable::ClipPath*>(srcClipPathPtr);
    VectorDrawable::ClipPath* newPath = new VectorDrawable::ClipPath(*srcClipPath);
    return reinterpret_cast<jlong>(newPath);
}

static jlong createEmptyGroup(JNIEnv*, jobject) {
    VectorDrawable::Group* newGroup = new VectorDrawable::Group();
    return reinterpret_cast<jlong>(newGroup);
}

static jlong createGroup(JNIEnv*, jobject, jlong srcGroupPtr) {
    VectorDrawable::Group* srcGroup = reinterpret_cast<VectorDrawable::Group*>(srcGroupPtr);
    VectorDrawable::Group* newGroup = new VectorDrawable::Group(*srcGroup);
    return reinterpret_cast<jlong>(newGroup);
}

static void setNodeName(JNIEnv* env, jobject, jlong nodePtr, jstring nameStr) {
    VectorDrawable::Node* node = reinterpret_cast<VectorDrawable::Node*>(nodePtr);
    const char* nodeName = env->GetStringUTFChars(nameStr, NULL);
    node->setName(nodeName);
    env->ReleaseStringUTFChars(nameStr, nodeName);
}

static void addChild(JNIEnv*, jobject, jlong groupPtr, jlong childPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    VectorDrawable::Node* child = reinterpret_cast<VectorDrawable::Node*>(childPtr);
    group->addChild(child);
}

static void setAllowCaching(JNIEnv*, jobject, jlong treePtr, jboolean allowCaching) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    tree->setAllowCaching(allowCaching);
}

static void setAntiAlias(JNIEnv*, jobject, jlong treePtr, jboolean aa) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    tree->setAntiAlias(aa);
}

/**
 * Draw
 */
static jint draw(JNIEnv* env, jobject, jlong treePtr, jlong canvasPtr,
        jlong colorFilterPtr, jobject jrect, jboolean needsMirroring, jboolean canReuseCache) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    Canvas* canvas = reinterpret_cast<Canvas*>(canvasPtr);
    SkRect rect;
    GraphicsJNI::jrect_to_rect(env, jrect, &rect);
    SkColorFilter* colorFilter = reinterpret_cast<SkColorFilter*>(colorFilterPtr);
    return tree->draw(canvas, colorFilter, rect, needsMirroring, canReuseCache);
}

/**
 * Setters and getters for updating staging properties that can happen both pre-draw and post draw.
 */
static void setTreeViewportSize(JNIEnv*, jobject, jlong treePtr,
        jfloat viewportWidth, jfloat viewportHeight) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    tree->mutateStagingProperties()->setViewportSize(viewportWidth, viewportHeight);
}

static jboolean setRootAlpha(JNIEnv*, jobject, jlong treePtr, jfloat alpha) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    return tree->mutateStagingProperties()->setRootAlpha(alpha);
}

static jfloat getRootAlpha(JNIEnv*, jobject, jlong treePtr) {
    VectorDrawable::Tree* tree = reinterpret_cast<VectorDrawable::Tree*>(treePtr);
    return tree->stagingProperties().getRootAlpha();
}

static void updateFullPathPropertiesAndStrokeStyles(JNIEnv*, jobject, jlong fullPathPtr,
        jfloat strokeWidth, jint strokeColor, jfloat strokeAlpha, jint fillColor, jfloat fillAlpha,
        jfloat trimPathStart, jfloat trimPathEnd, jfloat trimPathOffset, jfloat strokeMiterLimit,
        jint strokeLineCap, jint strokeLineJoin, jint fillType) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->updateProperties(strokeWidth, strokeColor, strokeAlpha,
            fillColor, fillAlpha, trimPathStart, trimPathEnd, trimPathOffset, strokeMiterLimit,
            strokeLineCap, strokeLineJoin, fillType);
}

static void updateFullPathFillGradient(JNIEnv*, jobject, jlong pathPtr, jlong fillGradientPtr) {
    VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr);
    SkShader* fillShader = reinterpret_cast<SkShader*>(fillGradientPtr);
    path->mutateStagingProperties()->setFillGradient(fillShader);
}

static void updateFullPathStrokeGradient(JNIEnv*, jobject, jlong pathPtr, jlong strokeGradientPtr) {
    VectorDrawable::FullPath* path = reinterpret_cast<VectorDrawable::FullPath*>(pathPtr);
    SkShader* strokeShader = reinterpret_cast<SkShader*>(strokeGradientPtr);
    path->mutateStagingProperties()->setStrokeGradient(strokeShader);
}

static jboolean getFullPathProperties(JNIEnv* env, jobject, jlong fullPathPtr,
        jbyteArray outProperties, jint length) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    int8_t pathProperties[length];
    bool success = fullPath->stagingProperties()->copyProperties(pathProperties, length);
    env->SetByteArrayRegion(outProperties, 0, length, reinterpret_cast<int8_t*>(&pathProperties));
    return success;
}

static jboolean getGroupProperties(JNIEnv* env, jobject, jlong groupPtr,
        jfloatArray outProperties, jint length) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    float groupProperties[length];
    bool success = group->stagingProperties()->copyProperties(groupProperties, length);
    env->SetFloatArrayRegion(outProperties, 0, length, reinterpret_cast<float*>(&groupProperties));
    return success;
}

static void updateGroupProperties(JNIEnv*, jobject, jlong groupPtr, jfloat rotate, jfloat pivotX,
        jfloat pivotY, jfloat scaleX, jfloat scaleY, jfloat translateX, jfloat translateY) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->updateProperties(rotate, pivotX, pivotY, scaleX, scaleY,
            translateX, translateY);
}

static void setPathString(JNIEnv* env, jobject, jlong pathPtr, jstring inputStr,
        jint stringLength) {
    VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr);
    const char* pathString = env->GetStringUTFChars(inputStr, NULL);

    PathParser::ParseResult result;
    PathData data;
    PathParser::getPathDataFromAsciiString(&data, &result, pathString, stringLength);
    if (result.failureOccurred) {
        doThrowIAE(env, result.failureMessage.c_str());
    }
    path->mutateStagingProperties()->setData(data);
    env->ReleaseStringUTFChars(inputStr, pathString);
}

/**
 * Setters and getters that should only be called from animation thread for animation purpose.
 */
static jfloat getRotation(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getRotation();
}

static void setRotation(JNIEnv*, jobject, jlong groupPtr, jfloat rotation) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setRotation(rotation);
}

static jfloat getPivotX(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getPivotX();
}

static void setPivotX(JNIEnv*, jobject, jlong groupPtr, jfloat pivotX) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setPivotX(pivotX);
}

static jfloat getPivotY(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getPivotY();
}

static void setPivotY(JNIEnv*, jobject, jlong groupPtr, jfloat pivotY) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setPivotY(pivotY);
}

static jfloat getScaleX(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getScaleX();
}

static void setScaleX(JNIEnv*, jobject, jlong groupPtr, jfloat scaleX) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setScaleX(scaleX);
}

static jfloat getScaleY(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getScaleY();
}

static void setScaleY(JNIEnv*, jobject, jlong groupPtr, jfloat scaleY) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setScaleY(scaleY);
}

static jfloat getTranslateX(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getTranslateX();
}

static void setTranslateX(JNIEnv*, jobject, jlong groupPtr, jfloat translateX) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setTranslateX(translateX);
}

static jfloat getTranslateY(JNIEnv*, jobject, jlong groupPtr) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    return group->stagingProperties()->getTranslateY();
}

static void setTranslateY(JNIEnv*, jobject, jlong groupPtr, jfloat translateY) {
    VectorDrawable::Group* group = reinterpret_cast<VectorDrawable::Group*>(groupPtr);
    group->mutateStagingProperties()->setTranslateY(translateY);
}

static void setPathData(JNIEnv*, jobject, jlong pathPtr, jlong pathDataPtr) {
    VectorDrawable::Path* path = reinterpret_cast<VectorDrawable::Path*>(pathPtr);
    PathData* pathData = reinterpret_cast<PathData*>(pathDataPtr);
    path->mutateStagingProperties()->setData(*pathData);
}

static jfloat getStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getStrokeWidth();
}

static void setStrokeWidth(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeWidth) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setStrokeWidth(strokeWidth);
}

static jint getStrokeColor(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getStrokeColor();
}

static void setStrokeColor(JNIEnv*, jobject, jlong fullPathPtr, jint strokeColor) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setStrokeColor(strokeColor);
}

static jfloat getStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getStrokeAlpha();
}

static void setStrokeAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat strokeAlpha) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setStrokeAlpha(strokeAlpha);
}

static jint getFillColor(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getFillColor();
}

static void setFillColor(JNIEnv*, jobject, jlong fullPathPtr, jint fillColor) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setFillColor(fillColor);
}

static jfloat getFillAlpha(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getFillAlpha();
}

static void setFillAlpha(JNIEnv*, jobject, jlong fullPathPtr, jfloat fillAlpha) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setFillAlpha(fillAlpha);
}

static jfloat getTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getTrimPathStart();
}

static void setTrimPathStart(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathStart) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setTrimPathStart(trimPathStart);
}

static jfloat getTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getTrimPathEnd();
}

static void setTrimPathEnd(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathEnd) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setTrimPathEnd(trimPathEnd);
}

static jfloat getTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    return fullPath->stagingProperties()->getTrimPathOffset();
}

static void setTrimPathOffset(JNIEnv*, jobject, jlong fullPathPtr, jfloat trimPathOffset) {
    VectorDrawable::FullPath* fullPath = reinterpret_cast<VectorDrawable::FullPath*>(fullPathPtr);
    fullPath->mutateStagingProperties()->setTrimPathOffset(trimPathOffset);
}

static const JNINativeMethod gMethods[] = {
        {"nDraw", "(JJJLandroid/graphics/Rect;ZZ)I", (void*)draw},
        {"nGetFullPathProperties", "(J[BI)Z", (void*)getFullPathProperties},
        {"nGetGroupProperties", "(J[FI)Z", (void*)getGroupProperties},
        {"nSetPathString", "(JLjava/lang/String;I)V", (void*)setPathString},
        {"nSetName", "(JLjava/lang/String;)V", (void*)setNodeName},

        // ------------- @FastNative ----------------

        {"nCreateTree", "(J)J", (void*)createTree},
        {"nCreateTreeFromCopy", "(JJ)J", (void*)createTreeFromCopy},
        {"nSetRendererViewportSize", "(JFF)V", (void*)setTreeViewportSize},
        {"nSetRootAlpha", "(JF)Z", (void*)setRootAlpha},
        {"nGetRootAlpha", "(J)F", (void*)getRootAlpha},
        {"nSetAntiAlias", "(JZ)V", (void*)setAntiAlias},
        {"nSetAllowCaching", "(JZ)V", (void*)setAllowCaching},

        {"nCreateFullPath", "()J", (void*)createEmptyFullPath},
        {"nCreateFullPath", "(J)J", (void*)createFullPath},
        {"nUpdateFullPathProperties", "(JFIFIFFFFFIII)V", (void*)updateFullPathPropertiesAndStrokeStyles},
        {"nUpdateFullPathFillGradient", "(JJ)V", (void*)updateFullPathFillGradient},
        {"nUpdateFullPathStrokeGradient", "(JJ)V", (void*)updateFullPathStrokeGradient},

        {"nCreateClipPath", "()J", (void*)createEmptyClipPath},
        {"nCreateClipPath", "(J)J", (void*)createClipPath},
        {"nCreateGroup", "()J", (void*)createEmptyGroup},
        {"nCreateGroup", "(J)J", (void*)createGroup},
        {"nUpdateGroupProperties", "(JFFFFFFF)V", (void*)updateGroupProperties},

        {"nAddChild", "(JJ)V", (void*)addChild},
        {"nGetRotation", "(J)F", (void*)getRotation},
        {"nSetRotation", "(JF)V", (void*)setRotation},
        {"nGetPivotX", "(J)F", (void*)getPivotX},
        {"nSetPivotX", "(JF)V", (void*)setPivotX},
        {"nGetPivotY", "(J)F", (void*)getPivotY},
        {"nSetPivotY", "(JF)V", (void*)setPivotY},
        {"nGetScaleX", "(J)F", (void*)getScaleX},
        {"nSetScaleX", "(JF)V", (void*)setScaleX},
        {"nGetScaleY", "(J)F", (void*)getScaleY},
        {"nSetScaleY", "(JF)V", (void*)setScaleY},
        {"nGetTranslateX", "(J)F", (void*)getTranslateX},
        {"nSetTranslateX", "(JF)V", (void*)setTranslateX},
        {"nGetTranslateY", "(J)F", (void*)getTranslateY},
        {"nSetTranslateY", "(JF)V", (void*)setTranslateY},

        {"nSetPathData", "(JJ)V", (void*)setPathData},
        {"nGetStrokeWidth", "(J)F", (void*)getStrokeWidth},
        {"nSetStrokeWidth", "(JF)V", (void*)setStrokeWidth},
        {"nGetStrokeColor", "(J)I", (void*)getStrokeColor},
        {"nSetStrokeColor", "(JI)V", (void*)setStrokeColor},
        {"nGetStrokeAlpha", "(J)F", (void*)getStrokeAlpha},
        {"nSetStrokeAlpha", "(JF)V", (void*)setStrokeAlpha},
        {"nGetFillColor", "(J)I", (void*)getFillColor},
        {"nSetFillColor", "(JI)V", (void*)setFillColor},
        {"nGetFillAlpha", "(J)F", (void*)getFillAlpha},
        {"nSetFillAlpha", "(JF)V", (void*)setFillAlpha},
        {"nGetTrimPathStart", "(J)F", (void*)getTrimPathStart},
        {"nSetTrimPathStart", "(JF)V", (void*)setTrimPathStart},
        {"nGetTrimPathEnd", "(J)F", (void*)getTrimPathEnd},
        {"nSetTrimPathEnd", "(JF)V", (void*)setTrimPathEnd},
        {"nGetTrimPathOffset", "(J)F", (void*)getTrimPathOffset},
        {"nSetTrimPathOffset", "(JF)V", (void*)setTrimPathOffset},
};

int register_android_graphics_drawable_VectorDrawable(JNIEnv* env) {
    return RegisterMethodsOrDie(env, "android/graphics/drawable/VectorDrawable", gMethods, NELEM(gMethods));
}

}; // namespace android