History log of /frameworks/base/tools/aapt/Images.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
48efde4fb14cfe160747a8148b8e1a810c8f1c6e 16-Mar-2016 Matt Sarett <msarett@google.com> Work-around paletted image decoding bug in SDK_JELLYBEAN

Because there is a bug decoding paletted images in SDK_JELLYBEAN,
we need to avoid encoding paletted images for apps that support
SDK_JELLYBEAN and earlier.

BUG=27643907

Change-Id: Ib7d51ed87435cd36507915d62b0057c06f18b2b6
/frameworks/base/tools/aapt/Images.cpp
37a866e9a6e325a6bcebd052e959ff264a34dd6a 01-Feb-2016 Matt Sarett <msarett@google.com> Merge "Encode paletted PNGs more efficiently (part 2)"
33fcd11bc296fa495a4f4584f782c1c0fe4fe592 30-Jan-2016 Matt Sarett <msarett@google.com> Encode paletted PNGs more efficiently (part 2)

Many PNGs have multiple distinct pixels with zero alpha. This
CL allows us to treat all of those pixels as a single zero pixel.

This saves space in the color palette and also may help save
memory pages when we skip writing zeros.

There is also a potential disadvantage: if someone intended to decode
this image as unpremultiplied with particular transfer modes where
their color components have an effect even though alpha is zero,
this will prevent that. At the moment, we do not support unpremul as
a source, so this won't affect anyone trying to draw with the view
system.

This change originated in:
https://googleplex-android-review.git.corp.google.com/#/c/854580/

Change-Id: I702c7bd22d431cc7c775ed29bbd73c930f945ca3
/frameworks/base/tools/aapt/Images.cpp
2a84e23399840dc365cd03edcbfcf2727a17cd6e 29-Jan-2016 Matt Sarett <msarett@google.com> Encode paletted PNGs more efficiently

Saves about 2 MB of encoded size across affected assets.

Also will enable more efficient decoding.

Specifically, encoded palette values are assumed to be opaque unless
alpha values are provided in a tRNS chunk. Before this change, we
would wastefully store many opaque alpha values in tRNS chunk.
Additionally, the decoder used to need to premultiply all of these
opaque colors, because the encoded data indicated that they had alpha.

Change-Id: Id21b3b31850c9db6149ced6d20ed5e0ce2d71c5b
/frameworks/base/tools/aapt/Images.cpp
3c7235d3868d4bf554d4c1700ac11fc3d4125c71 29-Jan-2016 Matt Sarett <msarett@google.com> Encode paletted PNGs more efficiently

Saves about 2 MB of encoded size across affected assets.

Also will enable more efficient decoding.

Specifically, encoded palette values are assumed to be opaque unless
alpha values are provided in a tRNS chunk. Before this change, we
would wastefully store many opaque alpha values in tRNS chunk.
Additionally, the decoder used to need to premultiply all of these
opaque colors, because the encoded data indicated that they had alpha.

Change-Id: I1d5400f71a0e3cb800fd0fc68a04c8c4069da8ef
/frameworks/base/tools/aapt/Images.cpp
3b1b68d6c764a4f60d034e57a94879b7df65fd43 14-Dec-2015 Matt Sarett <msarett@google.com> Allow ninepatches to be encoded using non-RGBA modes

The original intention for forcing ninepatches to be encoded as
RGBA (with alpha) was to avoid the possibility of the decoder
producing 565 output.

565 output is bad for ninepatches because dithering tiny images
that we intend to scale later leads to bad results. I would
argue that, since the new BitmapFactory does not dither, we might
now be ok to allow 565 decodes for ninepatches. However, we
will maintain the old behavior by disabling 565 decodes for
ninepatch.

There are two changes to PNG encodings:
(1) Allows ninepatch images to be encoded in any mode. Forcing
them to RGBA makes things awkward for the decoder. Currently,
BitmapFactory's png decoder checks every pixel for alpha.
That way, RGBA images that are actually opaque can be marked
as opaque, in order to optimize drawing. We want to remove
this complexity from the decoder.
(2) Make sure ninepatch chunks are stored in the png header. That
way we know immediately that the png is a ninepatch, and can
refuse to decode to 565 (if we feel this is best).

Change-Id: I724f5dbefb1be7b412f9b362dff83cbc0603f0bf
/frameworks/base/tools/aapt/Images.cpp
01f185633c1c12017731336e7f926fe398c69781 09-Apr-2015 Colin Cross <ccross@android.com> Re-enable -Wall and -Werror that were lost in a merge

