diff --git a/engine/flutter/shell/platform/ohos/ohos_surface_software.cc b/engine/flutter/shell/platform/ohos/ohos_surface_software.cc index 3395043eae77635d11adecf1b630124c9e00b4cc..cdafcbd20d0a04f04445e47a5d8eebc69ef86dd1 100644 --- a/engine/flutter/shell/platform/ohos/ohos_surface_software.cc +++ b/engine/flutter/shell/platform/ohos/ohos_surface_software.cc @@ -18,6 +18,8 @@ namespace flutter { namespace { +#define PIXEL_BASE 16 + bool GetSkColorType(int32_t buffer_format, SkColorType* color_type, SkAlphaType* alpha_type) @@ -122,8 +124,10 @@ bool OhosSurfaceSoftware::PresentBackingStore( return false; } + int32_t convertWidth = requestConfig_.width % PIXEL_BASE == 0 ? requestConfig_.width + : (requestConfig_.width / PIXEL_BASE + 1) * PIXEL_BASE; OHOS::BufferRequestConfig requestConfig = { - .width = requestConfig_.width, + .width = convertWidth, .height = requestConfig_.height, .strideAlignment = 8, .format = PIXEL_FMT_RGBA_8888,