Skip to content

Commit 89b7f2e

Browse files
committed
Fix Animation bugs from DisplayList properties integration
The new DisplayList properties functionality does not currently handle Animation (android.view.animation) functionality, so we fall back to the previous approach of redrawing the DisplayList when an Animation changes alpha/transform data for a View. The DL code was not, however, correctly using that logic, so that the Animation transform information was being ignored, or at least not set correctly on the DisplayList during redraws. This fix accounts for Animation changes and sets up the DisplayList correctly. Change-Id: I9f6e0382b05d0627f4779f30e74641dedcc77f82
1 parent fae7ab3 commit 89b7f2e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

core/java/android/view/View.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11481,7 +11481,7 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1148111481
layerType != LAYER_TYPE_HARDWARE;
1148211482

1148311483
int restoreTo = -1;
11484-
if (!useDisplayListProperties) {
11484+
if (!useDisplayListProperties || transformToApply != null) {
1148511485
restoreTo = canvas.save();
1148611486
}
1148711487
if (offsetForScroll) {
@@ -11515,11 +11515,9 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1151511515
if (concatMatrix) {
1151611516
// Undo the scroll translation, apply the transformation matrix,
1151711517
// then redo the scroll translate to get the correct result.
11518-
if (!useDisplayListProperties) {
11519-
canvas.translate(-transX, -transY);
11520-
canvas.concat(transformToApply.getMatrix());
11521-
canvas.translate(transX, transY);
11522-
}
11518+
canvas.translate(-transX, -transY);
11519+
canvas.concat(transformToApply.getMatrix());
11520+
canvas.translate(transX, transY);
1152311521
parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
1152411522
}
1152511523

@@ -11548,12 +11546,10 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1154811546
layerFlags |= Canvas.CLIP_TO_LAYER_SAVE_FLAG;
1154911547
}
1155011548
if (layerType == LAYER_TYPE_NONE) {
11551-
if (!useDisplayListProperties) {
11552-
final int scrollX = hasDisplayList ? 0 : sx;
11553-
final int scrollY = hasDisplayList ? 0 : sy;
11554-
canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
11555-
scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
11556-
}
11549+
final int scrollX = hasDisplayList ? 0 : sx;
11550+
final int scrollY = hasDisplayList ? 0 : sy;
11551+
canvas.saveLayerAlpha(scrollX, scrollY, scrollX + mRight - mLeft,
11552+
scrollY + mBottom - mTop, multipliedAlpha, layerFlags);
1155711553
}
1155811554
} else {
1155911555
// Alpha is handled by the child directly, clobber the layer's alpha

0 commit comments

Comments
 (0)