-Wall and -Werror were lost during a merge when they were added to
aaptCFLAGS instead of aaptCFlags. Fix the typo, and the warnings
that crept in while it was disabled.

Change-Id: Ib944b8d6149278e4f3861c1acac277bcd95cc7c2
/frameworks/base/tools/aapt/Images.cpp
030f536009b56dbcc23d284541e51562bd9a6ed3 04-Mar-2015 Dan Albert <danalbert@google.com> Stop using namespace std.

The pattern of #include and using namespace std here fails to build
with GCC. At first glance it's a GCC bug rather than libc++ doing
something wrong. Regardless, it can be worked around by just
specifying std:: where appropriate.

Bug: 19606303
Change-Id: I5652682eae7ca7559cf2a9307909859013440781
/frameworks/base/tools/aapt/Images.cpp
18d5d1107db296c6ac991d991fff98337f6724dd 18-Oct-2014 Adam Lesinski <adamlesinski@google.com> am 3cd840f4: Merge "AAPT: Fix an issue where a resource name was incorrectly derived on Windows" into lmp-dev

* commit '3cd840f4b5a2988700a6b366fa32f4565c319900':
AAPT: Fix an issue where a resource name was incorrectly derived on Windows
9306a474e1b7509f4cdf252359dc301ce933ca1d 17-Oct-2014 Adam Lesinski <adamlesinski@google.com> AAPT: Fix an issue where a resource name was incorrectly derived on Windows

Calling String8::getLeaf() will assume the system's file path separator,
however the source string was already converted to a unix path.
getLeaf() would therefore not find any occurence of '\' and would
return the full path.

Bug:18036805
Change-Id: Ic2bfac0cc553406740204a296327e266b05c0eff
/frameworks/base/tools/aapt/Images.cpp
e1b180e21e10e2cc18f3985c4e40cd32a605ac48 02-Oct-2014 Andreas Gampe <agampe@google.com> am 152d9aae: am 31629651: Merge "Frameworks/base: Fix more aapt issues"

* commit '152d9aae631381ea28f5701168d372a1486a7502':
Frameworks/base: Fix more aapt issues
8daabceb2efddebe2e7c0b2425ad9f8ef62c0a5c 02-Oct-2014 Andreas Gampe <agampe@google.com> resolved conflicts for merge of 1dcc75b2 to lmp-dev-plus-aosp

Change-Id: I8e1c6ee2025b6acd90803545fb95ab1b98560d92
b8dc7bc582ee4acd9d6c1379701a002c5ddbe323 02-Oct-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Fix more aapt issues

Change-Id: I6da7dc674e9f9e3b0886a3cfd1e3194d6b5ac948
/frameworks/base/tools/aapt/Images.cpp
2412f84064c26b643c722ce914a97c4ec7776c69 01-Oct-2014 Andreas Gampe <agampe@google.com> Frameworks/base: Fix AAPT warnings

Turn on -Wall -Werror. Fix warnings.

Change-Id: I287fb3c1e851c654479bcf9ea8c73bd354a6b2a1
/frameworks/base/tools/aapt/Images.cpp
e572c011feabf6319ba836cf5bc4c3baa0ba6a85 20-Sep-2014 Adam Lesinski <adamlesinski@google.com> AAPT: Continuation of public/private attribute fix

XML files like layouts are now scanned and checked
for v21 attributes. If those kinds of attributes
are found, then we remove them in the original
version and synthesize a new xml file under the
v21 configuration.

Bug:17520380
Change-Id: Icf984cb96134180a2e35349c1dbf2cef9a8f0bda
/frameworks/base/tools/aapt/Images.cpp
47d86230823de5d372688dff2b6e363a607009a8 15-Aug-2014 Chris Craik <ccraik@google.com> Fix nine patch outline radius computation

bug:16852714
Change-Id: I475154c0f324fd2e2c8991415e0d8240c75663d8
/frameworks/base/tools/aapt/Images.cpp
77b5cad3efedd20f2b7cc14d87ccce1b0261960a 31-Jul-2014 Chris Craik <ccraik@google.com> Add outline alpha

bug:16140822
bug:16566746

This allows background drawables to alter the opacity of a shadow
being cast with their own alpha values.

Change-Id: I49698cc7c1bf4b2b55ffe2f82899543ca62bc61c
/frameworks/base/tools/aapt/Images.cpp
47cd8e921db73e894f94ec4729ade90da50996f5 09-Jul-2014 Chris Craik <ccraik@google.com> Implement outline support for nine patches

