@@ -47,19 +47,12 @@ public Bitmap getUpdatedBlurBitmap() {
4747 // Lấy RootView thực sự (thường là DecorView của Window)
4848 View rootView = targetView .getRootView ();
4949 if (rootView == null ) return null ;
50-
51- // Lấy vị trí của View hiện tại trên màn hình
5250 targetView .getLocationOnScreen (location );
53-
54- // Tỷ lệ giữa Bitmap blur (đã thu nhỏ) và kích thước thực tế của RootView
55- // Điều này đảm bảo dù ScrollView dài bao nhiêu, vị trí vẫn khớp với Wallpaper phía sau DecorView
5651 float scaleX = (float ) blurBitmap .getWidth () / rootView .getWidth ();
5752 float scaleY = (float ) blurBitmap .getHeight () / rootView .getHeight ();
5853
5954 int w = (int ) (targetView .getWidth () * scaleX );
6055 int h = (int ) (targetView .getHeight () * scaleY );
61-
62- // Tính toán tọa độ cắt dựa trên vị trí tuyệt đối trên màn hình
6356 int x = (int ) (location [0 ] * scaleX );
6457 int y = (int ) (location [1 ] * scaleY );
6558
@@ -78,10 +71,7 @@ public Bitmap getUpdatedBlurBitmap() {
7871 srcRect .set (x , y , x + w , y + h );
7972 cachedCanvas .drawColor (0 , PorterDuff .Mode .CLEAR );
8073
81- // Vẽ vùng tương ứng của ảnh nền vào cachedBitmap
8274 cachedCanvas .drawBitmap (blurBitmap , srcRect , new Rect (0 , 0 , w , h ), null );
83-
84- // Phủ lớp màu (Tint)
8575 cachedCanvas .drawColor (getBlurTintColor ());
8676 return cachedBitmap ;
8777 } catch (Exception e ) {
0 commit comments