blob: 3d5b64d9047425a9ad68b66bb85acdd229ab73ec [file] [log] [blame]
Doris Liu30bcf692015-11-04 14:56:24 -08001/*
2 * Copyright (C) 2015 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 ANDROID_HWUI_PATHPARSER_H
18#define ANDROID_HWUI_PATHPARSER_H
19
Doris Liu4bbc2932015-12-01 17:59:40 -080020#include "VectorDrawable.h"
Doris Liu804618d2015-11-16 22:48:34 -080021#include "utils/VectorDrawableUtils.h"
Doris Liu30bcf692015-11-04 14:56:24 -080022
Doris Liu30bcf692015-11-04 14:56:24 -080023#include <android/log.h>
Doris Liucdd23f92015-11-11 14:31:13 -080024#include <cutils/compiler.h>
John Reck1bcacfd2017-11-03 10:12:19 -070025#include <jni.h>
Doris Liu30bcf692015-11-04 14:56:24 -080026
Doris Liu1e67f082015-11-12 15:57:45 -080027#include <string>
28
Doris Liu30bcf692015-11-04 14:56:24 -080029namespace android {
30namespace uirenderer {
31
32class PathParser {
33public:
Derek Sollenberger3fedf5a2020-02-21 13:07:28 -050034 struct ParseResult {
Doris Liu1e67f082015-11-12 15:57:45 -080035 bool failureOccurred = false;
36 std::string failureMessage;
37 };
Doris Liucdd23f92015-11-11 14:31:13 -080038 /**
39 * Parse the string literal and create a Skia Path. Return true on success.
40 */
Derek Sollenberger3fedf5a2020-02-21 13:07:28 -050041 static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result,
42 const char* pathStr, size_t strLength);
43 static void getPathDataFromAsciiString(PathData* outData, ParseResult* result,
44 const char* pathStr, size_t strLength);
Doris Liu30bcf692015-11-04 14:56:24 -080045 static void dump(const PathData& data);
Doris Liu4ad0e142018-03-23 18:33:45 -070046 static void validateVerbAndPoints(char verb, size_t points, ParseResult* result);
Doris Liu30bcf692015-11-04 14:56:24 -080047};
48
Chris Blume7b8a8082018-11-30 15:51:58 -080049} // namespace uirenderer
50} // namespace android
John Reck1bcacfd2017-11-03 10:12:19 -070051#endif // ANDROID_HWUI_PATHPARSER_H