b/15856895

Nine patches now have outline round rect metadata stored as optional
png tags. aapt generates these automatically by inspecting the bitmap
pixels to estimate outline bounds and round rect radius, based on
opacity.

Change-Id: I226e328a97873010d9e1adb797ac48f93a31183c
/frameworks/base/tools/aapt/Images.cpp
b5c4e7fd3866bbe30d7ea4d7bc463da5a70970e2 10-Mar-2014 Narayan Kamath <narayan@google.com> resolved conflicts for merge of 92860a74 to master

Change-Id: I3036ef9f1251c756092dc5ee2c4fed8146855e1e
6381dd4ff212a95be30d2b445d40ff419ab076b4 03-Mar-2014 Narayan Kamath <narayan@google.com> LP64: Make 9 patches architecture agnostic.

The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
/frameworks/base/tools/aapt/Images.cpp
b30296b5fda75bf383c7ab3f567eb41820747869 29-Oct-2013 Elliott Hughes <enh@google.com> Re-apply several tools fixes lost by the directory rearrangement.

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I56ce144958296961b77354815efc1a245564594b
/frameworks/base/tools/aapt/Images.cpp
859e19f97d481bf07c768087d8eb3031fac77aad 06-Sep-2013 John Reck <jreck@google.com> libpng usage tweaks

Bug: 10447005

Call png_set_interlace_handling explicitly instead of relying on
implicit handling that logs warnings

Include filename when printing warnings

Change-Id: Ia343427f5522dc8ab1010f8d7017e86f389caf99
/frameworks/base/tools/aapt/Images.cpp
282e181b58cf72b6ca770dc7ca5f91f135444502 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/base/tools/aapt/Images.cpp
c367d48c55e5a3fa0df14fd62889e4bb6b63cb01 29-Oct-2013 Elliott Hughes <enh@google.com> Fix a variety of small publicly-reported bugs.

Possible NULL dereference in cmds/bootanimation/BootAnimation.cpp.
https://code.google.com/p/android/issues/detail?id=61556

Missing fclose in core/jni/android_os_Debug.cpp.
https://code.google.com/p/android/issues/detail?id=61546

Bad loop guards in core/jni/android_util_Process.cpp.
https://code.google.com/p/android/issues/detail?id=61557

Assignment to wrong variable in libs/androidfw/AssetManager.cpp.
https://code.google.com/p/android/issues/detail?id=61560

Missing delete[]s in libs/androidfw/ObbFile.cpp.
https://code.google.com/p/android/issues/detail?id=61549

Leaks on error in tools/aapt/Images.cpp.
https://code.google.com/p/android/issues/detail?id=61552

Two missing fclose calls in tools/aapt/Resource.cpp.
https://code.google.com/p/android/issues/detail?id=61553

Missing fclose in tools/aidl/aidl.cpp.
https://code.google.com/p/android/issues/detail?id=61554

Change-Id: I5820f3824e72d07a9acb776cf0af3e7443f5694a
/frameworks/base/tools/aapt/Images.cpp
9f6a119c8aa276432ece4fe2118bd8a3c9b1067e 28-Aug-2013 Mike Lockwood <lockwood@google.com> Move frameworks/base/tools/ to frameworks/tools/

Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
/frameworks/base/tools/aapt/Images.cpp
e982b7231fcb465bd367f869fd1baaf3c27e0660 27-Aug-2013 John Reck <jreck@google.com> Forward compatibility fixes

Change-Id: Iaf387a10c387e5e157bb16d120a1e033b3d1a6e8
/frameworks/base/tools/aapt/Images.cpp
6c16fff219e8f733ea14ed7df9edda9c037d4b71 14-Aug-2013 John Reck <jreck@google.com> Fixes for libpng 1.6

png_set_filler() now fails if the color type doesn't support
a filler (such as RGB_ALPHA)
png_set_unknown_chunk location bug was fixed and now enforces
proper location setting

Change-Id: If3834e3744d9618c308cc442e66d85e9cffcea38
/frameworks/base/tools/aapt/Images.cpp
48b15b1e1df8315575ada27ab3b0206ed87d67b2 13-Aug-2013 John Reck <jreck@google.com> Fix libpng API usage

Remove usage of deprecated APIs no longer in 1.6

