mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-12-18 20:48:19 +00:00
!502 Bugfix for color gamut convertion and composition
Merge pull request !502 from xxfeng_hw/bugfix
This commit is contained in:
commit
56e87289f5
@ -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));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user