blob: 7f8b3bd7d976196ffb447fa38a2e304eef3db2a2 [file] [log] [blame]
Romain Guyb051e892010-09-28 19:09:36 -07001/*
2 * Copyright (C) 2010 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
17package android.view;
18
Chet Haase9420abd2012-03-29 16:28:32 -070019import android.graphics.Matrix;
Jeff Brown162a0212011-07-21 17:02:54 -070020
21import java.util.ArrayList;
Chet Haasedaf98e92011-01-10 14:10:36 -080022
Romain Guyb051e892010-09-28 19:09:36 -070023/**
24 * An implementation of display list for OpenGL ES 2.0.
25 */
26class GLES20DisplayList extends DisplayList {
Romain Guy16c03182013-06-17 11:21:58 -070027 private ArrayList<DisplayList> mChildDisplayLists;
Romain Guyb051e892010-09-28 19:09:36 -070028
Jeff Brown162a0212011-07-21 17:02:54 -070029 private GLES20RecordingCanvas mCanvas;
30 private boolean mValid;
Romain Guyb051e892010-09-28 19:09:36 -070031
Romain Guy13631f32012-01-30 17:41:55 -080032 // Used for debugging
33 private final String mName;
34
Patrick Dubroyf890fab2010-12-19 16:47:17 -080035 // The native display list will be destroyed when this object dies.
36 // DO NOT overwrite this reference once it is set.
Patrick Dubroyf890fab2010-12-19 16:47:17 -080037 private DisplayListFinalizer mFinalizer;
38
Romain Guy13631f32012-01-30 17:41:55 -080039 GLES20DisplayList(String name) {
40 mName = name;
41 }
42
Romain Guy0d6f4c02012-06-20 23:59:06 -070043 boolean hasNativeDisplayList() {
44 return mValid && mFinalizer != null;
45 }
46
Ashok Bhata0398432014-01-20 20:08:01 +000047 long getNativeDisplayList() {
Jeff Brown162a0212011-07-21 17:02:54 -070048 if (!mValid || mFinalizer == null) {
49 throw new IllegalStateException("The display list is not valid.");
50 }
51 return mFinalizer.mNativeDisplayList;
Chet Haasedaf98e92011-01-10 14:10:36 -080052 }
53
Romain Guyb051e892010-09-28 19:09:36 -070054 @Override
Romain Guy52036b12013-02-14 18:03:37 -080055 public HardwareCanvas start(int width, int height) {
Jeff Brown162a0212011-07-21 17:02:54 -070056 if (mCanvas != null) {
Romain Guyb051e892010-09-28 19:09:36 -070057 throw new IllegalStateException("Recording has already started");
58 }
59
Jeff Brown162a0212011-07-21 17:02:54 -070060 mValid = false;
61 mCanvas = GLES20RecordingCanvas.obtain(this);
62 mCanvas.start();
Romain Guy52036b12013-02-14 18:03:37 -080063
64 mCanvas.setViewport(width, height);
65 // The dirty rect should always be null for a display list
66 mCanvas.onPreDraw(null);
67
Romain Guyb051e892010-09-28 19:09:36 -070068 return mCanvas;
69 }
Romain Guyb051e892010-09-28 19:09:36 -070070 @Override
Romain Guy52036b12013-02-14 18:03:37 -080071 public void clear() {
72 clearDirty();
73
Jeff Brown162a0212011-07-21 17:02:54 -070074 if (mCanvas != null) {
75 mCanvas.recycle();
76 mCanvas = null;
77 }
Chet Haase9e90a992011-01-04 16:23:21 -080078 mValid = false;
Chet Haase9e90a992011-01-04 16:23:21 -080079
Romain Guy3b748a42013-04-17 18:54:38 -070080 clearReferences();
81 }
82
83 void clearReferences() {
Romain Guy16c03182013-06-17 11:21:58 -070084 if (mChildDisplayLists != null) mChildDisplayLists.clear();
85 }
86
Romain Guy16c03182013-06-17 11:21:58 -070087 ArrayList<DisplayList> getChildDisplayLists() {
88 if (mChildDisplayLists == null) mChildDisplayLists = new ArrayList<DisplayList>();
89 return mChildDisplayLists;
Romain Guy38c2ece2012-05-24 14:20:56 -070090 }
91
92 @Override
Chet Haase6a2d17f2012-09-30 12:14:13 -070093 public void reset() {
94 if (hasNativeDisplayList()) {
95 nReset(mFinalizer.mNativeDisplayList);
96 }
Romain Guy46bfc482013-08-16 18:38:29 -070097 clear();
Chet Haase6a2d17f2012-09-30 12:14:13 -070098 }
99
100 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800101 public boolean isValid() {
Chet Haase9e90a992011-01-04 16:23:21 -0800102 return mValid;
103 }
104
105 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800106 public void end() {
Romain Guyb051e892010-09-28 19:09:36 -0700107 if (mCanvas != null) {
Romain Guy52036b12013-02-14 18:03:37 -0800108 mCanvas.onPostDraw();
Jeff Brown162a0212011-07-21 17:02:54 -0700109 if (mFinalizer != null) {
110 mCanvas.end(mFinalizer.mNativeDisplayList);
111 } else {
112 mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
Romain Guy52036b12013-02-14 18:03:37 -0800113 nSetDisplayListName(mFinalizer.mNativeDisplayList, mName);
Jeff Brown162a0212011-07-21 17:02:54 -0700114 }
115 mCanvas.recycle();
116 mCanvas = null;
117 mValid = true;
Romain Guyb051e892010-09-28 19:09:36 -0700118 }
119 }
120
Romain Guy65b345f2011-07-27 18:51:50 -0700121 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800122 public int getSize() {
Romain Guy65b345f2011-07-27 18:51:50 -0700123 if (mFinalizer == null) return 0;
Romain Guy52036b12013-02-14 18:03:37 -0800124 return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
Romain Guy65b345f2011-07-27 18:51:50 -0700125 }
126
Ashok Bhata0398432014-01-20 20:08:01 +0000127 private static native void nDestroyDisplayList(long displayList);
128 private static native int nGetDisplayListSize(long displayList);
129 private static native void nSetDisplayListName(long displayList, String name);
Romain Guy52036b12013-02-14 18:03:37 -0800130
Chet Haasea1cff502012-02-21 13:43:44 -0800131 ///////////////////////////////////////////////////////////////////////////
132 // Native View Properties
133 ///////////////////////////////////////////////////////////////////////////
134
135 @Override
136 public void setCaching(boolean caching) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700137 if (hasNativeDisplayList()) {
138 nSetCaching(mFinalizer.mNativeDisplayList, caching);
Chet Haasea1cff502012-02-21 13:43:44 -0800139 }
140 }
141
142 @Override
Chet Haasedd671592013-04-19 14:54:34 -0700143 public void setClipToBounds(boolean clipToBounds) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700144 if (hasNativeDisplayList()) {
Chet Haasedd671592013-04-19 14:54:34 -0700145 nSetClipToBounds(mFinalizer.mNativeDisplayList, clipToBounds);
Chet Haasea1cff502012-02-21 13:43:44 -0800146 }
147 }
148
149 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800150 public void setMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700151 if (hasNativeDisplayList()) {
152 nSetStaticMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
Chet Haase9420abd2012-03-29 16:28:32 -0700153 }
154 }
155
156 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800157 public Matrix getMatrix(Matrix matrix) {
158 if (hasNativeDisplayList()) {
159 nGetMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
160 }
161 return matrix;
162 }
163
164 @Override
Chet Haase9420abd2012-03-29 16:28:32 -0700165 public void setAnimationMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700166 if (hasNativeDisplayList()) {
167 nSetAnimationMatrix(mFinalizer.mNativeDisplayList,
Chet Haaseafd5c3e2012-05-10 13:21:10 -0700168 (matrix != null) ? matrix.native_instance : 0);
Chet Haasea1cff502012-02-21 13:43:44 -0800169 }
170 }
171
172 @Override
173 public void setAlpha(float alpha) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700174 if (hasNativeDisplayList()) {
175 nSetAlpha(mFinalizer.mNativeDisplayList, alpha);
Chet Haasea1cff502012-02-21 13:43:44 -0800176 }
177 }
178
179 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800180 public float getAlpha() {
181 if (hasNativeDisplayList()) {
182 return nGetAlpha(mFinalizer.mNativeDisplayList);
183 }
184 return 1.0f;
185 }
186
187 @Override
Chet Haasedb8c9a62012-03-21 18:54:18 -0700188 public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700189 if (hasNativeDisplayList()) {
190 nSetHasOverlappingRendering(mFinalizer.mNativeDisplayList, hasOverlappingRendering);
Chet Haasedb8c9a62012-03-21 18:54:18 -0700191 }
192 }
193
194 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800195 public boolean hasOverlappingRendering() {
196 //noinspection SimplifiableIfStatement
197 if (hasNativeDisplayList()) {
198 return nHasOverlappingRendering(mFinalizer.mNativeDisplayList);
199 }
200 return true;
201 }
202
203 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800204 public void setTranslationX(float translationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700205 if (hasNativeDisplayList()) {
206 nSetTranslationX(mFinalizer.mNativeDisplayList, translationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800207 }
208 }
209
210 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800211 public float getTranslationX() {
212 if (hasNativeDisplayList()) {
213 return nGetTranslationX(mFinalizer.mNativeDisplayList);
214 }
215 return 0.0f;
216 }
217
218 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800219 public void setTranslationY(float translationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700220 if (hasNativeDisplayList()) {
221 nSetTranslationY(mFinalizer.mNativeDisplayList, translationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800222 }
223 }
224
225 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800226 public float getTranslationY() {
227 if (hasNativeDisplayList()) {
228 return nGetTranslationY(mFinalizer.mNativeDisplayList);
229 }
230 return 0.0f;
231 }
232
233 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800234 public void setRotation(float rotation) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700235 if (hasNativeDisplayList()) {
236 nSetRotation(mFinalizer.mNativeDisplayList, rotation);
Chet Haasea1cff502012-02-21 13:43:44 -0800237 }
238 }
239
240 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800241 public float getRotation() {
242 if (hasNativeDisplayList()) {
243 return nGetRotation(mFinalizer.mNativeDisplayList);
244 }
245 return 0.0f;
246 }
247
248 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800249 public void setRotationX(float rotationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700250 if (hasNativeDisplayList()) {
251 nSetRotationX(mFinalizer.mNativeDisplayList, rotationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800252 }
253 }
254
255 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800256 public float getRotationX() {
257 if (hasNativeDisplayList()) {
258 return nGetRotationX(mFinalizer.mNativeDisplayList);
259 }
260 return 0.0f;
261 }
262
263 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800264 public void setRotationY(float rotationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700265 if (hasNativeDisplayList()) {
266 nSetRotationY(mFinalizer.mNativeDisplayList, rotationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800267 }
268 }
269
270 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800271 public float getRotationY() {
272 if (hasNativeDisplayList()) {
273 return nGetRotationY(mFinalizer.mNativeDisplayList);
274 }
275 return 0.0f;
276 }
277
278 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800279 public void setScaleX(float scaleX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700280 if (hasNativeDisplayList()) {
281 nSetScaleX(mFinalizer.mNativeDisplayList, scaleX);
Chet Haasea1cff502012-02-21 13:43:44 -0800282 }
283 }
284
285 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800286 public float getScaleX() {
287 if (hasNativeDisplayList()) {
288 return nGetScaleX(mFinalizer.mNativeDisplayList);
289 }
290 return 1.0f;
291 }
292
293 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800294 public void setScaleY(float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700295 if (hasNativeDisplayList()) {
296 nSetScaleY(mFinalizer.mNativeDisplayList, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800297 }
298 }
299
300 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800301 public float getScaleY() {
302 if (hasNativeDisplayList()) {
303 return nGetScaleY(mFinalizer.mNativeDisplayList);
304 }
305 return 1.0f;
306 }
307
308 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800309 public void setTransformationInfo(float alpha, float translationX, float translationY,
310 float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700311 if (hasNativeDisplayList()) {
312 nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha, translationX, translationY,
Chet Haasea1cff502012-02-21 13:43:44 -0800313 rotation, rotationX, rotationY, scaleX, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800314 }
315 }
316
317 @Override
318 public void setPivotX(float pivotX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700319 if (hasNativeDisplayList()) {
320 nSetPivotX(mFinalizer.mNativeDisplayList, pivotX);
Chet Haasea1cff502012-02-21 13:43:44 -0800321 }
322 }
323
324 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800325 public float getPivotX() {
326 if (hasNativeDisplayList()) {
327 return nGetPivotX(mFinalizer.mNativeDisplayList);
328 }
329 return 0.0f;
330 }
331
332 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800333 public void setPivotY(float pivotY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700334 if (hasNativeDisplayList()) {
335 nSetPivotY(mFinalizer.mNativeDisplayList, pivotY);
Chet Haasea1cff502012-02-21 13:43:44 -0800336 }
337 }
338
339 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800340 public float getPivotY() {
341 if (hasNativeDisplayList()) {
342 return nGetPivotY(mFinalizer.mNativeDisplayList);
343 }
344 return 0.0f;
345 }
346
347 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800348 public void setCameraDistance(float distance) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700349 if (hasNativeDisplayList()) {
350 nSetCameraDistance(mFinalizer.mNativeDisplayList, distance);
Chet Haasea1cff502012-02-21 13:43:44 -0800351 }
352 }
353
354 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800355 public float getCameraDistance() {
356 if (hasNativeDisplayList()) {
357 return nGetCameraDistance(mFinalizer.mNativeDisplayList);
358 }
359 return 0.0f;
360 }
361
362 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800363 public void setLeft(int left) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700364 if (hasNativeDisplayList()) {
365 nSetLeft(mFinalizer.mNativeDisplayList, left);
Chet Haasea1cff502012-02-21 13:43:44 -0800366 }
367 }
368
369 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800370 public float getLeft() {
371 if (hasNativeDisplayList()) {
372 return nGetLeft(mFinalizer.mNativeDisplayList);
373 }
374 return 0.0f;
375 }
376
377 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800378 public void setTop(int top) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700379 if (hasNativeDisplayList()) {
380 nSetTop(mFinalizer.mNativeDisplayList, top);
Chet Haasea1cff502012-02-21 13:43:44 -0800381 }
382 }
383
384 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800385 public float getTop() {
386 if (hasNativeDisplayList()) {
387 return nGetTop(mFinalizer.mNativeDisplayList);
388 }
389 return 0.0f;
390 }
391
392 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800393 public void setRight(int right) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700394 if (hasNativeDisplayList()) {
395 nSetRight(mFinalizer.mNativeDisplayList, right);
Chet Haasea1cff502012-02-21 13:43:44 -0800396 }
397 }
398
399 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800400 public float getRight() {
401 if (hasNativeDisplayList()) {
402 return nGetRight(mFinalizer.mNativeDisplayList);
403 }
404 return 0.0f;
405 }
406
407 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800408 public void setBottom(int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700409 if (hasNativeDisplayList()) {
410 nSetBottom(mFinalizer.mNativeDisplayList, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800411 }
412 }
413
414 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800415 public float getBottom() {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700416 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800417 return nGetBottom(mFinalizer.mNativeDisplayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800418 }
Romain Guy52036b12013-02-14 18:03:37 -0800419 return 0.0f;
Chet Haasea1cff502012-02-21 13:43:44 -0800420 }
421
422 @Override
423 public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700424 if (hasNativeDisplayList()) {
425 nSetLeftTopRightBottom(mFinalizer.mNativeDisplayList, left, top, right, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800426 }
427 }
428
429 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800430 public void offsetLeftAndRight(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700431 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800432 nOffsetLeftAndRight(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800433 }
434 }
435
436 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800437 public void offsetTopAndBottom(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700438 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800439 nOffsetTopAndBottom(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800440 }
441 }
442
Ashok Bhata0398432014-01-20 20:08:01 +0000443 private static native void nReset(long displayList);
444 private static native void nOffsetTopAndBottom(long displayList, float offset);
445 private static native void nOffsetLeftAndRight(long displayList, float offset);
446 private static native void nSetLeftTopRightBottom(long displayList, int left, int top,
Chet Haasea1cff502012-02-21 13:43:44 -0800447 int right, int bottom);
Ashok Bhata0398432014-01-20 20:08:01 +0000448 private static native void nSetBottom(long displayList, int bottom);
449 private static native void nSetRight(long displayList, int right);
450 private static native void nSetTop(long displayList, int top);
451 private static native void nSetLeft(long displayList, int left);
452 private static native void nSetCameraDistance(long displayList, float distance);
453 private static native void nSetPivotY(long displayList, float pivotY);
454 private static native void nSetPivotX(long displayList, float pivotX);
455 private static native void nSetCaching(long displayList, boolean caching);
456 private static native void nSetClipToBounds(long displayList, boolean clipToBounds);
457 private static native void nSetAlpha(long displayList, float alpha);
458 private static native void nSetHasOverlappingRendering(long displayList,
Chet Haasedb8c9a62012-03-21 18:54:18 -0700459 boolean hasOverlappingRendering);
Ashok Bhata0398432014-01-20 20:08:01 +0000460 private static native void nSetTranslationX(long displayList, float translationX);
461 private static native void nSetTranslationY(long displayList, float translationY);
462 private static native void nSetRotation(long displayList, float rotation);
463 private static native void nSetRotationX(long displayList, float rotationX);
464 private static native void nSetRotationY(long displayList, float rotationY);
465 private static native void nSetScaleX(long displayList, float scaleX);
466 private static native void nSetScaleY(long displayList, float scaleY);
467 private static native void nSetTransformationInfo(long displayList, float alpha,
Chet Haasea1cff502012-02-21 13:43:44 -0800468 float translationX, float translationY, float rotation, float rotationX,
469 float rotationY, float scaleX, float scaleY);
Ashok Bhata0398432014-01-20 20:08:01 +0000470 private static native void nSetStaticMatrix(long displayList, long nativeMatrix);
471 private static native void nSetAnimationMatrix(long displayList, long animationMatrix);
Chet Haasea1cff502012-02-21 13:43:44 -0800472
Ashok Bhata0398432014-01-20 20:08:01 +0000473 private static native boolean nHasOverlappingRendering(long displayList);
474 private static native void nGetMatrix(long displayList, long matrix);
475 private static native float nGetAlpha(long displayList);
476 private static native float nGetLeft(long displayList);
477 private static native float nGetTop(long displayList);
478 private static native float nGetRight(long displayList);
479 private static native float nGetBottom(long displayList);
480 private static native float nGetCameraDistance(long displayList);
481 private static native float nGetScaleX(long displayList);
482 private static native float nGetScaleY(long displayList);
483 private static native float nGetTranslationX(long displayList);
484 private static native float nGetTranslationY(long displayList);
485 private static native float nGetRotation(long displayList);
486 private static native float nGetRotationX(long displayList);
487 private static native float nGetRotationY(long displayList);
488 private static native float nGetPivotX(long displayList);
489 private static native float nGetPivotY(long displayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800490
491 ///////////////////////////////////////////////////////////////////////////
492 // Finalization
493 ///////////////////////////////////////////////////////////////////////////
494
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800495 private static class DisplayListFinalizer {
Ashok Bhata0398432014-01-20 20:08:01 +0000496 final long mNativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700497
Ashok Bhata0398432014-01-20 20:08:01 +0000498 public DisplayListFinalizer(long nativeDisplayList) {
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800499 mNativeDisplayList = nativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700500 }
501
502 @Override
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800503 protected void finalize() throws Throwable {
Romain Guy6c319ca2011-01-11 14:29:25 -0800504 try {
Romain Guy52036b12013-02-14 18:03:37 -0800505 nDestroyDisplayList(mNativeDisplayList);
Romain Guy6c319ca2011-01-11 14:29:25 -0800506 } finally {
507 super.finalize();
508 }
Chet Haase5c13d892010-10-08 08:37:55 -0700509 }
510 }
Romain Guyb051e892010-09-28 19:09:36 -0700511}