Change-Id: I04cbceba718533312e900e62ddcf3872b61765ec
/frameworks/base/tools/aapt/Images.cpp
ec4a50428d5f26a22df3edaf7e5b08f41d5cb54b 04-Apr-2012 Amith Yamasani <yamasani@google.com> Embed layout padding in nine patch images

- Added a new custom PNG chunk that carries the layout padding ints.
- Extract the padding ticks from .9.png images and store in the chunk.
- Load the padding information at runtime into Bitmap and NinePatchDrawable.

- The new chunk is ordered first so that it doesn't cause a problem in older
versions of the platform.

Bug: 6087201

Change-Id: I5de46167a1d44b3ec21065b0c165e594b1dc8399
/frameworks/base/tools/aapt/Images.cpp
c0f7366a15655c6973ea21029f1997f24c006cca 17-Mar-2012 Jeff Brown <jeffbrown@google.com> aapt: Preprocess images in parallel.

Currently hardcoded to use up to 4 threads.

This change substantially reduces the amount of time spent
preprocessing framework resources to just a few seconds.

Change-Id: I02fdd283fb529a152aeb22ac87f278779fd77983
/frameworks/base/tools/aapt/Images.cpp
b13b9bdad2baf6ad1ec2e56b6b7598fa20f55fc4 18-Feb-2012 Mathias Agopian <mathias@google.com> frameworks/base refactoring.

step 2: move libutils headers to their new home: androidfw

Change-Id: I14624ba23db92a81f2cb929f104386e1fab293ef
/frameworks/base/tools/aapt/Images.cpp
e6b680364dd992907a8d2037685a2e500d188dfb 14-Oct-2011 Dianne Hackborn <hackbod@google.com> New aapt feature to do smarter filtering of configurations.

This adds a --preferred-configurations flag that specifies the
specific configurations you would like to have.

It is smarter than "-c" because it will avoid stripping a
configuration if that would result in there being no value
for the resource.

It is dumber than "-c" because it can't process as many kinds
of resources. It is really only intended for bitmaps and use
with density configs.

This required re-arranging AaptAssets to group files together
by config again, like they used to be. I think this hasn't
broken anything. Hopefully.

Change-Id: I4e9d12ff6e6dbd1abb8fd4cb1814c6674b19d0e5
/frameworks/base/tools/aapt/Images.cpp
8a39da80b33691b0c82458c3b7727e13ff71277e 07-Jun-2011 Josiah Gaskin <josiahgaskin@google.com> Added Caching for PreProcessed PNGs

Added a cache management system for pre-processed PNG files
along with unit tests. The cache system will be used if
the --no-crunch flag is passed to AAPT during the package
phase. The cache can be updated by a call to 'aapt crunch'
(see usage statement). Also put in benchmarking code.

Change-Id: I58271fb2ee2f5f9075fd74d4ff6f15e7afabd05c
/frameworks/base/tools/aapt/Images.cpp
9e652a67ca46c1841993a806e67822fc45b4dc42 12-Mar-2010 Kenny Root <kroot@google.com> Give an 9-patch error on too many rows and columns

When you have too many rows and columns, there are not enough colors in
the 9-patch private metadata to represent them. Instead of crashing
aapt, this change gives the user an error message telling them why it's
invalid.

Change-Id: I5e7bd59472a3a2eafa7cbc263792458cce2b5594
/frameworks/base/tools/aapt/Images.cpp
6a1fadea851db236331b3dfe1f3c1e482556057f 21-Apr-2009 Marco Nelissen <> AI 147028: Fix up aapt so it runs cleanly under the valgrind leak checker.

Automated import of CL 147028
/frameworks/base/tools/aapt/Images.cpp
4df2423a947bcd3f024cc3d3a1a315a8dc428598 05-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@136594
/frameworks/base/tools/aapt/Images.cpp
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/tools/aapt/Images.cpp
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/tools/aapt/Images.cpp
076357b8567458d4b6dfdcf839ef751634cd2bfb 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
/frameworks/base/tools/aapt/Images.cpp
3dec7d563a2f3e1eb967ce2054a00b6620e3558c 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
/frameworks/base/tools/aapt/Images.cpp
d24b8183b93e781080b2c16c487e60d51c12da31 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
/frameworks/base/tools/aapt/Images.cpp
9266c558bf1d21ff647525ff99f7dadbca417309 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
/frameworks/base/tools/aapt/Images.cpp
b798689749c64baba81f02e10cf2157c747d6b46 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
/frameworks/base/tools/aapt/Images.cpp
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/tools/aapt/Images.cpp
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/tools/aapt/Images.cpp