Commit 5e28f92a authored by Nikolay Igotti's avatar Nikolay Igotti

Reworked Skia patch.

parent 3b2c2fbf
diff --git a/include/private/SkPathRef.h b/include/private/SkPathRef.h
index f9533d7261..9c178fb69f 100644
--- a/include/private/SkPathRef.h
+++ b/include/private/SkPathRef.h
@@ -8,6 +8,8 @@
#ifndef SkPathRef_DEFINED
#define SkPathRef_DEFINED
+#include <tuple>
+
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
diff --git a/third_party/icu/SkLoadICU.cpp b/third_party/icu/SkLoadICU.cpp
index ac7ba0c15d..2b445e286e 100644
index ac7ba0c15d..b41af4e85a 100644
--- a/third_party/icu/SkLoadICU.cpp
+++ b/third_party/icu/SkLoadICU.cpp
@@ -69,7 +69,9 @@ static bool init_icu(void* addr) {
@@ -68,6 +68,16 @@ static bool init_icu(void* addr) {
return true;
}
static std::string executable_directory() {
- HMODULE hModule = GetModuleHandleA(NULL);
+static std::string library_directory() {
+ HMODULE hModule = NULL;
+ GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ reinterpret_cast<LPCSTR>(&executable_directory), &hModule);
+ reinterpret_cast<LPCSTR>(&library_directory), &hModule);
+ char path[MAX_PATH];
+ GetModuleFileNameA(hModule, path, MAX_PATH);
+ const char* end = strrchr(path, '\\');
+ return end ? std::string(path, end - path) : std::string();
+}
+
static std::string executable_directory() {
HMODULE hModule = GetModuleHandleA(NULL);
char path[MAX_PATH];
GetModuleFileNameA(hModule, path, MAX_PATH);
const char* end = strrchr(path, '\\');
@@ -76,17 +86,21 @@ static std::string executable_directory() {
return end ? std::string(path, end - path) : std::string();
}
+static bool load_from(const std::string& dir) {
+ auto sPath = dir + "\\icudtl.dat";
+ if (void* addr = win_mmap(sPath.c_str())) {
+ if (init_icu(addr)) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool SkLoadICU() {
static bool good = false;
static std::once_flag flag;
std::call_once(flag, []() {
- std::string sPath = executable_directory();
- sPath += "\\icudtl.dat";
- if (void* addr = win_mmap(sPath.c_str())) {
- if (init_icu(addr)) {
- good = true;
- }
- }
+ good = load_from(executable_directory()) || load_from(library_directory());
});
return good;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment