static Rect rescaleRect(Rect r, int w1, int h1, int w2, int h2) { if (r == null) null; double x = doubleRatio(w2, w1), y = doubleRatio(h2, h1); ret rectFromPoints(iround(r.x*x), iround(r.y*y), iround(r.x2()*x), iround(r.y2()*y)); }