提交 6e80f203 编写于 作者: O openharmony_ci 提交者: Gitee

!312 uiview GetBitMap和Screen GetCurrentScreenBitmap 截图问题修改

Merge pull request !312 from pssea/cherry-pick-1627301716
......@@ -45,7 +45,7 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
}
uint16_t screenWidth = BaseGfxEngine::GetInstance()->GetScreenWidth();
uint16_t screenHeight = BaseGfxEngine::GetInstance()->GetScreenHeight();
info.header.colorMode = bufferInfo->mode;
info.header.colorMode = ARGB8888;
info.dataSize = screenWidth * screenHeight * DrawUtils::GetByteSizeByColorMode(info.header.colorMode);
info.data = reinterpret_cast<uint8_t*>(ImageCacheMalloc(info));
if (info.data == nullptr) {
......@@ -56,11 +56,21 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
info.header.reserved = 0;
info.header.compressMode = 0;
if (memcpy_s(static_cast<void *>(const_cast<uint8_t *>(info.data)), info.dataSize,
bufferInfo->virAddr, info.dataSize) != EOK) {
ImageCacheFree(info);
return false;
}
Rect screenRect = {0, 0, static_cast<int16_t>(screenWidth - 1), static_cast<int16_t>(screenHeight - 1)};
Point dstPos = {0, 0};
BlendOption blendOption;
blendOption.opacity = OPA_OPAQUE;
BufferInfo dstBufferInfo;
dstBufferInfo.rect = screenRect;
dstBufferInfo.mode = ARGB8888;
dstBufferInfo.color = 0x44;
dstBufferInfo.phyAddr = dstBufferInfo.virAddr = static_cast<void*>(const_cast<uint8_t*>(info.data));
dstBufferInfo.stride = screenWidth * 4; // 4: bpp
dstBufferInfo.width = screenWidth;
dstBufferInfo.height = screenHeight;
BaseGfxEngine::GetInstance()->Blit(dstBufferInfo, dstPos, *bufferInfo, screenRect, blendOption);
return true;
}
......
......@@ -917,7 +917,7 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
mask.Intersect(mask, screenRect);
uint16_t bufferWidth = static_cast<uint16_t>(mask.GetWidth());
uint16_t bufferHeight = static_cast<uint16_t>(mask.GetHeight());
bitmap.header.colorMode = bufferInfo->mode;
bitmap.header.colorMode = ARGB8888;
bitmap.dataSize = bufferWidth * bufferHeight * DrawUtils::GetByteSizeByColorMode(bitmap.header.colorMode);
bitmap.header.width = bufferWidth;
bitmap.header.height = bufferHeight;
......@@ -937,7 +937,7 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
newBufferInfo.rect = mask;
newBufferInfo.width = bufferWidth;
newBufferInfo.height = bufferHeight;
newBufferInfo.mode = bufferInfo->mode;
newBufferInfo.mode = ARGB8888;
newBufferInfo.stride = bufferWidth * DrawUtils::GetByteSizeByColorMode(bitmap.header.colorMode);
RootView::GetInstance()->SaveDrawContext();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册