!502 Bugfix for color gamut convertion and composition

Merge pull request !502 from xxfeng_hw/bugfix
This commit is contained in:
openharmony_ci 2022-02-24 07:51:26 +00:00 committed by Gitee
commit 56e87289f5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 8 additions and 1 deletions

View File

@ -254,7 +254,7 @@ void RSHardwareProcessor::Redraw(sptr<Surface>& surface, const struct PrepareCom
*(static_cast<RSSurfaceRenderNode *>(layerInfo->GetLayerAdditionalInfo())));
} else {
ROSEN_LOGW("RSHardwareProcessor::Redraw: need to convert color gamut.");
RsRenderServiceUtil::DrawBuffer(canvas.get(), buffer,
RsRenderServiceUtil::DrawBuffer(*canvas, buffer,
*(static_cast<RSSurfaceRenderNode *>(layerInfo->GetLayerAdditionalInfo())),
static_cast<ColorGamut>(currScreenInfo_.colorGamut));
}

View File

@ -314,6 +314,8 @@ uint8_t ConvertColorGamut(uint8_t *dst, uint8_t* src, int32_t pixelFormat, Color
srcColor = {RGBUint8ToFloat(src[0]), RGBUint8ToFloat(src[1]), RGBUint8ToFloat(src[2])};
// R: dst + 0, G: dst + 1, B: dst + 2
colorDst = {dst + 0, dst + 1, dst + 2};
// Alpha: copy src[3] to dst[3]
dst[3] = src[3];
len = 4; // 4 bytes per pixel.
break;
}
@ -331,6 +333,8 @@ uint8_t ConvertColorGamut(uint8_t *dst, uint8_t* src, int32_t pixelFormat, Color
srcColor = {RGBUint8ToFloat(src[2]), RGBUint8ToFloat(src[1]), RGBUint8ToFloat(src[0])};
// R: dst + 2, G: dst + 1, B: dst + 0
colorDst = {dst + 2, dst + 1, dst + 0};
// Alpha: copy src[3] to dst[3]
dst[3] = src[3];
len = 4; // 4 bytes per pixel.
break;
}
@ -375,6 +379,9 @@ bool ConvertBufferColorGamut(std::vector<uint8_t>& dstBuf, const sptr<OHOS::Surf
uint8_t* dst = &dstBuf[offset];
uint8_t* src = srcStart + offset;
uint8_t len = ConvertColorGamut(dst, src, pixelFormat, srcGamut, dstGamut);
if (len == 0) {
return false;
}
offset += len;
}