mirror of
https://github.com/revanced/Apktool.git
synced 2024-06-02 11:26:12 +02:00
fix: you could make a hollywood movie out of all the hours I spent debugging and eventually after giving up found the solution on this beautiful day. Can you believe it?
This commit is contained in:
parent
8cdd9484f7
commit
820ef1e4cd
|
@ -263,8 +263,12 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
||||||
Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length);
|
Bitmap bm = BitmapFactory.decodeByteArray(data, 0, data.length);
|
||||||
int width = bm.getWidth(), height = bm.getHeight();
|
int width = bm.getWidth(), height = bm.getHeight();
|
||||||
|
|
||||||
Bitmap outImg = Bitmap.createBitmap(width + 2, height + 2, Bitmap.Config.ARGB_8888);
|
Bitmap outImg = Bitmap.createBitmap(width + 2, height + 2, bm.getConfig());
|
||||||
drawImage(outImg, bm);
|
for (int x = 0; x < width; x++) {
|
||||||
|
for (int y = 0; y < height; y++) {
|
||||||
|
outImg.setPixel(x + 1, y + 1, bm.getPixel(x, y));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NinePatch np = getNinePatch(data);
|
NinePatch np = getNinePatch(data);
|
||||||
drawHLineA(outImg, height + 1, np.padLeft + 1, width - np.padRight);
|
drawHLineA(outImg, height + 1, np.padLeft + 1, width - np.padRight);
|
||||||
|
@ -317,13 +321,8 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
outImg.compress(Bitmap.CompressFormat.PNG, 100, output);
|
outImg.compress(Bitmap.CompressFormat.PNG, 100, output);
|
||||||
}
|
bm.recycle();
|
||||||
|
outImg.recycle();
|
||||||
private void drawImage(Bitmap self, Bitmap toDraw) {
|
|
||||||
Canvas canvas = new Canvas(self);
|
|
||||||
Matrix matrix = new Matrix();
|
|
||||||
matrix.mapPoints(new float[] { 1f, 1f, self.getWidth(), self.getHeight() });
|
|
||||||
canvas.drawBitmap(toDraw, matrix, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user