diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/androidfw/Android.mk | 1 | ||||
-rw-r--r-- | libs/androidfw/AssetManager.cpp | 59 | ||||
-rwxr-xr-x | libs/hwui/OpenGLRenderer.cpp | 24 | ||||
-rwxr-xr-x[-rw-r--r--] | libs/hwui/OpenGLRenderer.h | 4 |
4 files changed, 79 insertions, 9 deletions
diff --git a/libs/androidfw/Android.mk b/libs/androidfw/Android.mk index d21197e..258a296 100644 --- a/libs/androidfw/Android.mk +++ b/libs/androidfw/Android.mk @@ -75,7 +75,6 @@ LOCAL_SHARED_LIBRARIES := \ LOCAL_STATIC_LIBRARIES := libziparchive LOCAL_C_INCLUDES := \ - external/icu4c/common \ external/zlib \ system/core/include diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index 87164ca..56c95bd 100644 --- a/libs/androidfw/AssetManager.cpp +++ b/libs/androidfw/AssetManager.cpp @@ -347,6 +347,15 @@ void AssetManager::setLocale(const char* locale) setLocaleLocked(locale); } + +static const char kFilPrefix[] = "fil"; +static const char kTlPrefix[] = "tl"; + +// The sizes of the prefixes, excluding the 0 suffix. +// char. +static const int kFilPrefixLen = sizeof(kFilPrefix) - 1; +static const int kTlPrefixLen = sizeof(kTlPrefix) - 1; + void AssetManager::setLocaleLocked(const char* locale) { if (mLocale != NULL) { @@ -355,8 +364,46 @@ void AssetManager::setLocaleLocked(const char* locale) //mZipSet.purgeLocale(); delete[] mLocale; } - mLocale = strdupNew(locale); + // If we're attempting to set a locale that starts with "fil", + // we should convert it to "tl" for backwards compatibility since + // we've been using "tl" instead of "fil" prior to L. + // + // If the resource table already has entries for "fil", we use that + // instead of attempting a fallback. + if (strncmp(locale, kFilPrefix, kFilPrefixLen) == 0) { + Vector<String8> locales; + ResTable* res = mResources; + if (res != NULL) { + res->getLocales(&locales); + } + const size_t localesSize = locales.size(); + bool hasFil = false; + for (size_t i = 0; i < localesSize; ++i) { + if (locales[i].find(kFilPrefix) == 0) { + hasFil = true; + break; + } + } + + + if (!hasFil) { + const size_t newLocaleLen = strlen(locale); + // This isn't a bug. We really do want mLocale to be 1 byte + // shorter than locale, because we're replacing "fil-" with + // "tl-". + mLocale = new char[newLocaleLen]; + // Copy over "tl". + memcpy(mLocale, kTlPrefix, kTlPrefixLen); + // Copy the rest of |locale|, including the terminating '\0'. + memcpy(mLocale + kTlPrefixLen, locale + kFilPrefixLen, + newLocaleLen - kFilPrefixLen + 1); + updateResourceParamsLocked(); + return; + } + } + + mLocale = strdupNew(locale); updateResourceParamsLocked(); } @@ -741,6 +788,16 @@ void AssetManager::getLocales(Vector<String8>* locales) const if (res != NULL) { res->getLocales(locales); } + + const size_t numLocales = locales->size(); + for (size_t i = 0; i < numLocales; ++i) { + const String8& localeStr = locales->itemAt(i); + if (localeStr.find(kTlPrefix) == 0) { + String8 replaced("fil"); + replaced += (localeStr.string() + kTlPrefixLen); + locales->editItemAt(i) = replaced; + } + } } /* diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index f0adea9..ebcd1c6 100755 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -283,21 +283,34 @@ void OpenGLRenderer::syncState() { } } -void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque) { +void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque, bool expand) { if (!mSuppressTiling) { Rect* clip = &mTilingClip; if (s->flags & Snapshot::kFlagFboTarget) { clip = &(s->layer->clipRect); } - startTiling(*clip, s->height, opaque); + startTiling(*clip, s->height, opaque, expand); } } -void OpenGLRenderer::startTiling(const Rect& clip, int windowHeight, bool opaque) { +void OpenGLRenderer::startTiling(const Rect& clip, int windowHeight, bool opaque, bool expand) { if (!mSuppressTiling) { - mCaches.startTiling(clip.left, windowHeight - clip.bottom, + if(expand) { + // Expand the startTiling region by 1 + int leftNotZero = (clip.left > 0) ? 1 : 0; + int topNotZero = (windowHeight - clip.bottom > 0) ? 1 : 0; + + mCaches.startTiling( + clip.left - leftNotZero, + windowHeight - clip.bottom - topNotZero, + clip.right - clip.left + leftNotZero + 1, + clip.bottom - clip.top + topNotZero + 1, + opaque); + } else { + mCaches.startTiling(clip.left, windowHeight - clip.bottom, clip.right - clip.left, clip.bottom - clip.top, opaque); + } } } @@ -1003,7 +1016,8 @@ bool OpenGLRenderer::createFboLayer(Layer* layer, Rect& bounds, Rect& clip, GLui glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, layer->getTexture(), 0); - startTiling(mSnapshot, true); + // Expand the startTiling region by 1 + startTiling(mSnapshot, true, true); // Clear the FBO, expand the clear region by 1 to get nice bilinear filtering mCaches.enableScissor(); diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 9afb7ad..2e03a1b 100644..100755 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -587,14 +587,14 @@ private: * This method needs to be invoked every time getTargetFbo() is * bound again. */ - void startTiling(const sp<Snapshot>& snapshot, bool opaque = false); + void startTiling(const sp<Snapshot>& snapshot, bool opaque = false, bool expand = false); /** * Tells the GPU what part of the screen is about to be redrawn. * This method needs to be invoked every time getTargetFbo() is * bound again. */ - void startTiling(const Rect& clip, int windowHeight, bool opaque = false); + void startTiling(const Rect& clip, int windowHeight, bool opaque = false, bool expand = false); /** * Tells the GPU that we are done drawing the frame or that we |