From 884b5f2e6fd3a708780a43f0ae7662afaf0e926d Mon Sep 17 00:00:00 2001 From: Gabriel Rauter Date: Tue, 1 Sep 2015 13:04:11 +0200 Subject: [PATCH 01/11] add submodule libwebp for #273 --- .gitmodules | 3 ++ CMakeLists.txt | 15 ++++++++ third_party/CMakeLists.txt | 4 +++ third_party/libwebp | 1 + third_party/libwebp-cmake/CMakeLists.txt | 45 ++++++++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 160000 third_party/libwebp create mode 100644 third_party/libwebp-cmake/CMakeLists.txt diff --git a/.gitmodules b/.gitmodules index 6d8632a203..83da9fb817 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "third_party/duktape"] path = third_party/duktape url = https://github.com/aseprite/duktape.git +[submodule "third_party/libwebp"] + path = third_party/libwebp + url = https://chromium.googlesource.com/webm/libwebp diff --git a/CMakeLists.txt b/CMakeLists.txt index eff1bc0c7e..a38160896f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off) option(USE_SHARED_ZLIB "Use your installed copy of zlib" off) option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off) option(USE_SHARED_LIBLOADPNG "Use your installed copy of libloadpng" off) +option(USE_SHARED_LIBWEBP "Use your installed copy of libwebp" off) option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off) option(USE_SHARED_PIXMAN "Use your installed copy of pixman" off) option(USE_SHARED_ALLEGRO4 "Use shared Allegro 4 library (without resize support)" off) @@ -106,6 +107,7 @@ set(LIBFREETYPE_DIR ${CMAKE_SOURCE_DIR}/third_party/freetype) set(LIBJPEG_DIR ${CMAKE_SOURCE_DIR}/third_party/jpeg) set(LIBPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/libpng) set(LOADPNG_DIR ${CMAKE_SOURCE_DIR}/third_party/loadpng) +set(LIBWEBP_DIR ${CMAKE_SOURCE_DIR}/third_party/libwebp) set(MONGOOSE_DIR ${CMAKE_SOURCE_DIR}/third_party/mongoose) set(PIXMAN_DIR ${CMAKE_SOURCE_DIR}/third_party/pixman) set(SIMPLEINI_DIR ${CMAKE_SOURCE_DIR}/third_party/simpleini) @@ -170,6 +172,19 @@ endif() include_directories(${PNG_INCLUDE_DIR}) add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code +# libwebp +if(USE_SHARED_LIBWEBP) + find_package(PkgConfig) + pkg_check_modules(WEBP libwebp) + if(NOT WEBP_FOUND) + message(FATAL_ERROR "libwebp not found") + endif() +else() + set(WEBP_LIBRARIES webp) + set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src) +endif() +include_directories(${WEBP_INCLUDE_DIR}) + # tinyxml if(USE_SHARED_TINYXML) find_library(TINYXML_LIBRARY NAMES tinyxml) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 59cd5aa7a4..9bcedd1107 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -20,6 +20,10 @@ if(NOT USE_SHARED_LIBPNG) add_subdirectory(libpng) endif() +if(NOT USE_SHARED_LIBWEBP) + add_subdirectory(libwebp-cmake) +endif() + if(NOT USE_SHARED_GIFLIB) add_subdirectory(giflib) endif() diff --git a/third_party/libwebp b/third_party/libwebp new file mode 160000 index 0000000000..03fb75221c --- /dev/null +++ b/third_party/libwebp @@ -0,0 +1 @@ +Subproject commit 03fb75221c36ff773379eb5f018d7206f1ef30c9 diff --git a/third_party/libwebp-cmake/CMakeLists.txt b/third_party/libwebp-cmake/CMakeLists.txt new file mode 100644 index 0000000000..fad88693c2 --- /dev/null +++ b/third_party/libwebp-cmake/CMakeLists.txt @@ -0,0 +1,45 @@ +project (webp C) +cmake_minimum_required(VERSION 2.6) + +add_definitions(-DNDEBUG -DWEBP_USE_THREAD) + +set(LIBWEBP_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../libwebp") + +file(GLOB WEBP_DEC_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/dec/*c +) + +file(GLOB WEBP_DEMUX_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/demux/*c +) + +file(GLOB WEBP_DSP_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/dsp/*c +) + +file(GLOB WEBP_ENC_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/enc/*c +) + +file(GLOB WEBP_UTILS_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/utils/*c +) + +file(GLOB WEBP_MUX_SRCS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/mux/*c +) + +file(GLOB WEBP_HEADERS + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBWEBP_SOURCE_DIR}/src/webp/*.h +) + +SET(CMAKE_DEBUG_POSTFIX "d") +set(WEBP_SOURCE ${WEBP_DEC_SRCS} ${WEBP_DEMUX_SRCS} ${WEBP_DSP_SRCS} ${WEBP_ENC_SRCS} ${WEBP_UTILS_SRCS} ${WEBP_MUX_SRC}) +add_library(${PROJECT_NAME} STATIC ${WEBP_SOURCE} ${WEBP_HEADERS}) From 497fc3ed3ae60e39d3f1f85a448f38daf80549ad Mon Sep 17 00:00:00 2001 From: Gabriel Rauter Date: Tue, 1 Sep 2015 13:05:24 +0200 Subject: [PATCH 02/11] implement simple non animation webp for #273 This includes lossless and lossy webp file format. For this reason a save option dialog was added giving rudimentary options for saving to the user. --- data/widgets/webp_options.xml | 48 ++++ src/app/CMakeLists.txt | 2 + src/app/file/file_formats_manager.cpp | 2 + src/app/file/webp_format.cpp | 361 ++++++++++++++++++++++++++ 4 files changed, 413 insertions(+) create mode 100644 data/widgets/webp_options.xml create mode 100644 src/app/file/webp_format.cpp diff --git a/data/widgets/webp_options.xml b/data/widgets/webp_options.xml new file mode 100644 index 0000000000..2f9a9f6985 --- /dev/null +++ b/data/widgets/webp_options.xml @@ -0,0 +1,48 @@ + + + + + +