From df62e453eb7e6e7dc35220c29283c703874ddca3 Mon Sep 17 00:00:00 2001 From: Zhouyj_zju Date: Tue, 6 Dec 2022 19:18:16 +0800 Subject: [PATCH] Description: add xgrb8888 for screen bitmap IssueNo: https://gitee.com/openharmony/graphic_ui/issues/I64WV4 Feature or Bugfix: Bugfix Binary Source:No Signed-off-by: zhouyj --- frameworks/common/screen.cpp | 7 ++++++- test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp | 4 ++++ test/uitest/test_view_bitmap/ui_test_view_bitmap.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frameworks/common/screen.cpp b/frameworks/common/screen.cpp index fef9951..d99d3c1 100644 --- a/frameworks/common/screen.cpp +++ b/frameworks/common/screen.cpp @@ -39,11 +39,14 @@ uint16_t Screen::GetHeight() bool Screen::GetCurrentScreenBitmap(ImageInfo& info) { +#if defined ENABLE_WINDOW && ENABLE_WINDOW + return false; +#else BufferInfo* bufferInfo = BaseGfxEngine::GetInstance()->GetFBBufferInfo(); if (bufferInfo == nullptr) { return false; } - uint16_t screenWidth = BaseGfxEngine::GetInstance()->GetScreenWidth(); + uint16_t screenWidth = BaseGfxEngine::GetInstance()->GetFBBufferInfo()->width; uint16_t screenHeight = BaseGfxEngine::GetInstance()->GetScreenHeight(); info.header.colorMode = ARGB8888; info.dataSize = screenWidth * screenHeight * DrawUtils::GetByteSizeByColorMode(info.header.colorMode); @@ -60,6 +63,7 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info) Point dstPos = {0, 0}; BlendOption blendOption; blendOption.opacity = OPA_OPAQUE; + blendOption.mode = BLEND_SRC; BufferInfo dstBufferInfo; dstBufferInfo.rect = screenRect; @@ -72,6 +76,7 @@ bool Screen::GetCurrentScreenBitmap(ImageInfo& info) BaseGfxEngine::GetInstance()->Blit(dstBufferInfo, dstPos, *bufferInfo, screenRect, blendOption); return true; +#endif } ScreenShape Screen::GetScreenShape() diff --git a/test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp b/test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp index c8929db..b7c94a4 100644 --- a/test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp +++ b/test/uitest/test_view_bitmap/ui_test_view_bitmap.cpp @@ -301,7 +301,9 @@ const UIView* UITestViewBitmap::GetTestView() UIKitBitmapTestGetViewBitmap002(); UIKitBitmapTestGetViewBitmap003(); UIKitBitmapTestGetViewBitmap004(); +#if !(defined ENABLE_WINDOW && ENABLE_WINDOW) UIKitBitmapTestGetScreenBitmap001(); +#endif return container_; } @@ -373,6 +375,7 @@ void UITestViewBitmap::UIKitBitmapTestGetViewBitmap004() btn->SetStyleForState(STYLE_BACKGROUND_COLOR, BUTTON_STYLE_BACKGROUND_COLOR_VALUE, UIButton::INACTIVE); } +#if !(defined ENABLE_WINDOW && ENABLE_WINDOW) void UITestViewBitmap::UIKitBitmapTestGetScreenBitmap001() { UILabelButton* btn = new UILabelButton(); @@ -390,4 +393,5 @@ void UITestViewBitmap::UIKitBitmapTestGetScreenBitmap001() btn->SetStyleForState(STYLE_BACKGROUND_COLOR, BUTTON_STYLE_BACKGROUND_COLOR_VALUE, UIButton::INACTIVE); btn->SetViewId(UI_TEST_FULL_SCREEN_CAPTURE); } +#endif } // namespace OHOS diff --git a/test/uitest/test_view_bitmap/ui_test_view_bitmap.h b/test/uitest/test_view_bitmap/ui_test_view_bitmap.h index aa13bda..0d0f038 100644 --- a/test/uitest/test_view_bitmap/ui_test_view_bitmap.h +++ b/test/uitest/test_view_bitmap/ui_test_view_bitmap.h @@ -35,7 +35,9 @@ public: void UIKitBitmapTestGetViewBitmap002(); void UIKitBitmapTestGetViewBitmap003(); void UIKitBitmapTestGetViewBitmap004(); +#if !(defined ENABLE_WINDOW && ENABLE_WINDOW) void UIKitBitmapTestGetScreenBitmap001(); +#endif private: UIScrollView* container_ = nullptr; UIImageView* viewBitmap_ = nullptr; -- GitLab