From 6eb19d20de5854f182913e159ea595ffbc447fbb Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 23 Aug 2023 09:09:46 +0800 Subject: [PATCH] =?UTF-8?q?graphic=5F2d=E6=A8=A1=E5=9D=97MAC/Windows?= =?UTF-8?q?=E4=B8=8Btextgine=E3=80=81txt=E3=80=81flutter=E4=B8=89=E4=B8=AA?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- adapter/preview/sdk/sharedlib_config.gni | 25 ++++++++++++++++ frameworks/core/BUILD.gn | 16 +++++----- frameworks/core/components/components.gni | 4 ++- frameworks/core/components_ng/components.gni | 7 ++--- .../text_field_layout_algorithm.cpp | 6 ++++ frameworks/core/gestures/drag_recognizer.h | 7 ----- frameworks/core/image/image_compressor.cpp | 29 ++----------------- 7 files changed, 48 insertions(+), 46 deletions(-) diff --git a/adapter/preview/sdk/sharedlib_config.gni b/adapter/preview/sdk/sharedlib_config.gni index 54355cf6434..a94adf67276 100644 --- a/adapter/preview/sdk/sharedlib_config.gni +++ b/adapter/preview/sdk/sharedlib_config.gni @@ -98,6 +98,21 @@ common_bin = [ subsystem_name = "graphic" part_name = "graphic_2d" }, + { + label = "//foundation/graphic/graphic_2d/rosen/modules/texgine:libtexgine" + subsystem_name = "graphic" + part_name = "graphic_2d" + }, + { + label = "//foundation/graphic/graphic_2d/rosen/modules/texgine/texgine_drawing:libtexgine_drawing" + subsystem_name = "graphic" + part_name = "graphic_2d" + }, + { + label = "//third_party/jsoncpp:jsoncpp" + subsystem_name = "thirdparty" + part_name = "jsoncpp" + }, { label = "//third_party/flutter/build/skia:skia_shared" subsystem_name = "thirdparty" @@ -161,6 +176,16 @@ common_bin = [ subsystem_name = "arkui" part_name = "ace_engine" }, + { + label = "//foundation/arkui/ace_engine/build:libace_compatible" + subsystem_name = "ace_engine_subsystem" + part_name = "ace_engine_part" + }, + { + label = "//foundation/arkui/ace_engine/interfaces/inner_api/ace:ace_forward_compatibility" + subsystem_name = "ace_engine_subsystem" + part_name = "ace_engine_part" + } ] if (enable_graphic_text_gine) { diff --git a/frameworks/core/BUILD.gn b/frameworks/core/BUILD.gn index e647f757535..67ddf5d12d0 100644 --- a/frameworks/core/BUILD.gn +++ b/frameworks/core/BUILD.gn @@ -427,10 +427,10 @@ template("ace_core_source_set") { "common/rosen/rosen_convert_helper.cpp", ] if (is_ohos) { - external_deps += [ - "graphic_2d:libtexgine", - "graphic_2d:rosen_text", - ] + external_deps += [ "graphic_2d:libtexgine" ] + if (enable_graphic_text_gine) { + external_deps += [ "graphic_2d:rosen_text" ] + } defines += [ "TEXGINE_SUPPORT_FOR_OHOS" ] } if (is_cross_platform_build) { @@ -897,10 +897,10 @@ template("ace_core_ng_source_set") { "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src/drawing/engine_adapter", ] if (is_ohos) { - external_deps += [ - "graphic_2d:libtexgine", - "graphic_2d:rosen_text", - ] + external_deps += [ "graphic_2d:libtexgine" ] + if (enable_graphic_text_gine) { + external_deps += [ "graphic_2d:rosen_text" ] + } defines += [ "TEXGINE_SUPPORT_FOR_OHOS" ] } if (is_cross_platform_build) { diff --git a/frameworks/core/components/components.gni b/frameworks/core/components/components.gni index 0544a424a26..b973e30d9d0 100644 --- a/frameworks/core/components/components.gni +++ b/frameworks/core/components/components.gni @@ -135,7 +135,9 @@ template("build_component") { if (defined(config.enable_rosen_backend) && config.enable_rosen_backend && defined(invoker.rosen_sources)) { sources += invoker.rosen_sources - external_deps += [ "graphic_2d:rosen_text" ] + if (enable_graphic_text_gine) { + external_deps += [ "graphic_2d:rosen_text" ] + } if (is_cross_platform_build) { deps += [ "//foundation/graphic/graphic_2d/rosen/modules/render_service_client:librender_service_client_static" ] } else { diff --git a/frameworks/core/components_ng/components.gni b/frameworks/core/components_ng/components.gni index 17229e23619..91ec56cc65f 100644 --- a/frameworks/core/components_ng/components.gni +++ b/frameworks/core/components_ng/components.gni @@ -146,10 +146,9 @@ template("build_component_ng") { "//third_party/openGLES:libGLES", ] external_deps += [ "graphic_2d:2d_graphics" ] - external_deps += [ - "graphic_2d:2d_graphics", - "graphic_2d:rosen_text", - ] + if (enable_graphic_text_gine) { + external_deps += [ "graphic_2d:rosen_text" ] + } } else { deps += [ "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics_source_$platform" ] } diff --git a/frameworks/core/components_ng/pattern/text_field/text_field_layout_algorithm.cpp b/frameworks/core/components_ng/pattern/text_field/text_field_layout_algorithm.cpp index 07e5362f8c6..7c8ba57caac 100644 --- a/frameworks/core/components_ng/pattern/text_field/text_field_layout_algorithm.cpp +++ b/frameworks/core/components_ng/pattern/text_field/text_field_layout_algorithm.cpp @@ -295,9 +295,15 @@ std::optional TextFieldLayoutAlgorithm::MeasureContent( if (textContent.empty() || showPlaceHolder) { preferredHeight = pattern->PreferredLineHeight(); } +#ifndef USE_GRAPHIC_TEXT_GINE // support sigleline + if (isInlineStyle && pattern->IsSelected()) { + pattern->SetSingleLineHeight(preferredHeight); + } +#else // support multi-line if (isInlineStyle && pattern->IsSelected() && paragraph_->GetLineCount() != 0) { pattern->SetSingleLineHeight(preferredHeight / paragraph_->GetLineCount()); } +#endif #ifndef USE_GRAPHIC_TEXT_GINE paragraphWidth_ = paragraph_->GetLongestLine(); #else diff --git a/frameworks/core/gestures/drag_recognizer.h b/frameworks/core/gestures/drag_recognizer.h index 87f3e81bac6..f255b2d0cdf 100644 --- a/frameworks/core/gestures/drag_recognizer.h +++ b/frameworks/core/gestures/drag_recognizer.h @@ -218,17 +218,10 @@ private: return; } -#ifndef USE_GRAPHIC_TEXT_GINE - auto marker = EventMarker( - [this, f = std::forward(func), args = std::make_tuple(std::forward(args)...)]() mutable { - std::apply(f, std::move(args)); - }); -#else auto marker = EventMarker( [f = std::forward(func), args = std::make_tuple(std::forward(args)...)]() mutable { std::apply(f, std::move(args)); }); -#endif ctx->FireAsyncEvent(std::move(marker)); } diff --git a/frameworks/core/image/image_compressor.cpp b/frameworks/core/image/image_compressor.cpp index f0fdd80dc4d..9c0375a00e9 100644 --- a/frameworks/core/image/image_compressor.cpp +++ b/frameworks/core/image/image_compressor.cpp @@ -251,29 +251,6 @@ std::shared_ptr ImageCompressor::GpuCompress(std::string key, RSBitmap& std::function ImageCompressor::ScheduleReleaseTask() { -#ifndef USE_GRAPHIC_TEXT_GINE - std::function task = [this]() { -#ifdef ENABLE_OPENCL - if (refCount_ > 0 && clOk_) { - refCount_--; - if (refCount_ <= 0) { - this->ReleaseResource(); - - // save failed records - std::ofstream saveFile(recordsPath_); - if (!saveFile.is_open()) { - return; - } - std::lock_guard mLock(recordsMutex_); - for (auto s : failedRecords_) { - saveFile << s << "\n"; - } - saveFile.close(); - } - } -#endif // ENABLE_OPENCL - }; -#else #ifdef ENABLE_OPENCL std::function task = [this]() { if (refCount_ > 0 && clOk_) { @@ -293,11 +270,11 @@ std::function ImageCompressor::ScheduleReleaseTask() saveFile.close(); } } - }; #else - std::function task = []() {}; + std::function task = []() { #endif // ENABLE_OPENCL -#endif + }; + return task; }