diff --git a/TotalCrossVM/CMakeLists.txt b/TotalCrossVM/CMakeLists.txt index dc8be73909..fdd50ad614 100644 --- a/TotalCrossVM/CMakeLists.txt +++ b/TotalCrossVM/CMakeLists.txt @@ -16,6 +16,11 @@ if(NOT DEFINED BUILD_SHARED_LIBS AND NOT DEFINED TCVM_SHARED) endif() endif() +# Use skia +if (NOT DEFINED USE_SKIA) + set(USE_SKIA ON) +endif() + if(TCVM_SHARED) add_library(tcvm SHARED) else() @@ -34,10 +39,11 @@ IF (NOT (DEFINED ANDROID_ABI OR MSVC OR CMAKE_GENERATOR STREQUAL Xcode)) ENDIF (NOT (DEFINED ANDROID_ABI OR MSVC OR CMAKE_GENERATOR STREQUAL Xcode)) # Find Skia -if(NOT MSVC) +if(NOT MSVC AND USE_SKIA) find_package(Skia REQUIRED) include_directories(${SKIA_INCLUDE_DIRS}) -endif(NOT MSVC) + add_definitions(-DUSE_SKIA) +endif(NOT MSVC AND USE_SKIA) set(TC_SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/src") set(LB_SRCDIR "${CMAKE_CURRENT_SOURCE_DIR}/src/litebase") @@ -668,4 +674,4 @@ if(MSVC) add_dependencies(Intermec tcvm) INCLUDE_EXTERNAL_MSPROJECT(Pidion ${CMAKE_CURRENT_SOURCE_DIR}/vc2008/Pidion.vcproj) endif() -endif() \ No newline at end of file +endif() diff --git a/TotalCrossVM/src/nm/ui/GraphicsPrimitives.h b/TotalCrossVM/src/nm/ui/GraphicsPrimitives.h index 40e016a149..ef09a6b3d8 100644 --- a/TotalCrossVM/src/nm/ui/GraphicsPrimitives.h +++ b/TotalCrossVM/src/nm/ui/GraphicsPrimitives.h @@ -10,7 +10,7 @@ #include "tcclass.h" -#if defined ANDROID || defined darwin || defined HEADLESS +#if defined USE_SKIA && (defined ANDROID || defined darwin || defined HEADLESS) #include "android/skia.h" #endif diff --git a/TotalCrossVM/src/nm/ui/PalmFont_c.h b/TotalCrossVM/src/nm/ui/PalmFont_c.h index 1e97855e21..2eb72f34ab 100644 --- a/TotalCrossVM/src/nm/ui/PalmFont_c.h +++ b/TotalCrossVM/src/nm/ui/PalmFont_c.h @@ -715,7 +715,7 @@ UserFont loadUserFontFromFontObj(Context currentContext, TCObject fontObj, JChar } } -#if defined ANDROID || defined darwin || defined HEADLESS +#if defined USE_SKIA && (defined ANDROID || defined darwin || defined HEADLESS) #include "android/skia.h" int32 getJCharWidth(Context currentContext, TCObject fontObj, JChar ch) { diff --git a/TotalCrossVM/src/nm/ui/font_Font.c b/TotalCrossVM/src/nm/ui/font_Font.c index db0bf6da4d..66f70884c4 100644 --- a/TotalCrossVM/src/nm/ui/font_Font.c +++ b/TotalCrossVM/src/nm/ui/font_Font.c @@ -7,7 +7,7 @@ #include "tcvm.h" #include "PalmFont_c.h" -#if defined ANDROID || defined darwin || defined HEADLESS +#if defined USE_SKIA && (defined ANDROID || defined darwin || defined HEADLESS) #include "android/skia.h" #endif @@ -37,6 +37,7 @@ TC_API void tufF_fontCreate(NMParams p) // totalcross/ui/font/Font native void f if(!(nameTTF[len-4] == '.' && nameTTF[len-3] == 't' && nameTTF[len-2] == 't' && nameTTF[len-1] == 'f')) { xstrcat(nameTTF, ".ttf"); } + int32 fontIdx = skia_getTypefaceIndex(nameTTF); if (fontIdx == -1) { if ((file = tczGetFile(nameTTF, false)) != null) { diff --git a/TotalCrossVM/src/nm/ui/gfx_Graphics.c b/TotalCrossVM/src/nm/ui/gfx_Graphics.c index b04b087db6..f9bb920538 100644 --- a/TotalCrossVM/src/nm/ui/gfx_Graphics.c +++ b/TotalCrossVM/src/nm/ui/gfx_Graphics.c @@ -4,7 +4,7 @@ // SPDX-License-Identifier: LGPL-2.1-only #include "tcvm.h" -#if defined ANDROID || defined darwin || defined HEADLESS +#if defined USE_SKIA && (defined ANDROID || defined darwin || defined HEADLESS) #define Graphics_forePixel(o) (Graphics_foreColor(o) | 0xFF000000) #define Graphics_backPixel(o) (Graphics_backColor(o) | 0xFF000000) #else diff --git a/TotalCrossVM/src/nm/ui/image_Image.c b/TotalCrossVM/src/nm/ui/image_Image.c index 25cb5bf573..31d58ece66 100644 --- a/TotalCrossVM/src/nm/ui/image_Image.c +++ b/TotalCrossVM/src/nm/ui/image_Image.c @@ -145,7 +145,7 @@ TC_API void tuiI_setTransparentColor_i(NMParams p) // totalcross/ui/image/Image p->retO = thisObj; } -#if defined ANDROID || defined darwin || defined HEADLESS +#if defined USE_SKIA && (defined ANDROID || defined darwin || defined HEADLESS) #include "android/skia.h" #endif ////////////////////////////////////////////////////////////////////////// diff --git a/TotalCrossVM/src/nm/ui/linux/gfx_Graphics_c.h b/TotalCrossVM/src/nm/ui/linux/gfx_Graphics_c.h index 691ad5bf71..c22d53a0c0 100644 --- a/TotalCrossVM/src/nm/ui/linux/gfx_Graphics_c.h +++ b/TotalCrossVM/src/nm/ui/linux/gfx_Graphics_c.h @@ -12,7 +12,9 @@ void privateScreenChange(int32 w, int32 h) } #include "../../init/tcsdl.h" +#ifdef USE_SKIA #include "../android/skia.h" +#endif bool graphicsStartup(ScreenSurface screen, int16 appTczAttr) @@ -63,7 +65,8 @@ bool graphicsStartup(ScreenSurface screen, int16 appTczAttr) screen->screenW = w; screen->screenH = h; - +#else + TCSDL_Init(screen, exeName, *(tcSettings.isFullScreenPtr)); #endif return true; } @@ -87,6 +90,8 @@ void graphicsUpdateScreen(Context currentContext, ScreenSurface screen) // scree bounds.x2 = currentContext->dirtyX2; bounds.y2 = currentContext->dirtyY2; SCREEN_EX(screen)->primary->Flip(SCREEN_EX(screen)->primary, &bounds, DSFLIP_ONSYNC); +#else + TCSDL_UpdateTexture(screen->screenW, screen->screenH, screen->pitch, screen->pixels); #endif }