Add error check for float parsing and fix tests
Change-Id: Ia4f4863d415536b3796edbcdb83c951b6cff02cf
diff --git a/libs/hwui/PathParser.h b/libs/hwui/PathParser.h
index d30bb0f..a9c1e60 100644
--- a/libs/hwui/PathParser.h
+++ b/libs/hwui/PathParser.h
@@ -23,17 +23,25 @@
#include <android/log.h>
#include <cutils/compiler.h>
+#include <string>
+
namespace android {
namespace uirenderer {
+
class PathParser {
public:
+ struct ANDROID_API ParseResult {
+ bool failureOccurred = false;
+ std::string failureMessage;
+ };
/**
* Parse the string literal and create a Skia Path. Return true on success.
*/
- ANDROID_API static bool parseStringForSkPath(SkPath* outPath, const char* pathStr,
- size_t strLength);
- static void getPathDataFromString(PathData* outData, const char* pathStr, size_t strLength);
+ ANDROID_API static void parseStringForSkPath(SkPath* outPath, ParseResult* result,
+ const char* pathStr, size_t strLength);
+ static void getPathDataFromString(PathData* outData, ParseResult* result,
+ const char* pathStr, size_t strLength);
static void dump(const PathData& data);
};