Fixed issue where HardwareBufferRenderer was not preserving contents

Updated RenderProxy creation to pass false for the opaque flag
in order to avoid an unnecessary canvas->clear invocation within
SkiaPipeline::draw

Fixes: 275398000
Test: Added test to HardwareBufferRendererTests
Change-Id: I5f884240439bf3e57500ed1404f31fbe2ea122fa
This commit is contained in:
Nader Jawad
2023-03-27 13:02:41 -07:00
parent 04fa4ea3e7
commit f5ce45285e
2 changed files with 2 additions and 3 deletions

View File

@@ -74,7 +74,7 @@ static long android_graphics_HardwareBufferRenderer_create(JNIEnv* env, jobject,
auto* hardwareBuffer = HardwareBufferHelpers::AHardwareBuffer_fromHardwareBuffer(env, buffer);
auto* rootRenderNode = reinterpret_cast<RootRenderNode*>(renderNodePtr);
ContextFactoryImpl factory(rootRenderNode);
auto* proxy = new RenderProxy(true, rootRenderNode, &factory);
auto* proxy = new RenderProxy(false, rootRenderNode, &factory);
proxy->setHardwareBuffer(hardwareBuffer);
return (jlong)proxy;
}

View File

@@ -499,8 +499,7 @@ void SkiaPipeline::renderFrameImpl(const SkRect& clip,
}
canvas->concat(preTransform);
// STOPSHIP: Revert, temporary workaround to clear always F16 frame buffer for b/74976293
if (!opaque || getSurfaceColorType() == kRGBA_F16_SkColorType) {
if (!opaque) {
canvas->clear(SK_ColorTRANSPARENT);
}