* commit '5d8343b8e27e766b5bfaaed2f9b1952c0d15da8d': libhwui: Handle the blurImage() implement once RS::init fail
This commit is contained in:
@ -735,30 +735,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
|
// a null path is OK because there are no custom kernels used
|
||||||
// hence nothing gets cached by RS
|
// hence nothing gets cached by RS
|
||||||
if (!mRs->init("", RSC::RS_INIT_LOW_LATENCY | RSC::RS_INIT_SYNCHRONOUS)) {
|
if (!mRs->init("", RSC::RS_INIT_LOW_LATENCY | RSC::RS_INIT_SYNCHRONOUS)) {
|
||||||
|
mRs.clear();
|
||||||
ALOGE("blur RS failed to init");
|
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);
|
||||||
|
|
||||||
RSC::sp<const RSC::Type> t = RSC::Type::create(mRs, mRsElement, width, height, 0);
|
mRsScript->setRadius(radius);
|
||||||
RSC::sp<RSC::Allocation> ain = RSC::Allocation::createTyped(mRs, t,
|
mRsScript->setInput(ain);
|
||||||
RS_ALLOCATION_MIPMAP_NONE, RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_SHARED,
|
mRsScript->forEach(aout);
|
||||||
*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);
|
// replace the original image's pointer, avoiding a copy back to the original buffer
|
||||||
mRsScript->setInput(ain);
|
free(*image);
|
||||||
mRsScript->forEach(aout);
|
*image = outImage;
|
||||||
|
|
||||||
// replace the original image's pointer, avoiding a copy back to the original buffer
|
return;
|
||||||
free(*image);
|
}
|
||||||
*image = outImage;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user