forked from iBotPeaches/Apktool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reverted 9patch fix as it causes problems.
- Loading branch information
1 parent
ba345ac
commit 6575ec9
Showing
4 changed files
with
7 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,35 +30,23 @@ | |
* @author Ryszard Wiśniewski <[email protected]> | ||
*/ | ||
public class Res9patchStreamDecoder implements ResStreamDecoder { | ||
public void decode(InputStream in, OutputStream out) | ||
public void decode(InputStream in, OutputStream out) | ||
throws AndrolibException { | ||
try { | ||
byte[] data = IOUtils.toByteArray(in); | ||
NinePatch np = getNinePatch(data); | ||
|
||
BufferedImage im = ImageIO.read(new ByteArrayInputStream(data)); | ||
int w = im.getWidth(), h = im.getHeight(); | ||
|
||
BufferedImage im2 = new BufferedImage( | ||
w + 2, h + 2, BufferedImage.TYPE_4BYTE_ABGR); | ||
Raster src = im.getRaster(); | ||
WritableRaster dst = im2.getRaster(); | ||
int nbands = im.getSampleModel().getNumBands(); | ||
int[] bands = new int[4]; | ||
if (nbands == 2) { | ||
bands[0] = bands[1] = bands[2] = 0; | ||
bands[3] = 1; | ||
if (im.getType() == BufferedImage.TYPE_4BYTE_ABGR) { | ||
im2.getRaster().setRect(1, 1, im.getRaster()); | ||
} else { | ||
bands[0] = 0; bands[1] = 1; bands[2] = 2; bands[3] = 3; | ||
} | ||
int[] band = null; | ||
for (int y = 0; y < h; y++) { | ||
for (int bi = 0; bi < 4; bi++) { | ||
band = src.getSamples(0, y, w, 1, bands[bi], band); | ||
dst.setSamples(1, y + 1, w, 1, bi, band); | ||
} | ||
im2.getGraphics().drawImage(im, 1, 1, null); | ||
} | ||
|
||
NinePatch np = getNinePatch(data); | ||
drawHLine(im2, h + 1, np.padLeft + 1, w - np.padRight); | ||
drawVLine(im2, w + 1, np.padTop + 1, h - np.padBottom); | ||
|
||
|
16 changes: 0 additions & 16 deletions
16
apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,3 @@ | ||
/** | ||
* Copyright 2011 Ryszard Wiśniewski <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.xmlpull.mxp1_serializer; | ||
|
||
import java.io.IOException; | ||
|