blob: f5bebce605fb7deb787ec1f32241881987a8a7d1 [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:
Doris Liu1e67f082015-11-12 15:57:45 -080034 struct ANDROID_API ParseResult {
35 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 */
Doris Liub35da392016-04-12 11:06:23 -070041 ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result,
John Reck1bcacfd2017-11-03 10:12:19 -070042 const char* pathStr, size_t strLength);
Doris Liub35da392016-04-12 11:06:23 -070043 ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result,
John Reck1bcacfd2017-11-03 10:12:19 -070044 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