@@ -382,15 +382,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
382382 private static final int ARRAY_INITIAL_CAPACITY = 12 ;
383383 private static final int ARRAY_CAPACITY_INCREMENT = 12 ;
384384
385- private static Paint DEBUG_PAINT ;
386-
387- private static Paint getDebugPaint () {
388- if (DEBUG_PAINT == null ) {
389- DEBUG_PAINT = new Paint ();
390- DEBUG_PAINT .setStyle (Paint .Style .STROKE );
391- }
392- return DEBUG_PAINT ;
393- }
385+ private static Paint sDebugPaint ;
386+ private static float [] sDebugLines ;
394387
395388 // Used to draw cached views
396389 Paint mCachePaint ;
@@ -2678,7 +2671,8 @@ Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipCh
26782671 private static void drawRect (Canvas canvas , int x1 , int y1 , int x2 , int y2 , int color ) {
26792672 Paint paint = getDebugPaint ();
26802673 paint .setColor (color );
2681- canvas .drawRect (x1 , y1 , x2 - 1 , y2 - 1 , paint );
2674+
2675+ canvas .drawLines (getDebugLines (x1 , y1 , x2 , y2 ), paint );
26822676 }
26832677
26842678 /**
@@ -6136,4 +6130,43 @@ private void clear() {
61366130 mLocation .set (0 , 0 , 0 , 0 );
61376131 }
61386132 }
6133+
6134+ private static Paint getDebugPaint () {
6135+ if (sDebugPaint == null ) {
6136+ sDebugPaint = new Paint ();
6137+ sDebugPaint .setAntiAlias (false );
6138+ }
6139+ return sDebugPaint ;
6140+ }
6141+
6142+ private static float [] getDebugLines (int x1 , int y1 , int x2 , int y2 ) {
6143+ if (sDebugLines == null ) {
6144+ sDebugLines = new float [16 ];
6145+ }
6146+
6147+ x2 --;
6148+ y2 --;
6149+
6150+ sDebugLines [0 ] = x1 ;
6151+ sDebugLines [1 ] = y1 ;
6152+ sDebugLines [2 ] = x2 ;
6153+ sDebugLines [3 ] = y1 ;
6154+
6155+ sDebugLines [4 ] = x2 ;
6156+ sDebugLines [5 ] = y1 ;
6157+ sDebugLines [6 ] = x2 ;
6158+ sDebugLines [7 ] = y2 + 1 ;
6159+
6160+ sDebugLines [8 ] = x2 + 1 ;
6161+ sDebugLines [9 ] = y2 ;
6162+ sDebugLines [10 ] = x1 ;
6163+ sDebugLines [11 ] = y2 ;
6164+
6165+ sDebugLines [12 ] = x1 ;
6166+ sDebugLines [13 ] = y2 ;
6167+ sDebugLines [14 ] = x1 ;
6168+ sDebugLines [15 ] = y1 ;
6169+
6170+ return sDebugLines ;
6171+ }
61396172}
0 commit comments