blob: 2e56349b3aa48fa9e051e4fd8a255c262ae7b280 [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_VPATH_H
18#define ANDROID_HWUI_VPATH_H
19
Doris Liu804618d2015-11-16 22:48:34 -080020#include <cutils/compiler.h>
Doris Liu30bcf692015-11-04 14:56:24 -080021#include "SkPath.h"
22#include <vector>
23
24namespace android {
25namespace uirenderer {
26
Doris Liu804618d2015-11-16 22:48:34 -080027struct ANDROID_API PathData {
Doris Liu30bcf692015-11-04 14:56:24 -080028 // TODO: Try using FatVector instead of std::vector and do a micro benchmark on the performance
29 // difference.
30 std::vector<char> verbs;
31 std::vector<size_t> verbSizes;
32 std::vector<float> points;
33 bool operator== (const PathData& data) const {
34 return verbs == data.verbs && verbSizes == data.verbSizes && points == data.points;
35 }
36
37};
38
39class VectorDrawablePath {
40public:
41 VectorDrawablePath(const PathData& nodes);
42 VectorDrawablePath(const VectorDrawablePath& path);
43 VectorDrawablePath(const char* path, size_t strLength);
44 bool canMorph(const PathData& path);
45 bool canMorph(const VectorDrawablePath& path);
Doris Liu804618d2015-11-16 22:48:34 -080046
Doris Liu30bcf692015-11-04 14:56:24 -080047private:
48 PathData mData;
49 SkPath mSkPath;
50};
51
52} // namespace uirenderer
53} // namespace android
54
55#endif // ANDROID_HWUI_VPATH_H