Skip to content
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ build-*

build/
/temp
/out
/out
/target
68 changes: 67 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"files.associations": {
"*.temp": "plaintext",
"*.cc": "cpp",
"*.conf": "apacheconf",
"*.h": "cpp",
Expand All @@ -11,7 +12,72 @@
"*.pch": "objective-cpp",
"utility": "cpp",
"random": "cpp",
"cstdlib": "cpp"
"cstdlib": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"exception": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"*.rh": "cpp"
},
"C_Cpp.errorSquiggles": "disabled",
}
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ endif()

add_library(xege STATIC)

target_include_directories(xege PUBLIC include)
target_include_directories(xege PUBLIC ${PROJECT_SOURCE_DIR}/export)

# 是否使用 libpng 和 zlib 处理 PNG 图片。
# 目前只能为 ON,未来或允许选择使用 WIC。
Expand Down Expand Up @@ -259,7 +259,7 @@ endmacro()
add_subdirectory(src)

if(EGE_BUILD_DEMO)
add_subdirectory(demo)
add_subdirectory(examples)
endif()

if(EGE_BUILD_TEMP AND EXISTS "${PROJECT_SOURCE_DIR}/temp/CMakeLists.txt")
Expand Down
58 changes: 58 additions & 0 deletions cup.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[project]
name = "xege"
version = "0.1.0"
type = "static"

[build]
# generator = "Ninja"
# generator = "MinGW Makefiles"
# generator = "Visual Studio 17 2022"
jobs = 0
defines = ["CUP_BUILD"]

[dependencies]
libpng = { url = "@Anglebase/libpng", version = "0.1.0" }

[tests]
sources = [
"tests/tests/image_generator.cpp",
"tests/tests/performance_timer.cpp",
"tests/tests/test_framework.cpp",
]
includes = ["tests/tests"]
defines = ["CUP_BUILD"]

[examples]
defines = ["CUP_BUILD"]

[generator."Visual Studio 17 2022"]
compile_options = ["/utf-8"]
[generator."Visual Studio 16 2019"]
compile_options = ["/utf-8"]
[generator."Visual Studio 15 2017"]
compile_options = ["/utf-8"]
[generator."Visual Studio 14 2015"]
compile_options = ["/utf-8"]

[generator."MinGW Makefiles"]
link_libs = [
"gdi32",
"user32",
"kernel32",
"gdiplus",
"ole32",
"oleaut32",
"uuid",
"winmm",
]
[generator."Ninja"]
link_libs = [
"gdi32",
"user32",
"kernel32",
"gdiplus",
"ole32",
"oleaut32",
"uuid",
"winmm",
]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion demo/egelogo.rc → examples/egelogo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
EGE_LOGO_JPG JPG "../egelogo.jpg"
EGE_LOGO_JPG JPG "../egelogo.jpg"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 8 additions & 2 deletions include/ege.h → export/ege.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@
# endif
#endif

#ifdef CUP_BUILD
# define _LINK_NAME "xege.lib"
#else
# define _LINK_NAME "graphics.lib"
#endif

#if !defined(EGE_GRAPH_LIB_BUILD) && !defined(EGE_GRAPH_NO_LIB)
# ifdef _MSC_VER
# pragma comment(lib,"gdiplus.lib")
# ifdef _WIN64 // 64 bit libs
# pragma comment(lib,"graphics.lib")
# pragma comment(lib,_LINK_NAME)
# else // 32 bit libs
# pragma comment(lib,"graphics.lib")
# pragma comment(lib,_LINK_NAME)
# endif
# endif
#endif
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ target_sources(xege
PRIVATE ${EGE_CPP_SRC}
)

target_include_directories(xege
PRIVATE ${PROJECT_SOURCE_DIR}/include
)

target_include_directories(xege
PRIVATE lpng
)
Expand Down
5 changes: 4 additions & 1 deletion src/compress.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "ege_head.h"
#ifdef CUP_BUILD
#include "zlib/zlib.h"
#else
#include <zlib.h>

