blob: 2f60a1d12a209f33043ef06ef76da055016bd98e [file] [log] [blame]
Adam Lesinski4452e132016-10-12 07:47:28 -07001/*
2 * Copyright (C) 2016 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 ANDROIDFW_ATTRIBUTERESOLUTION_H
18#define ANDROIDFW_ATTRIBUTERESOLUTION_H
19
20#include <androidfw/ResourceTypes.h>
21
22namespace android {
23
24// These are all variations of the same method. They each perform the exact same operation,
25// but on various data sources. I *think* they are re-written to avoid an extra branch
26// in the inner loop, but after one branch miss (some pointer != null), the branch predictor should
27// predict the rest of the iterations' branch correctly.
28// TODO(adamlesinski): Run performance tests against these methods and a new, single method
29// that uses all the sources and branches to the right ones within the inner loop.
30
31bool resolveAttrs(ResTable::Theme* theme,
32 uint32_t defStyleAttr,
33 uint32_t defStyleRes,
34 uint32_t* srcValues, size_t srcValuesLength,
35 uint32_t* attrs, size_t attrsLength,
36 uint32_t* outValues,
37 uint32_t* outIndices);
38
39bool applyStyle(ResTable::Theme* theme, ResXMLParser* xmlParser,
40 uint32_t defStyleAttr,
41 uint32_t defStyleRes,
42 uint32_t* attrs, size_t attrsLength,
43 uint32_t* outValues,
44 uint32_t* outIndices);
45
46bool retrieveAttributes(const ResTable* res, ResXMLParser* xmlParser,
47 uint32_t* attrs, size_t attrsLength,
48 uint32_t* outValues,
49 uint32_t* outIndices);
50
51} // namespace android
52
53#endif /* ANDROIDFW_ATTRIBUTERESOLUTION_H */