Move GLES20DisplayList functionality into DisplayList

Removes unneeded indirection layer

Change-Id: I75d3e369eda2788cbc52a3575c4e1c521e842f59
This commit is contained in:
Chris Craik
2013-12-20 13:28:11 -08:00
parent 638fcf0df6
commit 5438979e49
9 changed files with 521 additions and 701 deletions

View File

@@ -18,6 +18,8 @@ package android.view;
import android.graphics.Matrix;
import java.util.ArrayList;
/**
* <p>A display list records a series of graphics related operations and can replay
* them later. Display lists are usually built by recording operations on a
@@ -120,12 +122,23 @@ import android.graphics.Matrix;
*
* @hide
*/
public abstract class DisplayList {
public class DisplayList {
private boolean mDirty;
private ArrayList<DisplayList> mChildDisplayLists;
private GLES20RecordingCanvas mCanvas;
private boolean mValid;
// Used for debugging
private final String mName;
// The native display list will be destroyed when this object dies.
// DO NOT overwrite this reference once it is set.
private DisplayListFinalizer mFinalizer;
/**
* Flag used when calling
* {@link HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int)}
* {@link HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int)}
* When this flag is set, draw operations lying outside of the bounds of the
* display list will be culled early. It is recommeneded to always set this
* flag.
@@ -173,6 +186,10 @@ public abstract class DisplayList {
*/
public static final int STATUS_DREW = 0x4;
private DisplayList(String name) {
mName = name;
}
/**
* Creates a new display list that can be used to record batches of
* drawing operations.
@@ -184,7 +201,7 @@ public abstract class DisplayList {
* @hide
*/
public static DisplayList create(String name) {
return new GLES20DisplayList(name);
return new DisplayList(name);
}
/**
@@ -202,7 +219,21 @@ public abstract class DisplayList {
* @see #end()
* @see #isValid()
*/
public abstract HardwareCanvas start(int width, int height);
public HardwareCanvas start(int width, int height) {
if (mCanvas != null) {
throw new IllegalStateException("Recording has already started");
}
mValid = false;
mCanvas = GLES20RecordingCanvas.obtain(this);
mCanvas.start();
mCanvas.setViewport(width, height);
// The dirty rect should always be null for a display list
mCanvas.onPreDraw(null);
return mCanvas;
}
/**
* Ends the recording for this display list. A display list cannot be
@@ -212,7 +243,20 @@ public abstract class DisplayList {
* @see #start(int, int)
* @see #isValid()
*/
public abstract void end();
public void end() {
if (mCanvas != null) {
mCanvas.onPostDraw();
if (mFinalizer != null) {
mCanvas.end(mFinalizer.mNativeDisplayList);
} else {
mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
nSetDisplayListName(mFinalizer.mNativeDisplayList, mName);
}
mCanvas.recycle();
mCanvas = null;
mValid = true;
}
}
/**
* Clears resources held onto by this display list. After calling this method
@@ -221,8 +265,26 @@ public abstract class DisplayList {
* @see #isValid()
* @see #reset()
*/
public abstract void clear();
public void clear() {
clearDirty();
if (mCanvas != null) {
mCanvas.recycle();
mCanvas = null;
}
mValid = false;
clearReferences();
}
void clearReferences() {
if (mChildDisplayLists != null) mChildDisplayLists.clear();
}
ArrayList<DisplayList> getChildDisplayLists() {
if (mChildDisplayLists == null) mChildDisplayLists = new ArrayList<DisplayList>();
return mChildDisplayLists;
}
/**
* Reset native resources. This is called when cleaning up the state of display lists
@@ -233,7 +295,12 @@ public abstract class DisplayList {
*
* @hide
*/
public abstract void reset();
public void reset() {
if (hasNativeDisplayList()) {
nReset(mFinalizer.mNativeDisplayList);
}
clear();
}
/**
* Sets the dirty flag. When a display list is dirty, {@link #clear()} should
@@ -279,16 +346,30 @@ public abstract class DisplayList {
*
* @return boolean true if the display list is able to be replayed, false otherwise.
*/
public abstract boolean isValid();
public boolean isValid() { return mValid; }
/**
* Return the amount of memory used by this display list.
*
*
* @return The size of this display list in bytes
*
* @hide
*/
public abstract int getSize();
public int getSize() {
if (mFinalizer == null) return 0;
return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
}
boolean hasNativeDisplayList() {
return mValid && mFinalizer != null;
}
int getNativeDisplayList() {
if (!mValid || mFinalizer == null) {
throw new IllegalStateException("The display list is not valid.");
}
return mFinalizer.mNativeDisplayList;
}
///////////////////////////////////////////////////////////////////////////
// DisplayList Property Setters
@@ -303,7 +384,11 @@ public abstract class DisplayList {
*
* @hide
*/
public abstract void setCaching(boolean caching);
public void setCaching(boolean caching) {
if (hasNativeDisplayList()) {
nSetCaching(mFinalizer.mNativeDisplayList, caching);
}
}
/**
* Set whether the display list should clip itself to its bounds. This property is controlled by
@@ -311,7 +396,11 @@ public abstract class DisplayList {
*
* @param clipToBounds true if the display list should clip to its bounds
*/
public abstract void setClipToBounds(boolean clipToBounds);
public void setClipToBounds(boolean clipToBounds) {
if (hasNativeDisplayList()) {
nSetClipToBounds(mFinalizer.mNativeDisplayList, clipToBounds);
}
}
/**
* Set the static matrix on the display list. The specified matrix is combined with other
@@ -322,7 +411,11 @@ public abstract class DisplayList {
* @see #getMatrix(android.graphics.Matrix)
* @see #getMatrix()
*/
public abstract void setMatrix(Matrix matrix);
public void setMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nSetStaticMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
}
}
/**
* Returns the static matrix set on this display list.
@@ -348,7 +441,12 @@ public abstract class DisplayList {
* @see #getMatrix()
* @see #setMatrix(android.graphics.Matrix)
*/
public abstract Matrix getMatrix(Matrix matrix);
public Matrix getMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nGetMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
}
return matrix;
}
/**
* Set the Animation matrix on the display list. This matrix exists if an Animation is
@@ -360,7 +458,12 @@ public abstract class DisplayList {
*
* @hide
*/
public abstract void setAnimationMatrix(Matrix matrix);
public void setAnimationMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nSetAnimationMatrix(mFinalizer.mNativeDisplayList,
(matrix != null) ? matrix.native_instance : 0);
}
}
/**
* Sets the translucency level for the display list.
@@ -370,7 +473,11 @@ public abstract class DisplayList {
* @see View#setAlpha(float)
* @see #getAlpha()
*/
public abstract void setAlpha(float alpha);
public void setAlpha(float alpha) {
if (hasNativeDisplayList()) {
nSetAlpha(mFinalizer.mNativeDisplayList, alpha);
}
}
/**
* Returns the translucency level of this display list.
@@ -379,7 +486,12 @@ public abstract class DisplayList {
*
* @see #setAlpha(float)
*/
public abstract float getAlpha();
public float getAlpha() {
if (hasNativeDisplayList()) {
return nGetAlpha(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
/**
* Sets whether the display list renders content which overlaps. Non-overlapping rendering
@@ -392,7 +504,11 @@ public abstract class DisplayList {
* @see android.view.View#hasOverlappingRendering()
* @see #hasOverlappingRendering()
*/
public abstract void setHasOverlappingRendering(boolean hasOverlappingRendering);
public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
if (hasNativeDisplayList()) {
nSetHasOverlappingRendering(mFinalizer.mNativeDisplayList, hasOverlappingRendering);
}
}
/**
* Indicates whether the content of this display list overlaps.
@@ -401,7 +517,13 @@ public abstract class DisplayList {
*
* @see #setHasOverlappingRendering(boolean)
*/
public abstract boolean hasOverlappingRendering();
public boolean hasOverlappingRendering() {
//noinspection SimplifiableIfStatement
if (hasNativeDisplayList()) {
return nHasOverlappingRendering(mFinalizer.mNativeDisplayList);
}
return true;
}
/**
* Sets the translation value for the display list on the X axis
@@ -411,14 +533,23 @@ public abstract class DisplayList {
* @see View#setTranslationX(float)
* @see #getTranslationX()
*/
public abstract void setTranslationX(float translationX);
public void setTranslationX(float translationX) {
if (hasNativeDisplayList()) {
nSetTranslationX(mFinalizer.mNativeDisplayList, translationX);
}
}
/**
* Returns the translation value for this display list on the X axis, in pixels.
*
* @see #setTranslationX(float)
*/
public abstract float getTranslationX();
public float getTranslationX() {
if (hasNativeDisplayList()) {
return nGetTranslationX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the translation value for the display list on the Y axis
@@ -428,14 +559,23 @@ public abstract class DisplayList {
* @see View#setTranslationY(float)
* @see #getTranslationY()
*/
public abstract void setTranslationY(float translationY);
public void setTranslationY(float translationY) {
if (hasNativeDisplayList()) {
nSetTranslationY(mFinalizer.mNativeDisplayList, translationY);
}
}
/**
* Returns the translation value for this display list on the Y axis, in pixels.
*
* @see #setTranslationY(float)
*/
public abstract float getTranslationY();
public float getTranslationY() {
if (hasNativeDisplayList()) {
return nGetTranslationY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the translation value for the display list on the Z axis
@@ -443,14 +583,23 @@ public abstract class DisplayList {
* @see View#setTranslationZ(float)
* @see #getTranslationZ()
*/
public abstract void setTranslationZ(float translationZ);
public void setTranslationZ(float translationZ) {
if (hasNativeDisplayList()) {
nSetTranslationZ(mFinalizer.mNativeDisplayList, translationZ);
}
}
/**
* Returns the translation value for this display list on the Z axis.
*
* @see #setTranslationZ(float)
*/
public abstract float getTranslationZ();
public float getTranslationZ() {
if (hasNativeDisplayList()) {
return nGetTranslationZ(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the rotation value for the display list around the Z axis
@@ -460,14 +609,23 @@ public abstract class DisplayList {
* @see View#setRotation(float)
* @see #getRotation()
*/
public abstract void setRotation(float rotation);
public void setRotation(float rotation) {
if (hasNativeDisplayList()) {
nSetRotation(mFinalizer.mNativeDisplayList, rotation);
}
}
/**
* Returns the rotation value for this display list around the Z axis, in degrees.
*
* @see #setRotation(float)
*/
public abstract float getRotation();
public float getRotation() {
if (hasNativeDisplayList()) {
return nGetRotation(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the rotation value for the display list around the X axis
@@ -477,14 +635,23 @@ public abstract class DisplayList {
* @see View#setRotationX(float)
* @see #getRotationX()
*/
public abstract void setRotationX(float rotationX);
public void setRotationX(float rotationX) {
if (hasNativeDisplayList()) {
nSetRotationX(mFinalizer.mNativeDisplayList, rotationX);
}
}
/**
* Returns the rotation value for this display list around the X axis, in degrees.
*
* @see #setRotationX(float)
*/
public abstract float getRotationX();
public float getRotationX() {
if (hasNativeDisplayList()) {
return nGetRotationX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the rotation value for the display list around the Y axis
@@ -494,14 +661,23 @@ public abstract class DisplayList {
* @see View#setRotationY(float)
* @see #getRotationY()
*/
public abstract void setRotationY(float rotationY);
public void setRotationY(float rotationY) {
if (hasNativeDisplayList()) {
nSetRotationY(mFinalizer.mNativeDisplayList, rotationY);
}
}
/**
* Returns the rotation value for this display list around the Y axis, in degrees.
*
* @see #setRotationY(float)
*/
public abstract float getRotationY();
public float getRotationY() {
if (hasNativeDisplayList()) {
return nGetRotationY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the scale value for the display list on the X axis
@@ -511,14 +687,23 @@ public abstract class DisplayList {
* @see View#setScaleX(float)
* @see #getScaleX()
*/
public abstract void setScaleX(float scaleX);
public void setScaleX(float scaleX) {
if (hasNativeDisplayList()) {
nSetScaleX(mFinalizer.mNativeDisplayList, scaleX);
}
}
/**
* Returns the scale value for this display list on the X axis.
*
* @see #setScaleX(float)
*/
public abstract float getScaleX();
public float getScaleX() {
if (hasNativeDisplayList()) {
return nGetScaleX(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
/**
* Sets the scale value for the display list on the Y axis
@@ -528,14 +713,23 @@ public abstract class DisplayList {
* @see View#setScaleY(float)
* @see #getScaleY()
*/
public abstract void setScaleY(float scaleY);
public void setScaleY(float scaleY) {
if (hasNativeDisplayList()) {
nSetScaleY(mFinalizer.mNativeDisplayList, scaleY);
}
}
/**
* Returns the scale value for this display list on the Y axis.
*
* @see #setScaleY(float)
*/
public abstract float getScaleY();
public float getScaleY() {
if (hasNativeDisplayList()) {
return nGetScaleY(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
/**
* Sets all of the transform-related values of the display list
@@ -551,9 +745,15 @@ public abstract class DisplayList {
*
* @hide
*/
public abstract void setTransformationInfo(float alpha,
public void setTransformationInfo(float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
if (hasNativeDisplayList()) {
nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha,
translationX, translationY, translationZ,
rotation, rotationX, rotationY, scaleX, scaleY);
}
}
/**
* Sets the pivot value for the display list on the X axis
@@ -563,14 +763,23 @@ public abstract class DisplayList {
* @see View#setPivotX(float)
* @see #getPivotX()
*/
public abstract void setPivotX(float pivotX);
public void setPivotX(float pivotX) {
if (hasNativeDisplayList()) {
nSetPivotX(mFinalizer.mNativeDisplayList, pivotX);
}
}
/**
* Returns the pivot value for this display list on the X axis, in pixels.
*
* @see #setPivotX(float)
*/
public abstract float getPivotX();
public float getPivotX() {
if (hasNativeDisplayList()) {
return nGetPivotX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the pivot value for the display list on the Y axis
@@ -580,14 +789,23 @@ public abstract class DisplayList {
* @see View#setPivotY(float)
* @see #getPivotY()
*/
public abstract void setPivotY(float pivotY);
public void setPivotY(float pivotY) {
if (hasNativeDisplayList()) {
nSetPivotY(mFinalizer.mNativeDisplayList, pivotY);
}
}
/**
* Returns the pivot value for this display list on the Y axis, in pixels.
*
* @see #setPivotY(float)
*/
public abstract float getPivotY();
public float getPivotY() {
if (hasNativeDisplayList()) {
return nGetPivotY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the camera distance for the display list. Refer to
@@ -599,14 +817,23 @@ public abstract class DisplayList {
* @see View#setCameraDistance(float)
* @see #getCameraDistance()
*/
public abstract void setCameraDistance(float distance);
public void setCameraDistance(float distance) {
if (hasNativeDisplayList()) {
nSetCameraDistance(mFinalizer.mNativeDisplayList, distance);
}
}
/**
* Returns the distance in Z of the camera of the display list.
*
* @see #setCameraDistance(float)
*/
public abstract float getCameraDistance();
public float getCameraDistance() {
if (hasNativeDisplayList()) {
return nGetCameraDistance(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the left position for the display list.
@@ -616,14 +843,23 @@ public abstract class DisplayList {
* @see View#setLeft(int)
* @see #getLeft()
*/
public abstract void setLeft(int left);
public void setLeft(int left) {
if (hasNativeDisplayList()) {
nSetLeft(mFinalizer.mNativeDisplayList, left);
}
}
/**
* Returns the left position for the display list in pixels.
*
* @see #setLeft(int)
*/
public abstract float getLeft();
public float getLeft() {
if (hasNativeDisplayList()) {
return nGetLeft(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the top position for the display list.
@@ -633,14 +869,23 @@ public abstract class DisplayList {
* @see View#setTop(int)
* @see #getTop()
*/
public abstract void setTop(int top);
public void setTop(int top) {
if (hasNativeDisplayList()) {
nSetTop(mFinalizer.mNativeDisplayList, top);
}
}
/**
* Returns the top position for the display list in pixels.
*
* @see #setTop(int)
*/
public abstract float getTop();
public float getTop() {
if (hasNativeDisplayList()) {
return nGetTop(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the right position for the display list.
@@ -650,14 +895,23 @@ public abstract class DisplayList {
* @see View#setRight(int)
* @see #getRight()
*/
public abstract void setRight(int right);
public void setRight(int right) {
if (hasNativeDisplayList()) {
nSetRight(mFinalizer.mNativeDisplayList, right);
}
}
/**
* Returns the right position for the display list in pixels.
*
* @see #setRight(int)
*/
public abstract float getRight();
public float getRight() {
if (hasNativeDisplayList()) {
return nGetRight(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the bottom position for the display list.
@@ -667,14 +921,23 @@ public abstract class DisplayList {
* @see View#setBottom(int)
* @see #getBottom()
*/
public abstract void setBottom(int bottom);
public void setBottom(int bottom) {
if (hasNativeDisplayList()) {
nSetBottom(mFinalizer.mNativeDisplayList, bottom);
}
}
/**
* Returns the bottom position for the display list in pixels.
*
* @see #setBottom(int)
*/
public abstract float getBottom();
public float getBottom() {
if (hasNativeDisplayList()) {
return nGetBottom(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
/**
* Sets the left and top positions for the display list
@@ -689,7 +952,11 @@ public abstract class DisplayList {
* @see View#setRight(int)
* @see View#setBottom(int)
*/
public abstract void setLeftTopRightBottom(int left, int top, int right, int bottom);
public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
if (hasNativeDisplayList()) {
nSetLeftTopRightBottom(mFinalizer.mNativeDisplayList, left, top, right, bottom);
}
}
/**
* Offsets the left and right positions for the display list
@@ -699,7 +966,11 @@ public abstract class DisplayList {
*
* @see View#offsetLeftAndRight(int)
*/
public abstract void offsetLeftAndRight(float offset);
public void offsetLeftAndRight(float offset) {
if (hasNativeDisplayList()) {
nOffsetLeftAndRight(mFinalizer.mNativeDisplayList, offset);
}
}
/**
* Offsets the top and bottom values for the display list
@@ -709,7 +980,11 @@ public abstract class DisplayList {
*
* @see View#offsetTopAndBottom(int)
*/
public abstract void offsetTopAndBottom(float offset);
public void offsetTopAndBottom(float offset) {
if (hasNativeDisplayList()) {
nOffsetTopAndBottom(mFinalizer.mNativeDisplayList, offset);
}
}
/**
* Outputs the display list to the log. This method exists for use by
@@ -717,5 +992,91 @@ public abstract class DisplayList {
*
* @hide
*/
public abstract void output();
public void output() {
if (hasNativeDisplayList()) {
nOutput(mFinalizer.mNativeDisplayList);
}
}
///////////////////////////////////////////////////////////////////////////
// Native methods
///////////////////////////////////////////////////////////////////////////
private static native void nDestroyDisplayList(int displayList);
private static native int nGetDisplayListSize(int displayList);
private static native void nSetDisplayListName(int displayList, String name);
// Properties
private static native void nReset(int displayList);
private static native void nOffsetTopAndBottom(int displayList, float offset);
private static native void nOffsetLeftAndRight(int displayList, float offset);
private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
int right, int bottom);
private static native void nSetBottom(int displayList, int bottom);
private static native void nSetRight(int displayList, int right);
private static native void nSetTop(int displayList, int top);
private static native void nSetLeft(int displayList, int left);
private static native void nSetCameraDistance(int displayList, float distance);
private static native void nSetPivotY(int displayList, float pivotY);
private static native void nSetPivotX(int displayList, float pivotX);
private static native void nSetCaching(int displayList, boolean caching);
private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
private static native void nSetAlpha(int displayList, float alpha);
private static native void nSetHasOverlappingRendering(int displayList,
boolean hasOverlappingRendering);
private static native void nSetTranslationX(int displayList, float translationX);
private static native void nSetTranslationY(int displayList, float translationY);
private static native void nSetTranslationZ(int displayList, float translationZ);
private static native void nSetRotation(int displayList, float rotation);
private static native void nSetRotationX(int displayList, float rotationX);
private static native void nSetRotationY(int displayList, float rotationY);
private static native void nSetScaleX(int displayList, float scaleX);
private static native void nSetScaleY(int displayList, float scaleY);
private static native void nSetTransformationInfo(int displayList, float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
private static native boolean nHasOverlappingRendering(int displayList);
private static native void nGetMatrix(int displayList, int matrix);
private static native float nGetAlpha(int displayList);
private static native float nGetLeft(int displayList);
private static native float nGetTop(int displayList);
private static native float nGetRight(int displayList);
private static native float nGetBottom(int displayList);
private static native float nGetCameraDistance(int displayList);
private static native float nGetScaleX(int displayList);
private static native float nGetScaleY(int displayList);
private static native float nGetTranslationX(int displayList);
private static native float nGetTranslationY(int displayList);
private static native float nGetTranslationZ(int displayList);
private static native float nGetRotation(int displayList);
private static native float nGetRotationX(int displayList);
private static native float nGetRotationY(int displayList);
private static native float nGetPivotX(int displayList);
private static native float nGetPivotY(int displayList);
private static native void nOutput(int displayList);
///////////////////////////////////////////////////////////////////////////
// Finalization
///////////////////////////////////////////////////////////////////////////
private static class DisplayListFinalizer {
final int mNativeDisplayList;
public DisplayListFinalizer(int nativeDisplayList) {
mNativeDisplayList = nativeDisplayList;
}
@Override
protected void finalize() throws Throwable {
try {
nDestroyDisplayList(mNativeDisplayList);
} finally {
super.finalize();
}
}
}
}

View File

@@ -416,7 +416,7 @@ class GLES20Canvas extends HardwareCanvas {
@Override
public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) {
return nDrawDisplayList(mRenderer, ((GLES20DisplayList) displayList).getNativeDisplayList(),
return nDrawDisplayList(mRenderer, displayList.getNativeDisplayList(),
dirty, flags);
}

View File

@@ -1,538 +0,0 @@
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.view;
import android.graphics.Matrix;
import java.util.ArrayList;
/**
* An implementation of display list for OpenGL ES 2.0.
*/
class GLES20DisplayList extends DisplayList {
private ArrayList<DisplayList> mChildDisplayLists;
private GLES20RecordingCanvas mCanvas;
private boolean mValid;
// Used for debugging
private final String mName;
// The native display list will be destroyed when this object dies.
// DO NOT overwrite this reference once it is set.
private DisplayListFinalizer mFinalizer;
GLES20DisplayList(String name) {
mName = name;
}
boolean hasNativeDisplayList() {
return mValid && mFinalizer != null;
}
int getNativeDisplayList() {
if (!mValid || mFinalizer == null) {
throw new IllegalStateException("The display list is not valid.");
}
return mFinalizer.mNativeDisplayList;
}
@Override
public HardwareCanvas start(int width, int height) {
if (mCanvas != null) {
throw new IllegalStateException("Recording has already started");
}
mValid = false;
mCanvas = GLES20RecordingCanvas.obtain(this);
mCanvas.start();
mCanvas.setViewport(width, height);
// The dirty rect should always be null for a display list
mCanvas.onPreDraw(null);
return mCanvas;
}
@Override
public void clear() {
clearDirty();
if (mCanvas != null) {
mCanvas.recycle();
mCanvas = null;
}
mValid = false;
clearReferences();
}
void clearReferences() {
if (mChildDisplayLists != null) mChildDisplayLists.clear();
}
ArrayList<DisplayList> getChildDisplayLists() {
if (mChildDisplayLists == null) mChildDisplayLists = new ArrayList<DisplayList>();
return mChildDisplayLists;
}
@Override
public void reset() {
if (hasNativeDisplayList()) {
nReset(mFinalizer.mNativeDisplayList);
}
clear();
}
@Override
public boolean isValid() {
return mValid;
}
@Override
public void end() {
if (mCanvas != null) {
mCanvas.onPostDraw();
if (mFinalizer != null) {
mCanvas.end(mFinalizer.mNativeDisplayList);
} else {
mFinalizer = new DisplayListFinalizer(mCanvas.end(0));
nSetDisplayListName(mFinalizer.mNativeDisplayList, mName);
}
mCanvas.recycle();
mCanvas = null;
mValid = true;
}
}
@Override
public int getSize() {
if (mFinalizer == null) return 0;
return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
}
private static native void nDestroyDisplayList(int displayList);
private static native int nGetDisplayListSize(int displayList);
private static native void nSetDisplayListName(int displayList, String name);
///////////////////////////////////////////////////////////////////////////
// Native View Properties
///////////////////////////////////////////////////////////////////////////
@Override
public void setCaching(boolean caching) {
if (hasNativeDisplayList()) {
nSetCaching(mFinalizer.mNativeDisplayList, caching);
}
}
@Override
public void setClipToBounds(boolean clipToBounds) {
if (hasNativeDisplayList()) {
nSetClipToBounds(mFinalizer.mNativeDisplayList, clipToBounds);
}
}
@Override
public void setMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nSetStaticMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
}
}
@Override
public Matrix getMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nGetMatrix(mFinalizer.mNativeDisplayList, matrix.native_instance);
}
return matrix;
}
@Override
public void setAnimationMatrix(Matrix matrix) {
if (hasNativeDisplayList()) {
nSetAnimationMatrix(mFinalizer.mNativeDisplayList,
(matrix != null) ? matrix.native_instance : 0);
}
}
@Override
public void setAlpha(float alpha) {
if (hasNativeDisplayList()) {
nSetAlpha(mFinalizer.mNativeDisplayList, alpha);
}
}
@Override
public float getAlpha() {
if (hasNativeDisplayList()) {
return nGetAlpha(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
@Override
public void setHasOverlappingRendering(boolean hasOverlappingRendering) {
if (hasNativeDisplayList()) {
nSetHasOverlappingRendering(mFinalizer.mNativeDisplayList, hasOverlappingRendering);
}
}
@Override
public boolean hasOverlappingRendering() {
//noinspection SimplifiableIfStatement
if (hasNativeDisplayList()) {
return nHasOverlappingRendering(mFinalizer.mNativeDisplayList);
}
return true;
}
@Override
public void setTranslationX(float translationX) {
if (hasNativeDisplayList()) {
nSetTranslationX(mFinalizer.mNativeDisplayList, translationX);
}
}
@Override
public float getTranslationX() {
if (hasNativeDisplayList()) {
return nGetTranslationX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setTranslationY(float translationY) {
if (hasNativeDisplayList()) {
nSetTranslationY(mFinalizer.mNativeDisplayList, translationY);
}
}
@Override
public float getTranslationY() {
if (hasNativeDisplayList()) {
return nGetTranslationY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setTranslationZ(float translationZ) {
if (hasNativeDisplayList()) {
nSetTranslationZ(mFinalizer.mNativeDisplayList, translationZ);
}
}
@Override
public float getTranslationZ() {
if (hasNativeDisplayList()) {
return nGetTranslationZ(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setRotation(float rotation) {
if (hasNativeDisplayList()) {
nSetRotation(mFinalizer.mNativeDisplayList, rotation);
}
}
@Override
public float getRotation() {
if (hasNativeDisplayList()) {
return nGetRotation(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setRotationX(float rotationX) {
if (hasNativeDisplayList()) {
nSetRotationX(mFinalizer.mNativeDisplayList, rotationX);
}
}
@Override
public float getRotationX() {
if (hasNativeDisplayList()) {
return nGetRotationX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setRotationY(float rotationY) {
if (hasNativeDisplayList()) {
nSetRotationY(mFinalizer.mNativeDisplayList, rotationY);
}
}
@Override
public float getRotationY() {
if (hasNativeDisplayList()) {
return nGetRotationY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setScaleX(float scaleX) {
if (hasNativeDisplayList()) {
nSetScaleX(mFinalizer.mNativeDisplayList, scaleX);
}
}
@Override
public float getScaleX() {
if (hasNativeDisplayList()) {
return nGetScaleX(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
@Override
public void setScaleY(float scaleY) {
if (hasNativeDisplayList()) {
nSetScaleY(mFinalizer.mNativeDisplayList, scaleY);
}
}
@Override
public float getScaleY() {
if (hasNativeDisplayList()) {
return nGetScaleY(mFinalizer.mNativeDisplayList);
}
return 1.0f;
}
@Override
public void setTransformationInfo(float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
if (hasNativeDisplayList()) {
nSetTransformationInfo(mFinalizer.mNativeDisplayList, alpha,
translationX, translationY, translationZ,
rotation, rotationX, rotationY, scaleX, scaleY);
}
}
@Override
public void setPivotX(float pivotX) {
if (hasNativeDisplayList()) {
nSetPivotX(mFinalizer.mNativeDisplayList, pivotX);
}
}
@Override
public float getPivotX() {
if (hasNativeDisplayList()) {
return nGetPivotX(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setPivotY(float pivotY) {
if (hasNativeDisplayList()) {
nSetPivotY(mFinalizer.mNativeDisplayList, pivotY);
}
}
@Override
public float getPivotY() {
if (hasNativeDisplayList()) {
return nGetPivotY(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setCameraDistance(float distance) {
if (hasNativeDisplayList()) {
nSetCameraDistance(mFinalizer.mNativeDisplayList, distance);
}
}
@Override
public float getCameraDistance() {
if (hasNativeDisplayList()) {
return nGetCameraDistance(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setLeft(int left) {
if (hasNativeDisplayList()) {
nSetLeft(mFinalizer.mNativeDisplayList, left);
}
}
@Override
public float getLeft() {
if (hasNativeDisplayList()) {
return nGetLeft(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setTop(int top) {
if (hasNativeDisplayList()) {
nSetTop(mFinalizer.mNativeDisplayList, top);
}
}
@Override
public float getTop() {
if (hasNativeDisplayList()) {
return nGetTop(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setRight(int right) {
if (hasNativeDisplayList()) {
nSetRight(mFinalizer.mNativeDisplayList, right);
}
}
@Override
public float getRight() {
if (hasNativeDisplayList()) {
return nGetRight(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setBottom(int bottom) {
if (hasNativeDisplayList()) {
nSetBottom(mFinalizer.mNativeDisplayList, bottom);
}
}
@Override
public float getBottom() {
if (hasNativeDisplayList()) {
return nGetBottom(mFinalizer.mNativeDisplayList);
}
return 0.0f;
}
@Override
public void setLeftTopRightBottom(int left, int top, int right, int bottom) {
if (hasNativeDisplayList()) {
nSetLeftTopRightBottom(mFinalizer.mNativeDisplayList, left, top, right, bottom);
}
}
@Override
public void offsetLeftAndRight(float offset) {
if (hasNativeDisplayList()) {
nOffsetLeftAndRight(mFinalizer.mNativeDisplayList, offset);
}
}
@Override
public void offsetTopAndBottom(float offset) {
if (hasNativeDisplayList()) {
nOffsetTopAndBottom(mFinalizer.mNativeDisplayList, offset);
}
}
@Override
public void output() {
if (hasNativeDisplayList()) {
nOutput(mFinalizer.mNativeDisplayList);
}
}
private static native void nReset(int displayList);
private static native void nOffsetTopAndBottom(int displayList, float offset);
private static native void nOffsetLeftAndRight(int displayList, float offset);
private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
int right, int bottom);
private static native void nSetBottom(int displayList, int bottom);
private static native void nSetRight(int displayList, int right);
private static native void nSetTop(int displayList, int top);
private static native void nSetLeft(int displayList, int left);
private static native void nSetCameraDistance(int displayList, float distance);
private static native void nSetPivotY(int displayList, float pivotY);
private static native void nSetPivotX(int displayList, float pivotX);
private static native void nSetCaching(int displayList, boolean caching);
private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
private static native void nSetAlpha(int displayList, float alpha);
private static native void nSetHasOverlappingRendering(int displayList,
boolean hasOverlappingRendering);
private static native void nSetTranslationX(int displayList, float translationX);
private static native void nSetTranslationY(int displayList, float translationY);
private static native void nSetTranslationZ(int displayList, float translationZ);
private static native void nSetRotation(int displayList, float rotation);
private static native void nSetRotationX(int displayList, float rotationX);
private static native void nSetRotationY(int displayList, float rotationY);
private static native void nSetScaleX(int displayList, float scaleX);
private static native void nSetScaleY(int displayList, float scaleY);
private static native void nSetTransformationInfo(int displayList, float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
private static native boolean nHasOverlappingRendering(int displayList);
private static native void nGetMatrix(int displayList, int matrix);
private static native float nGetAlpha(int displayList);
private static native float nGetLeft(int displayList);
private static native float nGetTop(int displayList);
private static native float nGetRight(int displayList);
private static native float nGetBottom(int displayList);
private static native float nGetCameraDistance(int displayList);
private static native float nGetScaleX(int displayList);
private static native float nGetScaleY(int displayList);
private static native float nGetTranslationX(int displayList);
private static native float nGetTranslationY(int displayList);
private static native float nGetTranslationZ(int displayList);
private static native float nGetRotation(int displayList);
private static native float nGetRotationX(int displayList);
private static native float nGetRotationY(int displayList);
private static native float nGetPivotX(int displayList);
private static native float nGetPivotY(int displayList);
private static native void nOutput(int displayList);
///////////////////////////////////////////////////////////////////////////
// Finalization
///////////////////////////////////////////////////////////////////////////
private static class DisplayListFinalizer {
final int mNativeDisplayList;
public DisplayListFinalizer(int nativeDisplayList) {
mNativeDisplayList = nativeDisplayList;
}
@Override
protected void finalize() throws Throwable {
try {
nDestroyDisplayList(mNativeDisplayList);
} finally {
super.finalize();
}
}
}
}

View File

@@ -33,13 +33,13 @@ class GLES20RecordingCanvas extends GLES20Canvas {
private static final SynchronizedPool<GLES20RecordingCanvas> sPool =
new SynchronizedPool<GLES20RecordingCanvas>(POOL_LIMIT);
private GLES20DisplayList mDisplayList;
private DisplayList mDisplayList;
private GLES20RecordingCanvas() {
super(true, true);
}
static GLES20RecordingCanvas obtain(GLES20DisplayList displayList) {
static GLES20RecordingCanvas obtain(DisplayList displayList) {
GLES20RecordingCanvas canvas = sPool.acquire();
if (canvas == null) {
canvas = new GLES20RecordingCanvas();

View File

@@ -124,7 +124,7 @@ class GLES20RenderLayer extends GLES20Layer {
@Override
void redrawLater(DisplayList displayList, Rect dirtyRect) {
GLES20Canvas.nUpdateRenderLayer(mLayer, mCanvas.getRenderer(),
((GLES20DisplayList) displayList).getNativeDisplayList(),
displayList.getNativeDisplayList(),
dirtyRect.left, dirtyRect.top, dirtyRect.right, dirtyRect.bottom);
}
}

View File

@@ -42,6 +42,7 @@ LOCAL_SRC_FILES:= \
android_database_SQLiteDebug.cpp \
android_emoji_EmojiFactory.cpp \
android_view_DisplayEventReceiver.cpp \
android_view_DisplayList.cpp \
android_view_Surface.cpp \
android_view_SurfaceControl.cpp \
android_view_SurfaceSession.cpp \
@@ -55,7 +56,6 @@ LOCAL_SRC_FILES:= \
android_view_KeyCharacterMap.cpp \
android_view_GraphicBuffer.cpp \
android_view_GLRenderer.cpp \
android_view_GLES20DisplayList.cpp \
android_view_GLES20Canvas.cpp \
android_view_ThreadedRenderer.cpp \
android_view_MotionEvent.cpp \

View File

@@ -119,8 +119,8 @@ extern int register_android_graphics_SurfaceTexture(JNIEnv* env);
extern int register_android_graphics_Xfermode(JNIEnv* env);
extern int register_android_graphics_pdf_PdfDocument(JNIEnv* env);
extern int register_android_view_DisplayEventReceiver(JNIEnv* env);
extern int register_android_view_DisplayList(JNIEnv* env);
extern int register_android_view_GraphicBuffer(JNIEnv* env);
extern int register_android_view_GLES20DisplayList(JNIEnv* env);
extern int register_android_view_GLES20Canvas(JNIEnv* env);
extern int register_android_view_GLRenderer(JNIEnv* env);
extern int register_android_view_ThreadedRenderer(JNIEnv* env);
@@ -1121,11 +1121,11 @@ static const RegJNIRec gRegJNI[] = {
REG_JNI(register_android_os_SystemProperties),
REG_JNI(register_android_os_Binder),
REG_JNI(register_android_os_Parcel),
REG_JNI(register_android_view_DisplayEventReceiver),
REG_JNI(register_android_nio_utils),
REG_JNI(register_android_graphics_Graphics),
REG_JNI(register_android_view_DisplayEventReceiver),
REG_JNI(register_android_view_DisplayList),
REG_JNI(register_android_view_GraphicBuffer),
REG_JNI(register_android_view_GLES20DisplayList),
REG_JNI(register_android_view_GLES20Canvas),
REG_JNI(register_android_view_GLRenderer),
REG_JNI(register_android_view_ThreadedRenderer),

View File

@@ -41,17 +41,17 @@ using namespace uirenderer;
// DisplayList view properties
// ----------------------------------------------------------------------------
static void android_view_GLES20DisplayList_reset(JNIEnv* env,
static void android_view_DisplayList_reset(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
displayList->reset();
}
static jint android_view_GLES20DisplayList_getDisplayListSize(JNIEnv* env,
static jint android_view_DisplayList_getDisplayListSize(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getSize();
}
static void android_view_GLES20DisplayList_setDisplayListName(JNIEnv* env,
static void android_view_DisplayList_setDisplayListName(JNIEnv* env,
jobject clazz, DisplayList* displayList, jstring name) {
if (name != NULL) {
const char* textArray = env->GetStringUTFChars(name, NULL);
@@ -60,12 +60,12 @@ static void android_view_GLES20DisplayList_setDisplayListName(JNIEnv* env,
}
}
static void android_view_GLES20DisplayList_output(JNIEnv* env,
static void android_view_DisplayList_output(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
displayList->output();
}
static void android_view_GLES20DisplayList_destroyDisplayList(JNIEnv* env,
static void android_view_DisplayList_destroyDisplayList(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
DisplayList::destroyDisplayListDeferred(displayList);
}
@@ -74,77 +74,77 @@ static void android_view_GLES20DisplayList_destroyDisplayList(JNIEnv* env,
// DisplayList view properties
// ----------------------------------------------------------------------------
static void android_view_GLES20DisplayList_setCaching(JNIEnv* env,
static void android_view_DisplayList_setCaching(JNIEnv* env,
jobject clazz, DisplayList* displayList, jboolean caching) {
displayList->setCaching(caching);
}
static void android_view_GLES20DisplayList_setStaticMatrix(JNIEnv* env,
static void android_view_DisplayList_setStaticMatrix(JNIEnv* env,
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
displayList->setStaticMatrix(matrix);
}
static void android_view_GLES20DisplayList_setAnimationMatrix(JNIEnv* env,
static void android_view_DisplayList_setAnimationMatrix(JNIEnv* env,
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
displayList->setAnimationMatrix(matrix);
}
static void android_view_GLES20DisplayList_setClipToBounds(JNIEnv* env,
static void android_view_DisplayList_setClipToBounds(JNIEnv* env,
jobject clazz, DisplayList* displayList, jboolean clipToBounds) {
displayList->setClipToBounds(clipToBounds);
}
static void android_view_GLES20DisplayList_setAlpha(JNIEnv* env,
static void android_view_DisplayList_setAlpha(JNIEnv* env,
jobject clazz, DisplayList* displayList, float alpha) {
displayList->setAlpha(alpha);
}
static void android_view_GLES20DisplayList_setHasOverlappingRendering(JNIEnv* env,
static void android_view_DisplayList_setHasOverlappingRendering(JNIEnv* env,
jobject clazz, DisplayList* displayList, bool hasOverlappingRendering) {
displayList->setHasOverlappingRendering(hasOverlappingRendering);
}
static void android_view_GLES20DisplayList_setTranslationX(JNIEnv* env,
static void android_view_DisplayList_setTranslationX(JNIEnv* env,
jobject clazz, DisplayList* displayList, float tx) {
displayList->setTranslationX(tx);
}
static void android_view_GLES20DisplayList_setTranslationY(JNIEnv* env,
static void android_view_DisplayList_setTranslationY(JNIEnv* env,
jobject clazz, DisplayList* displayList, float ty) {
displayList->setTranslationY(ty);
}
static void android_view_GLES20DisplayList_setTranslationZ(JNIEnv* env,
static void android_view_DisplayList_setTranslationZ(JNIEnv* env,
jobject clazz, DisplayList* displayList, float tz) {
displayList->setTranslationZ(tz);
}
static void android_view_GLES20DisplayList_setRotation(JNIEnv* env,
static void android_view_DisplayList_setRotation(JNIEnv* env,
jobject clazz, DisplayList* displayList, float rotation) {
displayList->setRotation(rotation);
}
static void android_view_GLES20DisplayList_setRotationX(JNIEnv* env,
static void android_view_DisplayList_setRotationX(JNIEnv* env,
jobject clazz, DisplayList* displayList, float rx) {
displayList->setRotationX(rx);
}
static void android_view_GLES20DisplayList_setRotationY(JNIEnv* env,
static void android_view_DisplayList_setRotationY(JNIEnv* env,
jobject clazz, DisplayList* displayList, float ry) {
displayList->setRotationY(ry);
}
static void android_view_GLES20DisplayList_setScaleX(JNIEnv* env,
static void android_view_DisplayList_setScaleX(JNIEnv* env,
jobject clazz, DisplayList* displayList, float sx) {
displayList->setScaleX(sx);
}
static void android_view_GLES20DisplayList_setScaleY(JNIEnv* env,
static void android_view_DisplayList_setScaleY(JNIEnv* env,
jobject clazz, DisplayList* displayList, float sy) {
displayList->setScaleY(sy);
}
static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
static void android_view_DisplayList_setTransformationInfo(JNIEnv* env,
jobject clazz, DisplayList* displayList, float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
@@ -159,58 +159,58 @@ static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
displayList->setScaleY(scaleY);
}
static void android_view_GLES20DisplayList_setPivotX(JNIEnv* env,
static void android_view_DisplayList_setPivotX(JNIEnv* env,
jobject clazz, DisplayList* displayList, float px) {
displayList->setPivotX(px);
}
static void android_view_GLES20DisplayList_setPivotY(JNIEnv* env,
static void android_view_DisplayList_setPivotY(JNIEnv* env,
jobject clazz, DisplayList* displayList, float py) {
displayList->setPivotY(py);
}
static void android_view_GLES20DisplayList_setCameraDistance(JNIEnv* env,
static void android_view_DisplayList_setCameraDistance(JNIEnv* env,
jobject clazz, DisplayList* displayList, float distance) {
displayList->setCameraDistance(distance);
}
static void android_view_GLES20DisplayList_setLeft(JNIEnv* env,
static void android_view_DisplayList_setLeft(JNIEnv* env,
jobject clazz, DisplayList* displayList, int left) {
displayList->setLeft(left);
}
static void android_view_GLES20DisplayList_setTop(JNIEnv* env,
static void android_view_DisplayList_setTop(JNIEnv* env,
jobject clazz, DisplayList* displayList, int top) {
displayList->setTop(top);
}
static void android_view_GLES20DisplayList_setRight(JNIEnv* env,
static void android_view_DisplayList_setRight(JNIEnv* env,
jobject clazz, DisplayList* displayList, int right) {
displayList->setRight(right);
}
static void android_view_GLES20DisplayList_setBottom(JNIEnv* env,
static void android_view_DisplayList_setBottom(JNIEnv* env,
jobject clazz, DisplayList* displayList, int bottom) {
displayList->setBottom(bottom);
}
static void android_view_GLES20DisplayList_setLeftTopRightBottom(JNIEnv* env,
static void android_view_DisplayList_setLeftTopRightBottom(JNIEnv* env,
jobject clazz, DisplayList* displayList, int left, int top,
int right, int bottom) {
displayList->setLeftTopRightBottom(left, top, right, bottom);
}
static void android_view_GLES20DisplayList_offsetLeftAndRight(JNIEnv* env,
static void android_view_DisplayList_offsetLeftAndRight(JNIEnv* env,
jobject clazz, DisplayList* displayList, float offset) {
displayList->offsetLeftRight(offset);
}
static void android_view_GLES20DisplayList_offsetTopAndBottom(JNIEnv* env,
static void android_view_DisplayList_offsetTopAndBottom(JNIEnv* env,
jobject clazz, DisplayList* displayList, float offset) {
displayList->offsetTopBottom(offset);
}
static void android_view_GLES20DisplayList_getMatrix(JNIEnv* env,
static void android_view_DisplayList_getMatrix(JNIEnv* env,
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
SkMatrix* source = displayList->getStaticMatrix();
if (source) {
@@ -220,82 +220,82 @@ static void android_view_GLES20DisplayList_getMatrix(JNIEnv* env,
}
}
static jboolean android_view_GLES20DisplayList_hasOverlappingRendering(JNIEnv* env,
static jboolean android_view_DisplayList_hasOverlappingRendering(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->hasOverlappingRendering();
}
static jfloat android_view_GLES20DisplayList_getAlpha(JNIEnv* env,
static jfloat android_view_DisplayList_getAlpha(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getAlpha();
}
static jfloat android_view_GLES20DisplayList_getLeft(JNIEnv* env,
static jfloat android_view_DisplayList_getLeft(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getLeft();
}
static jfloat android_view_GLES20DisplayList_getTop(JNIEnv* env,
static jfloat android_view_DisplayList_getTop(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getTop();
}
static jfloat android_view_GLES20DisplayList_getRight(JNIEnv* env,
static jfloat android_view_DisplayList_getRight(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getRight();
}
static jfloat android_view_GLES20DisplayList_getBottom(JNIEnv* env,
static jfloat android_view_DisplayList_getBottom(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getBottom();
}
static jfloat android_view_GLES20DisplayList_getCameraDistance(JNIEnv* env,
static jfloat android_view_DisplayList_getCameraDistance(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getCameraDistance();
}
static jfloat android_view_GLES20DisplayList_getScaleX(JNIEnv* env,
static jfloat android_view_DisplayList_getScaleX(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getScaleX();
}
static jfloat android_view_GLES20DisplayList_getScaleY(JNIEnv* env,
static jfloat android_view_DisplayList_getScaleY(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getScaleY();
}
static jfloat android_view_GLES20DisplayList_getTranslationX(JNIEnv* env,
static jfloat android_view_DisplayList_getTranslationX(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getTranslationX();
}
static jfloat android_view_GLES20DisplayList_getTranslationY(JNIEnv* env,
static jfloat android_view_DisplayList_getTranslationY(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getTranslationY();
}
static jfloat android_view_GLES20DisplayList_getRotation(JNIEnv* env,
static jfloat android_view_DisplayList_getRotation(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getRotation();
}
static jfloat android_view_GLES20DisplayList_getRotationX(JNIEnv* env,
static jfloat android_view_DisplayList_getRotationX(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getRotationX();
}
static jfloat android_view_GLES20DisplayList_getRotationY(JNIEnv* env,
static jfloat android_view_DisplayList_getRotationY(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getRotationY();
}
static jfloat android_view_GLES20DisplayList_getPivotX(JNIEnv* env,
static jfloat android_view_DisplayList_getPivotX(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getPivotX();
}
static jfloat android_view_GLES20DisplayList_getPivotY(JNIEnv* env,
static jfloat android_view_DisplayList_getPivotY(JNIEnv* env,
jobject clazz, DisplayList* displayList) {
return displayList->getPivotY();
}
@@ -306,64 +306,62 @@ static jfloat android_view_GLES20DisplayList_getPivotY(JNIEnv* env,
// JNI Glue
// ----------------------------------------------------------------------------
const char* const kClassPathName = "android/view/GLES20DisplayList";
const char* const kClassPathName = "android/view/DisplayList";
static JNINativeMethod gMethods[] = {
#ifdef USE_OPENGL_RENDERER
{ "nDestroyDisplayList", "(I)V", (void*) android_view_GLES20DisplayList_destroyDisplayList },
{ "nGetDisplayListSize", "(I)I", (void*) android_view_GLES20DisplayList_getDisplayListSize },
{ "nDestroyDisplayList", "(I)V", (void*) android_view_DisplayList_destroyDisplayList },
{ "nGetDisplayListSize", "(I)I", (void*) android_view_DisplayList_getDisplayListSize },
{ "nSetDisplayListName", "(ILjava/lang/String;)V",
(void*) android_view_GLES20DisplayList_setDisplayListName },
{ "nOutput", "(I)V", (void*) android_view_GLES20DisplayList_output },
(void*) android_view_DisplayList_setDisplayListName },
{ "nOutput", "(I)V", (void*) android_view_DisplayList_output },
{ "nReset", "(I)V", (void*) android_view_GLES20DisplayList_reset },
{ "nSetCaching", "(IZ)V", (void*) android_view_GLES20DisplayList_setCaching },
{ "nSetStaticMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setStaticMatrix },
{ "nSetAnimationMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setAnimationMatrix },
{ "nSetClipToBounds", "(IZ)V", (void*) android_view_GLES20DisplayList_setClipToBounds },
{ "nSetAlpha", "(IF)V", (void*) android_view_GLES20DisplayList_setAlpha },
{ "nReset", "(I)V", (void*) android_view_DisplayList_reset },
{ "nSetCaching", "(IZ)V", (void*) android_view_DisplayList_setCaching },
{ "nSetStaticMatrix", "(II)V", (void*) android_view_DisplayList_setStaticMatrix },
{ "nSetAnimationMatrix", "(II)V", (void*) android_view_DisplayList_setAnimationMatrix },
{ "nSetClipToBounds", "(IZ)V", (void*) android_view_DisplayList_setClipToBounds },
{ "nSetAlpha", "(IF)V", (void*) android_view_DisplayList_setAlpha },
{ "nSetHasOverlappingRendering", "(IZ)V",
(void*) android_view_GLES20DisplayList_setHasOverlappingRendering },
{ "nSetTranslationX", "(IF)V", (void*) android_view_GLES20DisplayList_setTranslationX },
{ "nSetTranslationY", "(IF)V", (void*) android_view_GLES20DisplayList_setTranslationY },
{ "nSetTranslationZ", "(IF)V", (void*) android_view_GLES20DisplayList_setTranslationZ },
{ "nSetRotation", "(IF)V", (void*) android_view_GLES20DisplayList_setRotation },
{ "nSetRotationX", "(IF)V", (void*) android_view_GLES20DisplayList_setRotationX },
{ "nSetRotationY", "(IF)V", (void*) android_view_GLES20DisplayList_setRotationY },
{ "nSetScaleX", "(IF)V", (void*) android_view_GLES20DisplayList_setScaleX },
{ "nSetScaleY", "(IF)V", (void*) android_view_GLES20DisplayList_setScaleY },
(void*) android_view_DisplayList_setHasOverlappingRendering },
{ "nSetTranslationX", "(IF)V", (void*) android_view_DisplayList_setTranslationX },
{ "nSetTranslationY", "(IF)V", (void*) android_view_DisplayList_setTranslationY },
{ "nSetTranslationZ", "(IF)V", (void*) android_view_DisplayList_setTranslationZ },
{ "nSetRotation", "(IF)V", (void*) android_view_DisplayList_setRotation },
{ "nSetRotationX", "(IF)V", (void*) android_view_DisplayList_setRotationX },
{ "nSetRotationY", "(IF)V", (void*) android_view_DisplayList_setRotationY },
{ "nSetScaleX", "(IF)V", (void*) android_view_DisplayList_setScaleX },
{ "nSetScaleY", "(IF)V", (void*) android_view_DisplayList_setScaleY },
{ "nSetTransformationInfo","(IFFFFFFFFF)V",
(void*) android_view_GLES20DisplayList_setTransformationInfo },
{ "nSetPivotX", "(IF)V", (void*) android_view_GLES20DisplayList_setPivotX },
{ "nSetPivotY", "(IF)V", (void*) android_view_GLES20DisplayList_setPivotY },
{ "nSetCameraDistance", "(IF)V", (void*) android_view_GLES20DisplayList_setCameraDistance },
{ "nSetLeft", "(II)V", (void*) android_view_GLES20DisplayList_setLeft },
{ "nSetTop", "(II)V", (void*) android_view_GLES20DisplayList_setTop },
{ "nSetRight", "(II)V", (void*) android_view_GLES20DisplayList_setRight },
{ "nSetBottom", "(II)V", (void*) android_view_GLES20DisplayList_setBottom },
{ "nSetLeftTopRightBottom","(IIIII)V",
(void*) android_view_GLES20DisplayList_setLeftTopRightBottom },
{ "nOffsetLeftAndRight", "(IF)V", (void*) android_view_GLES20DisplayList_offsetLeftAndRight },
{ "nOffsetTopAndBottom", "(IF)V", (void*) android_view_GLES20DisplayList_offsetTopAndBottom },
(void*) android_view_DisplayList_setTransformationInfo },
{ "nSetPivotX", "(IF)V", (void*) android_view_DisplayList_setPivotX },
{ "nSetPivotY", "(IF)V", (void*) android_view_DisplayList_setPivotY },
{ "nSetCameraDistance", "(IF)V", (void*) android_view_DisplayList_setCameraDistance },
{ "nSetLeft", "(II)V", (void*) android_view_DisplayList_setLeft },
{ "nSetTop", "(II)V", (void*) android_view_DisplayList_setTop },
{ "nSetRight", "(II)V", (void*) android_view_DisplayList_setRight },
{ "nSetBottom", "(II)V", (void*) android_view_DisplayList_setBottom },
{ "nSetLeftTopRightBottom","(IIIII)V", (void*) android_view_DisplayList_setLeftTopRightBottom },
{ "nOffsetLeftAndRight", "(IF)V", (void*) android_view_DisplayList_offsetLeftAndRight },
{ "nOffsetTopAndBottom", "(IF)V", (void*) android_view_DisplayList_offsetTopAndBottom },
{ "nGetMatrix", "(II)V", (void*) android_view_GLES20DisplayList_getMatrix },
{ "nHasOverlappingRendering", "(I)Z", (void*) android_view_GLES20DisplayList_hasOverlappingRendering },
{ "nGetAlpha", "(I)F", (void*) android_view_GLES20DisplayList_getAlpha },
{ "nGetLeft", "(I)F", (void*) android_view_GLES20DisplayList_getLeft },
{ "nGetTop", "(I)F", (void*) android_view_GLES20DisplayList_getTop },
{ "nGetRight", "(I)F", (void*) android_view_GLES20DisplayList_getRight },
{ "nGetBottom", "(I)F", (void*) android_view_GLES20DisplayList_getBottom },
{ "nGetCameraDistance", "(I)F", (void*) android_view_GLES20DisplayList_getCameraDistance },
{ "nGetScaleX", "(I)F", (void*) android_view_GLES20DisplayList_getScaleX },
{ "nGetScaleY", "(I)F", (void*) android_view_GLES20DisplayList_getScaleY },
{ "nGetTranslationX", "(I)F", (void*) android_view_GLES20DisplayList_getTranslationX },
{ "nGetTranslationY", "(I)F", (void*) android_view_GLES20DisplayList_getTranslationY },
{ "nGetRotation", "(I)F", (void*) android_view_GLES20DisplayList_getRotation },
{ "nGetRotationX", "(I)F", (void*) android_view_GLES20DisplayList_getRotationX },
{ "nGetRotationY", "(I)F", (void*) android_view_GLES20DisplayList_getRotationY },
{ "nGetPivotX", "(I)F", (void*) android_view_GLES20DisplayList_getPivotX },
{ "nGetPivotY", "(I)F", (void*) android_view_GLES20DisplayList_getPivotY },
{ "nGetMatrix", "(II)V", (void*) android_view_DisplayList_getMatrix },
{ "nHasOverlappingRendering", "(I)Z", (void*) android_view_DisplayList_hasOverlappingRendering },
{ "nGetAlpha", "(I)F", (void*) android_view_DisplayList_getAlpha },
{ "nGetLeft", "(I)F", (void*) android_view_DisplayList_getLeft },
{ "nGetTop", "(I)F", (void*) android_view_DisplayList_getTop },
{ "nGetRight", "(I)F", (void*) android_view_DisplayList_getRight },
{ "nGetBottom", "(I)F", (void*) android_view_DisplayList_getBottom },
{ "nGetCameraDistance", "(I)F", (void*) android_view_DisplayList_getCameraDistance },
{ "nGetScaleX", "(I)F", (void*) android_view_DisplayList_getScaleX },
{ "nGetScaleY", "(I)F", (void*) android_view_DisplayList_getScaleY },
{ "nGetTranslationX", "(I)F", (void*) android_view_DisplayList_getTranslationX },
{ "nGetTranslationY", "(I)F", (void*) android_view_DisplayList_getTranslationY },
{ "nGetRotation", "(I)F", (void*) android_view_DisplayList_getRotation },
{ "nGetRotationX", "(I)F", (void*) android_view_DisplayList_getRotationX },
{ "nGetRotationY", "(I)F", (void*) android_view_DisplayList_getRotationY },
{ "nGetPivotX", "(I)F", (void*) android_view_DisplayList_getPivotX },
{ "nGetPivotY", "(I)F", (void*) android_view_DisplayList_getPivotY },
#endif
};
@@ -380,7 +378,7 @@ static JNINativeMethod gMethods[] = {
#define GET_METHOD_ID(var, clazz, methodName, methodDescriptor)
#endif
int register_android_view_GLES20DisplayList(JNIEnv* env) {
int register_android_view_DisplayList(JNIEnv* env) {
return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}

View File

@@ -977,14 +977,13 @@ android.view.DisplayEventReceiver
android.view.DisplayInfo
android.view.DisplayInfo$1
android.view.DisplayList
android.view.DisplayList$DisplayListFinalizer
android.view.FallbackEventHandler
android.view.FocusFinder
android.view.FocusFinder$1
android.view.FocusFinder$SequentialFocusComparator
android.view.GLES20Canvas
android.view.GLES20Canvas$CanvasFinalizer
android.view.GLES20DisplayList
android.view.GLES20DisplayList$DisplayListFinalizer
android.view.GLES20Layer
android.view.GLES20Layer$Finalizer
android.view.GLES20RecordingCanvas