blob: db7df64a346e663803edcc8530177bf9d1367d92 [file] [log] [blame]
Jason Sams221a4b12012-02-22 15:22:41 -08001/*
Jason Sams69cccdf2012-04-02 19:11:49 -07002 * Copyright (C) 2012 The Android Open Source Project
Jason Sams221a4b12012-02-22 15:22:41 -08003 *
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
Jason Sams221a4b12012-02-22 15:22:41 -080017#include <malloc.h>
18#include <string.h>
19
20#include "RenderScript.h"
Tim Murrayeeaf7142013-09-09 15:03:50 -070021#include "rsCppInternal.h"
Jason Sams221a4b12012-02-22 15:22:41 -080022
Jason Sams69cccdf2012-04-02 19:11:49 -070023using namespace android;
Tim Murray9eb7f4b2012-11-16 14:02:18 -080024using namespace RSC;
Jason Sams221a4b12012-02-22 15:22:41 -080025
Tim Murray89daad62013-07-29 14:30:02 -070026android::RSC::sp<const Element> Element::getSubElement(uint32_t index) {
Jason Sams221a4b12012-02-22 15:22:41 -080027 if (!mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070028 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Element contains no sub-elements");
29 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -080030 }
31 if (index >= mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070032 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Illegal sub-element index");
33 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -080034 }
35 return mElements[mVisibleElementMap[index]];
36}
37
38const char * Element::getSubElementName(uint32_t index) {
39 if (!mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070040 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Element contains no sub-elements");
41 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -080042 }
43 if (index >= mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070044 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Illegal sub-element index");
45 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -080046 }
Tim Murrayab716362013-08-12 12:37:18 -070047 return mElementNames[mVisibleElementMap[index]].c_str();
Jason Sams221a4b12012-02-22 15:22:41 -080048}
49
50size_t Element::getSubElementArraySize(uint32_t index) {
51 if (!mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070052 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Element contains no sub-elements");
53 return 0;
Jason Sams221a4b12012-02-22 15:22:41 -080054 }
55 if (index >= mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070056 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Illegal sub-element index");
57 return 0;
Jason Sams221a4b12012-02-22 15:22:41 -080058 }
59 return mArraySizes[mVisibleElementMap[index]];
60}
61
62uint32_t Element::getSubElementOffsetBytes(uint32_t index) {
63 if (mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070064 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Element contains no sub-elements");
65 return 0;
Jason Sams221a4b12012-02-22 15:22:41 -080066 }
67 if (index >= mVisibleElementMap.size()) {
Tim Murray21fa7a02013-08-15 16:25:03 -070068 mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Illegal sub-element index");
69 return 0;
Jason Sams221a4b12012-02-22 15:22:41 -080070 }
71 return mOffsetInBytes[mVisibleElementMap[index]];
72}
73
74
Tim Murray89daad62013-07-29 14:30:02 -070075#define CREATE_USER(N, T) android::RSC::sp<const Element> Element::N(android::RSC::sp<RS> rs) { \
Tim Murray729b6fe2013-07-23 16:20:42 -070076 if (rs->mElements.N == NULL) { \
Tim Murrayeb4426d2013-08-27 15:30:16 -070077 rs->mElements.N = (createUser(rs, RS_TYPE_##T)); \
Tim Murray729b6fe2013-07-23 16:20:42 -070078 } \
79 return rs->mElements.N; \
80 }
81
Jason Sams221a4b12012-02-22 15:22:41 -080082CREATE_USER(BOOLEAN, BOOLEAN);
83CREATE_USER(U8, UNSIGNED_8);
84CREATE_USER(I8, SIGNED_8);
85CREATE_USER(U16, UNSIGNED_16);
86CREATE_USER(I16, SIGNED_16);
87CREATE_USER(U32, UNSIGNED_32);
88CREATE_USER(I32, SIGNED_32);
89CREATE_USER(U64, UNSIGNED_64);
90CREATE_USER(I64, SIGNED_64);
91CREATE_USER(F32, FLOAT_32);
92CREATE_USER(F64, FLOAT_64);
93CREATE_USER(ELEMENT, ELEMENT);
94CREATE_USER(TYPE, TYPE);
95CREATE_USER(ALLOCATION, ALLOCATION);
96CREATE_USER(SAMPLER, SAMPLER);
97CREATE_USER(SCRIPT, SCRIPT);
98CREATE_USER(MESH, MESH);
99CREATE_USER(PROGRAM_FRAGMENT, PROGRAM_FRAGMENT);
100CREATE_USER(PROGRAM_VERTEX, PROGRAM_VERTEX);
101CREATE_USER(PROGRAM_RASTER, PROGRAM_RASTER);
102CREATE_USER(PROGRAM_STORE, PROGRAM_STORE);
103CREATE_USER(MATRIX_4X4, MATRIX_4X4);
104CREATE_USER(MATRIX_3X3, MATRIX_3X3);
105CREATE_USER(MATRIX_2X2, MATRIX_2X2);
106
Tim Murray89daad62013-07-29 14:30:02 -0700107#define CREATE_PIXEL(N, T, K) android::RSC::sp<const Element> Element::N(android::RSC::sp<RS> rs) { \
Tim Murrayeb4426d2013-08-27 15:30:16 -0700108 if (rs->mElements.N == NULL) { \
109 rs->mElements.N = createPixel(rs, RS_TYPE_##T, RS_KIND_##K); \
110 } \
111 return rs->mElements.N; \
Jason Sams221a4b12012-02-22 15:22:41 -0800112}
Tim Murrayeb4426d2013-08-27 15:30:16 -0700113
Jason Sams221a4b12012-02-22 15:22:41 -0800114CREATE_PIXEL(A_8, UNSIGNED_8, PIXEL_A);
115CREATE_PIXEL(RGB_565, UNSIGNED_5_6_5, PIXEL_RGB);
116CREATE_PIXEL(RGB_888, UNSIGNED_8, PIXEL_RGB);
117CREATE_PIXEL(RGBA_4444, UNSIGNED_4_4_4_4, PIXEL_RGBA);
118CREATE_PIXEL(RGBA_8888, UNSIGNED_8, PIXEL_RGBA);
Tim Murrayeb4426d2013-08-27 15:30:16 -0700119CREATE_PIXEL(YUV, UNSIGNED_8, PIXEL_YUV);
Jason Sams221a4b12012-02-22 15:22:41 -0800120
Tim Murray89daad62013-07-29 14:30:02 -0700121#define CREATE_VECTOR(N, T) android::RSC::sp<const Element> Element::N##_2(android::RSC::sp<RS> rs) { \
Tim Murrayeb4426d2013-08-27 15:30:16 -0700122 if (rs->mElements.N##_2 == NULL) { \
123 rs->mElements.N##_2 = createVector(rs, RS_TYPE_##T, 2); \
124 } \
125 return rs->mElements.N##_2; \
126} \
Tim Murray89daad62013-07-29 14:30:02 -0700127android::RSC::sp<const Element> Element::N##_3(android::RSC::sp<RS> rs) { \
Tim Murrayeb4426d2013-08-27 15:30:16 -0700128 if (rs->mElements.N##_3 == NULL) { \
129 rs->mElements.N##_3 = createVector(rs, RS_TYPE_##T, 3); \
130 } \
131 return rs->mElements.N##_3; \
Jason Sams221a4b12012-02-22 15:22:41 -0800132} \
Tim Murray89daad62013-07-29 14:30:02 -0700133android::RSC::sp<const Element> Element::N##_4(android::RSC::sp<RS> rs) { \
Tim Murrayeb4426d2013-08-27 15:30:16 -0700134 if (rs->mElements.N##_4 == NULL) { \
135 rs->mElements.N##_4 = createVector(rs, RS_TYPE_##T, 4); \
136 } \
137 return rs->mElements.N##_4; \
Jason Sams221a4b12012-02-22 15:22:41 -0800138}
139CREATE_VECTOR(U8, UNSIGNED_8);
140CREATE_VECTOR(I8, SIGNED_8);
141CREATE_VECTOR(U16, UNSIGNED_16);
142CREATE_VECTOR(I16, SIGNED_16);
143CREATE_VECTOR(U32, UNSIGNED_32);
144CREATE_VECTOR(I32, SIGNED_32);
145CREATE_VECTOR(U64, UNSIGNED_64);
146CREATE_VECTOR(I64, SIGNED_64);
147CREATE_VECTOR(F32, FLOAT_32);
148CREATE_VECTOR(F64, FLOAT_64);
149
150
151void Element::updateVisibleSubElements() {
152 if (!mElements.size()) {
153 return;
154 }
155 mVisibleElementMap.clear();
156
157 int noPaddingFieldCount = 0;
158 size_t fieldCount = mElementNames.size();
159 // Find out how many elements are not padding
160 for (size_t ct = 0; ct < fieldCount; ct ++) {
Tim Murrayab716362013-08-12 12:37:18 -0700161 if (mElementNames[ct].c_str()[0] != '#') {
Jason Sams221a4b12012-02-22 15:22:41 -0800162 noPaddingFieldCount ++;
163 }
164 }
165
166 // Make a map that points us at non-padding elements
167 for (size_t ct = 0; ct < fieldCount; ct ++) {
Tim Murrayab716362013-08-12 12:37:18 -0700168 if (mElementNames[ct].c_str()[0] != '#') {
Tim Murray89daad62013-07-29 14:30:02 -0700169 mVisibleElementMap.push_back((uint32_t)ct);
Jason Sams221a4b12012-02-22 15:22:41 -0800170 }
171 }
172}
173
Tim Murray89daad62013-07-29 14:30:02 -0700174Element::Element(void *id, android::RSC::sp<RS> rs,
175 std::vector<android::RSC::sp<Element> > &elements,
Tim Murrayab716362013-08-12 12:37:18 -0700176 std::vector<std::string> &elementNames,
Tim Murray89daad62013-07-29 14:30:02 -0700177 std::vector<uint32_t> &arraySizes) : BaseObj(id, rs) {
Jason Sams221a4b12012-02-22 15:22:41 -0800178 mSizeBytes = 0;
179 mVectorSize = 1;
180 mElements = elements;
181 mArraySizes = arraySizes;
182 mElementNames = elementNames;
183
184 mType = RS_TYPE_NONE;
185 mKind = RS_KIND_USER;
186
187 for (size_t ct = 0; ct < mElements.size(); ct++ ) {
Tim Murray89daad62013-07-29 14:30:02 -0700188 mOffsetInBytes.push_back(mSizeBytes);
Jason Sams221a4b12012-02-22 15:22:41 -0800189 mSizeBytes += mElements[ct]->mSizeBytes * mArraySizes[ct];
190 }
191 updateVisibleSubElements();
192}
193
194
195static uint32_t GetSizeInBytesForType(RsDataType dt) {
196 switch(dt) {
197 case RS_TYPE_NONE:
198 return 0;
199 case RS_TYPE_SIGNED_8:
200 case RS_TYPE_UNSIGNED_8:
201 case RS_TYPE_BOOLEAN:
202 return 1;
203
204 case RS_TYPE_FLOAT_16:
205 case RS_TYPE_SIGNED_16:
206 case RS_TYPE_UNSIGNED_16:
207 case RS_TYPE_UNSIGNED_5_6_5:
208 case RS_TYPE_UNSIGNED_5_5_5_1:
209 case RS_TYPE_UNSIGNED_4_4_4_4:
210 return 2;
211
212 case RS_TYPE_FLOAT_32:
213 case RS_TYPE_SIGNED_32:
214 case RS_TYPE_UNSIGNED_32:
215 return 4;
216
217 case RS_TYPE_FLOAT_64:
218 case RS_TYPE_SIGNED_64:
219 case RS_TYPE_UNSIGNED_64:
220 return 8;
221
222 case RS_TYPE_MATRIX_4X4:
223 return 16 * 4;
224 case RS_TYPE_MATRIX_3X3:
225 return 9 * 4;
226 case RS_TYPE_MATRIX_2X2:
227 return 4 * 4;
228
229 case RS_TYPE_TYPE:
230 case RS_TYPE_ALLOCATION:
231 case RS_TYPE_SAMPLER:
232 case RS_TYPE_SCRIPT:
233 case RS_TYPE_MESH:
234 case RS_TYPE_PROGRAM_FRAGMENT:
235 case RS_TYPE_PROGRAM_VERTEX:
236 case RS_TYPE_PROGRAM_RASTER:
237 case RS_TYPE_PROGRAM_STORE:
238 return 4;
239
240 default:
241 break;
242 }
243
244 ALOGE("Missing type %i", dt);
245 return 0;
246}
247
Tim Murray89daad62013-07-29 14:30:02 -0700248Element::Element(void *id, android::RSC::sp<RS> rs,
Jason Sams221a4b12012-02-22 15:22:41 -0800249 RsDataType dt, RsDataKind dk, bool norm, uint32_t size) :
250 BaseObj(id, rs)
251{
252 uint32_t tsize = GetSizeInBytesForType(dt);
253 if ((dt != RS_TYPE_UNSIGNED_5_6_5) &&
254 (dt != RS_TYPE_UNSIGNED_4_4_4_4) &&
255 (dt != RS_TYPE_UNSIGNED_5_5_5_1)) {
256 if (size == 3) {
257 mSizeBytes = tsize * 4;
258 } else {
259 mSizeBytes = tsize * size;
260 }
261 } else {
262 mSizeBytes = tsize;
263 }
264 mType = dt;
265 mKind = dk;
266 mNormalized = norm;
267 mVectorSize = size;
268}
269
270Element::~Element() {
271}
272
Jason Sams221a4b12012-02-22 15:22:41 -0800273void Element::updateFromNative() {
274 BaseObj::updateFromNative();
Jason Sams221a4b12012-02-22 15:22:41 -0800275 updateVisibleSubElements();
276}
277
Tim Murray89daad62013-07-29 14:30:02 -0700278android::RSC::sp<const Element> Element::createUser(android::RSC::sp<RS> rs, RsDataType dt) {
Tim Murraya4230962013-07-17 16:50:10 -0700279 void * id = RS::dispatch->ElementCreate(rs->getContext(), dt, RS_KIND_USER, false, 1);
Jason Sams221a4b12012-02-22 15:22:41 -0800280 return new Element(id, rs, dt, RS_KIND_USER, false, 1);
281}
282
Tim Murray89daad62013-07-29 14:30:02 -0700283android::RSC::sp<const Element> Element::createVector(android::RSC::sp<RS> rs, RsDataType dt, uint32_t size) {
Jason Sams221a4b12012-02-22 15:22:41 -0800284 if (size < 2 || size > 4) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700285 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Vector size out of range 2-4.");
286 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800287 }
Tim Murraya4230962013-07-17 16:50:10 -0700288 void *id = RS::dispatch->ElementCreate(rs->getContext(), dt, RS_KIND_USER, false, size);
Jason Sams221a4b12012-02-22 15:22:41 -0800289 return new Element(id, rs, dt, RS_KIND_USER, false, size);
290}
291
Tim Murray89daad62013-07-29 14:30:02 -0700292android::RSC::sp<const Element> Element::createPixel(android::RSC::sp<RS> rs, RsDataType dt, RsDataKind dk) {
Jason Sams221a4b12012-02-22 15:22:41 -0800293 if (!(dk == RS_KIND_PIXEL_L ||
294 dk == RS_KIND_PIXEL_A ||
295 dk == RS_KIND_PIXEL_LA ||
296 dk == RS_KIND_PIXEL_RGB ||
297 dk == RS_KIND_PIXEL_RGBA ||
298 dk == RS_KIND_PIXEL_DEPTH)) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700299 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Unsupported DataKind");
300 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800301 }
302 if (!(dt == RS_TYPE_UNSIGNED_8 ||
303 dt == RS_TYPE_UNSIGNED_16 ||
304 dt == RS_TYPE_UNSIGNED_5_6_5 ||
305 dt == RS_TYPE_UNSIGNED_4_4_4_4 ||
306 dt == RS_TYPE_UNSIGNED_5_5_5_1)) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700307 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Unsupported DataType");
308 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800309 }
310 if (dt == RS_TYPE_UNSIGNED_5_6_5 && dk != RS_KIND_PIXEL_RGB) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700311 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Bad kind and type combo");
312 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800313 }
314 if (dt == RS_TYPE_UNSIGNED_5_5_5_1 && dk != RS_KIND_PIXEL_RGBA) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700315 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Bad kind and type combo");
316 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800317 }
318 if (dt == RS_TYPE_UNSIGNED_4_4_4_4 && dk != RS_KIND_PIXEL_RGBA) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700319 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Bad kind and type combo");
320 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800321 }
322 if (dt == RS_TYPE_UNSIGNED_16 && dk != RS_KIND_PIXEL_DEPTH) {
Tim Murray21fa7a02013-08-15 16:25:03 -0700323 rs->throwError(RS_ERROR_INVALID_PARAMETER, "Bad kind and type combo");
324 return NULL;
Jason Sams221a4b12012-02-22 15:22:41 -0800325 }
326
327 int size = 1;
328 switch (dk) {
329 case RS_KIND_PIXEL_LA:
330 size = 2;
331 break;
332 case RS_KIND_PIXEL_RGB:
333 size = 3;
334 break;
335 case RS_KIND_PIXEL_RGBA:
336 size = 4;
337 break;
338 case RS_KIND_PIXEL_DEPTH:
339 size = 2;
340 break;
341 default:
342 break;
343 }
344
Tim Murraya4230962013-07-17 16:50:10 -0700345 void * id = RS::dispatch->ElementCreate(rs->getContext(), dt, dk, true, size);
Jason Sams221a4b12012-02-22 15:22:41 -0800346 return new Element(id, rs, dt, dk, true, size);
347}
348
Tim Murray10913a52013-08-20 17:19:47 -0700349bool Element::isCompatible(android::RSC::sp<const Element>e) const {
Jason Sams221a4b12012-02-22 15:22:41 -0800350 // Try strict BaseObj equality to start with.
Jason Sams69cccdf2012-04-02 19:11:49 -0700351 if (this == e.get()) {
Jason Sams221a4b12012-02-22 15:22:41 -0800352 return true;
353 }
354
355 // Ignore mKind because it is allowed to be different (user vs. pixel).
356 // We also ignore mNormalized because it can be different. The mType
357 // field must be non-null since we require name equivalence for
358 // user-created Elements.
359 return ((mSizeBytes == e->mSizeBytes) &&
Jason Sams69cccdf2012-04-02 19:11:49 -0700360 (mType != RS_TYPE_NONE) &&
Jason Sams221a4b12012-02-22 15:22:41 -0800361 (mType == e->mType) &&
362 (mVectorSize == e->mVectorSize));
363}
364
Tim Murray89daad62013-07-29 14:30:02 -0700365Element::Builder::Builder(android::RSC::sp<RS> rs) {
Jason Sams221a4b12012-02-22 15:22:41 -0800366 mRS = rs;
367 mSkipPadding = false;
368}
369
Tim Murrayab716362013-08-12 12:37:18 -0700370void Element::Builder::add(android::RSC::sp</*const*/ Element>e, std::string &name, uint32_t arraySize) {
Jason Sams221a4b12012-02-22 15:22:41 -0800371 // Skip padding fields after a vector 3 type.
372 if (mSkipPadding) {
373 const char *s1 = "#padding_";
Tim Murrayab716362013-08-12 12:37:18 -0700374 const char *s2 = name.c_str();
Jason Sams221a4b12012-02-22 15:22:41 -0800375 size_t len = strlen(s1);
376 if (strlen(s2) >= len) {
377 if (!memcmp(s1, s2, len)) {
378 mSkipPadding = false;
379 return;
380 }
381 }
382 }
383
384 if (e->mVectorSize == 3) {
385 mSkipPadding = true;
386 } else {
387 mSkipPadding = false;
388 }
389
Tim Murray89daad62013-07-29 14:30:02 -0700390 mElements.push_back(e);
391 mElementNames.push_back(name);
392 mArraySizes.push_back(arraySize);
Jason Sams221a4b12012-02-22 15:22:41 -0800393}
394
Tim Murray89daad62013-07-29 14:30:02 -0700395android::RSC::sp<const Element> Element::Builder::create() {
Jason Sams221a4b12012-02-22 15:22:41 -0800396 size_t fieldCount = mElements.size();
397 const char ** nameArray = (const char **)calloc(fieldCount, sizeof(char *));
Jason Sams69cccdf2012-04-02 19:11:49 -0700398 const Element ** elementArray = (const Element **)calloc(fieldCount, sizeof(Element *));
Jason Sams221a4b12012-02-22 15:22:41 -0800399 size_t* sizeArray = (size_t*)calloc(fieldCount, sizeof(size_t));
400
401 for (size_t ct = 0; ct < fieldCount; ct++) {
Tim Murrayab716362013-08-12 12:37:18 -0700402 nameArray[ct] = mElementNames[ct].c_str();
Jason Sams69cccdf2012-04-02 19:11:49 -0700403 elementArray[ct] = mElements[ct].get();
Jason Sams221a4b12012-02-22 15:22:41 -0800404 sizeArray[ct] = mElementNames[ct].length();
405 }
406
Tim Murraya4230962013-07-17 16:50:10 -0700407 void *id = RS::dispatch->ElementCreate2(mRS->getContext(),
Jason Sams69cccdf2012-04-02 19:11:49 -0700408 (RsElement *)elementArray, fieldCount,
Jason Sams221a4b12012-02-22 15:22:41 -0800409 nameArray, fieldCount * sizeof(size_t), sizeArray,
Tim Murray89daad62013-07-29 14:30:02 -0700410 (const uint32_t *)&mArraySizes[0], fieldCount);
Jason Sams221a4b12012-02-22 15:22:41 -0800411
412
413 free(nameArray);
414 free(sizeArray);
Jason Sams69cccdf2012-04-02 19:11:49 -0700415 free(elementArray);
416 return new Element(id, mRS, mElements, mElementNames, mArraySizes);
Jason Sams221a4b12012-02-22 15:22:41 -0800417}
418