diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/androidfw/Android.mk | 6 | ||||
| -rw-r--r-- | libs/androidfw/AssetManager.cpp | 14 | ||||
| -rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 4 | ||||
| -rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 8 | ||||
| -rw-r--r-- | libs/androidfw/tests/BackupData_test.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/AnimatorManager.cpp | 4 | ||||
| -rw-r--r-- | libs/hwui/DeferredDisplayList.cpp | 9 | ||||
| -rw-r--r-- | libs/hwui/DeferredDisplayList.h | 5 | ||||
| -rw-r--r-- | libs/hwui/Extensions.cpp | 1 | ||||
| -rw-r--r-- | libs/hwui/Extensions.h | 3 | ||||
| -rw-r--r-- | libs/hwui/FontRenderer.cpp | 10 | ||||
| -rw-r--r-- | libs/hwui/FontRenderer.h | 2 | ||||
| -rw-r--r-- | libs/hwui/font/Font.cpp | 2 | ||||
| -rw-r--r-- | libs/hwui/utils/TinyHashMap.h | 70 |
14 files changed, 28 insertions, 112 deletions
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk index 2f287000f746..f682fb8684e8 100644 --- a/libs/androidfw/Android.mk +++ b/libs/androidfw/Android.mk @@ -40,10 +40,9 @@ hostSources := $(commonSources) # For the host # ===================================================== include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE:= libandroidfw -LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_HOST_OS := darwin linux windows LOCAL_CFLAGS += -DSTATIC_ANDROIDFW_FOR_TOOLS LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code LOCAL_SRC_FILES:= $(hostSources) @@ -56,13 +55,10 @@ include $(BUILD_HOST_STATIC_LIBRARY) # ===================================================== include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE:= libandroidfw -LOCAL_MODULE_TAGS := optional LOCAL_SRC_FILES:= $(deviceSources) LOCAL_C_INCLUDES := \ - external/zlib \ system/core/include LOCAL_STATIC_LIBRARIES := libziparchive libbase LOCAL_SHARED_LIBRARIES := \ diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 2dc1c96259c0..623ea896626b 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -34,7 +34,7 @@ #include <utils/String8.h> #include <utils/threads.h> #include <utils/Timers.h> -#ifdef HAVE_ANDROID_OS +#ifdef __ANDROID__ #include <cutils/trace.h> #endif @@ -54,7 +54,7 @@ _rc; }) #endif -#ifdef HAVE_ANDROID_OS +#ifdef __ANDROID__ #define MY_TRACE_BEGIN(x) ATRACE_BEGIN(x) #define MY_TRACE_END() ATRACE_END() #else @@ -229,7 +229,7 @@ bool AssetManager::addAssetPath(const String8& path, int32_t* cookie) *cookie = static_cast<int32_t>(mAssetPaths.size()); } -#ifdef HAVE_ANDROID_OS +#ifdef __ANDROID__ // Load overlays, if any asset_path oap; for (size_t idx = 0; mZipSet.getOverlay(ap.path, idx, &oap); idx++) { @@ -657,7 +657,7 @@ bool AssetManager::appendPathToResTable(const asset_path& ap) const { ALOGV("Creating shared resources for %s", ap.path.string()); sharedRes = new ResTable(); sharedRes->add(ass, idmap, nextEntryIdx + 1, false); -#ifdef HAVE_ANDROID_OS +#ifdef __ANDROID__ const char* data = getenv("ANDROID_DATA"); LOG_ALWAYS_FATAL_IF(data == NULL, "ANDROID_DATA not set"); String8 overlaysListPath(data); @@ -1545,7 +1545,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg */ int dirNameLen = dirName.length(); void *iterationCookie; - if (!pZip->startIteration(&iterationCookie)) { + if (!pZip->startIteration(&iterationCookie, dirName.string(), NULL)) { ALOGW("ZipFileRO::startIteration returned false"); return false; } @@ -1560,9 +1560,7 @@ bool AssetManager::scanAndMergeZipLocked(SortedVector<AssetDir::FileInfo>* pMerg continue; } //printf("Comparing %s in %s?\n", nameBuf, dirName.string()); - if (dirNameLen == 0 || - (strncmp(nameBuf, dirName.string(), dirNameLen) == 0 && - nameBuf[dirNameLen] == '/')) + if (dirNameLen == 0 || nameBuf[dirNameLen] == '/') { const char* cp; const char* nextSlash; diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 62aabb13858d..806eeda3555a 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -47,7 +47,7 @@ namespace android { -#ifdef HAVE_WINSOCK +#if defined(_WIN32) #undef nhtol #undef htonl #define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) ) @@ -727,7 +727,7 @@ const char16_t* ResStringPool::stringAt(size_t idx, size_t* u16len) const AutoMutex lock(mDecodeLock); if (mCache == NULL) { -#ifndef HAVE_ANDROID_OS +#ifndef __ANDROID__ if (kDebugStringPoolNoisy) { ALOGI("CREATING STRING CACHE OF %zu bytes", mHeader->stringCount*sizeof(char16_t**)); diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index a6f6d8c4ff16..49fe8a261178 100644 --- a/libs/androidfw/ZipFileRO.cpp +++ b/libs/androidfw/ZipFileRO.cpp @@ -39,7 +39,7 @@ using namespace android; class _ZipEntryRO { public: ZipEntry entry; - ZipEntryName name; + ZipString name; void *cookie; _ZipEntryRO() : cookie(NULL) {} @@ -80,7 +80,7 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const { _ZipEntryRO* data = new _ZipEntryRO; - data->name = ZipEntryName(entryName); + data->name = ZipString(entryName); const int32_t error = FindEntry(mHandle, data->name, &(data->entry)); if (error) { @@ -133,8 +133,8 @@ bool ZipFileRO::startIteration(void** cookie) { bool ZipFileRO::startIteration(void** cookie, const char* prefix, const char* suffix) { _ZipEntryRO* ze = new _ZipEntryRO; - ZipEntryName pe(prefix ? prefix : ""); - ZipEntryName se(suffix ? suffix : ""); + ZipString pe(prefix ? prefix : ""); + ZipString se(suffix ? suffix : ""); int32_t error = StartIteration(mHandle, &(ze->cookie), prefix ? &pe : NULL, suffix ? &se : NULL); diff --git a/libs/androidfw/tests/BackupData_test.cpp b/libs/androidfw/tests/BackupData_test.cpp index 92af7fe790bd..e25b616dcbd9 100644 --- a/libs/androidfw/tests/BackupData_test.cpp +++ b/libs/androidfw/tests/BackupData_test.cpp @@ -108,7 +108,7 @@ TEST_F(BackupDataTest, WriteAndReadSingle) { EXPECT_EQ(DATA1[i], dataBytes[i]) << "data character " << i << " should be equal"; } - delete dataBytes; + delete[] dataBytes; delete writer; delete reader; } diff --git a/libs/hwui/AnimatorManager.cpp b/libs/hwui/AnimatorManager.cpp index 0dababd774c1..cd30b1859384 100644 --- a/libs/hwui/AnimatorManager.cpp +++ b/libs/hwui/AnimatorManager.cpp @@ -124,8 +124,6 @@ uint32_t AnimatorManager::animate(TreeInfo& info) { } void AnimatorManager::animateNoDamage(TreeInfo& info) { - if (!mAnimators.size()) return; - animateCommon(info); } @@ -169,7 +167,7 @@ private: }; void AnimatorManager::endAllActiveAnimators() { - ALOGD("endAllStagingAnimators on %p (%s) with handle %p", + ALOGD("endAllActiveAnimators on %p (%s) with handle %p", &mParent, mParent.getName(), mAnimationHandle); EndActiveAnimatorsFunctor functor(mAnimationHandle->context()); for_each(mAnimators.begin(), mAnimators.end(), functor); diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp index f05857c43a35..03aecd42d16a 100644 --- a/libs/hwui/DeferredDisplayList.cpp +++ b/libs/hwui/DeferredDisplayList.cpp @@ -536,7 +536,11 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { if (deferInfo.mergeable) { // Try to merge with any existing batch with same mergeId. - if (mMergingBatches[deferInfo.batchId].get(deferInfo.mergeId, targetBatch)) { + std::unordered_map<mergeid_t, DrawBatch*>& mergingBatch + = mMergingBatches[deferInfo.batchId]; + auto getResult = mergingBatch.find(deferInfo.mergeId); + if (getResult != mergingBatch.end()) { + targetBatch = getResult->second; if (!((MergingDrawBatch*) targetBatch)->canMergeWith(op, state)) { targetBatch = nullptr; } @@ -580,7 +584,8 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { if (deferInfo.mergeable) { targetBatch = new MergingDrawBatch(deferInfo, renderer.getViewportWidth(), renderer.getViewportHeight()); - mMergingBatches[deferInfo.batchId].put(deferInfo.mergeId, targetBatch); + mMergingBatches[deferInfo.batchId].insert( + std::make_pair(deferInfo.mergeId, targetBatch)); } else { targetBatch = new DrawBatch(deferInfo); mBatchLookup[deferInfo.batchId] = targetBatch; diff --git a/libs/hwui/DeferredDisplayList.h b/libs/hwui/DeferredDisplayList.h index 160c1ad2d1f6..3bc4904d6921 100644 --- a/libs/hwui/DeferredDisplayList.h +++ b/libs/hwui/DeferredDisplayList.h @@ -17,10 +17,11 @@ #ifndef ANDROID_HWUI_DEFERRED_DISPLAY_LIST_H #define ANDROID_HWUI_DEFERRED_DISPLAY_LIST_H +#include <unordered_map> + #include <utils/Errors.h> #include <utils/LinearAllocator.h> #include <utils/Vector.h> -#include <utils/TinyHashMap.h> #include "Matrix.h" #include "OpenGLRenderer.h" @@ -176,7 +177,7 @@ private: * MergingDrawBatch of that id. These ids are unique per draw type and guaranteed to not * collide, which avoids the need to resolve mergeid collisions. */ - TinyHashMap<mergeid_t, DrawBatch*> mMergingBatches[kOpBatch_Count]; + std::unordered_map<mergeid_t, DrawBatch*> mMergingBatches[kOpBatch_Count]; LinearAllocator mAllocator; }; diff --git a/libs/hwui/Extensions.cpp b/libs/hwui/Extensions.cpp index 2a82216eb145..d96775aa7ff1 100644 --- a/libs/hwui/Extensions.cpp +++ b/libs/hwui/Extensions.cpp @@ -58,6 +58,7 @@ Extensions::Extensions() { mHasTiledRendering = hasGlExtension("GL_QCOM_tiled_rendering"); mHas1BitStencil = hasGlExtension("GL_OES_stencil1"); mHas4BitStencil = hasGlExtension("GL_OES_stencil4"); + mHasUnpackSubImage = hasGlExtension("GL_EXT_unpack_subimage"); // Query EGL extensions findExtensions(eglQueryString(eglGetCurrentDisplay(), EGL_EXTENSIONS), mEglExtensionList); diff --git a/libs/hwui/Extensions.h b/libs/hwui/Extensions.h index e7d317d21941..a4eef0f0bb86 100644 --- a/libs/hwui/Extensions.h +++ b/libs/hwui/Extensions.h @@ -44,7 +44,7 @@ public: inline bool has1BitStencil() const { return mHas1BitStencil; } inline bool has4BitStencil() const { return mHas4BitStencil; } inline bool hasNvSystemTime() const { return mHasNvSystemTime; } - inline bool hasUnpackRowLength() const { return mVersionMajor >= 3; } + inline bool hasUnpackRowLength() const { return mVersionMajor >= 3 || mHasUnpackSubImage; } inline bool hasPixelBufferObjects() const { return mVersionMajor >= 3; } inline bool hasOcclusionQueries() const { return mVersionMajor >= 3; } inline bool hasFloatTextures() const { return mVersionMajor >= 3; } @@ -71,6 +71,7 @@ private: bool mHas1BitStencil; bool mHas4BitStencil; bool mHasNvSystemTime; + bool mHasUnpackSubImage; int mVersionMajor; int mVersionMinor; diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp index 35051b7cccea..9a2a879e594e 100644 --- a/libs/hwui/FontRenderer.cpp +++ b/libs/hwui/FontRenderer.cpp @@ -474,7 +474,6 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { if (!mFunctor) return; bool first = true; - bool forceRebind = false; for (uint32_t i = 0; i < cacheTextures.size(); i++) { CacheTexture* texture = cacheTextures[i]; if (texture->canDraw()) { @@ -487,7 +486,6 @@ void FontRenderer::issueDrawCommand(Vector<CacheTexture*>& cacheTextures) { mFunctor->draw(*texture, mLinearFiltering); texture->resetMesh(); - forceRebind = false; } } } @@ -683,14 +681,6 @@ bool FontRenderer::renderTextOnPath(const SkPaint* paint, const Rect* clip, cons return mDrawn; } -void FontRenderer::removeFont(const Font* font) { - mActiveFonts.remove(font->getDescription()); - - if (mCurrentFont == font) { - mCurrentFont = nullptr; - } -} - void FontRenderer::blurImage(uint8_t** image, int32_t width, int32_t height, float radius) { uint32_t intRadius = Blur::convertRadiusToInt(radius); #ifdef ANDROID_ENABLE_RENDERSCRIPT diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h index dfb107c99bc5..3da20ee255af 100644 --- a/libs/hwui/FontRenderer.h +++ b/libs/hwui/FontRenderer.h @@ -151,8 +151,6 @@ private: float x3, float y3, float u3, float v3, float x4, float y4, float u4, float v4, CacheTexture* texture); - void removeFont(const Font* font); - void checkTextureUpdate(); void setTextureDirty() { diff --git a/libs/hwui/font/Font.cpp b/libs/hwui/font/Font.cpp index 5de64a4b1654..762f2bba3340 100644 --- a/libs/hwui/font/Font.cpp +++ b/libs/hwui/font/Font.cpp @@ -64,8 +64,6 @@ Font::FontDescription::FontDescription(const SkPaint* paint, const SkMatrix& ras } Font::~Font() { - mState->removeFont(this); - for (uint32_t i = 0; i < mCachedGlyphs.size(); i++) { delete mCachedGlyphs.valueAt(i); } diff --git a/libs/hwui/utils/TinyHashMap.h b/libs/hwui/utils/TinyHashMap.h deleted file mode 100644 index 4ff9a42f6d5d..000000000000 --- a/libs/hwui/utils/TinyHashMap.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * 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. - */ - -#ifndef ANDROID_HWUI_TINYHASHMAP_H -#define ANDROID_HWUI_TINYHASHMAP_H - -#include <utils/BasicHashtable.h> - -namespace android { -namespace uirenderer { - -/** - * A very simple hash map that doesn't allow duplicate keys, overwriting the older entry. - */ -template <typename TKey, typename TValue> -class TinyHashMap { -public: - typedef key_value_pair_t<TKey, TValue> TEntry; - - /** - * Puts an entry in the hash, removing any existing entry with the same key - */ - void put(TKey key, TValue value) { - hash_t hash = android::hash_type(key); - - ssize_t index = mTable.find(-1, hash, key); - if (index != -1) { - mTable.removeAt(index); - } - - TEntry initEntry(key, value); - mTable.add(hash, initEntry); - } - - /** - * Return true if key is in the map, in which case stores the value in the output ref - */ - bool get(TKey key, TValue& outValue) { - hash_t hash = android::hash_type(key); - ssize_t index = mTable.find(-1, hash, key); - if (index == -1) { - return false; - } - outValue = mTable.entryAt(index).value; - return true; - } - - void clear() { mTable.clear(); } - -private: - BasicHashtable<TKey, TEntry> mTable; -}; - -}; // namespace uirenderer -}; // namespace android - -#endif // ANDROID_HWUI_TINYHASHMAP_H |