summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-05-05 21:53:56 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-05 21:53:56 +0000
commit81997fef183074728b8981fd8e858b82ec70ed27 (patch)
treeccdc3b049037b5b43df541d499926bb2d0ae90e6 /libs
parentce8083fc51d71f104222d90a6736e52bccb33b7f (diff)
parent3cb74d21b2ac2427e805f72a113e8d7a2cc460f3 (diff)
downloadframeworks_base-81997fef183074728b8981fd8e858b82ec70ed27.zip
frameworks_base-81997fef183074728b8981fd8e858b82ec70ed27.tar.gz
frameworks_base-81997fef183074728b8981fd8e858b82ec70ed27.tar.bz2
am 3cb74d21: am 5d8343b8: am a85db5ab: Merge "libhwui: Handle the blurImage() implement once RS::init fail"
* commit '3cb74d21b2ac2427e805f72a113e8d7a2cc460f3': libhwui: Handle the blurImage() implement once RS::init fail
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/FontRenderer.cpp44
1 files changed, 24 insertions, 20 deletions
diff --git a/libs/hwui/FontRenderer.cpp b/libs/hwui/FontRenderer.cpp
index b52003c..647c281 100644
--- a/libs/hwui/FontRenderer.cpp
+++ b/libs/hwui/FontRenderer.cpp
@@ -737,30 +737,34 @@ void FontRenderer::blurImage(uint8_t** image, int32_t width, int32_t height, int
// a null path is OK because there are no custom kernels used
// hence nothing gets cached by RS
if (!mRs->init("", RSC::RS_INIT_LOW_LATENCY | RSC::RS_INIT_SYNCHRONOUS)) {
+ mRs.clear();
ALOGE("blur RS failed to init");
+ } else {
+ mRsElement = RSC::Element::A_8(mRs);
+ mRsScript = RSC::ScriptIntrinsicBlur::create(mRs, mRsElement);
}
-
- mRsElement = RSC::Element::A_8(mRs);
- mRsScript = RSC::ScriptIntrinsicBlur::create(mRs, mRsElement);
}
+ if (mRs != 0) {
+ RSC::sp<const RSC::Type> t = RSC::Type::create(mRs, mRsElement, width, height, 0);
+ RSC::sp<RSC::Allocation> ain = RSC::Allocation::createTyped(mRs, t,
+ RS_ALLOCATION_MIPMAP_NONE,
+ RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED,
+ *image);
+ RSC::sp<RSC::Allocation> aout = RSC::Allocation::createTyped(mRs, t,
+ RS_ALLOCATION_MIPMAP_NONE,
+ RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED,
+ outImage);
+
+ mRsScript->setRadius(radius);
+ mRsScript->setInput(ain);
+ mRsScript->forEach(aout);
+
+ // replace the original image's pointer, avoiding a copy back to the original buffer
+ free(*image);
+ *image = outImage;
- RSC::sp<const RSC::Type> t = RSC::Type::create(mRs, mRsElement, width, height, 0);
- RSC::sp<RSC::Allocation> ain = RSC::Allocation::createTyped(mRs, t,
- RS_ALLOCATION_MIPMAP_NONE, RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED,
- *image);
- RSC::sp<RSC::Allocation> aout = RSC::Allocation::createTyped(mRs, t,
- RS_ALLOCATION_MIPMAP_NONE, RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED,
- outImage);
-
- mRsScript->setRadius(radius);
- mRsScript->setInput(ain);
- mRsScript->forEach(aout);
-
- // replace the original image's pointer, avoiding a copy back to the original buffer
- free(*image);
- *image = outImage;
-
- return;
+ return;
+ }
}
#endif