@@ -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 ;
@@ -330,20 +330,4 @@ public ImageData getImageData(int zoom) {
330
330
return DPIUtil .scaleImageData (device , imageData , zoom , currentZoom );
331
331
}
332
332
}
333
-
334
- private class FloatAwareGeometryFactory {
335
- static Rectangle .OfFloat createFrom (Rectangle rectangle ) {
336
- if (rectangle instanceof Rectangle .OfFloat ) {
337
- return (Rectangle .OfFloat ) rectangle ;
338
- }
339
- return new Rectangle .OfFloat (rectangle .x , rectangle .y , rectangle .width , rectangle .height );
340
- }
341
-
342
- static Point .OfFloat createFrom (Point point ) {
343
- if (point instanceof Point .OfFloat ) {
344
- return (Point .OfFloat ) point ;
345
- }
346
- return new Point .OfFloat (point .x , point .y );
347
- }
348
- }
349
333
}
0 commit comments