mirror of
https://gitee.com/openharmony/graphic_graphic_2d
synced 2024-11-30 02:31:42 +00:00
graphic_2d模块MAC/Windows下textgine、txt、flutter三个版本适配 Signed-off-by: changleipeng <changleipeng4@huawei.com>
This commit is contained in:
parent
b24dad05e6
commit
fe714c62f9
@ -137,6 +137,9 @@ template("rosen_libharfbuzz") {
|
||||
}
|
||||
|
||||
deps = [ "//foundation/graphic/graphic_2d/rosen/build/flutter/icu:rosen_libicu_$platform" ]
|
||||
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,8 +118,6 @@ template("rosen_libicu") {
|
||||
|
||||
ohos_source_set(target_name) {
|
||||
if (enable_text_gine) {
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
defines += [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
}
|
||||
public_configs = [ ":icu_config_$platform" ]
|
||||
@ -567,7 +565,43 @@ template("rosen_libicu") {
|
||||
]
|
||||
if (enable_text_gine) {
|
||||
defines += [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
sources += [
|
||||
}
|
||||
sources += [
|
||||
"$skia_root/third_party/externals/icu/source/common/localebuilder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localematcher.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localeprioritylist.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/locdistance.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/loclikelysubtags.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/lsr.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/restrace.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-double-to-string.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-string-to-double.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formatted_string_builder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedval_iterimpl.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedval_sbimpl.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedvalue.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/measunit_extra.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_output.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_symbolswrapper.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_usageprefs.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/numrange_capi.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/pluralranges.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/string_segment.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_complexconverter.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_converter.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_data.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_router.cpp",
|
||||
]
|
||||
if (defined(use_new_skia) && use_new_skia) {
|
||||
sources -= [
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-diy-fp.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/nounit.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_stringbuilder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/numparse_stringsegment.cpp",
|
||||
]
|
||||
} else {
|
||||
sources -= [
|
||||
"$skia_root/third_party/externals/icu/source/common/localebuilder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localematcher.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localeprioritylist.cpp",
|
||||
@ -593,47 +627,14 @@ template("rosen_libicu") {
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_data.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_router.cpp",
|
||||
]
|
||||
if (defined(use_new_skia) && use_new_skia) {
|
||||
sources -= [
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-diy-fp.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/nounit.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_stringbuilder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/numparse_stringsegment.cpp",
|
||||
]
|
||||
} else {
|
||||
sources -= [
|
||||
"$skia_root/third_party/externals/icu/source/common/localebuilder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localematcher.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/localeprioritylist.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/locdistance.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/loclikelysubtags.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/lsr.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/common/restrace.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-double-to-string.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/double-conversion-string-to-double.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formatted_string_builder.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedval_iterimpl.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedval_sbimpl.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/formattedvalue.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/measunit_extra.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_output.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_symbolswrapper.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/number_usageprefs.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/numrange_capi.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/pluralranges.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/string_segment.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_complexconverter.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_converter.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_data.cpp",
|
||||
"$skia_root/third_party/externals/icu/source/i18n/units_router.cpp",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
deps = [
|
||||
"$ace_flutter_engine_root/icu:ace_icu_make_data_assembly_$platform",
|
||||
]
|
||||
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,7 @@ if (enable_text_gine) {
|
||||
public_configs = [ ":rosen_text_public_config" ]
|
||||
|
||||
defines += [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
cflags_cc = [ "-Wno-c++17-extensions" ]
|
||||
cflags = [ "-Wno-c++17-extensions" ]
|
||||
cflags = [ "-std=c++17" ]
|
||||
|
||||
include_dirs = [ "$rosen_root/modules/render_service_base/include" ]
|
||||
|
||||
@ -89,14 +88,12 @@ if (enable_text_gine) {
|
||||
"$rosen_root/modules/render_service_base/include",
|
||||
]
|
||||
|
||||
defines += [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
cflags_cc = [
|
||||
"-Wno-c++17-extensions",
|
||||
"-std=c++17",
|
||||
defines += [
|
||||
"USE_GRAPHIC_TEXT_GINE",
|
||||
"WINDOWS_PLATFORM",
|
||||
]
|
||||
defines += [ "WINDOWS_PLATFORM" ]
|
||||
cflags = [ "-std=c++17" ]
|
||||
|
||||
cflags = [ "-Wno-c++17-extensions" ]
|
||||
if (defined(use_new_skia) && use_new_skia) {
|
||||
include_dirs += [ "$flutter_root/txt/src" ]
|
||||
} else {
|
||||
|
@ -213,8 +213,7 @@ template("graphics2d_source_set") {
|
||||
include_dirs += [ "$flutter_root/engine/flutter/third_party/txt/src" ]
|
||||
}
|
||||
} else {
|
||||
cflags = [ "-Wno-c++17-extensions" ]
|
||||
|
||||
cflags = [ "-std=c++17" ]
|
||||
deps = [ "$ace_flutter_engine_root/libtxt:thirdparty_lib_txt_$platform" ]
|
||||
|
||||
if (!is_cross_platform_build) {
|
||||
|
@ -24,17 +24,9 @@ config("libtexgine_config") {
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-g3",
|
||||
"-std=c++17",
|
||||
]
|
||||
|
||||
if (enable_text_gine) {
|
||||
defines = [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
} else {
|
||||
defines = [
|
||||
"LOGGER_ENABLE_SCOPE",
|
||||
"TEXGINE_ENABLE_DEBUGLOG",
|
||||
]
|
||||
}
|
||||
|
||||
include_dirs = [
|
||||
"src",
|
||||
"export",
|
||||
@ -112,44 +104,42 @@ ohos_shared_library("libtexgine") {
|
||||
|
||||
public_deps = [
|
||||
"texgine_drawing:libtexgine_drawing",
|
||||
"//third_party/bounds_checking_function:libsec_static",
|
||||
"//third_party/jsoncpp:jsoncpp",
|
||||
]
|
||||
|
||||
defines = []
|
||||
if (enable_text_gine) {
|
||||
cflags_cc = [ "-Wno-c++17-extensions" ]
|
||||
cflags = [ "-Wno-c++17-extensions" ]
|
||||
if (platform == "ohos") {
|
||||
defines = [
|
||||
"BUILD_NON_SDK_VER",
|
||||
"LOGGER_ENABLE_SCOPE",
|
||||
"TEXGINE_ENABLE_DEBUGLOG",
|
||||
]
|
||||
defines += [ "USE_GRAPHIC_TEXT_GINE" ]
|
||||
}
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
]
|
||||
|
||||
public_deps +=
|
||||
[ "//third_party/flutter/build/icu:ace_libicu_$platform" ]
|
||||
} else {
|
||||
sources -= [ "src/utils/trace_ohos.cpp" ]
|
||||
public_deps += [ "//third_party/skia/third_party/icu" ]
|
||||
}
|
||||
} else {
|
||||
public_deps +=
|
||||
[ "$graphic_2d_root/rosen/build/flutter/icu:rosen_libicu_$platform" ]
|
||||
if (platform == "ohos") {
|
||||
defines += [
|
||||
"BUILD_NON_SDK_VER",
|
||||
"LOGGER_ENABLE_SCOPE",
|
||||
"TEXGINE_ENABLE_DEBUGLOG",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"hitrace:hitrace_meter",
|
||||
]
|
||||
|
||||
public_deps += [ "//third_party/flutter/build/icu:ace_libicu_$platform" ]
|
||||
} else {
|
||||
sources -= [ "src/utils/trace_ohos.cpp" ]
|
||||
if (platform == "mac") {
|
||||
defines += [ "BUILD_SDK_MAC" ]
|
||||
public_deps += [ "$graphic_2d_root/rosen/build/flutter/harfbuzz:rosen_libharfbuzz_$platform" ]
|
||||
} else {
|
||||
public_deps += [
|
||||
"$graphic_2d_root/rosen/build/flutter/icu:rosen_libicu_$platform",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
|
@ -18,25 +18,17 @@
|
||||
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace TextEngine {
|
||||
std::vector<VariantSpan> BidiProcesser::ProcessBidiText(const std::vector<VariantSpan> &spans, const TextDirection dir)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("BidiProcesser::ProcessBidiText");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("BidiProcesser::ProcessBidiText");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "ProcessBidiText");
|
||||
std::vector<VariantSpan> newSpans;
|
||||
|
@ -32,14 +32,6 @@ std::shared_ptr<DynamicFileFontProvider> DynamicFileFontProvider::Create() noexc
|
||||
int DynamicFileFontProvider::LoadFont(const std::string &familyName, const std::string &path) noexcept(true)
|
||||
{
|
||||
LOGEX_FUNC_LINE(DEBUG) << "loading font: '" << path << "'";
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
std::error_code ec;
|
||||
auto ret = StdFilesystemExists(path, ec);
|
||||
if (ec) {
|
||||
LOGEX_FUNC_LINE(ERROR) << "open file failed: " << ec.message();
|
||||
return FAILED;
|
||||
}
|
||||
#else
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
std::error_code ec;
|
||||
auto ret = StdFilesystemExists(path, ec);
|
||||
@ -49,7 +41,6 @@ int DynamicFileFontProvider::LoadFont(const std::string &familyName, const std::
|
||||
}
|
||||
#else
|
||||
auto ret = StdFilesystemExists(path);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!ret) {
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
#include "securec.h"
|
||||
#endif
|
||||
#include "texgine/utils/exlog.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -43,11 +45,13 @@ FontConfig::FontConfig(const char* fname)
|
||||
|
||||
char* FontConfig::GetFileData(const char* fname, int& size)
|
||||
{
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
char realPath[PATH_MAX] = {0};
|
||||
if (fname == nullptr || realpath(fname, realPath) == NULL) {
|
||||
LOGSO_FUNC_LINE(ERROR) << "path or realPath is NULL";
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
std::ifstream file(fname);
|
||||
if (file.good()) {
|
||||
FILE* fp = fopen(fname, "r");
|
||||
@ -62,9 +66,7 @@ char* FontConfig::GetFileData(const char* fname, int& size)
|
||||
fclose(fp);
|
||||
return nullptr;
|
||||
}
|
||||
#ifdef USE_GRAPHIC_TEXT_GINE
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
#endif
|
||||
if (memset_s(data, size, 0, size) != EOK) {
|
||||
LOGSO_FUNC_LINE(ERROR) << "memset failed";
|
||||
free(data);
|
||||
@ -72,10 +74,8 @@ char* FontConfig::GetFileData(const char* fname, int& size)
|
||||
fclose(fp);
|
||||
return nullptr;
|
||||
}
|
||||
#ifdef USE_GRAPHIC_TEXT_GINE
|
||||
#else
|
||||
memset(data, 0, size);
|
||||
#endif
|
||||
#endif
|
||||
(void)fread(data, size, 1, fp);
|
||||
fclose(fp);
|
||||
|
@ -116,14 +116,6 @@ int FontParser::ProcessNameTable(const struct NameTable* nameTable, FontParser::
|
||||
if (buffer == nullptr) {
|
||||
return FAILED;
|
||||
}
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
if (memcpy_s(buffer, len, data, len) != EOK) {
|
||||
LOGSO_FUNC_LINE(ERROR) << "memcpy failed";
|
||||
delete[] buffer;
|
||||
return FAILED;
|
||||
}
|
||||
const char16_t* strPtr = reinterpret_cast<const char16_t*>(buffer);
|
||||
#else
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
if (memcpy_s(buffer, len, data, len) != EOK) {
|
||||
LOGSO_FUNC_LINE(ERROR) << "memcpy failed";
|
||||
@ -134,7 +126,6 @@ int FontParser::ProcessNameTable(const struct NameTable* nameTable, FontParser::
|
||||
memcpy(buffer, data, len);
|
||||
#endif
|
||||
const char16_t *strPtr = reinterpret_cast<const char16_t *>(buffer);
|
||||
#endif
|
||||
const std::u16string u16str(strPtr, strPtr + HALF(len));
|
||||
std::wstring_convert<std::codecvt_utf16<char16_t>, char16_t> converter;
|
||||
const std::string name = converter.to_bytes(u16str);
|
||||
|
@ -15,27 +15,15 @@
|
||||
|
||||
#include <unicode/putil.h>
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static __attribute__((constructor)) void Init()
|
||||
{
|
||||
u_setDataDirectory("/system/usr/ohos_icu");
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#ifndef TEXGINE_ENABLE_TRACE
|
||||
OHOS::Rosen::TextEngine::Trace::Disable();
|
||||
#endif
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef TEXGINE_ENABLE_TRACE
|
||||
OHOS::Rosen::TextEngine::Trace::Disable();
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -20,13 +20,9 @@
|
||||
#include "texgine/any_span.h"
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_merger.h"
|
||||
#include "text_span.h"
|
||||
|
||||
|
@ -17,13 +17,9 @@
|
||||
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_converter.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -120,12 +116,8 @@ const std::vector<Boundary> &MeasurerImpl::GetWordBoundary() const
|
||||
|
||||
int MeasurerImpl::Measure(CharGroups &cgs)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("MeasurerImpl::Measure");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("MeasurerImpl::Measure");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "MeasurerImpl::Measure");
|
||||
struct MeasurerCacheKey key = {
|
||||
@ -172,12 +164,8 @@ int MeasurerImpl::Measure(CharGroups &cgs)
|
||||
|
||||
void MeasurerImpl::SeekTypeface(std::list<struct MeasuringRun> &runs)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("MeasurerImpl::SeekTypeface");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("MeasurerImpl::SeekTypeface");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "typeface");
|
||||
int index = 0;
|
||||
@ -226,12 +214,8 @@ void MeasurerImpl::SeekTypeface(std::list<struct MeasuringRun> &runs)
|
||||
|
||||
void MeasurerImpl::SeekScript(std::list<struct MeasuringRun> &runs)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("MeasurerImpl::SeekScript");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("MeasurerImpl::SeekScript");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "script");
|
||||
auto icuGetUnicodeFuncs = hb_unicode_funcs_create(hb_icu_get_unicode_funcs());
|
||||
@ -297,12 +281,8 @@ void MeasurerImpl::DoSeekScript(std::list<struct MeasuringRun> &runs, hb_unicode
|
||||
|
||||
int MeasurerImpl::Shape(CharGroups &cgs, std::list<struct MeasuringRun> &runs, std::vector<Boundary> boundaries)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("MeasurerImpl::Shape");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("MeasurerImpl::Shape");
|
||||
#endif
|
||||
#endif
|
||||
cgs = CharGroups::CreateEmpty();
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "shape");
|
||||
|
@ -15,13 +15,9 @@
|
||||
|
||||
#include "mock.h"
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include <filesystem>
|
||||
#else
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
#include <filesystem>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@ -59,12 +55,6 @@ void MockIFStream::StdFilestystemClose()
|
||||
std::ifstream::close();
|
||||
}
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
bool StdFilesystemExists(const std::string &p, std::error_code &ec)
|
||||
{
|
||||
return std::filesystem::exists(p, ec);
|
||||
}
|
||||
#else
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
bool StdFilesystemExists(const std::string &p, std::error_code &ec)
|
||||
{
|
||||
@ -77,8 +67,6 @@ bool StdFilesystemExists(const std::string &p)
|
||||
return f.good();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} // namespace TextEngine
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -40,15 +40,11 @@ public:
|
||||
void StdFilestystemClose();
|
||||
};
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
bool StdFilesystemExists(const std::string &p, std::error_code &ec);
|
||||
#else
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
bool StdFilesystemExists(const std::string &p, std::error_code &ec);
|
||||
#else
|
||||
bool StdFilesystemExists(const std::string &p);
|
||||
#endif
|
||||
#endif
|
||||
} // namespace TextEngine
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
@ -24,13 +24,9 @@
|
||||
#include "texgine/any_span.h"
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_breaker.h"
|
||||
#include "text_merger.h"
|
||||
#include "text_reverser.h"
|
||||
@ -54,12 +50,8 @@ void DumpLineMetrics(const std::vector<LineMetrics> &lineMetrics)
|
||||
std::vector<LineMetrics> Shaper::DoShape(std::vector<VariantSpan> spans, const TypographyStyle &tstyle,
|
||||
const std::shared_ptr<FontProviders> &fontProviders, const double widthLimit)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("Shaper::DoShape");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("Shaper::DoShape");
|
||||
#endif
|
||||
#endif
|
||||
TextBreaker tb;
|
||||
auto ret = tb.WordBreak(spans, tstyle, fontProviders);
|
||||
|
@ -22,13 +22,9 @@
|
||||
#include "texgine_exception.h"
|
||||
#include "text_span.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_converter.h"
|
||||
#include "word_breaker.h"
|
||||
|
||||
@ -38,12 +34,8 @@ namespace TextEngine {
|
||||
int TextBreaker::WordBreak(std::vector<VariantSpan> &spans, const TypographyStyle &ys,
|
||||
const std::shared_ptr<FontProviders> &fontProviders)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("TextBreaker::WordBreak");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("TextBreaker::WordBreak");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "WordBreak");
|
||||
std::vector<VariantSpan> visitingSpans;
|
||||
|
@ -19,13 +19,9 @@
|
||||
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_span.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -54,12 +50,8 @@ std::ostream &operator <<(std::ostream &os, const MergeResult &result)
|
||||
|
||||
std::vector<VariantSpan> TextMerger::MergeSpans(const std::vector<VariantSpan> &spans)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("TextMerger::MergeSpans");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("TextMerger::MergeSpans");
|
||||
#endif
|
||||
#endif
|
||||
std::vector<VariantSpan> vss;
|
||||
auto it = spans.begin();
|
||||
|
@ -16,25 +16,17 @@
|
||||
#include "text_reverser.h"
|
||||
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace TextEngine {
|
||||
void TextReverser::ReverseRTLText(std::vector<VariantSpan> &lineSpans)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("Shaper::ReverseRTLText");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("Shaper::ReverseRTLText");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "ReverseRTLText");
|
||||
const auto &endit = lineSpans.end();
|
||||
@ -105,12 +97,8 @@ void TextReverser::ReverseConDirectionText(std::vector<VariantSpan> &lineSpans,
|
||||
|
||||
void TextReverser::ProcessTypoDirection(std::vector<VariantSpan> &lineSpans, const TextDirection dir)
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("ProcessTypoDirection");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("ProcessTypoDirection");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "ProcessTypoDirection");
|
||||
if (dir == TextDirection::LTR) {
|
||||
|
@ -21,13 +21,9 @@
|
||||
#include "texgine_text_blob_builder.h"
|
||||
#include "texgine/typography_types.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@ -37,12 +33,8 @@ namespace TextEngine {
|
||||
int TextShaper::Shape(const VariantSpan &span, const TypographyStyle &ys,
|
||||
const std::shared_ptr<FontProviders> &fontProviders) const
|
||||
{
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("TextShaper::ShapeLineSpans");
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
ScopedTrace scope("TextShaper::ShapeLineSpans");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "TextShaper::ShapeLineSpans");
|
||||
if (span == nullptr) {
|
||||
|
@ -31,10 +31,8 @@
|
||||
#include "texgine_path_1d_path_effect.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "text_converter.h"
|
||||
#include "word_breaker.h"
|
||||
|
||||
|
@ -20,10 +20,8 @@
|
||||
#include "texgine_exception.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
@ -62,9 +60,7 @@ bool Typeface::ParseCmap(const std::shared_ptr<CmapParser> &parser)
|
||||
{
|
||||
LOGEX_FUNC_LINE(DEBUG) << "Parse Cmap: " << GetName();
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("Typeface::InitCmap");
|
||||
#endif
|
||||
#endif
|
||||
auto tag = HB_TAG('c', 'm', 'a', 'p');
|
||||
if (typeface_ == nullptr || typeface_->GetTypeface() == nullptr) {
|
||||
@ -93,10 +89,8 @@ bool Typeface::ParseCmap(const std::shared_ptr<CmapParser> &parser)
|
||||
}
|
||||
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
scope.Finish();
|
||||
ScopedTrace scope2("Typeface::ParseCmap");
|
||||
#endif
|
||||
#endif
|
||||
auto retval = parser->Parse(hb_blob_get_data(hblob_, nullptr), hb_blob_get_length(hblob_));
|
||||
return retval == 0;
|
||||
|
@ -29,10 +29,8 @@
|
||||
#include "texgine/typography_types.h"
|
||||
#include "texgine/utils/exlog.h"
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
#endif
|
||||
#endif
|
||||
#include "word_breaker.h"
|
||||
|
||||
namespace OHOS {
|
||||
@ -287,9 +285,7 @@ void TypographyImpl::Layout(double maxWidth)
|
||||
boundariesCache_ = {};
|
||||
try {
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
ScopedTrace scope("TypographyImpl::Layout");
|
||||
#endif
|
||||
#endif
|
||||
LOGSCOPED(sl, LOGEX_FUNC_LINE_DEBUG(), "TypographyImpl::Layout");
|
||||
LOGEX_FUNC_LINE(INFO) << "Layout maxWidth: " << maxWidth << ", spans.size(): " << spans_.size();
|
||||
|
@ -18,18 +18,27 @@
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include <sys/syscall.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef USE_GRAPHIC_TEXT_GINE
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
#include <sys/syscall.h>
|
||||
#define GET_TID() syscall(__NR_gettid)
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define gettid GetCurrentThreadId
|
||||
#define GET_TID GetCurrentThreadId
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_SDK_MAC
|
||||
#include <stdlib.h>
|
||||
#include <sys/syscall.h>
|
||||
#define GET_TID() syscall(SYS_thread_selfid)
|
||||
#else
|
||||
#ifdef __gnu_linux__
|
||||
#include <sys/types.h>
|
||||
#include <sys/syscall.h>
|
||||
#define GET_TID() syscall(SYS_gettid)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
@ -40,9 +49,6 @@
|
||||
#undef ERROR
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define GET_TID() syscall(__NR_gettid)
|
||||
|
||||
#ifdef LOGGER_NO_COLOR
|
||||
#define IF_COLOR(x)
|
||||
@ -189,15 +195,7 @@ void Logger::AppendFileFuncLine(Logger &logger, enum LOG_PHASE phase)
|
||||
void Logger::AppendPidTid(Logger &logger, enum LOG_PHASE phase)
|
||||
{
|
||||
if (phase == LOG_PHASE::BEGIN) {
|
||||
#ifdef BUILD_NON_SDK_VER
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
logger << getpid() << ":" << GET_TID() << " ";
|
||||
#endif
|
||||
#else
|
||||
#ifdef USE_GRAPHIC_TEXT_GINE
|
||||
logger << getpid() << ":" << gettid() << " ";
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,36 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef USE_GRAPHIC_TEXT_GINE
|
||||
#include "texgine/utils/trace.h"
|
||||
|
||||
#include <hitrace_meter.h>
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
namespace TextEngine {
|
||||
void Trace::Start(const std::string &proc)
|
||||
{
|
||||
StartTrace(HITRACE_TAG_GRAPHIC_AGP, proc);
|
||||
}
|
||||
|
||||
void Trace::Finish()
|
||||
{
|
||||
FinishTrace(HITRACE_TAG_GRAPHIC_AGP);
|
||||
}
|
||||
|
||||
void Trace::Count(const std::string &key, int val)
|
||||
{
|
||||
CountTrace(HITRACE_TAG_GRAPHIC_AGP, key, val);
|
||||
}
|
||||
|
||||
void Trace::Disable()
|
||||
{
|
||||
}
|
||||
} // namespace TextEngine
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
#else
|
||||
#ifdef LOGGER_ENABLE_SCOPE
|
||||
#include "texgine/utils/trace.h"
|
||||
|
||||
@ -73,4 +43,3 @@ void Trace::Disable()
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
#endif
|
||||
#endif
|
||||
|
@ -18,14 +18,12 @@ is_ok = true
|
||||
|
||||
config("texgine_drawing_public_config") {
|
||||
include_dirs = [ "./src" ]
|
||||
if (enable_text_gine) {
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-g3",
|
||||
"-std=c++17",
|
||||
]
|
||||
}
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-g3",
|
||||
"-std=c++17",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_shared_library("libtexgine_drawing") {
|
||||
@ -69,6 +67,7 @@ ohos_shared_library("libtexgine_drawing") {
|
||||
|
||||
deps = []
|
||||
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
part_name = "graphic_2d"
|
||||
subsystem_name = "graphic"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user