|
24 | 24 |
|
25 | 25 | const Element * Element::getSubElement(uint32_t index) { |
26 | 26 | if (!mVisibleElementMap.size()) { |
27 | | - ALOGE("Element contains no sub-elements"); |
28 | | - return NULL; |
| 27 | + mRS->throwError("Element contains no sub-elements"); |
29 | 28 | } |
30 | 29 | if (index >= mVisibleElementMap.size()) { |
31 | | - ALOGE("Illegal sub-element index"); |
| 30 | + mRS->throwError("Illegal sub-element index"); |
32 | 31 | } |
33 | 32 | return mElements[mVisibleElementMap[index]]; |
34 | 33 | } |
35 | 34 |
|
36 | 35 | const char * Element::getSubElementName(uint32_t index) { |
37 | 36 | if (!mVisibleElementMap.size()) { |
38 | | - ALOGE("Element contains no sub-elements"); |
| 37 | + mRS->throwError("Element contains no sub-elements"); |
39 | 38 | } |
40 | 39 | if (index >= mVisibleElementMap.size()) { |
41 | | - ALOGE("Illegal sub-element index"); |
| 40 | + mRS->throwError("Illegal sub-element index"); |
42 | 41 | } |
43 | 42 | return mElementNames[mVisibleElementMap[index]]; |
44 | 43 | } |
45 | 44 |
|
46 | 45 | size_t Element::getSubElementArraySize(uint32_t index) { |
47 | 46 | if (!mVisibleElementMap.size()) { |
48 | | - ALOGE("Element contains no sub-elements"); |
| 47 | + mRS->throwError("Element contains no sub-elements"); |
49 | 48 | } |
50 | 49 | if (index >= mVisibleElementMap.size()) { |
51 | | - ALOGE("Illegal sub-element index"); |
| 50 | + mRS->throwError("Illegal sub-element index"); |
52 | 51 | } |
53 | 52 | return mArraySizes[mVisibleElementMap[index]]; |
54 | 53 | } |
55 | 54 |
|
56 | 55 | uint32_t Element::getSubElementOffsetBytes(uint32_t index) { |
57 | 56 | if (mVisibleElementMap.size()) { |
58 | | - ALOGE("Element contains no sub-elements"); |
| 57 | + mRS->throwError("Element contains no sub-elements"); |
59 | 58 | } |
60 | 59 | if (index >= mVisibleElementMap.size()) { |
61 | | - ALOGE("Illegal sub-element index"); |
| 60 | + mRS->throwError("Illegal sub-element index"); |
62 | 61 | } |
63 | 62 | return mOffsetInBytes[mVisibleElementMap[index]]; |
64 | 63 | } |
@@ -293,54 +292,45 @@ void Element::updateFromNative() { |
293 | 292 | } |
294 | 293 |
|
295 | 294 | const Element * Element::createUser(RenderScript *rs, RsDataType dt) { |
296 | | - ALOGE("createUser %p %i", rs, dt); |
297 | 295 | void * id = rsElementCreate(rs->mContext, dt, RS_KIND_USER, false, 1); |
298 | 296 | return new Element(id, rs, dt, RS_KIND_USER, false, 1); |
299 | 297 | } |
300 | 298 |
|
301 | 299 | const Element * Element::createVector(RenderScript *rs, RsDataType dt, uint32_t size) { |
302 | 300 | if (size < 2 || size > 4) { |
303 | | - ALOGE("Vector size out of range 2-4."); |
304 | | - return NULL; |
| 301 | + rs->throwError("Vector size out of range 2-4."); |
305 | 302 | } |
306 | 303 | void *id = rsElementCreate(rs->mContext, dt, RS_KIND_USER, false, size); |
307 | 304 | return new Element(id, rs, dt, RS_KIND_USER, false, size); |
308 | 305 | } |
309 | 306 |
|
310 | 307 | const Element * Element::createPixel(RenderScript *rs, RsDataType dt, RsDataKind dk) { |
311 | | - ALOGE("createPixel %p %i %i", rs, dt, dk); |
312 | 308 | if (!(dk == RS_KIND_PIXEL_L || |
313 | 309 | dk == RS_KIND_PIXEL_A || |
314 | 310 | dk == RS_KIND_PIXEL_LA || |
315 | 311 | dk == RS_KIND_PIXEL_RGB || |
316 | 312 | dk == RS_KIND_PIXEL_RGBA || |
317 | 313 | dk == RS_KIND_PIXEL_DEPTH)) { |
318 | | - ALOGE("Unsupported DataKind"); |
319 | | - return NULL; |
| 314 | + rs->throwError("Unsupported DataKind"); |
320 | 315 | } |
321 | 316 | if (!(dt == RS_TYPE_UNSIGNED_8 || |
322 | 317 | dt == RS_TYPE_UNSIGNED_16 || |
323 | 318 | dt == RS_TYPE_UNSIGNED_5_6_5 || |
324 | 319 | dt == RS_TYPE_UNSIGNED_4_4_4_4 || |
325 | 320 | dt == RS_TYPE_UNSIGNED_5_5_5_1)) { |
326 | | - ALOGE("Unsupported DataType"); |
327 | | - return NULL; |
| 321 | + rs->throwError("Unsupported DataType"); |
328 | 322 | } |
329 | 323 | if (dt == RS_TYPE_UNSIGNED_5_6_5 && dk != RS_KIND_PIXEL_RGB) { |
330 | | - ALOGE("Bad kind and type combo"); |
331 | | - return NULL; |
| 324 | + rs->throwError("Bad kind and type combo"); |
332 | 325 | } |
333 | 326 | if (dt == RS_TYPE_UNSIGNED_5_5_5_1 && dk != RS_KIND_PIXEL_RGBA) { |
334 | | - ALOGE("Bad kind and type combo"); |
335 | | - return NULL; |
| 327 | + rs->throwError("Bad kind and type combo"); |
336 | 328 | } |
337 | 329 | if (dt == RS_TYPE_UNSIGNED_4_4_4_4 && dk != RS_KIND_PIXEL_RGBA) { |
338 | | - ALOGE("Bad kind and type combo"); |
339 | | - return NULL; |
| 330 | + rs->throwError("Bad kind and type combo"); |
340 | 331 | } |
341 | 332 | if (dt == RS_TYPE_UNSIGNED_16 && dk != RS_KIND_PIXEL_DEPTH) { |
342 | | - ALOGE("Bad kind and type combo"); |
343 | | - return NULL; |
| 333 | + rs->throwError("Bad kind and type combo"); |
344 | 334 | } |
345 | 335 |
|
346 | 336 | int size = 1; |
|
0 commit comments