Merge "Fix how outlines are sent to rendernode" into nyc-dev
This commit is contained in:
@@ -307,18 +307,22 @@ public class RenderNode {
|
|||||||
*
|
*
|
||||||
* Deep copies the data into native to simplify reference ownership.
|
* Deep copies the data into native to simplify reference ownership.
|
||||||
*/
|
*/
|
||||||
public boolean setOutline(Outline outline) {
|
public boolean setOutline(@Nullable Outline outline) {
|
||||||
if (outline == null) {
|
if (outline == null) {
|
||||||
return nSetOutlineNone(mNativeRenderNode);
|
return nSetOutlineNone(mNativeRenderNode);
|
||||||
} else if (outline.isEmpty()) {
|
|
||||||
return nSetOutlineEmpty(mNativeRenderNode);
|
|
||||||
} else if (outline.mRect != null) {
|
|
||||||
return nSetOutlineRoundRect(mNativeRenderNode, outline.mRect.left, outline.mRect.top,
|
|
||||||
outline.mRect.right, outline.mRect.bottom, outline.mRadius, outline.mAlpha);
|
|
||||||
} else if (outline.mPath != null) {
|
|
||||||
return nSetOutlineConvexPath(mNativeRenderNode, outline.mPath.mNativePath,
|
|
||||||
outline.mAlpha);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch(outline.mMode) {
|
||||||
|
case Outline.MODE_EMPTY:
|
||||||
|
return nSetOutlineEmpty(mNativeRenderNode);
|
||||||
|
case Outline.MODE_ROUND_RECT:
|
||||||
|
return nSetOutlineRoundRect(mNativeRenderNode, outline.mRect.left, outline.mRect.top,
|
||||||
|
outline.mRect.right, outline.mRect.bottom, outline.mRadius, outline.mAlpha);
|
||||||
|
case Outline.MODE_CONVEX_PATH:
|
||||||
|
return nSetOutlineConvexPath(mNativeRenderNode, outline.mPath.mNativePath,
|
||||||
|
outline.mAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
throw new IllegalArgumentException("Unrecognized outline?");
|
throw new IllegalArgumentException("Unrecognized outline?");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,22 +37,26 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
public final class Outline {
|
public final class Outline {
|
||||||
private static final float RADIUS_UNDEFINED = Float.NEGATIVE_INFINITY;
|
private static final float RADIUS_UNDEFINED = Float.NEGATIVE_INFINITY;
|
||||||
|
|
||||||
private static final int MODE_EMPTY = 0;
|
/** @hide */
|
||||||
private static final int MODE_RECT = 1;
|
public static final int MODE_EMPTY = 0;
|
||||||
private static final int MODE_CONVEX_PATH = 2;
|
/** @hide */
|
||||||
|
public static final int MODE_ROUND_RECT = 1;
|
||||||
|
/** @hide */
|
||||||
|
public static final int MODE_CONVEX_PATH = 2;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef(flag = false,
|
@IntDef(flag = false,
|
||||||
value = {
|
value = {
|
||||||
MODE_EMPTY,
|
MODE_EMPTY,
|
||||||
MODE_RECT,
|
MODE_ROUND_RECT,
|
||||||
MODE_CONVEX_PATH,
|
MODE_CONVEX_PATH,
|
||||||
})
|
})
|
||||||
public @interface Mode {}
|
public @interface Mode {}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
@Mode
|
@Mode
|
||||||
private int mMode = MODE_EMPTY;
|
public int mMode = MODE_EMPTY;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
public final Path mPath = new Path();
|
public final Path mPath = new Path();
|
||||||
@@ -176,7 +180,7 @@ public final class Outline {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mMode = MODE_RECT;
|
mMode = MODE_ROUND_RECT;
|
||||||
mRect.set(left, top, right, bottom);
|
mRect.set(left, top, right, bottom);
|
||||||
mRadius = radius;
|
mRadius = radius;
|
||||||
mPath.rewind();
|
mPath.rewind();
|
||||||
@@ -199,7 +203,7 @@ public final class Outline {
|
|||||||
* bounds, or {@code false} if no outline bounds are set
|
* bounds, or {@code false} if no outline bounds are set
|
||||||
*/
|
*/
|
||||||
public boolean getRect(@NonNull Rect outRect) {
|
public boolean getRect(@NonNull Rect outRect) {
|
||||||
if (mMode != MODE_RECT) {
|
if (mMode != MODE_ROUND_RECT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
outRect.set(mRect);
|
outRect.set(mRect);
|
||||||
@@ -270,7 +274,7 @@ public final class Outline {
|
|||||||
* Offsets the Outline by (dx,dy)
|
* Offsets the Outline by (dx,dy)
|
||||||
*/
|
*/
|
||||||
public void offset(int dx, int dy) {
|
public void offset(int dx, int dy) {
|
||||||
if (mMode == MODE_RECT) {
|
if (mMode == MODE_ROUND_RECT) {
|
||||||
mRect.offset(dx, dy);
|
mRect.offset(dx, dy);
|
||||||
} else if (mMode == MODE_CONVEX_PATH) {
|
} else if (mMode == MODE_CONVEX_PATH) {
|
||||||
mPath.offset(dx, dy);
|
mPath.offset(dx, dy);
|
||||||
|
|||||||
@@ -155,6 +155,23 @@ void RenderProperties::debugOutputProperties(const int level) const {
|
|||||||
ALOGD("%*s(ClipRect %d, %d, %d, %d)", level * 2, "",
|
ALOGD("%*s(ClipRect %d, %d, %d, %d)", level * 2, "",
|
||||||
(int)clipRect.left, (int)clipRect.top, (int)clipRect.right, (int)clipRect.bottom);
|
(int)clipRect.left, (int)clipRect.top, (int)clipRect.right, (int)clipRect.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getRevealClip().willClip()) {
|
||||||
|
Rect bounds;
|
||||||
|
getRevealClip().getBounds(&bounds);
|
||||||
|
ALOGD("%*s(Clip to reveal clip with bounds %.2f %.2f %.2f %.2f)", level * 2, "",
|
||||||
|
RECT_ARGS(bounds));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& outline = mPrimitiveFields.mOutline;
|
||||||
|
if (outline.getShouldClip()) {
|
||||||
|
if (outline.isEmpty()) {
|
||||||
|
ALOGD("%*s(Clip to empty outline)", level * 2, "");
|
||||||
|
} else if (outline.willClip()) {
|
||||||
|
ALOGD("%*s(Clip to outline with bounds %.2f %.2f %.2f %.2f)", level * 2, "",
|
||||||
|
RECT_ARGS(outline.getBounds()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderProperties::updateMatrix() {
|
void RenderProperties::updateMatrix() {
|
||||||
|
|||||||
Reference in New Issue
Block a user