@@ -115,7 +115,7 @@ public static float pixelToPoint(Drawable drawable, float size, int zoom) {
115
115
116
116
public static Point pixelToPoint (Point point , int zoom ) {
117
117
if (zoom == 100 || point == null ) return point ;
118
- Point .OfFloat fPoint = FloatAwareGeometryFactory . createFrom (point );
118
+ Point .OfFloat fPoint = Point . OfFloat . from (point );
119
119
float scaleFactor = DPIUtil .getScalingFactor (zoom );
120
120
float scaledX = fPoint .getX () / scaleFactor ;
121
121
float scaledY = fPoint .getY () / scaleFactor ;
@@ -170,7 +170,7 @@ public static Rectangle scaleBounds (Rectangle rect, int targetZoom, int current
170
170
*/
171
171
private static Rectangle scaleBounds (Rectangle .OfFloat rect , int targetZoom , int currentZoom ) {
172
172
if (rect == null || targetZoom == currentZoom ) return rect ;
173
- Rectangle .OfFloat fRect = FloatAwareGeometryFactory . createFrom (rect );
173
+ Rectangle .OfFloat fRect = Rectangle . OfFloat . from (rect );
174
174
float scaleFactor = DPIUtil .getScalingFactor (targetZoom , currentZoom );
175
175
float scaledX = fRect .getX () * scaleFactor ;
176
176
float scaledY = fRect .getY () * scaleFactor ;
@@ -221,7 +221,7 @@ public static float pointToPixel(Drawable drawable, float size, int zoom) {
221
221
222
222
public static Point pointToPixel (Point point , int zoom ) {
223
223
if (zoom == 100 || point == null ) return point ;
224
- Point .OfFloat fPoint = FloatAwareGeometryFactory . createFrom (point );
224
+ Point .OfFloat fPoint = Point . OfFloat . from (point );
225
225
float scaleFactor = DPIUtil .getScalingFactor (zoom );
226
226
float scaledX = fPoint .getX () * scaleFactor ;
227
227
float scaledY = fPoint .getY () * scaleFactor ;
@@ -323,20 +323,4 @@ public ImageData getImageData(int zoom) {
323
323
return DPIUtil .scaleImageData (device , imageData , zoom , currentZoom );
324
324
}
325
325
}
326
-
327
- private class FloatAwareGeometryFactory {
328
- static Rectangle .OfFloat createFrom (Rectangle rectangle ) {
329
- if (rectangle instanceof Rectangle .OfFloat ) {
330
- return (Rectangle .OfFloat ) rectangle ;
331
- }
332
- return new Rectangle .OfFloat (rectangle .x , rectangle .y , rectangle .width , rectangle .height );
333
- }
334
-
335
- static Point .OfFloat createFrom (Point point ) {
336
- if (point instanceof Point .OfFloat ) {
337
- return (Point .OfFloat ) point ;
338
- }
339
- return new Point .OfFloat (point .x , point .y );
340
- }
341
- }
342
326
}
0 commit comments