blob: b41c552d17c08bbfa70556fb9c2d89eabd3b126c [file] [log] [blame]
Jason Sams326e0dd2009-05-22 14:03:28 -07001/*
2 * Copyright (C) 2009 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_STRUCTURED_ELEMENT_H
18#define ANDROID_STRUCTURED_ELEMENT_H
19
Jason Sams326e0dd2009-05-22 14:03:28 -070020#include "rsComponent.h"
21
22// ---------------------------------------------------------------------------
23namespace android {
24namespace renderscript {
25
26
27// An element is a group of Components that occupies one cell in a structure.
28class Element : public ObjectBase
29{
30public:
Jason Samse514b452009-09-25 14:51:22 -070031 Element(Context *, uint32_t count);
Jason Sams326e0dd2009-05-22 14:03:28 -070032 ~Element();
33
34
35 void setComponent(uint32_t idx, Component *c);
36
Jason Sams565ac362009-06-03 16:04:54 -070037 uint32_t getGLType() const;
38 uint32_t getGLFormat() const;
Jason Sams326e0dd2009-05-22 14:03:28 -070039
40
41 size_t getSizeBits() const;
Jason Samse5ffb872009-08-09 17:01:55 -070042 size_t getSizeBytes() const {
43 return (getSizeBits() + 7) >> 3;
Jason Sams326e0dd2009-05-22 14:03:28 -070044 }
45
46 size_t getComponentOffsetBits(uint32_t componentNumber) const;
Jason Samse5ffb872009-08-09 17:01:55 -070047 size_t getComponentOffsetBytes(uint32_t componentNumber) const {
Jason Sams326e0dd2009-05-22 14:03:28 -070048 return (getComponentOffsetBits(componentNumber) + 7) >> 3;
49 }
50
51 uint32_t getComponentCount() const {return mComponentCount;}
52 Component * getComponent(uint32_t idx) const {return mComponents[idx].get();}
53
Jason Samse12c1c52009-09-27 17:50:38 -070054
55 void dumpLOGV(const char *prefix) const;
56
Jason Sams326e0dd2009-05-22 14:03:28 -070057protected:
58 // deallocate any components that are part of this element.
59 void clear();
60
61 size_t mComponentCount;
62 ObjectBaseRef<Component> * mComponents;
63 //uint32_t *mOffsetTable;
64
Jason Samse514b452009-09-25 14:51:22 -070065 Element(Context *);
Jason Sams326e0dd2009-05-22 14:03:28 -070066};
67
68
69class ElementState {
70public:
71 ElementState();
72 ~ElementState();
73
Jason Sams326e0dd2009-05-22 14:03:28 -070074 Vector<Component *> mComponentBuildList;
Jason Sams326e0dd2009-05-22 14:03:28 -070075};
76
77
78}
79}
80#endif //ANDROID_STRUCTURED_ELEMENT_H