reverted 9patch fix as it causes problems.

This commit is contained in:
Connor Tumbleson 2012-07-08 11:10:04 -05:00
parent ba345ac6b9
commit 6575ec9109
4 changed files with 7 additions and 33 deletions

View File

@ -43,6 +43,7 @@
<excludes>
<exclude>src/main/java/com/mindprod/**</exclude>
<exclude>src/main/java/android/**</exclude>
<exclude>src/main/java/org/xmlpull/**</exclude>
<exclude>src/main/resources/brut/androlib/apktool.properties</exclude>
<exclude>src/test/resources/brut/apktool/testapp/**</exclude>
</excludes>

View File

@ -179,6 +179,7 @@ public class Androlib {
Map<String, Object> meta = readMetaFile(appDir);
Object t1 = meta.get("isFrameworkApk");
boolean framework = t1 == null ? false : (Boolean) t1;
mAndRes.setSdkInfo((Map<String, String>) meta.get("sdkInfo"));
if (outFile == null) {
String outFileName = (String) meta.get("apkFileName");

View File

@ -34,31 +34,19 @@ public class Res9patchStreamDecoder implements ResStreamDecoder {
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);

View File

@ -1,19 +1,3 @@
/**
* Copyright 2011 Ryszard Wiśniewski <brut.alll@gmail.com>
*
* 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;