blob: 3272504fbfa68d35c9cdc740a17254ee427a6240 [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
Jeff Brown162a0212011-07-21 17:02:54 -070019import android.graphics.Bitmap;
Chet Haase9420abd2012-03-29 16:28:32 -070020import android.graphics.Matrix;
Jeff Brown162a0212011-07-21 17:02:54 -070021
22import java.util.ArrayList;
Chet Haasedaf98e92011-01-10 14:10:36 -080023
Romain Guyb051e892010-09-28 19:09:36 -070024/**
25 * An implementation of display list for OpenGL ES 2.0.
26 */
27class GLES20DisplayList extends DisplayList {
Chet Haaseca479d42012-08-30 17:20:08 -070028 // These lists ensure that any Bitmaps and DisplayLists recorded by a DisplayList are kept
29 // alive as long as the DisplayList is alive. The Bitmap and DisplayList lists
30 // are populated by the GLES20RecordingCanvas during appropriate drawing calls and are
31 // cleared at the start of a new drawing frame or when the view is detached from the window.
Jeff Brown162a0212011-07-21 17:02:54 -070032 final ArrayList<Bitmap> mBitmaps = new ArrayList<Bitmap>(5);
Chet Haaseca479d42012-08-30 17:20:08 -070033 final ArrayList<DisplayList> mChildDisplayLists = new ArrayList<DisplayList>();
Romain Guyb051e892010-09-28 19:09:36 -070034
Jeff Brown162a0212011-07-21 17:02:54 -070035 private GLES20RecordingCanvas mCanvas;
36 private boolean mValid;
Romain Guyb051e892010-09-28 19:09:36 -070037
Romain Guy13631f32012-01-30 17:41:55 -080038 // Used for debugging
39 private final String mName;
40
Patrick Dubroyf890fab2010-12-19 16:47:17 -080041 // The native display list will be destroyed when this object dies.
42 // DO NOT overwrite this reference once it is set.
Patrick Dubroyf890fab2010-12-19 16:47:17 -080043 private DisplayListFinalizer mFinalizer;
44
Romain Guy13631f32012-01-30 17:41:55 -080045 GLES20DisplayList(String name) {
46 mName = name;
47 }
48
Romain Guy0d6f4c02012-06-20 23:59:06 -070049 boolean hasNativeDisplayList() {
50 return mValid && mFinalizer != null;
51 }
52
Jeff Brown162a0212011-07-21 17:02:54 -070053 int getNativeDisplayList() {
54 if (!mValid || mFinalizer == null) {
55 throw new IllegalStateException("The display list is not valid.");
56 }
57 return mFinalizer.mNativeDisplayList;
Chet Haasedaf98e92011-01-10 14:10:36 -080058 }
59
Romain Guyb051e892010-09-28 19:09:36 -070060 @Override
Romain Guy52036b12013-02-14 18:03:37 -080061 public HardwareCanvas start(int width, int height) {
Jeff Brown162a0212011-07-21 17:02:54 -070062 if (mCanvas != null) {
Romain Guyb051e892010-09-28 19:09:36 -070063 throw new IllegalStateException("Recording has already started");
64 }
65
Jeff Brown162a0212011-07-21 17:02:54 -070066 mValid = false;
67 mCanvas = GLES20RecordingCanvas.obtain(this);
68 mCanvas.start();
Romain Guy52036b12013-02-14 18:03:37 -080069
70 mCanvas.setViewport(width, height);
71 // The dirty rect should always be null for a display list
72 mCanvas.onPreDraw(null);
73
Romain Guyb051e892010-09-28 19:09:36 -070074 return mCanvas;
75 }
Romain Guyb051e892010-09-28 19:09:36 -070076 @Override
Romain Guy52036b12013-02-14 18:03:37 -080077 public void clear() {
78 clearDirty();
79
Jeff Brown162a0212011-07-21 17:02:54 -070080 if (mCanvas != null) {
81 mCanvas.recycle();
82 mCanvas = null;
83 }
Chet Haase9e90a992011-01-04 16:23:21 -080084 mValid = false;
Chet Haase9e90a992011-01-04 16:23:21 -080085
Romain Guy52036b12013-02-14 18:03:37 -080086 mBitmaps.clear();
87 mChildDisplayLists.clear();
Romain Guy38c2ece2012-05-24 14:20:56 -070088 }
89
90 @Override
Chet Haase6a2d17f2012-09-30 12:14:13 -070091 public void reset() {
92 if (hasNativeDisplayList()) {
93 nReset(mFinalizer.mNativeDisplayList);
94 }
95 }
96
97 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -080098 public boolean isValid() {
Chet Haase9e90a992011-01-04 16:23:21 -080099 return mValid;
100 }
101
102 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800103 public void end() {
Romain Guyb051e892010-09-28 19:09:36 -0700104 if (mCanvas != null) {
Romain Guy52036b12013-02-14 18:03:37 -0800105 mCanvas.onPostDraw();
Jeff Brown162a0212011-07-21 17:02:54 -0700106 if (mFinalizer != null) {
107 mCanvas.end(mFinalizer.mNativeDisplayList);
108 } else {
109 mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
Romain Guy52036b12013-02-14 18:03:37 -0800110 nSetDisplayListName(mFinalizer.mNativeDisplayList, mName);
Jeff Brown162a0212011-07-21 17:02:54 -0700111 }
112 mCanvas.recycle();
113 mCanvas = null;
114 mValid = true;
Romain Guyb051e892010-09-28 19:09:36 -0700115 }
116 }
117
Romain Guy65b345f2011-07-27 18:51:50 -0700118 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800119 public int getSize() {
Romain Guy65b345f2011-07-27 18:51:50 -0700120 if (mFinalizer == null) return 0;
Romain Guy52036b12013-02-14 18:03:37 -0800121 return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
Romain Guy65b345f2011-07-27 18:51:50 -0700122 }
123
Romain Guy52036b12013-02-14 18:03:37 -0800124 private static native void nDestroyDisplayList(int displayList);
125 private static native int nGetDisplayListSize(int displayList);
126 private static native void nSetDisplayListName(int displayList, String name);
127
Chet Haasea1cff502012-02-21 13:43:44 -0800128 ///////////////////////////////////////////////////////////////////////////
129 // Native View Properties
130 ///////////////////////////////////////////////////////////////////////////
131
132 @Override
133 public void setCaching(boolean caching) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700134 if (hasNativeDisplayList()) {
135 nSetCaching(mFinalizer.mNativeDisplayList, caching);
Chet Haasea1cff502012-02-21 13:43:44 -0800136 }
137 }
138
139 @Override
Chet Haasedd671592013-04-19 14:54:34 -0700140 public void setClipToBounds(boolean clipToBounds) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700141 if (hasNativeDisplayList()) {
Chet Haasedd671592013-04-19 14:54:34 -0700142 nSetClipToBounds(mFinalizer.mNativeDisplayList, clipToBounds);
Chet Haasea1cff502012-02-21 13:43:44 -0800143 }
144 }
145
146 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800147 public void setMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700148 if (hasNativeDisplayList()) {
149 nSetStaticMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
Chet Haase9420abd2012-03-29 16:28:32 -0700150 }
151 }
152
153 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800154 public Matrix getMatrix(Matrix matrix) {
155 if (hasNativeDisplayList()) {
156 nGetMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
157 }
158 return matrix;
159 }
160
161 @Override
Chet Haase9420abd2012-03-29 16:28:32 -0700162 public void setAnimationMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700163 if (hasNativeDisplayList()) {
164 nSetAnimationMatrix(mFinalizer.mNativeDisplayList,
Chet Haaseafd5c3e2012-05-10 13:21:10 -0700165 (matrix != null) ? matrix.native_instance : 0);
Chet Haasea1cff502012-02-21 13:43:44 -0800166 }
167 }
168
169 @Override
170 public void setAlpha(float alpha) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700171 if (hasNativeDisplayList()) {
172 nSetAlpha(mFinalizer.mNativeDisplayList, alpha);
Chet Haasea1cff502012-02-21 13:43:44 -0800173 }
174 }
175
176 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800177 public float getAlpha() {
178 if (hasNativeDisplayList()) {
179 return nGetAlpha(mFinalizer.mNativeDisplayList);
180 }
181 return 1.0f;
182 }
183
184 @Override
Chet Haasedb8c9a62012-03-21 18:54:18 -0700185 public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700186 if (hasNativeDisplayList()) {
187 nSetHasOverlappingRendering(mFinalizer.mNativeDisplayList, hasOverlappingRendering);
Chet Haasedb8c9a62012-03-21 18:54:18 -0700188 }
189 }
190
191 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800192 public boolean hasOverlappingRendering() {
193 //noinspection SimplifiableIfStatement
194 if (hasNativeDisplayList()) {
195 return nHasOverlappingRendering(mFinalizer.mNativeDisplayList);
196 }
197 return true;
198 }
199
200 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800201 public void setTranslationX(float translationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700202 if (hasNativeDisplayList()) {
203 nSetTranslationX(mFinalizer.mNativeDisplayList, translationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800204 }
205 }
206
207 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800208 public float getTranslationX() {
209 if (hasNativeDisplayList()) {
210 return nGetTranslationX(mFinalizer.mNativeDisplayList);
211 }
212 return 0.0f;
213 }
214
215 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800216 public void setTranslationY(float translationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700217 if (hasNativeDisplayList()) {
218 nSetTranslationY(mFinalizer.mNativeDisplayList, translationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800219 }
220 }
221
222 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800223 public float getTranslationY() {
224 if (hasNativeDisplayList()) {
225 return nGetTranslationY(mFinalizer.mNativeDisplayList);
226 }
227 return 0.0f;
228 }
229
230 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800231 public void setRotation(float rotation) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700232 if (hasNativeDisplayList()) {
233 nSetRotation(mFinalizer.mNativeDisplayList, rotation);
Chet Haasea1cff502012-02-21 13:43:44 -0800234 }
235 }
236
237 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800238 public float getRotation() {
239 if (hasNativeDisplayList()) {
240 return nGetRotation(mFinalizer.mNativeDisplayList);
241 }
242 return 0.0f;
243 }
244
245 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800246 public void setRotationX(float rotationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700247 if (hasNativeDisplayList()) {
248 nSetRotationX(mFinalizer.mNativeDisplayList, rotationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800249 }
250 }
251
252 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800253 public float getRotationX() {
254 if (hasNativeDisplayList()) {
255 return nGetRotationX(mFinalizer.mNativeDisplayList);
256 }
257 return 0.0f;
258 }
259
260 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800261 public void setRotationY(float rotationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700262 if (hasNativeDisplayList()) {
263 nSetRotationY(mFinalizer.mNativeDisplayList, rotationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800264 }
265 }
266
267 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800268 public float getRotationY() {
269 if (hasNativeDisplayList()) {
270 return nGetRotationY(mFinalizer.mNativeDisplayList);
271 }
272 return 0.0f;
273 }
274
275 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800276 public void setScaleX(float scaleX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700277 if (hasNativeDisplayList()) {
278 nSetScaleX(mFinalizer.mNativeDisplayList, scaleX);
Chet Haasea1cff502012-02-21 13:43:44 -0800279 }
280 }
281
282 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800283 public float getScaleX() {
284 if (hasNativeDisplayList()) {
285 return nGetScaleX(mFinalizer.mNativeDisplayList);
286 }
287 return 1.0f;
288 }
289
290 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800291 public void setScaleY(float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700292 if (hasNativeDisplayList()) {
293 nSetScaleY(mFinalizer.mNativeDisplayList, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800294 }
295 }
296
297 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800298 public float getScaleY() {
299 if (hasNativeDisplayList()) {
300 return nGetScaleY(mFinalizer.mNativeDisplayList);
301 }
302 return 1.0f;
303 }
304
305 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800306 public void setTransformationInfo(float alpha, float translationX, float translationY,
307 float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700308 if (hasNativeDisplayList()) {
309 nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha, translationX, translationY,
Chet Haasea1cff502012-02-21 13:43:44 -0800310 rotation, rotationX, rotationY, scaleX, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800311 }
312 }
313
314 @Override
315 public void setPivotX(float pivotX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700316 if (hasNativeDisplayList()) {
317 nSetPivotX(mFinalizer.mNativeDisplayList, pivotX);
Chet Haasea1cff502012-02-21 13:43:44 -0800318 }
319 }
320
321 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800322 public float getPivotX() {
323 if (hasNativeDisplayList()) {
324 return nGetPivotX(mFinalizer.mNativeDisplayList);
325 }
326 return 0.0f;
327 }
328
329 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800330 public void setPivotY(float pivotY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700331 if (hasNativeDisplayList()) {
332 nSetPivotY(mFinalizer.mNativeDisplayList, pivotY);
Chet Haasea1cff502012-02-21 13:43:44 -0800333 }
334 }
335
336 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800337 public float getPivotY() {
338 if (hasNativeDisplayList()) {
339 return nGetPivotY(mFinalizer.mNativeDisplayList);
340 }
341 return 0.0f;
342 }
343
344 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800345 public void setCameraDistance(float distance) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700346 if (hasNativeDisplayList()) {
347 nSetCameraDistance(mFinalizer.mNativeDisplayList, distance);
Chet Haasea1cff502012-02-21 13:43:44 -0800348 }
349 }
350
351 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800352 public float getCameraDistance() {
353 if (hasNativeDisplayList()) {
354 return nGetCameraDistance(mFinalizer.mNativeDisplayList);
355 }
356 return 0.0f;
357 }
358
359 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800360 public void setLeft(int left) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700361 if (hasNativeDisplayList()) {
362 nSetLeft(mFinalizer.mNativeDisplayList, left);
Chet Haasea1cff502012-02-21 13:43:44 -0800363 }
364 }
365
366 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800367 public float getLeft() {
368 if (hasNativeDisplayList()) {
369 return nGetLeft(mFinalizer.mNativeDisplayList);
370 }
371 return 0.0f;
372 }
373
374 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800375 public void setTop(int top) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700376 if (hasNativeDisplayList()) {
377 nSetTop(mFinalizer.mNativeDisplayList, top);
Chet Haasea1cff502012-02-21 13:43:44 -0800378 }
379 }
380
381 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800382 public float getTop() {
383 if (hasNativeDisplayList()) {
384 return nGetTop(mFinalizer.mNativeDisplayList);
385 }
386 return 0.0f;
387 }
388
389 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800390 public void setRight(int right) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700391 if (hasNativeDisplayList()) {
392 nSetRight(mFinalizer.mNativeDisplayList, right);
Chet Haasea1cff502012-02-21 13:43:44 -0800393 }
394 }
395
396 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800397 public float getRight() {
398 if (hasNativeDisplayList()) {
399 return nGetRight(mFinalizer.mNativeDisplayList);
400 }
401 return 0.0f;
402 }
403
404 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800405 public void setBottom(int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700406 if (hasNativeDisplayList()) {
407 nSetBottom(mFinalizer.mNativeDisplayList, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800408 }
409 }
410
411 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800412 public float getBottom() {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700413 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800414 return nGetBottom(mFinalizer.mNativeDisplayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800415 }
Romain Guy52036b12013-02-14 18:03:37 -0800416 return 0.0f;
Chet Haasea1cff502012-02-21 13:43:44 -0800417 }
418
419 @Override
420 public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700421 if (hasNativeDisplayList()) {
422 nSetLeftTopRightBottom(mFinalizer.mNativeDisplayList, left, top, right, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800423 }
424 }
425
426 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800427 public void offsetLeftAndRight(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700428 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800429 nOffsetLeftAndRight(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800430 }
431 }
432
433 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800434 public void offsetTopAndBottom(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700435 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800436 nOffsetTopAndBottom(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800437 }
438 }
439
Chet Haase6a2d17f2012-09-30 12:14:13 -0700440 private static native void nReset(int displayList);
Romain Guy52036b12013-02-14 18:03:37 -0800441 private static native void nOffsetTopAndBottom(int displayList, float offset);
442 private static native void nOffsetLeftAndRight(int displayList, float offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800443 private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
444 int right, int bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800445 private static native void nSetBottom(int displayList, int bottom);
446 private static native void nSetRight(int displayList, int right);
447 private static native void nSetTop(int displayList, int top);
448 private static native void nSetLeft(int displayList, int left);
449 private static native void nSetCameraDistance(int displayList, float distance);
450 private static native void nSetPivotY(int displayList, float pivotY);
451 private static native void nSetPivotX(int displayList, float pivotX);
452 private static native void nSetCaching(int displayList, boolean caching);
Chet Haasedd671592013-04-19 14:54:34 -0700453 private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
Chet Haasea1cff502012-02-21 13:43:44 -0800454 private static native void nSetAlpha(int displayList, float alpha);
Chet Haasedb8c9a62012-03-21 18:54:18 -0700455 private static native void nSetHasOverlappingRendering(int displayList,
456 boolean hasOverlappingRendering);
Chet Haasea1cff502012-02-21 13:43:44 -0800457 private static native void nSetTranslationX(int displayList, float translationX);
458 private static native void nSetTranslationY(int displayList, float translationY);
459 private static native void nSetRotation(int displayList, float rotation);
460 private static native void nSetRotationX(int displayList, float rotationX);
461 private static native void nSetRotationY(int displayList, float rotationY);
462 private static native void nSetScaleX(int displayList, float scaleX);
463 private static native void nSetScaleY(int displayList, float scaleY);
464 private static native void nSetTransformationInfo(int displayList, float alpha,
465 float translationX, float translationY, float rotation, float rotationX,
466 float rotationY, float scaleX, float scaleY);
Chet Haase9420abd2012-03-29 16:28:32 -0700467 private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
468 private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
Chet Haasea1cff502012-02-21 13:43:44 -0800469
Romain Guy52036b12013-02-14 18:03:37 -0800470 private static native boolean nHasOverlappingRendering(int displayList);
471 private static native void nGetMatrix(int displayList, int matrix);
472 private static native float nGetAlpha(int displayList);
473 private static native float nGetLeft(int displayList);
474 private static native float nGetTop(int displayList);
475 private static native float nGetRight(int displayList);
476 private static native float nGetBottom(int displayList);
477 private static native float nGetCameraDistance(int displayList);
478 private static native float nGetScaleX(int displayList);
479 private static native float nGetScaleY(int displayList);
480 private static native float nGetTranslationX(int displayList);
481 private static native float nGetTranslationY(int displayList);
482 private static native float nGetRotation(int displayList);
483 private static native float nGetRotationX(int displayList);
484 private static native float nGetRotationY(int displayList);
485 private static native float nGetPivotX(int displayList);
486 private static native float nGetPivotY(int displayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800487
488 ///////////////////////////////////////////////////////////////////////////
489 // Finalization
490 ///////////////////////////////////////////////////////////////////////////
491
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800492 private static class DisplayListFinalizer {
Jeff Brown162a0212011-07-21 17:02:54 -0700493 final int mNativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700494
Jeff Brown162a0212011-07-21 17:02:54 -0700495 public DisplayListFinalizer(int nativeDisplayList) {
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800496 mNativeDisplayList = nativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700497 }
498
499 @Override
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800500 protected void finalize() throws Throwable {
Romain Guy6c319ca2011-01-11 14:29:25 -0800501 try {
Romain Guy52036b12013-02-14 18:03:37 -0800502 nDestroyDisplayList(mNativeDisplayList);
Romain Guy6c319ca2011-01-11 14:29:25 -0800503 } finally {
504 super.finalize();
505 }
Chet Haase5c13d892010-10-08 08:37:55 -0700506 }
507 }
Romain Guyb051e892010-09-28 19:09:36 -0700508}