#endif
namespace ege
{

Expand Down
5 changes: 4 additions & 1 deletion src/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@
// #undef _ITERATOR_DEBUG_LEVEL
// #endif

#ifdef CUP_BUILD
#include "libpng/png.h"
#else
#include <png.h>

#endif

#include <math.h>
#include <limits.h>
Expand Down
134 changes: 1 addition & 133 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,133 +1 @@
# 包含EGE头文件目录
include_directories(../include)

# 添加编译定义
add_definitions(-DSHOW_CONSOLE=1)
add_definitions(-DEGE_GRAPH_NO_LIB)
add_definitions(-DNOMINMAX)

# 添加Windows系统库
set(SYSTEM_LIBS
gdi32
user32
kernel32
gdiplus
ole32
oleaut32
uuid
winmm
)

# 创建测试工具库
add_library(test_framework STATIC
test_framework.cpp
test_framework.h
image_generator.cpp
image_generator.h
performance_timer.cpp
performance_timer.h
)

target_link_libraries(test_framework ${SYSTEM_LIBS})

if(MSVC)
target_compile_options(test_framework PUBLIC
/source-charset:utf-8
/Zc:__cplusplus
)
endif()

# 主性能测试程序
add_executable(putimage_performance_test
tests/putimage_performance_test.cpp
)

target_link_libraries(putimage_performance_test
test_framework
xege
${SYSTEM_LIBS}
)

# 单独的测试用例
add_executable(putimage_basic_test
tests/putimage_basic_test.cpp
)

target_link_libraries(putimage_basic_test
test_framework
xege
${SYSTEM_LIBS}
)

add_executable(putimage_alphablend_test
tests/putimage_alphablend_test.cpp
)

target_link_libraries(putimage_alphablend_test
test_framework
xege
${SYSTEM_LIBS}
)

add_executable(putimage_transparent_test
tests/putimage_transparent_test.cpp
)

target_link_libraries(putimage_transparent_test
test_framework
xege
${SYSTEM_LIBS}
)

add_executable(putimage_rotate_test
tests/putimage_rotate_test.cpp
)

target_link_libraries(putimage_rotate_test
test_framework
xege
${SYSTEM_LIBS}
)

add_executable(putimage_comparison_test
tests/putimage_comparison_test.cpp
)

target_link_libraries(putimage_comparison_test
test_framework
xege
${SYSTEM_LIBS}
)

add_executable(putimage_alphablend_comprehensive_test
tests/putimage_alphablend_comprehensive_test.cpp
)

target_link_libraries(putimage_alphablend_comprehensive_test
test_framework
xege
${SYSTEM_LIBS}
)

# 设置输出目录
set_target_properties(
putimage_performance_test
putimage_basic_test
putimage_alphablend_test
putimage_transparent_test
putimage_rotate_test
putimage_comparison_test
putimage_alphablend_comprehensive_test
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)

# 创建测试目标
enable_testing()
add_test(NAME putimage_performance COMMAND putimage_performance_test)
add_test(NAME putimage_basic COMMAND putimage_basic_test)
add_test(NAME putimage_alphablend COMMAND putimage_alphablend_test)
add_test(NAME putimage_transparent COMMAND putimage_transparent_test)
add_test(NAME putimage_rotate COMMAND putimage_rotate_test)
add_test(NAME putimage_comparison COMMAND putimage_comparison_test)
add_test(NAME putimage_alphablend_comprehensive COMMAND putimage_alphablend_comprehensive_test)
add_subdirectory(tests)
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
*/

#define SHOW_CONSOLE 1
#define NOMINMAX 1
#include "ege.h"
#include "../image_generator.h"
#include "../performance_timer.h"
#include "../test_framework.h"
#include "image_generator.h"
#include "performance_timer.h"
#include "test_framework.h"

#include <iostream>
#include <iomanip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/

#define SHOW_CONSOLE 1
#include "../image_generator.h"
#include "../performance_timer.h"
#include "../test_framework.h"
#include "image_generator.h"
#include "performance_timer.h"
#include "test_framework.h"
#include "ege.h"

#include <functional>
Expand Down
Loading