Skip to content

Commit

Permalink
to skia 122
Browse files Browse the repository at this point in the history
  • Loading branch information
xland committed Jan 29, 2024
1 parent 4bff367 commit 4bb8837
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ if(WIN32)
set_property(TARGET ScreenCapture PROPERTY VS_DPI_AWARE "PerMonitor")
target_compile_definitions(ScreenCapture PRIVATE $<$<CONFIG:Debug>:UNICODE _UNICODE DEBUG NOMINMAX _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS SK_DEBUG WIN32 _WINDOWS>)
target_compile_definitions(ScreenCapture PRIVATE $<$<CONFIG:Release>:UNICODE _UNICODE NDEBUG NOMINMAX _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS SK_RELEASE WIN32 _WINDOWS>)
TARGET_LINK_LIBRARIES(ScreenCapture skia Dwmapi winmm kernel32 user32 shell32 imm32)
TARGET_LINK_LIBRARIES(ScreenCapture skia Dwmapi winmm kernel32 user32 shell32 imm32 gdi32 Usp10)
elseif(APPLE)
endif()
13 changes: 8 additions & 5 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
#include <Windows.h>
#include <shlobj.h>
#include <sstream>
#include "../res/res.h"
#include "include/core/SkFont.h"
#include "include/core//SkFontMgr.h"
#include "include/core/SkFontStyle.h"
#include "include/core/SkData.h"
#include "include/ports/SkTypeface_win.h"
#include "../res/res.h"
#include "WindowMain.h"
#include "WindowPin.h"
#include "Cursor.h"
Expand All @@ -19,13 +22,15 @@ SkFont* fontText{ nullptr };
WindowBase* win { nullptr };
static int exitCode{ 0 };
static std::vector<std::shared_ptr<SkRect>> screens;
sk_sp<SkFontMgr> fontMgr;

App::~App()
{
}

void App::Init()
{
fontMgr = SkFontMgr_New_GDI();
initFontText();
initFontIcon();
win = new WindowMain();
Expand Down Expand Up @@ -104,14 +109,12 @@ void App::initFontIcon()
}
LPVOID resData = LockResource(res);
auto fontData = SkData::MakeWithoutCopy(resData, resSize);
auto iconFace = SkTypeface::MakeFromData(fontData);
fontIcon = new SkFont(iconFace);
fontIcon = new SkFont(fontMgr->makeFromData(fontData));
}

void App::initFontText()
{
auto fontFace = SkTypeface::MakeFromName("Microsoft YaHei", SkFontStyle::Normal());
fontText = new SkFont(fontFace);
fontText = new SkFont(fontMgr->matchFamilyStyle("Microsoft YaHei", {}));
}
void App::initScreens() {
EnumDisplayMonitors(NULL, NULL, [](HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM lParam)
Expand Down

0 comments on commit 4bb8837

Please sign in to comment.