AdaptiveIconDrawable: add hacks to make it work

We don't currently have "shaders" implemented properly,
so just draw the layers and don't mask anything.
This commit is contained in:
Mis012
2025-06-08 02:14:01 +02:00
parent 43d3d39ee8
commit 9461c47082

View File

@@ -348,12 +348,13 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
continue; continue;
} }
int insetWidth = (int)(bounds.width() / (DEFAULT_VIEW_PORT_SCALE * 2)); /*int insetWidth = (int)(bounds.width() / (DEFAULT_VIEW_PORT_SCALE * 2));
int insetHeight = (int)(bounds.height() / (DEFAULT_VIEW_PORT_SCALE * 2)); int insetHeight = (int)(bounds.height() / (DEFAULT_VIEW_PORT_SCALE * 2));
final Rect outRect = mTmpOutRect; final Rect outRect = mTmpOutRect;
outRect.set(cX - insetWidth, cY - insetHeight, cX + insetWidth, cY + insetHeight); outRect.set(cX - insetWidth, cY - insetHeight, cX + insetWidth, cY + insetHeight);
d.setBounds(outRect); d.setBounds(outRect);*/
d.setBounds(bounds);
} }
} }
@@ -376,7 +377,7 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
@Override @Override
public void draw(Canvas canvas) { public void draw(Canvas canvas) {
if (mLayersBitmap == null) { /* if (mLayersBitmap == null) {
return; return;
} }
if (mLayersShader == null) { if (mLayersShader == null) {
@@ -397,6 +398,16 @@ public class AdaptiveIconDrawable extends Drawable implements Drawable.Callback
canvas.drawPath(mMaskScaleOnly, mPaint); canvas.drawPath(mMaskScaleOnly, mPaint);
canvas.translate(-bounds.left, -bounds.top); canvas.translate(-bounds.left, -bounds.top);
} }
*/
Rect bounds = getBounds();
canvas.translate(bounds.left, bounds.top);
if (mLayerState.mChildren[BACKGROUND_ID].mDrawable != null) {
mLayerState.mChildren[BACKGROUND_ID].mDrawable.draw(canvas);
}
if (mLayerState.mChildren[FOREGROUND_ID].mDrawable != null) {
mLayerState.mChildren[FOREGROUND_ID].mDrawable.draw(canvas);
}
canvas.translate(-bounds.left, -bounds.top);
} }
@Override @Override