130bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu/* 230bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * Copyright (C) 2015 The Android Open Source Project 330bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * 430bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * Licensed under the Apache License, Version 2.0 (the "License"); 530bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * you may not use this file except in compliance with the License. 630bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * You may obtain a copy of the License at 730bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * 830bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * http://www.apache.org/licenses/LICENSE-2.0 930bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * 1030bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * Unless required by applicable law or agreed to in writing, software 1130bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * distributed under the License is distributed on an "AS IS" BASIS, 1230bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1330bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * See the License for the specific language governing permissions and 1430bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu * limitations under the License. 1530bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu */ 1630bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 1730bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu#ifndef ANDROID_HWUI_PATHPARSER_H 1830bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu#define ANDROID_HWUI_PATHPARSER_H 1930bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 204bbc2931263b232fba61807fca00e127573eff42Doris Liu#include "VectorDrawable.h" 21804618d0863a5d8ad1b08a846bd5319be864a1cbDoris Liu#include "utils/VectorDrawableUtils.h" 2230bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 2330bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu#include <jni.h> 2430bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu#include <android/log.h> 25cdd23f9d45ea2974c3f295754b89f5462bdd2c0dDoris Liu#include <cutils/compiler.h> 2630bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 271e67f08963cc245660049b6a588483a148955e08Doris Liu#include <string> 281e67f08963cc245660049b6a588483a148955e08Doris Liu 2930bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liunamespace android { 3030bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liunamespace uirenderer { 3130bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 321e67f08963cc245660049b6a588483a148955e08Doris Liu 3330bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liuclass PathParser { 3430bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liupublic: 351e67f08963cc245660049b6a588483a148955e08Doris Liu struct ANDROID_API ParseResult { 361e67f08963cc245660049b6a588483a148955e08Doris Liu bool failureOccurred = false; 371e67f08963cc245660049b6a588483a148955e08Doris Liu std::string failureMessage; 381e67f08963cc245660049b6a588483a148955e08Doris Liu }; 39cdd23f9d45ea2974c3f295754b89f5462bdd2c0dDoris Liu /** 40cdd23f9d45ea2974c3f295754b89f5462bdd2c0dDoris Liu * Parse the string literal and create a Skia Path. Return true on success. 41cdd23f9d45ea2974c3f295754b89f5462bdd2c0dDoris Liu */ 42b35da390601e3c24e777d72daacd8dbeb4d1d9c4Doris Liu ANDROID_API static void parseAsciiStringForSkPath(SkPath* outPath, ParseResult* result, 431e67f08963cc245660049b6a588483a148955e08Doris Liu const char* pathStr, size_t strLength); 44b35da390601e3c24e777d72daacd8dbeb4d1d9c4Doris Liu ANDROID_API static void getPathDataFromAsciiString(PathData* outData, ParseResult* result, 451e67f08963cc245660049b6a588483a148955e08Doris Liu const char* pathStr, size_t strLength); 4630bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu static void dump(const PathData& data); 470a1a5167be26d363d4e27bdc7b816f425b7b4e66Doris Liu static bool isVerbValid(char verb); 4830bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu}; 4930bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu 5030bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu}; // namespace uirenderer 5130bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu}; // namespace android 5230bcf69df9cfae40b621335958656cb0e4afd7d5Doris Liu#endif //ANDROID_HWUI_PATHPARSER_H 53