diff --git a/frameworks/common/screen.cpp b/frameworks/common/screen.cpp index fef9951b44d99c4c0c210751e6001fd533882215..d99d3c17e2954c6209630e2b78bad114ba3c3cbb 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 c8929db6cbd73a5c59cb4e0e153f394a1a49562f..b7c94a4ffd109166f8b96f0e51e851cbb70d028c 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 aa13bdab0a6e7448db7f0a3185ce0bff758fcfb4..0d0f03871efc6e529a35677ac0443dc472d29ef5 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;