Temporarily allow StackView to use a canvas.clipRectUnion
StackView currently expands the clip of the view which is a prohibited operation in API Level 28. This CL currently allows this specialized use case to work in this situation until we can update StackView to not clip to its bounds and then just intersect with this clip provided by its parent. Test: CtsWidgetTestCases Bug: 77642155 Change-Id: Icc003ad3946bb226368ec2030d4707753f4f55e9
This commit is contained in:
@@ -28,7 +28,6 @@ import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.graphics.TableMaskFilter;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
@@ -550,8 +549,8 @@ public class StackView extends AdapterViewAnimator {
|
||||
|
||||
// We only expand the clip bounds if necessary.
|
||||
if (expandClipRegion) {
|
||||
canvas.save(Canvas.CLIP_SAVE_FLAG);
|
||||
canvas.clipRect(stackInvalidateRect, Region.Op.UNION);
|
||||
canvas.save();
|
||||
canvas.clipRectUnion(stackInvalidateRect);
|
||||
super.dispatchDraw(canvas);
|
||||
canvas.restore();
|
||||
} else {
|
||||
|
||||
@@ -828,6 +828,17 @@ public class Canvas extends BaseCanvas {
|
||||
op.nativeInt);
|
||||
}
|
||||
|
||||
/**
|
||||
* DON'T USE THIS METHOD. It exists only to support a particular legacy behavior in
|
||||
* the view system and will be removed as soon as that code is refactored to no longer
|
||||
* depend on this behavior.
|
||||
* @hide
|
||||
*/
|
||||
public boolean clipRectUnion(@NonNull Rect rect) {
|
||||
return nClipRect(mNativeCanvasWrapper, rect.left, rect.top, rect.right, rect.bottom,
|
||||
Region.Op.UNION.nativeInt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Intersect the current clip with the specified rectangle, which is
|
||||
* expressed in local coordinates.
|
||||
|
||||
Reference in New Issue
Block a user