PathParser.h revision b35da390601e3c24e777d72daacd8dbeb4d1d9c4
1215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann/*
2215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * Copyright (C) 2015 The Android Open Source Project
3215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann *
4215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * Licensed under the Apache License, Version 2.0 (the "License");
5215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * you may not use this file except in compliance with the License.
6215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * You may obtain a copy of the License at
7215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann *
8215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann *      http://www.apache.org/licenses/LICENSE-2.0
9215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann *
10215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * Unless required by applicable law or agreed to in writing, software
11215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * distributed under the License is distributed on an "AS IS" BASIS,
12215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * See the License for the specific language governing permissions and
14215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann * limitations under the License.
15215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann */
16215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
17215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#ifndef ANDROID_HWUI_PATHPARSER_H
18215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#define ANDROID_HWUI_PATHPARSER_H
19215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
208f886fe8c7e23fe6ccb8734167c960c2ed3429c3Alan Viverette#include "VectorDrawable.h"
21215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#include "utils/VectorDrawableUtils.h"
22215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
23215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#include <jni.h>
24215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#include <android/log.h>
258f886fe8c7e23fe6ccb8734167c960c2ed3429c3Alan Viverette#include <cutils/compiler.h>
2673cad7b8c14ee0003a958e9a30be11e4ecaf304dPhilip P. Moltmann
27215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann#include <string>
28215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
29215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmannnamespace android {
3073cad7b8c14ee0003a958e9a30be11e4ecaf304dPhilip P. Moltmannnamespace uirenderer {
31215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
32215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmann
33215440785861d37af3c6056be63ec2dd8274c452Philip P. Moltmannclass PathParser {
34public:
35    struct ANDROID_API ParseResult {
36        bool failureOccurred = false;
37        std::string failureMessage;
38    };
39    /**
40     * Parse the string literal and create a Skia Path. Return true on success.
41     */
42    ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result,
43            const char* pathStr, size_t strLength);
44    ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result,
45            const char* pathStr, size_t strLength);
46    static void dump(const PathData& data);
47    static bool isVerbValid(char verb);
48};
49
50}; // namespace uirenderer
51}; // namespace android
52#endif //ANDROID_HWUI_PATHPARSER_H
53