提交 bd6b7cb6 编写于 作者: L liqiang

fix codex warnings

Change-Id: I5bd29e3e033c99b808f57f7e23c76b06a86c9216
上级 6cfdf8c5
...@@ -43,6 +43,7 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info) ...@@ -43,6 +43,7 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info)
info.header.compressMode = 0; info.header.compressMode = 0;
if (!ScreenDeviceProxy::GetInstance()->GetScreenBitmapBuffer(screenBitmapBuffer, info.dataSize)) { if (!ScreenDeviceProxy::GetInstance()->GetScreenBitmapBuffer(screenBitmapBuffer, info.dataSize)) {
ImageCacheFree(info);
return false; return false;
} }
info.data = screenBitmapBuffer; info.data = screenBitmapBuffer;
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "draw/draw_utils.h" #include "draw/draw_utils.h"
#include "gfx_utils/graphic_log.h" #include "gfx_utils/graphic_log.h"
#include "gfx_utils/mem_api.h" #include "gfx_utils/mem_api.h"
#include "securec.h"
#include "themes/theme_manager.h" #include "themes/theme_manager.h"
namespace OHOS { namespace OHOS {
...@@ -829,8 +830,8 @@ bool UIView::GetBitmap(ImageInfo& bitmap) ...@@ -829,8 +830,8 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
rect_.SetPosition(0, 0); rect_.SetPosition(0, 0);
Rect mask = GetRect(); Rect mask = GetRect();
mask.Intersect(mask, screenRect); mask.Intersect(mask, screenRect);
uint16_t bufferWidth = mask.GetWidth(); uint16_t bufferWidth = static_cast<uint16_t>(mask.GetWidth());
uint16_t bufferHeight = mask.GetHeight(); uint16_t bufferHeight = static_cast<uint16_t>(mask.GetHeight());
bitmap.header.colorMode = ScreenDeviceProxy::GetInstance()->GetBufferMode(); bitmap.header.colorMode = ScreenDeviceProxy::GetInstance()->GetBufferMode();
bitmap.dataSize = bufferWidth * bufferHeight * DrawUtils::GetByteSizeByColorMode(bitmap.header.colorMode); bitmap.dataSize = bufferWidth * bufferHeight * DrawUtils::GetByteSizeByColorMode(bitmap.header.colorMode);
bitmap.header.width = bufferWidth; bitmap.header.width = bufferWidth;
...@@ -844,6 +845,10 @@ bool UIView::GetBitmap(ImageInfo& bitmap) ...@@ -844,6 +845,10 @@ bool UIView::GetBitmap(ImageInfo& bitmap)
rect_.SetPosition(tempX, tempY); rect_.SetPosition(tempX, tempY);
return false; return false;
} }
if (memset_s(viewBitmapBuffer, bitmap.dataSize, 0, bitmap.dataSize) != EOK) {
ImageCacheFree(bitmap);
return false;
}
ScreenDeviceProxy::GetInstance()->EnableBitmapBuffer(viewBitmapBuffer); ScreenDeviceProxy::GetInstance()->EnableBitmapBuffer(viewBitmapBuffer);
ScreenDeviceProxy::GetInstance()->SetViewBitmapBufferWidth(bufferWidth); ScreenDeviceProxy::GetInstance()->SetViewBitmapBufferWidth(bufferWidth);
RootView::GetInstance()->DrawTop(this, mask); RootView::GetInstance()->DrawTop(this, mask);
......
...@@ -129,6 +129,9 @@ bool ScreenDeviceProxy::GetScreenBitmapBuffer(uint8_t* dest, uint32_t size) ...@@ -129,6 +129,9 @@ bool ScreenDeviceProxy::GetScreenBitmapBuffer(uint8_t* dest, uint32_t size)
return false; return false;
} }
uint8_t* buf = GetBuffer(); uint8_t* buf = GetBuffer();
if (buf == nullptr) {
return false;
}
if (memcpy_s(dest, size, buf, bufSize) != EOK) { if (memcpy_s(dest, size, buf, bufSize) != EOK) {
return false; return false;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册