@@ -533,14 +533,10 @@ public void copyArea (int srcX, int srcY, int width, int height, int destX, int
533
533
* @since 3.1
534
534
*/
535
535
public void copyArea (int srcX , int srcY , int width , int height , int destX , int destY , boolean paint ) {
536
- int deviceZoom = getZoom ();
537
- srcX = DPIUtil .scaleUp (drawable , srcX , deviceZoom );
538
- srcY = DPIUtil .scaleUp (drawable , srcY , deviceZoom );
539
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
540
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
541
- destX = DPIUtil .scaleUp (drawable , destX , deviceZoom );
542
- destY = DPIUtil .scaleUp (drawable , destY , deviceZoom );
543
- copyAreaInPixels (srcX , srcY , width , height , destX , destY , paint );
536
+ int zoom = getZoom ();
537
+ Rectangle sourceRect = DPIUtil .scaleUp (drawable , new Rectangle (srcX , srcY , width , height ), zoom );
538
+ Rectangle destRect = DPIUtil .scaleUp (drawable , new Rectangle (destX , destY , width , height ), zoom );
539
+ copyAreaInPixels (sourceRect .x , sourceRect .y , sourceRect .width , sourceRect .height , destRect .x , destRect .y , paint );
544
540
}
545
541
546
542
void copyAreaInPixels (int srcX , int srcY , int width , int height , int destX , int destY , boolean paint ) {
@@ -780,12 +776,8 @@ void disposeGdip() {
780
776
* </ul>
781
777
*/
782
778
public void drawArc (int x , int y , int width , int height , int startAngle , int arcAngle ) {
783
- int deviceZoom = getZoom ();
784
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
785
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
786
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
787
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
788
- drawArcInPixels (x , y , width , height , startAngle , arcAngle );
779
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
780
+ drawArcInPixels (rect .x , rect .y , rect .width , rect .height , startAngle , arcAngle );
789
781
}
790
782
791
783
void drawArcInPixels (int x , int y , int width , int height , int startAngle , int arcAngle ) {
@@ -864,12 +856,8 @@ void drawArcInPixels (int x, int y, int width, int height, int startAngle, int a
864
856
* @see #drawRectangle(int, int, int, int)
865
857
*/
866
858
public void drawFocus (int x , int y , int width , int height ) {
867
- int deviceZoom = getZoom ();
868
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
869
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
870
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
871
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
872
- drawFocusInPixels (x , y , width , height );
859
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
860
+ drawFocusInPixels (rect .x , rect .y , rect .width , rect .height );
873
861
}
874
862
875
863
void drawFocusInPixels (int x , int y , int width , int height ) {
@@ -1717,12 +1705,8 @@ void drawLineInPixels (int x1, int y1, int x2, int y2) {
1717
1705
* </ul>
1718
1706
*/
1719
1707
public void drawOval (int x , int y , int width , int height ) {
1720
- int deviceZoom = getZoom ();
1721
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
1722
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
1723
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
1724
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
1725
- drawOvalInPixels (x , y , width , height );
1708
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
1709
+ drawOvalInPixels (rect .x , rect .y , rect .width , rect .height );
1726
1710
}
1727
1711
1728
1712
void drawOvalInPixels (int x , int y , int width , int height ) {
@@ -1931,12 +1915,7 @@ void drawPolylineInPixels(int[] pointArray) {
1931
1915
* </ul>
1932
1916
*/
1933
1917
public void drawRectangle (int x , int y , int width , int height ) {
1934
- int deviceZoom = getZoom ();
1935
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
1936
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
1937
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
1938
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
1939
- drawRectangleInPixels (x , y , width , height );
1918
+ drawRectangle (new Rectangle (x , y , width , height ));
1940
1919
}
1941
1920
1942
1921
void drawRectangleInPixels (int x , int y , int width , int height ) {
@@ -2017,14 +1996,11 @@ public void drawRectangle (Rectangle rect) {
2017
1996
* </ul>
2018
1997
*/
2019
1998
public void drawRoundRectangle (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
2020
- int deviceZoom = getZoom ();
2021
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
2022
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
2023
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
2024
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
2025
- arcWidth = DPIUtil .scaleUp (drawable , arcWidth , deviceZoom );
2026
- arcHeight = DPIUtil .scaleUp (drawable , arcHeight , deviceZoom );
2027
- drawRoundRectangleInPixels (x , y , width , height , arcWidth , arcHeight );
1999
+ int zoom = getZoom ();
2000
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), zoom );
2001
+ arcWidth = DPIUtil .scaleUp (drawable , arcWidth , zoom );
2002
+ arcHeight = DPIUtil .scaleUp (drawable , arcHeight , zoom );
2003
+ drawRoundRectangleInPixels (rect .x , rect .y , rect .width , rect .height , arcWidth , arcHeight );
2028
2004
}
2029
2005
2030
2006
void drawRoundRectangleInPixels (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
@@ -2708,12 +2684,8 @@ public boolean equals (Object object) {
2708
2684
* @see #drawArc
2709
2685
*/
2710
2686
public void fillArc (int x , int y , int width , int height , int startAngle , int arcAngle ) {
2711
- int deviceZoom = getZoom ();
2712
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
2713
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
2714
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
2715
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
2716
- fillArcInPixels (x , y , width , height , startAngle , arcAngle );
2687
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
2688
+ fillArcInPixels (rect .x , rect .y , rect .width , rect .height , startAngle , arcAngle );
2717
2689
}
2718
2690
2719
2691
void fillArcInPixels (int x , int y , int width , int height , int startAngle , int arcAngle ) {
@@ -2788,12 +2760,8 @@ void fillArcInPixels (int x, int y, int width, int height, int startAngle, int a
2788
2760
* @see #drawRectangle(int, int, int, int)
2789
2761
*/
2790
2762
public void fillGradientRectangle (int x , int y , int width , int height , boolean vertical ) {
2791
- int deviceZoom = getZoom ();
2792
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
2793
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
2794
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
2795
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
2796
- fillGradientRectangleInPixels (x , y , width , height , vertical );
2763
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
2764
+ fillGradientRectangleInPixels (rect .x , rect .y , rect .width , rect .height , vertical );
2797
2765
}
2798
2766
2799
2767
void fillGradientRectangleInPixels (int x , int y , int width , int height , boolean vertical ) {
@@ -2907,12 +2875,8 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean
2907
2875
* @see #drawOval
2908
2876
*/
2909
2877
public void fillOval (int x , int y , int width , int height ) {
2910
- int deviceZoom = getZoom ();
2911
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
2912
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
2913
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
2914
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
2915
- fillOvalInPixels (x , y , width , height );
2878
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), getZoom ());
2879
+ fillOvalInPixels (rect .x , rect .y , rect .width , rect .height );
2916
2880
}
2917
2881
2918
2882
void fillOvalInPixels (int x , int y , int width , int height ) {
@@ -3031,12 +2995,7 @@ void fillPolygonInPixels (int[] pointArray) {
3031
2995
* @see #drawRectangle(int, int, int, int)
3032
2996
*/
3033
2997
public void fillRectangle (int x , int y , int width , int height ) {
3034
- int deviceZoom = getZoom ();
3035
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
3036
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
3037
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
3038
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
3039
- fillRectangleInPixels (x , y , width , height );
2998
+ fillRectangle (new Rectangle (x , y , width , height ));
3040
2999
}
3041
3000
3042
3001
void fillRectangleInPixels (int x , int y , int width , int height ) {
@@ -3097,14 +3056,11 @@ public void fillRectangle (Rectangle rect) {
3097
3056
* @see #drawRoundRectangle
3098
3057
*/
3099
3058
public void fillRoundRectangle (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
3100
- int deviceZoom = getZoom ();
3101
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
3102
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
3103
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
3104
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
3105
- arcWidth = DPIUtil .scaleUp (drawable , arcWidth , deviceZoom );
3106
- arcHeight = DPIUtil .scaleUp (drawable , arcHeight , deviceZoom );
3107
- fillRoundRectangleInPixels (x , y , width , height , arcWidth , arcHeight );
3059
+ int zoom = getZoom ();
3060
+ Rectangle rect = DPIUtil .scaleUp (drawable , new Rectangle (x , y , width , height ), zoom );
3061
+ arcWidth = DPIUtil .scaleUp (drawable , arcWidth , zoom );
3062
+ arcHeight = DPIUtil .scaleUp (drawable , arcHeight , zoom );
3063
+ fillRoundRectangleInPixels (rect .x , rect .y , rect .width , rect .height , arcWidth , arcHeight );
3108
3064
}
3109
3065
3110
3066
void fillRoundRectangleInPixels (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
@@ -4302,12 +4258,7 @@ void setClipping(long clipRgn) {
4302
4258
* </ul>
4303
4259
*/
4304
4260
public void setClipping (int x , int y , int width , int height ) {
4305
- int deviceZoom = getZoom ();
4306
- x = DPIUtil .scaleUp (drawable , x , deviceZoom );
4307
- y = DPIUtil .scaleUp (drawable , y , deviceZoom );
4308
- width = DPIUtil .scaleUp (drawable , width , deviceZoom );
4309
- height = DPIUtil .scaleUp (drawable , height , deviceZoom );
4310
- setClippingInPixels (x , y , width , height );
4261
+ setClipping (new Rectangle (x , y , width , height ));
4311
4262
}
4312
4263
4313
4264
void setClippingInPixels (int x , int y , int width , int height ) {
0 commit comments