Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: option to build tcvm without Skia #287

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions TotalCrossVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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")
Expand Down Expand Up @@ -668,4 +674,4 @@ if(MSVC)
add_dependencies(Intermec tcvm)
INCLUDE_EXTERNAL_MSPROJECT(Pidion ${CMAKE_CURRENT_SOURCE_DIR}/vc2008/Pidion.vcproj)
endif()
endif()
endif()
2 changes: 1 addition & 1 deletion TotalCrossVM/src/nm/ui/GraphicsPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion TotalCrossVM/src/nm/ui/PalmFont_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion TotalCrossVM/src/nm/ui/font_Font.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion TotalCrossVM/src/nm/ui/gfx_Graphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion TotalCrossVM/src/nm/ui/image_Image.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
//////////////////////////////////////////////////////////////////////////
Expand Down
7 changes: 6 additions & 1 deletion TotalCrossVM/src/nm/ui/linux/gfx_Graphics_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand All @@ -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
}

Expand Down