Loading core/java/android/view/DisplayList.java +22 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.graphics.Matrix; import android.graphics.Path; import java.util.ArrayList; Loading Loading @@ -171,7 +172,7 @@ public class DisplayList { * Indicates that the display list needs to re-execute its GL functors. * * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) * @see HardwareCanvas#callDrawGLFunction(int) * @see HardwareCanvas#callDrawGLFunction(long) * * @hide */ Loading Loading @@ -406,7 +407,7 @@ public class DisplayList { * Set whether the display list should collect and Z order all 3d composited descendents, and * draw them in order with the default Z=0 content. * * @param isolateZVolume true if the display list should collect and Z order descendents. * @param isolatedZVolume true if the display list should collect and Z order descendents. */ public void setIsolatedZVolume(boolean isolatedZVolume) { if (hasNativeDisplayList()) { Loading @@ -429,6 +430,20 @@ public class DisplayList { } } /** * Sets the outline, defining the shape that casts a shadow. * * Deep copies the native path to simplify reference ownership. * * @param outline Convex, CW Path to store in the DisplayList. May be null. */ public void setOutline(Path outline) { if (hasNativeDisplayList()) { long nativePath = (outline == null) ? 0 : outline.mNativePath; nSetOutline(mFinalizer.mNativeDisplayList, nativePath); } } /** * Set the static matrix on the display list. The specified matrix is combined with other * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) Loading Loading @@ -1051,6 +1066,7 @@ public class DisplayList { private static native void nSetClipToBounds(long displayList, boolean clipToBounds); private static native void nSetProjectBackwards(long displayList, boolean shouldProject); private static native void nSetIsolatedZVolume(long displayList, boolean isolateZVolume); private static native void nSetOutline(long displayList, long nativePath); private static native void nSetAlpha(long displayList, float alpha); private static native void nSetHasOverlappingRendering(long displayList, boolean hasOverlappingRendering); Loading core/java/android/view/View.java +34 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Interpolator; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.PorterDuff; Loading Loading @@ -3294,6 +3295,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private int[] mDrawableState = null; /** * Stores the outline of the view, passed down to the DisplayList level for shadow shape. */ private Path mOutline; /** * When this view has focus and the next focus is {@link #FOCUS_LEFT}, * the user may specify which view to go to next. Loading Loading @@ -10623,6 +10629,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** * @hide */ public final void getOutline(Path outline) { if (mOutline == null) { outline.reset(); } else { outline.set(mOutline); } } /** * @hide */ public void setOutline(Path path) { // always copy the path since caller may reuse if (mOutline == null) { mOutline = new Path(path); } else { mOutline.set(path); } if (mDisplayList != null) { mDisplayList.setOutline(path); } } /** * Hit rectangle in parent's coordinates * Loading Loading @@ -14266,6 +14299,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, displayList.setIsolatedZVolume( (((ViewGroup) this).mGroupFlags & ViewGroup.FLAG_ISOLATED_Z_VOLUME) != 0); } displayList.setOutline(mOutline); float alpha = 1; if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) { core/jni/android_view_DisplayList.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,13 @@ static void android_view_DisplayList_setProjectBackwards(JNIEnv* env, displayList->setProjectBackwards(shouldProject); } static void android_view_DisplayList_setOutline(JNIEnv* env, jobject clazz, jlong displayListPtr, jlong outlinePathPtr) { DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr); SkPath* outline = reinterpret_cast<SkPath*>(outlinePathPtr); displayList->setOutline(outline); } static void android_view_DisplayList_setAlpha(JNIEnv* env, jobject clazz, jlong displayListPtr, float alpha) { DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr); Loading Loading @@ -385,6 +392,7 @@ static JNINativeMethod gMethods[] = { { "nSetClipToBounds", "(JZ)V", (void*) android_view_DisplayList_setClipToBounds }, { "nSetIsolatedZVolume", "(JZ)V", (void*) android_view_DisplayList_setIsolatedZVolume }, { "nSetProjectBackwards", "(JZ)V", (void*) android_view_DisplayList_setProjectBackwards }, { "nSetOutline", "(JJ)V", (void*) android_view_DisplayList_setOutline }, { "nSetAlpha", "(JF)V", (void*) android_view_DisplayList_setAlpha }, { "nSetHasOverlappingRendering", "(JZ)V", (void*) android_view_DisplayList_setHasOverlappingRendering }, Loading libs/hwui/DisplayList.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -240,6 +240,7 @@ void DisplayList::init() { mClipToBounds = true; mIsolatedZVolume = true; mProjectBackwards = false; mOutline.rewind(); mAlpha = 1; mHasOverlappingRendering = true; mTranslationX = 0; Loading Loading @@ -654,16 +655,15 @@ void DisplayList::iterate3dChildren(ChildrenSelectMode mode, OpenGLRenderer& ren /* draw shadow with parent matrix applied, passing in the child's total matrix * * TODO: * -determine and pass background shape (and possibly drawable alpha) * -view must opt-in to shadows * -consider shadows for other content * -inform shadow system of ancestor transform (for use in lighting) * -consider depth in more complex scenarios (neg z, added shadow depth) */ mat4 shadowMatrix(childOp->mTransformFromCompositingAncestor); childOp->mDisplayList->applyViewPropertyTransforms(shadowMatrix); DisplayList* child = childOp->mDisplayList; DisplayListOp* shadowOp = new (alloc) DrawShadowOp(shadowMatrix, childOp->mDisplayList->mAlpha, childOp->mDisplayList->getWidth(), childOp->mDisplayList->getHeight()); child->mAlpha, &(child->mOutline), child->mWidth, child->mHeight); handler(shadowOp, PROPERTY_SAVECOUNT, mClipToBounds); } Loading libs/hwui/DisplayList.h +9 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,14 @@ public: mProjectBackwards = shouldProject; } void setOutline(const SkPath* outline) { if (!outline) { mOutline.reset(); } else { mOutline = *outline; } } void setStaticMatrix(SkMatrix* matrix) { delete mStaticMatrix; mStaticMatrix = new SkMatrix(*matrix); Loading Loading @@ -592,6 +600,7 @@ private: bool mClipToBounds; bool mIsolatedZVolume; bool mProjectBackwards; SkPath mOutline; float mAlpha; bool mHasOverlappingRendering; float mTranslationX, mTranslationY, mTranslationZ; Loading Loading
core/java/android/view/DisplayList.java +22 −6 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.view; import android.graphics.Matrix; import android.graphics.Path; import java.util.ArrayList; Loading Loading @@ -171,7 +172,7 @@ public class DisplayList { * Indicates that the display list needs to re-execute its GL functors. * * @see HardwareCanvas#drawDisplayList(DisplayList, android.graphics.Rect, int) * @see HardwareCanvas#callDrawGLFunction(int) * @see HardwareCanvas#callDrawGLFunction(long) * * @hide */ Loading Loading @@ -406,7 +407,7 @@ public class DisplayList { * Set whether the display list should collect and Z order all 3d composited descendents, and * draw them in order with the default Z=0 content. * * @param isolateZVolume true if the display list should collect and Z order descendents. * @param isolatedZVolume true if the display list should collect and Z order descendents. */ public void setIsolatedZVolume(boolean isolatedZVolume) { if (hasNativeDisplayList()) { Loading @@ -429,6 +430,20 @@ public class DisplayList { } } /** * Sets the outline, defining the shape that casts a shadow. * * Deep copies the native path to simplify reference ownership. * * @param outline Convex, CW Path to store in the DisplayList. May be null. */ public void setOutline(Path outline) { if (hasNativeDisplayList()) { long nativePath = (outline == null) ? 0 : outline.mNativePath; nSetOutline(mFinalizer.mNativeDisplayList, nativePath); } } /** * Set the static matrix on the display list. The specified matrix is combined with other * transforms (such as {@link #setScaleX(float)}, {@link #setRotation(float)}, etc.) Loading Loading @@ -1051,6 +1066,7 @@ public class DisplayList { private static native void nSetClipToBounds(long displayList, boolean clipToBounds); private static native void nSetProjectBackwards(long displayList, boolean shouldProject); private static native void nSetIsolatedZVolume(long displayList, boolean isolateZVolume); private static native void nSetOutline(long displayList, long nativePath); private static native void nSetAlpha(long displayList, float alpha); private static native void nSetHasOverlappingRendering(long displayList, boolean hasOverlappingRendering); Loading
core/java/android/view/View.java +34 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.graphics.Interpolator; import android.graphics.LinearGradient; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PixelFormat; import android.graphics.Point; import android.graphics.PorterDuff; Loading Loading @@ -3294,6 +3295,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, private int[] mDrawableState = null; /** * Stores the outline of the view, passed down to the DisplayList level for shadow shape. */ private Path mOutline; /** * When this view has focus and the next focus is {@link #FOCUS_LEFT}, * the user may specify which view to go to next. Loading Loading @@ -10623,6 +10629,33 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** * @hide */ public final void getOutline(Path outline) { if (mOutline == null) { outline.reset(); } else { outline.set(mOutline); } } /** * @hide */ public void setOutline(Path path) { // always copy the path since caller may reuse if (mOutline == null) { mOutline = new Path(path); } else { mOutline.set(path); } if (mDisplayList != null) { mDisplayList.setOutline(path); } } /** * Hit rectangle in parent's coordinates * Loading Loading @@ -14266,6 +14299,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, displayList.setIsolatedZVolume( (((ViewGroup) this).mGroupFlags & ViewGroup.FLAG_ISOLATED_Z_VOLUME) != 0); } displayList.setOutline(mOutline); float alpha = 1; if (mParent instanceof ViewGroup && (((ViewGroup) mParent).mGroupFlags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
core/jni/android_view_DisplayList.cpp +8 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,13 @@ static void android_view_DisplayList_setProjectBackwards(JNIEnv* env, displayList->setProjectBackwards(shouldProject); } static void android_view_DisplayList_setOutline(JNIEnv* env, jobject clazz, jlong displayListPtr, jlong outlinePathPtr) { DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr); SkPath* outline = reinterpret_cast<SkPath*>(outlinePathPtr); displayList->setOutline(outline); } static void android_view_DisplayList_setAlpha(JNIEnv* env, jobject clazz, jlong displayListPtr, float alpha) { DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr); Loading Loading @@ -385,6 +392,7 @@ static JNINativeMethod gMethods[] = { { "nSetClipToBounds", "(JZ)V", (void*) android_view_DisplayList_setClipToBounds }, { "nSetIsolatedZVolume", "(JZ)V", (void*) android_view_DisplayList_setIsolatedZVolume }, { "nSetProjectBackwards", "(JZ)V", (void*) android_view_DisplayList_setProjectBackwards }, { "nSetOutline", "(JJ)V", (void*) android_view_DisplayList_setOutline }, { "nSetAlpha", "(JF)V", (void*) android_view_DisplayList_setAlpha }, { "nSetHasOverlappingRendering", "(JZ)V", (void*) android_view_DisplayList_setHasOverlappingRendering }, Loading
libs/hwui/DisplayList.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -240,6 +240,7 @@ void DisplayList::init() { mClipToBounds = true; mIsolatedZVolume = true; mProjectBackwards = false; mOutline.rewind(); mAlpha = 1; mHasOverlappingRendering = true; mTranslationX = 0; Loading Loading @@ -654,16 +655,15 @@ void DisplayList::iterate3dChildren(ChildrenSelectMode mode, OpenGLRenderer& ren /* draw shadow with parent matrix applied, passing in the child's total matrix * * TODO: * -determine and pass background shape (and possibly drawable alpha) * -view must opt-in to shadows * -consider shadows for other content * -inform shadow system of ancestor transform (for use in lighting) * -consider depth in more complex scenarios (neg z, added shadow depth) */ mat4 shadowMatrix(childOp->mTransformFromCompositingAncestor); childOp->mDisplayList->applyViewPropertyTransforms(shadowMatrix); DisplayList* child = childOp->mDisplayList; DisplayListOp* shadowOp = new (alloc) DrawShadowOp(shadowMatrix, childOp->mDisplayList->mAlpha, childOp->mDisplayList->getWidth(), childOp->mDisplayList->getHeight()); child->mAlpha, &(child->mOutline), child->mWidth, child->mHeight); handler(shadowOp, PROPERTY_SAVECOUNT, mClipToBounds); } Loading
libs/hwui/DisplayList.h +9 −0 Original line number Diff line number Diff line Loading @@ -198,6 +198,14 @@ public: mProjectBackwards = shouldProject; } void setOutline(const SkPath* outline) { if (!outline) { mOutline.reset(); } else { mOutline = *outline; } } void setStaticMatrix(SkMatrix* matrix) { delete mStaticMatrix; mStaticMatrix = new SkMatrix(*matrix); Loading Loading @@ -592,6 +600,7 @@ private: bool mClipToBounds; bool mIsolatedZVolume; bool mProjectBackwards; SkPath mOutline; float mAlpha; bool mHasOverlappingRendering; float mTranslationX, mTranslationY, mTranslationZ; Loading