From: Xavier Ducrohet Date: Thu, 21 Jul 2011 00:49:26 +0000 (-0700) Subject: am 84be06e4: resolved conflicts for merge of ea9e6d24 to honeycomb-plus-aosp X-Git-Url: https://git.saurik.com/android/aapt.git/commitdiff_plain/c1b83bdbc6526f4c8f366bc3716f46b4ad93b0fd?ds=sidebyside;hp=-c am 84be06e4: resolved conflicts for merge of ea9e6d24 to honeycomb-plus-aosp * commit '84be06e4ce0778fbf0c1ac72f94795ef8433439b': Added Caching for PreProcessed PNGs --- c1b83bdbc6526f4c8f366bc3716f46b4ad93b0fd diff --combined Resource.cpp index 1d97a4e,2d5138b..cb6484f --- a/Resource.cpp +++ b/Resource.cpp @@@ -10,6 -10,10 +10,10 @@@ #include "ResourceTable.h" #include "Images.h" + #include "CrunchCache.h" + #include "FileFinder.h" + #include "CacheUpdater.h" + #define NOISY(x) // x // ========================================================================== @@@ -293,18 -297,19 +297,19 @@@ static status_t makeFileResources(Bundl static status_t preProcessImages(Bundle* bundle, const sp& assets, const sp& set, const char* type) { - ResourceDirIterator it(set, String8(type)); - Vector > newNameFiles; - Vector newNamePaths; bool hasErrors = false; - ssize_t res; - while ((res=it.next()) == NO_ERROR) { - res = preProcessImage(bundle, assets, it.getFile(), NULL); - if (res < NO_ERROR) { - hasErrors = true; + ssize_t res = NO_ERROR; + if (bundle->getUseCrunchCache() == false) { + ResourceDirIterator it(set, String8(type)); + Vector > newNameFiles; + Vector newNamePaths; + while ((res=it.next()) == NO_ERROR) { + res = preProcessImage(bundle, assets, it.getFile(), NULL); + if (res < NO_ERROR) { + hasErrors = true; + } } } - return (hasErrors || (res < NO_ERROR)) ? UNKNOWN_ERROR : NO_ERROR; } @@@ -754,6 -759,35 +759,35 @@@ status_t massageManifest(Bundle* bundle } \ } while (0) + status_t updatePreProcessedCache(Bundle* bundle) + { + #if BENCHMARK + fprintf(stdout, "BENCHMARK: Starting PNG PreProcessing \n"); + long startPNGTime = clock(); + #endif /* BENCHMARK */ + + String8 source(bundle->getResourceSourceDirs()[0]); + String8 dest(bundle->getCrunchedOutputDir()); + + FileFinder* ff = new SystemFileFinder(); + CrunchCache cc(source,dest,ff); + + CacheUpdater* cu = new SystemCacheUpdater(bundle); + size_t numFiles = cc.crunch(cu); + + if (bundle->getVerbose()) + fprintf(stdout, "Crunched %d PNG files to update cache\n", (int)numFiles); + + delete ff; + delete cu; + + #if BENCHMARK + fprintf(stdout, "BENCHMARK: End PNG PreProcessing. Time Elapsed: %f ms \n" + ,(clock() - startPNGTime)/1000.0); + #endif /* BENCHMARK */ + return 0; + } + status_t buildResources(Bundle* bundle, const sp& assets) { // First, look for a package file to parse. This is required to @@@ -2210,11 -2244,6 +2244,11 @@@ writeProguardForLayouts(ProguardKeepSet } } } + // Handle the overlays + sp overlay = assets->getOverlay(); + if (overlay.get()) { + return writeProguardForLayouts(keep, overlay); + } return NO_ERROR; }