diff --git a/BUILD.gn b/BUILD.gn index 20d81b0ca48fa9ee4bbc62f23c23cb53046720be..360bf02df1169bd7ab957e4346f8e7ef897a21d1 100755 --- a/BUILD.gn +++ b/BUILD.gn @@ -29,20 +29,21 @@ config("graphic_define_config") { "interfaces/kits", "interfaces/innerkits", ] + if (ohos_kernel_type != "liteos_m") { + defines = [ + "ENABLE_VECTOR_FONT=1", + "ENABLE_BITMAP_FONT=0", + "ENABLE_SHAPING=0", + "ENABLE_ICU=1", + "ENABLE_MULTI_FONT=0", + "DEFAULT_ANIMATION=1", + ] - defines = [ - "ENABLE_VECTOR_FONT=1", - "ENABLE_BITMAP_FONT=0", - "ENABLE_SHAPING=0", - "ENABLE_ICU=1", - "ENABLE_MULTI_FONT=0", - "DEFAULT_ANIMATION=1" - ] - - if (ohos_kernel_type == "linux") { - defines += [ "RESOURCE_DIR=\"/storage/data/\"" ] - } else { - defines += [ "RESOURCE_DIR=\"/user/data/\"" ] + if (ohos_kernel_type == "linux") { + defines += [ "RESOURCE_DIR=\"/storage/data/\"" ] + } else { + defines += [ "RESOURCE_DIR=\"/user/data/\"" ] + } } } @@ -56,15 +57,15 @@ if (enable_graphic_font) { } } -shared_library("ui") { +lite_library("ui") { sources = [ "frameworks/animator/animator.cpp", "frameworks/animator/animator_manager.cpp", "frameworks/animator/easing_equation.cpp", "frameworks/animator/interpolation.cpp", "frameworks/common/graphic_startup.cpp", - "frameworks/common/image_decode_ability.cpp", "frameworks/common/image.cpp", + "frameworks/common/image_decode_ability.cpp", "frameworks/common/input_device_manager.cpp", "frameworks/common/screen.cpp", "frameworks/common/task.cpp", @@ -135,6 +136,8 @@ shared_library("ui") { "frameworks/draw/draw_rect.cpp", "frameworks/draw/draw_triangle.cpp", "frameworks/draw/draw_utils.cpp", + "frameworks/engines/gfx/gfx_engine_manager.cpp", + "frameworks/engines/gfx/hi3516/hi3516_engine.cpp", "frameworks/events/event.cpp", "frameworks/font/base_font.cpp", "frameworks/font/glyphs_manager.cpp", @@ -158,34 +161,58 @@ shared_library("ui") { "frameworks/themes/theme_manager.cpp", "frameworks/window/window.cpp", "frameworks/window/window_impl.cpp", - "frameworks/engines/gfx/gfx_engine_manager.cpp", - "frameworks/engines/gfx/hi3516/hi3516_engine.cpp", ] - include_dirs = [ "//foundation/graphic/ui/frameworks" ] - deps = [ - "//build/lite/config/component/cJSON:cjson_shared", - "//foundation/graphic/surface:lite_surface", - "//foundation/graphic/utils:lite_graphic_hals", - "//foundation/graphic/wms:lite_wms", - "//third_party/bounds_checking_function:libsec_shared", - "//third_party/freetype:freetype", - "//third_party/giflib:libgif", - "//third_party/icu/icu4c/source/common:icu_font", - "//third_party/libjpeg:libjpeg", - "//third_party/libpng:libpng", - "//third_party/qrcodegen:qrcodegen", - ] - - if (enable_video_component) { - defines += [ "ENABLE_VIDEO_COMPONENT=1" ] - source += [ - "frameworks/components/ui_video.cpp", + if (ohos_kernel_type == "liteos_m") { + target_type = "static_library" + include_dirs = [ + "frameworks", + "//third_party/freetype/include", ] - - deps += [ - "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", + sources -= [ + "frameworks/components/ui_surface_view.cpp", + "frameworks/dfx/ui_dump_dom_tree.cpp", + "frameworks/dfx/ui_screenshot.cpp", + "frameworks/engines/gfx/hi3516/hi3516_engine.cpp", + "frameworks/window/window.cpp", + "frameworks/window/window_impl.cpp", ] + deps = [ + "//build/lite/config/component/cJSON:cjson_static", + "//third_party/bounds_checking_function:libsec_static", + "//third_party/freetype:freetype", + "//third_party/giflib:libgif", + "//third_party/libjpeg:libjpeg", + "//third_party/libpng:libpng", + "//third_party/qrcodegen:qrcodegen", + ] + } else { + target_type = "shared_library" + include_dirs = [ "frameworks" ] + deps = [ + "//build/lite/config/component/cJSON:cjson_shared", + "//foundation/graphic/surface:lite_surface", + "//foundation/graphic/utils:lite_graphic_hals", + "//foundation/graphic/wms:lite_wms", + "//third_party/bounds_checking_function:libsec_shared", + "//third_party/freetype:freetype", + "//third_party/giflib:libgif", + "//third_party/icu/icu4c/source/common:icu_font", + "//third_party/libjpeg:libjpeg", + "//third_party/libpng:libpng", + "//third_party/qrcodegen:qrcodegen", + ] + + if (enable_video_component) { + defines += [ "ENABLE_VIDEO_COMPONENT=1" ] + source += [ "frameworks/components/ui_video.cpp" ] + + deps += [ + "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", + ] + } + + ldflags = [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] } public_deps = [ "//foundation/graphic/utils:lite_graphic_utils" ] @@ -195,5 +222,4 @@ shared_library("ui") { "-fno-exceptions", ] cflags_cc = cflags - ldflags = [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] } diff --git a/frameworks/components/root_view.cpp b/frameworks/components/root_view.cpp index d908b9f525d3f183c5039b5ccfbc3fa06aba1110..7fee96e969da65f502560141550c3f93411c7c9f 100755 --- a/frameworks/components/root_view.cpp +++ b/frameworks/components/root_view.cpp @@ -529,9 +529,18 @@ void RootView::Render() invalidateMap_.clear(); #else if ( invalidateRects_.Size() > 0) { +#if (FULLY_RENDER != 1) + // only draw invalid rects. in this case, buffers (if there are two buffers or more to display) should keep + // same with each others, because only delta changes write to the buffer between each frames, so it fits one + // buffer to display. for (ListNode* iter = invalidateRects_.Begin(); iter != invalidateRects_.End(); iter = iter->next_) { RenderManager::RenderRect(iter->data_, this); } +#else + // fully draw whole reacts. in this case, buffers (if there are two buffers or more to display) could be + // independent on each others, so it fits two buffers or more to display. + RenderManager::RenderRect(GetScreenRect(), this); +#endif invalidateRects_.Clear(); #endif diff --git a/frameworks/components/ui_image_view.cpp b/frameworks/components/ui_image_view.cpp index ae8a9fe2b56730e4940d043fbcfb773582f78e84..e24367d6b46e92aeb62a324605f7bd9ceab5bf8a 100644 --- a/frameworks/components/ui_image_view.cpp +++ b/frameworks/components/ui_image_view.cpp @@ -23,12 +23,12 @@ #include "gfx_utils/image_info.h" #include "gfx_utils/mem_api.h" #include "imgdecode/cache_manager.h" -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) #include "gif_lib.h" #endif namespace OHOS { -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) class GifImageAnimator : public Animator, public AnimatorCallback { public: GifImageAnimator(UIView* view, const char* src) @@ -85,7 +85,7 @@ private: const void GifImageAnimator::OpenGifFile(const char* src) { - int32_t error = D_GIF_SUCCEEDED; + int error = D_GIF_SUCCEEDED; GifFileType* gifFileType = DGifOpenFileName(src, &error); if (error != D_GIF_SUCCEEDED) { return; @@ -231,7 +231,7 @@ UIImageView::UIImageView() reserve_(0) { style_ = &(StyleDefault::GetBackgroundTransparentStyle()); -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) gifImageAnimator_ = nullptr; gifFrameFlag_ = false; #endif @@ -239,7 +239,7 @@ UIImageView::UIImageView() UIImageView::~UIImageView() { -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) RemoveAndStopGifAnimator(); #endif if (drawTransMap_ != nullptr) { @@ -475,7 +475,7 @@ void UIImageView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) void UIImageView::SetSrc(const char* src) { -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) if (src == nullptr) { return; } @@ -543,7 +543,7 @@ void UIImageView::ReMeasure() void UIImageView::SetSrc(const ImageInfo* src) { -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) if (!gifFrameFlag_ && (gifImageAnimator_ != nullptr)) { RemoveAndStopGifAnimator(); } @@ -560,7 +560,7 @@ void UIImageView::SetSrc(const ImageInfo* src) Invalidate(); } -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) void UIImageView::AddAndStartGifAnimator() { if (gifImageAnimator_ != nullptr) { diff --git a/interfaces/kits/components/ui_image_view.h b/interfaces/kits/components/ui_image_view.h index 4abc338d7708711b856ccbc632975039d562f86f..6cabf9a1b0c52137ed4cf9fd74126b1fb877f784 100644 --- a/interfaces/kits/components/ui_image_view.h +++ b/interfaces/kits/components/ui_image_view.h @@ -38,7 +38,7 @@ #include "common/image.h" #include "components/ui_view.h" #include "gfx_utils/graphic_types.h" -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) #include "animator/animator.h" #endif @@ -309,7 +309,7 @@ protected: bool transMapInvalid_ = true; private: void ReMeasure() override; -#ifndef VERSION_LITE +#if (ENABLE_GIF == 1) friend class GifImageAnimator; void AddAndStartGifAnimator(); void RemoveAndStopGifAnimator(); @@ -322,4 +322,4 @@ private: int16_t widgetWidth, int16_t widgetHeight) const; }; } // namespace OHOS -#endif // GRAPHIC_LITE_UI_IMAGE_VIEW_H \ No newline at end of file +#endif // GRAPHIC_LITE_UI_IMAGE_VIEW_H diff --git a/test/framework/BUILD.gn b/test/framework/BUILD.gn index d84b85228292bb5c37445c038d0dbfd27fdc0468..69553e33793676269b531d7d54ae1e0ff9de4966 100755 --- a/test/framework/BUILD.gn +++ b/test/framework/BUILD.gn @@ -24,6 +24,7 @@ test_sources = [ "../uitest/test_animator/ui_test_animator.cpp", "../uitest/test_anti_aliasing/ui_test_anti_aliasing.cpp", "../uitest/test_arc_label/ui_test_arc_label.cpp", + "../uitest/test_border_margin_padding/ui_test_border_margin_padding.cpp", "../uitest/test_button/ui_test_button.cpp", "../uitest/test_canvas/ui_test_canvas.cpp", "../uitest/test_chart/ui_test_chart_pillar.cpp", @@ -66,7 +67,6 @@ test_sources = [ "../uitest/test_view_group/ui_test_view_group.cpp", "../uitest/test_view_percent/ui_test_view_percent.cpp", "../uitest/test_view_scale_rotate/ui_test_view_scale_rotate.cpp", - "../uitest/test_border_margin_padding/ui_test_border_margin_padding.cpp", "common/ui_text_language.cpp", "src/test_ability.cpp", "src/test_case_list_adapter.cpp", @@ -75,9 +75,7 @@ test_sources = [ ] if (enable_video_component) { - test_sources += [ - "../uitest/test_video/ui_test_video.cpp", - ] + test_sources += [ "../uitest/test_video/ui_test_video.cpp" ] } auto_test_sources = [ diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index 3fd4749d27e678c78664a84718775a1931f5e0a1..724a08f284f329c5f2f8e854ac8ff6f6b7c5fa04 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -65,11 +65,11 @@ if (ohos_build_type == "debug") { "components/ui_image_unit_test.cpp", "components/ui_label_button_unit_test.cpp", "components/ui_label_unit_test.cpp", + "components/ui_list_unit_test.cpp", "components/ui_picker_unit_test.cpp", "components/ui_qrcode_unit_test.cpp", "components/ui_radio_button_unit_test.cpp", "components/ui_repeat_button_unit_test.cpp", - "components/ui_list_unit_test.cpp", "components/ui_scroll_bar_test.cpp", "components/ui_scroll_view_unit_test.cpp", "components/ui_slider_unit_test.cpp", @@ -101,14 +101,10 @@ if (ohos_build_type == "debug") { "themes/theme_manager_unit_test.cpp", ] - deps = [ - "//foundation/graphic/ui:ui", - ] + deps = [ "//foundation/graphic/ui:ui" ] if (enable_video_component) { - sources += [ - "components/ui_video_unit_test.cpp", - ] + sources += [ "components/ui_video_unit_test.cpp" ] deps += [ "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite",