提交 45b5e81c 编写于 作者: S son

6644301: lightweight components can repaint outside request bounds

Summary: repaint() needs to adjust width and height if it receives negative x or y.
Reviewed-by: art
上级 f93edc72
...@@ -3052,10 +3052,24 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -3052,10 +3052,24 @@ public abstract class Component implements ImageObserver, MenuContainer,
// services. Additionally, the request is restricted to // services. Additionally, the request is restricted to
// the bounds of the component. // the bounds of the component.
if (parent != null) { if (parent != null) {
int px = this.x + ((x < 0) ? 0 : x); if (x < 0) {
int py = this.y + ((y < 0) ? 0 : y); width += x;
x = 0;
}
if (y < 0) {
height += y;
y = 0;
}
int pwidth = (width > this.width) ? this.width : width; int pwidth = (width > this.width) ? this.width : width;
int pheight = (height > this.height) ? this.height : height; int pheight = (height > this.height) ? this.height : height;
if (pwidth <= 0 || pheight <= 0) {
return;
}
int px = this.x + x;
int py = this.y + y;
parent.repaint(tm, px, py, pwidth, pheight); parent.repaint(tm, px, py, pwidth, pheight);
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册