Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit baf7b9ad authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Use correct rounding in View for potentially negative values"

parents 261eda26 c45b1d4a
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -6329,8 +6329,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        position.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop);
        position.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop);
        outRect.set((int) (position.left + 0.5f), (int) (position.top + 0.5f),
        outRect.set(Math.round(position.left), Math.round(position.top),
                (int) (position.right + 0.5f), (int) (position.bottom + 0.5f));
                Math.round(position.right), Math.round(position.bottom));
    }
    }
    /**
    /**
@@ -18548,8 +18548,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            position[1] -= vr.mCurScrollY;
            position[1] -= vr.mCurScrollY;
        }
        }
        inOutLocation[0] = (int) (position[0] + 0.5f);
        inOutLocation[0] = Math.round(position[0]);
        inOutLocation[1] = (int) (position[1] + 0.5f);
        inOutLocation[1] = Math.round(position[1]);
    }
    }
    /**
    /**
+12 −12
Original line number Original line Diff line number Diff line
@@ -5114,10 +5114,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    transformMatrix = childMatrix;
                    transformMatrix = childMatrix;
                }
                }
                transformMatrix.mapRect(boundingRect);
                transformMatrix.mapRect(boundingRect);
                dirty.set((int) (boundingRect.left - 0.5f),
                dirty.set((int) Math.floor(boundingRect.left),
                        (int) (boundingRect.top - 0.5f),
                        (int) Math.floor(boundingRect.top),
                        (int) (boundingRect.right + 0.5f),
                        (int) Math.ceil(boundingRect.right),
                        (int) (boundingRect.bottom + 0.5f));
                        (int) Math.ceil(boundingRect.bottom));
            }
            }


            do {
            do {
@@ -5154,10 +5154,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                        RectF boundingRect = attachInfo.mTmpTransformRect;
                        RectF boundingRect = attachInfo.mTmpTransformRect;
                        boundingRect.set(dirty);
                        boundingRect.set(dirty);
                        m.mapRect(boundingRect);
                        m.mapRect(boundingRect);
                        dirty.set((int) (boundingRect.left - 0.5f),
                        dirty.set((int) Math.floor(boundingRect.left),
                                (int) (boundingRect.top - 0.5f),
                                (int) Math.floor(boundingRect.top),
                                (int) (boundingRect.right + 0.5f),
                                (int) Math.ceil(boundingRect.right),
                                (int) (boundingRect.bottom + 0.5f));
                                (int) Math.ceil(boundingRect.bottom));
                    }
                    }
                }
                }
            } while (parent != null);
            } while (parent != null);
@@ -5457,8 +5457,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                position[0] = offset.x;
                position[0] = offset.x;
                position[1] = offset.y;
                position[1] = offset.y;
                child.getMatrix().mapPoints(position);
                child.getMatrix().mapPoints(position);
                offset.x = (int) (position[0] + 0.5f);
                offset.x = Math.round(position[0]);
                offset.y = (int) (position[1] + 0.5f);
                offset.y = Math.round(position[1]);
            }
            }
            offset.x += dx;
            offset.x += dx;
            offset.y += dy;
            offset.y += dy;
@@ -5485,8 +5485,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            rectIsVisible = rect.intersect(mClipBounds.left, mClipBounds.top, mClipBounds.right,
            rectIsVisible = rect.intersect(mClipBounds.left, mClipBounds.top, mClipBounds.right,
                    mClipBounds.bottom);
                    mClipBounds.bottom);
        }
        }
        r.set((int) (rect.left + 0.5f), (int) (rect.top + 0.5f), (int) (rect.right + 0.5f),
        r.set((int) Math.floor(rect.left), (int) Math.floor(rect.top),
                (int) (rect.bottom + 0.5f));
                (int) Math.ceil(rect.right), (int) Math.ceil(rect.bottom));
        if (rectIsVisible && mParent != null) {
        if (rectIsVisible && mParent != null) {
            rectIsVisible = mParent.getChildVisibleRect(this, r, offset);
            rectIsVisible = mParent.getChildVisibleRect(this, r, offset);
        }
        }