blob: 8b2a2ef8b6e092e4894d3206bb6003297e33058e [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
Jeff Brown162a0212011-07-21 17:02:54 -070047 int getNativeDisplayList() {
48 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 }
97 }
98
99 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800100 public boolean isValid() {
Chet Haase9e90a992011-01-04 16:23:21 -0800101 return mValid;
102 }
103
104 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800105 public void end() {
Romain Guyb051e892010-09-28 19:09:36 -0700106 if (mCanvas != null) {
Romain Guy52036b12013-02-14 18:03:37 -0800107 mCanvas.onPostDraw();
Jeff Brown162a0212011-07-21 17:02:54 -0700108 if (mFinalizer != null) {
109 mCanvas.end(mFinalizer.mNativeDisplayList);
110 } else {
111 mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
Romain Guy52036b12013-02-14 18:03:37 -0800112 nSetDisplayListName(mFinalizer.mNativeDisplayList, mName);
Jeff Brown162a0212011-07-21 17:02:54 -0700113 }
114 mCanvas.recycle();
115 mCanvas = null;
116 mValid = true;
Romain Guyb051e892010-09-28 19:09:36 -0700117 }
118 }
119
Romain Guy65b345f2011-07-27 18:51:50 -0700120 @Override
Gilles Debunneb35ab7b2011-12-05 15:54:00 -0800121 public int getSize() {
Romain Guy65b345f2011-07-27 18:51:50 -0700122 if (mFinalizer == null) return 0;
Romain Guy52036b12013-02-14 18:03:37 -0800123 return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
Romain Guy65b345f2011-07-27 18:51:50 -0700124 }
125
Romain Guy52036b12013-02-14 18:03:37 -0800126 private static native void nDestroyDisplayList(int displayList);
127 private static native int nGetDisplayListSize(int displayList);
128 private static native void nSetDisplayListName(int displayList, String name);
129
Chet Haasea1cff502012-02-21 13:43:44 -0800130 ///////////////////////////////////////////////////////////////////////////
131 // Native View Properties
132 ///////////////////////////////////////////////////////////////////////////
133
134 @Override
135 public void setCaching(boolean caching) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700136 if (hasNativeDisplayList()) {
137 nSetCaching(mFinalizer.mNativeDisplayList, caching);
Chet Haasea1cff502012-02-21 13:43:44 -0800138 }
139 }
140
141 @Override
Chet Haasedd671592013-04-19 14:54:34 -0700142 public void setClipToBounds(boolean clipToBounds) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700143 if (hasNativeDisplayList()) {
Chet Haasedd671592013-04-19 14:54:34 -0700144 nSetClipToBounds(mFinalizer.mNativeDisplayList, clipToBounds);
Chet Haasea1cff502012-02-21 13:43:44 -0800145 }
146 }
147
148 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800149 public void setMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700150 if (hasNativeDisplayList()) {
151 nSetStaticMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
Chet Haase9420abd2012-03-29 16:28:32 -0700152 }
153 }
154
155 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800156 public Matrix getMatrix(Matrix matrix) {
157 if (hasNativeDisplayList()) {
158 nGetMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
159 }
160 return matrix;
161 }
162
163 @Override
Chet Haase9420abd2012-03-29 16:28:32 -0700164 public void setAnimationMatrix(Matrix matrix) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700165 if (hasNativeDisplayList()) {
166 nSetAnimationMatrix(mFinalizer.mNativeDisplayList,
Chet Haaseafd5c3e2012-05-10 13:21:10 -0700167 (matrix != null) ? matrix.native_instance : 0);
Chet Haasea1cff502012-02-21 13:43:44 -0800168 }
169 }
170
171 @Override
172 public void setAlpha(float alpha) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700173 if (hasNativeDisplayList()) {
174 nSetAlpha(mFinalizer.mNativeDisplayList, alpha);
Chet Haasea1cff502012-02-21 13:43:44 -0800175 }
176 }
177
178 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800179 public float getAlpha() {
180 if (hasNativeDisplayList()) {
181 return nGetAlpha(mFinalizer.mNativeDisplayList);
182 }
183 return 1.0f;
184 }
185
186 @Override
Chet Haasedb8c9a62012-03-21 18:54:18 -0700187 public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700188 if (hasNativeDisplayList()) {
189 nSetHasOverlappingRendering(mFinalizer.mNativeDisplayList, hasOverlappingRendering);
Chet Haasedb8c9a62012-03-21 18:54:18 -0700190 }
191 }
192
193 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800194 public boolean hasOverlappingRendering() {
195 //noinspection SimplifiableIfStatement
196 if (hasNativeDisplayList()) {
197 return nHasOverlappingRendering(mFinalizer.mNativeDisplayList);
198 }
199 return true;
200 }
201
202 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800203 public void setTranslationX(float translationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700204 if (hasNativeDisplayList()) {
205 nSetTranslationX(mFinalizer.mNativeDisplayList, translationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800206 }
207 }
208
209 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800210 public float getTranslationX() {
211 if (hasNativeDisplayList()) {
212 return nGetTranslationX(mFinalizer.mNativeDisplayList);
213 }
214 return 0.0f;
215 }
216
217 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800218 public void setTranslationY(float translationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700219 if (hasNativeDisplayList()) {
220 nSetTranslationY(mFinalizer.mNativeDisplayList, translationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800221 }
222 }
223
224 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800225 public float getTranslationY() {
226 if (hasNativeDisplayList()) {
227 return nGetTranslationY(mFinalizer.mNativeDisplayList);
228 }
229 return 0.0f;
230 }
231
232 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800233 public void setRotation(float rotation) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700234 if (hasNativeDisplayList()) {
235 nSetRotation(mFinalizer.mNativeDisplayList, rotation);
Chet Haasea1cff502012-02-21 13:43:44 -0800236 }
237 }
238
239 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800240 public float getRotation() {
241 if (hasNativeDisplayList()) {
242 return nGetRotation(mFinalizer.mNativeDisplayList);
243 }
244 return 0.0f;
245 }
246
247 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800248 public void setRotationX(float rotationX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700249 if (hasNativeDisplayList()) {
250 nSetRotationX(mFinalizer.mNativeDisplayList, rotationX);
Chet Haasea1cff502012-02-21 13:43:44 -0800251 }
252 }
253
254 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800255 public float getRotationX() {
256 if (hasNativeDisplayList()) {
257 return nGetRotationX(mFinalizer.mNativeDisplayList);
258 }
259 return 0.0f;
260 }
261
262 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800263 public void setRotationY(float rotationY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700264 if (hasNativeDisplayList()) {
265 nSetRotationY(mFinalizer.mNativeDisplayList, rotationY);
Chet Haasea1cff502012-02-21 13:43:44 -0800266 }
267 }
268
269 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800270 public float getRotationY() {
271 if (hasNativeDisplayList()) {
272 return nGetRotationY(mFinalizer.mNativeDisplayList);
273 }
274 return 0.0f;
275 }
276
277 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800278 public void setScaleX(float scaleX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700279 if (hasNativeDisplayList()) {
280 nSetScaleX(mFinalizer.mNativeDisplayList, scaleX);
Chet Haasea1cff502012-02-21 13:43:44 -0800281 }
282 }
283
284 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800285 public float getScaleX() {
286 if (hasNativeDisplayList()) {
287 return nGetScaleX(mFinalizer.mNativeDisplayList);
288 }
289 return 1.0f;
290 }
291
292 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800293 public void setScaleY(float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700294 if (hasNativeDisplayList()) {
295 nSetScaleY(mFinalizer.mNativeDisplayList, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800296 }
297 }
298
299 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800300 public float getScaleY() {
301 if (hasNativeDisplayList()) {
302 return nGetScaleY(mFinalizer.mNativeDisplayList);
303 }
304 return 1.0f;
305 }
306
307 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800308 public void setTransformationInfo(float alpha, float translationX, float translationY,
309 float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700310 if (hasNativeDisplayList()) {
311 nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha, translationX, translationY,
Chet Haasea1cff502012-02-21 13:43:44 -0800312 rotation, rotationX, rotationY, scaleX, scaleY);
Chet Haasea1cff502012-02-21 13:43:44 -0800313 }
314 }
315
316 @Override
317 public void setPivotX(float pivotX) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700318 if (hasNativeDisplayList()) {
319 nSetPivotX(mFinalizer.mNativeDisplayList, pivotX);
Chet Haasea1cff502012-02-21 13:43:44 -0800320 }
321 }
322
323 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800324 public float getPivotX() {
325 if (hasNativeDisplayList()) {
326 return nGetPivotX(mFinalizer.mNativeDisplayList);
327 }
328 return 0.0f;
329 }
330
331 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800332 public void setPivotY(float pivotY) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700333 if (hasNativeDisplayList()) {
334 nSetPivotY(mFinalizer.mNativeDisplayList, pivotY);
Chet Haasea1cff502012-02-21 13:43:44 -0800335 }
336 }
337
338 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800339 public float getPivotY() {
340 if (hasNativeDisplayList()) {
341 return nGetPivotY(mFinalizer.mNativeDisplayList);
342 }
343 return 0.0f;
344 }
345
346 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800347 public void setCameraDistance(float distance) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700348 if (hasNativeDisplayList()) {
349 nSetCameraDistance(mFinalizer.mNativeDisplayList, distance);
Chet Haasea1cff502012-02-21 13:43:44 -0800350 }
351 }
352
353 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800354 public float getCameraDistance() {
355 if (hasNativeDisplayList()) {
356 return nGetCameraDistance(mFinalizer.mNativeDisplayList);
357 }
358 return 0.0f;
359 }
360
361 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800362 public void setLeft(int left) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700363 if (hasNativeDisplayList()) {
364 nSetLeft(mFinalizer.mNativeDisplayList, left);
Chet Haasea1cff502012-02-21 13:43:44 -0800365 }
366 }
367
368 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800369 public float getLeft() {
370 if (hasNativeDisplayList()) {
371 return nGetLeft(mFinalizer.mNativeDisplayList);
372 }
373 return 0.0f;
374 }
375
376 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800377 public void setTop(int top) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700378 if (hasNativeDisplayList()) {
379 nSetTop(mFinalizer.mNativeDisplayList, top);
Chet Haasea1cff502012-02-21 13:43:44 -0800380 }
381 }
382
383 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800384 public float getTop() {
385 if (hasNativeDisplayList()) {
386 return nGetTop(mFinalizer.mNativeDisplayList);
387 }
388 return 0.0f;
389 }
390
391 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800392 public void setRight(int right) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700393 if (hasNativeDisplayList()) {
394 nSetRight(mFinalizer.mNativeDisplayList, right);
Chet Haasea1cff502012-02-21 13:43:44 -0800395 }
396 }
397
398 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800399 public float getRight() {
400 if (hasNativeDisplayList()) {
401 return nGetRight(mFinalizer.mNativeDisplayList);
402 }
403 return 0.0f;
404 }
405
406 @Override
Chet Haasea1cff502012-02-21 13:43:44 -0800407 public void setBottom(int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700408 if (hasNativeDisplayList()) {
409 nSetBottom(mFinalizer.mNativeDisplayList, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800410 }
411 }
412
413 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800414 public float getBottom() {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700415 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800416 return nGetBottom(mFinalizer.mNativeDisplayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800417 }
Romain Guy52036b12013-02-14 18:03:37 -0800418 return 0.0f;
Chet Haasea1cff502012-02-21 13:43:44 -0800419 }
420
421 @Override
422 public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700423 if (hasNativeDisplayList()) {
424 nSetLeftTopRightBottom(mFinalizer.mNativeDisplayList, left, top, right, bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800425 }
426 }
427
428 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800429 public void offsetLeftAndRight(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700430 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800431 nOffsetLeftAndRight(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800432 }
433 }
434
435 @Override
Romain Guy52036b12013-02-14 18:03:37 -0800436 public void offsetTopAndBottom(float offset) {
Romain Guy0d6f4c02012-06-20 23:59:06 -0700437 if (hasNativeDisplayList()) {
Romain Guy52036b12013-02-14 18:03:37 -0800438 nOffsetTopAndBottom(mFinalizer.mNativeDisplayList, offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800439 }
440 }
441
Chet Haase6a2d17f2012-09-30 12:14:13 -0700442 private static native void nReset(int displayList);
Romain Guy52036b12013-02-14 18:03:37 -0800443 private static native void nOffsetTopAndBottom(int displayList, float offset);
444 private static native void nOffsetLeftAndRight(int displayList, float offset);
Chet Haasea1cff502012-02-21 13:43:44 -0800445 private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
446 int right, int bottom);
Chet Haasea1cff502012-02-21 13:43:44 -0800447 private static native void nSetBottom(int displayList, int bottom);
448 private static native void nSetRight(int displayList, int right);
449 private static native void nSetTop(int displayList, int top);
450 private static native void nSetLeft(int displayList, int left);
451 private static native void nSetCameraDistance(int displayList, float distance);
452 private static native void nSetPivotY(int displayList, float pivotY);
453 private static native void nSetPivotX(int displayList, float pivotX);
454 private static native void nSetCaching(int displayList, boolean caching);
Chet Haasedd671592013-04-19 14:54:34 -0700455 private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
Chet Haasea1cff502012-02-21 13:43:44 -0800456 private static native void nSetAlpha(int displayList, float alpha);
Chet Haasedb8c9a62012-03-21 18:54:18 -0700457 private static native void nSetHasOverlappingRendering(int displayList,
458 boolean hasOverlappingRendering);
Chet Haasea1cff502012-02-21 13:43:44 -0800459 private static native void nSetTranslationX(int displayList, float translationX);
460 private static native void nSetTranslationY(int displayList, float translationY);
461 private static native void nSetRotation(int displayList, float rotation);
462 private static native void nSetRotationX(int displayList, float rotationX);
463 private static native void nSetRotationY(int displayList, float rotationY);
464 private static native void nSetScaleX(int displayList, float scaleX);
465 private static native void nSetScaleY(int displayList, float scaleY);
466 private static native void nSetTransformationInfo(int displayList, float alpha,
467 float translationX, float translationY, float rotation, float rotationX,
468 float rotationY, float scaleX, float scaleY);
Chet Haase9420abd2012-03-29 16:28:32 -0700469 private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
470 private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
Chet Haasea1cff502012-02-21 13:43:44 -0800471
Romain Guy52036b12013-02-14 18:03:37 -0800472 private static native boolean nHasOverlappingRendering(int displayList);
473 private static native void nGetMatrix(int displayList, int matrix);
474 private static native float nGetAlpha(int displayList);
475 private static native float nGetLeft(int displayList);
476 private static native float nGetTop(int displayList);
477 private static native float nGetRight(int displayList);
478 private static native float nGetBottom(int displayList);
479 private static native float nGetCameraDistance(int displayList);
480 private static native float nGetScaleX(int displayList);
481 private static native float nGetScaleY(int displayList);
482 private static native float nGetTranslationX(int displayList);
483 private static native float nGetTranslationY(int displayList);
484 private static native float nGetRotation(int displayList);
485 private static native float nGetRotationX(int displayList);
486 private static native float nGetRotationY(int displayList);
487 private static native float nGetPivotX(int displayList);
488 private static native float nGetPivotY(int displayList);
Chet Haasea1cff502012-02-21 13:43:44 -0800489
490 ///////////////////////////////////////////////////////////////////////////
491 // Finalization
492 ///////////////////////////////////////////////////////////////////////////
493
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800494 private static class DisplayListFinalizer {
Jeff Brown162a0212011-07-21 17:02:54 -0700495 final int mNativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700496
Jeff Brown162a0212011-07-21 17:02:54 -0700497 public DisplayListFinalizer(int nativeDisplayList) {
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800498 mNativeDisplayList = nativeDisplayList;
Chet Haase5c13d892010-10-08 08:37:55 -0700499 }
500
501 @Override
Patrick Dubroyf890fab2010-12-19 16:47:17 -0800502 protected void finalize() throws Throwable {
Romain Guy6c319ca2011-01-11 14:29:25 -0800503 try {
Romain Guy52036b12013-02-14 18:03:37 -0800504 nDestroyDisplayList(mNativeDisplayList);
Romain Guy6c319ca2011-01-11 14:29:25 -0800505 } finally {
506 super.finalize();
507 }
Chet Haase5c13d892010-10-08 08:37:55 -0700508 }
509 }
Romain Guyb051e892010-09-28 19:09:36 -0700510}