blob: 5578e8d42e2fd51ad2a3b96e93dea39e419979df [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
23#include <jni.h>
24#include <android/log.h>
Doris Liucdd23f92015-11-11 14:31:13 -080025#include <cutils/compiler.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
Doris Liu1e67f082015-11-12 15:57:45 -080032
Doris Liu30bcf692015-11-04 14:56:24 -080033class PathParser {
34public:
Doris Liu1e67f082015-11-12 15:57:45 -080035 struct ANDROID_API ParseResult {
36 bool failureOccurred = false;
37 std::string failureMessage;
38 };
Doris Liucdd23f92015-11-11 14:31:13 -080039 /**
40 * Parse the string literal and create a Skia Path. Return true on success.
41 */
Doris Liub35da392016-04-12 11:06:23 -070042 ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result,
Doris Liu1e67f082015-11-12 15:57:45 -080043 const char* pathStr, size_t strLength);
Doris Liub35da392016-04-12 11:06:23 -070044 ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result,
Doris Liu1e67f082015-11-12 15:57:45 -080045 const char* pathStr, size_t strLength);
Doris Liu30bcf692015-11-04 14:56:24 -080046 static void dump(const PathData& data);
Doris Liu0a1a5162016-04-07 15:03:11 -070047 static bool isVerbValid(char verb);
Doris Liu30bcf692015-11-04 14:56:24 -080048};
49
50}; // namespace uirenderer
51}; // namespace android
52#endif //ANDROID_HWUI_PATHPARSER_H