@@ -533,14 +533,10 @@ public void copyArea (int srcX, int srcY, int width, int height, int destX, int
533533 * @since 3.1
534534 */
535535public 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 );
544540}
545541
546542void copyAreaInPixels (int srcX , int srcY , int width , int height , int destX , int destY , boolean paint ) {
@@ -780,12 +776,8 @@ void disposeGdip() {
780776 * </ul>
781777 */
782778public 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 );
789781}
790782
791783void 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
864856 * @see #drawRectangle(int, int, int, int)
865857 */
866858public 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 );
873861}
874862
875863void drawFocusInPixels (int x , int y , int width , int height ) {
@@ -1717,12 +1705,8 @@ void drawLineInPixels (int x1, int y1, int x2, int y2) {
17171705 * </ul>
17181706 */
17191707public 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 );
17261710}
17271711
17281712void drawOvalInPixels (int x , int y , int width , int height ) {
@@ -1931,12 +1915,7 @@ void drawPolylineInPixels(int[] pointArray) {
19311915 * </ul>
19321916 */
19331917public 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 ));
19401919}
19411920
19421921void drawRectangleInPixels (int x , int y , int width , int height ) {
@@ -2017,14 +1996,11 @@ public void drawRectangle (Rectangle rect) {
20171996 * </ul>
20181997 */
20191998public 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 );
20282004}
20292005
20302006void drawRoundRectangleInPixels (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
@@ -2708,12 +2684,8 @@ public boolean equals (Object object) {
27082684 * @see #drawArc
27092685 */
27102686public 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 );
27172689}
27182690
27192691void 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
27882760 * @see #drawRectangle(int, int, int, int)
27892761 */
27902762public 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 );
27972765}
27982766
27992767void 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
29072875 * @see #drawOval
29082876 */
29092877public 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 );
29162880}
29172881
29182882void fillOvalInPixels (int x , int y , int width , int height ) {
@@ -3031,12 +2995,7 @@ void fillPolygonInPixels (int[] pointArray) {
30312995 * @see #drawRectangle(int, int, int, int)
30322996 */
30332997public 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 ));
30402999}
30413000
30423001void fillRectangleInPixels (int x , int y , int width , int height ) {
@@ -3097,14 +3056,11 @@ public void fillRectangle (Rectangle rect) {
30973056 * @see #drawRoundRectangle
30983057 */
30993058public 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 );
31083064}
31093065
31103066void fillRoundRectangleInPixels (int x , int y , int width , int height , int arcWidth , int arcHeight ) {
@@ -4302,12 +4258,7 @@ void setClipping(long clipRgn) {
43024258 * </ul>
43034259 */
43044260public 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 ));
43114262}
43124263
43134264void setClippingInPixels (int x , int y , int width , int height ) {
0 commit comments