1
1

Compare commits

..

7 Commits

Author SHA1 Message Date
f4dcad7b24 GPU: Sizecheck for push constants buffer.
According to the specs platforms should at least support push constants
of 128 bytes. As there are known platforms that have set this as their
maximum (Mesa for example) we should use this as the maximum as well.
2021-07-02 16:38:23 +02:00
fd4652d4f6 DrawManager: Add push constants command. 2021-07-02 16:25:13 +02:00
2e7ea42377 GPU: Binding uniformbuffer as push constant. 2021-07-02 16:06:15 +02:00
d8d0071367 GPU: Added push constants to shader interface 2021-07-02 13:43:01 +02:00
2436d36158 Cleanup: Renamed converter to patcher. 2021-07-02 12:11:03 +02:00
cc23dbaa26 Refactored GLSL patching for future extension.
Every patch would be its own class this would keep the data and logic contained.
When a source is unchained during patching it would reuse the original source.
2021-07-02 11:55:19 +02:00
fdda05bf15 [WIP] GPU: Push Constants.
See T89553 for more details.
2021-06-30 17:10:47 +02:00
1488 changed files with 17172 additions and 32110 deletions

View File

@@ -349,7 +349,7 @@ mark_as_advanced(WITH_SYSTEM_GLOG)
option(WITH_FREESTYLE "Enable Freestyle (advanced edges rendering)" ON)
# Misc
if(WIN32 OR APPLE)
if(WIN32)
option(WITH_INPUT_IME "Enable Input Method Editor (IME) for complex Asian character input" ON)
endif()
option(WITH_INPUT_NDOF "Enable NDOF input devices (SpaceNavigator and friends)" ON)
@@ -1705,18 +1705,22 @@ if(WITH_PYTHON)
endif()
endif()
# Select C++17 as the standard for C++ projects.
set(CMAKE_CXX_STANDARD 17)
# If C++17 is not available, downgrading to an earlier standard is NOT OK.
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Do not enable compiler specific language extentions.
set(CMAKE_CXX_EXTENSIONS OFF)
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above.
if(MSVC AND MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
if(MSVC)
string(APPEND CMAKE_CXX_FLAGS " /std:c++17")
# Make MSVC properly report the value of the __cplusplus preprocessor macro
# Available MSVC 15.7 (1914) and up, without this it reports 199711L regardless
# of the C++ standard chosen above
if(MSVC_VERSION GREATER 1913)
string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
endif()
elseif(
CMAKE_COMPILER_IS_GNUCC OR
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
CMAKE_C_COMPILER_ID MATCHES "Intel"
)
string(APPEND CMAKE_CXX_FLAGS " -std=c++17")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++17 build")
endif()
# Visual Studio has all standards it supports available by default
@@ -1911,7 +1915,6 @@ if(FIRST_RUN)
info_cfg_option(WITH_IK_ITASC)
info_cfg_option(WITH_IK_SOLVER)
info_cfg_option(WITH_INPUT_NDOF)
info_cfg_option(WITH_INPUT_IME)
info_cfg_option(WITH_INTERNATIONAL)
info_cfg_option(WITH_OPENCOLLADA)
info_cfg_option(WITH_OPENCOLORIO)

View File

@@ -56,7 +56,6 @@ else()
endif()
include(cmake/zlib.cmake)
include(cmake/zstd.cmake)
include(cmake/openal.cmake)
include(cmake/png.cmake)
include(cmake/jpeg.cmake)
@@ -165,7 +164,6 @@ endif()
if(UNIX AND NOT APPLE)
include(cmake/libglu.cmake)
include(cmake/mesa.cmake)
include(cmake/wayland_protocols.cmake)
endif()
include(cmake/harvest.cmake)

View File

@@ -87,9 +87,7 @@ download_source(LIBGLU)
download_source(MESA)
download_source(NASM)
download_source(XR_OPENXR_SDK)
download_source(WL_PROTOCOLS)
download_source(ISPC)
download_source(GMP)
download_source(POTRACE)
download_source(HARU)
download_source(ZSTD)

View File

@@ -126,8 +126,6 @@ if(UNIX AND NOT APPLE)
harvest(xml2/include xml2/include "*.h")
harvest(xml2/lib xml2/lib "*.a")
harvest(wayland-protocols/share/wayland-protocols wayland-protocols/share/wayland-protocols/ "*.xml")
else()
harvest(blosc/lib openvdb/lib "*.a")
harvest(xml2/lib opencollada/lib "*.a")
@@ -192,8 +190,6 @@ harvest(potrace/include potrace/include "*.h")
harvest(potrace/lib potrace/lib "*.a")
harvest(haru/include haru/include "*.h")
harvest(haru/lib haru/lib "*.a")
harvest(zstd/include zstd/include "*.h")
harvest(zstd/lib zstd/lib "*.a")
if(UNIX AND NOT APPLE)
harvest(libglu/lib mesa/lib "*.so*")

View File

@@ -216,9 +216,9 @@ set(OPENVDB_HASH 01b490be16cc0e15c690f9a153c21461)
set(OPENVDB_HASH_TYPE MD5)
set(OPENVDB_FILE openvdb-${OPENVDB_VERSION}.tar.gz)
set(NANOVDB_GIT_UID dc37d8a631922e7bef46712947dc19b755f3e841)
set(NANOVDB_GIT_UID e62f7a0bf1e27397223c61ddeaaf57edf111b77f)
set(NANOVDB_URI https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_GIT_UID}.tar.gz)
set(NANOVDB_HASH e7b9e863ec2f3b04ead171dec2322807)
set(NANOVDB_HASH 90919510bc6ccd630fedc56f748cb199)
set(NANOVDB_HASH_TYPE MD5)
set(NANOVDB_FILE nano-vdb-${NANOVDB_GIT_UID}.tar.gz)
@@ -456,18 +456,12 @@ set(NASM_HASH aded8b796c996a486a56e0515c83e414116decc3b184d88043480b32eb0a8589)
set(NASM_HASH_TYPE SHA256)
set(NASM_FILE nasm-${NASM_VERSION}.tar.gz)
set(XR_OPENXR_SDK_VERSION 1.0.17)
set(XR_OPENXR_SDK_VERSION 1.0.14)
set(XR_OPENXR_SDK_URI https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(XR_OPENXR_SDK_HASH bf0fd8828837edff01047474e90013e1)
set(XR_OPENXR_SDK_HASH 0df6b2fd6045423451a77ff6bc3e1a75)
set(XR_OPENXR_SDK_HASH_TYPE MD5)
set(XR_OPENXR_SDK_FILE OpenXR-SDK-${XR_OPENXR_SDK_VERSION}.tar.gz)
set(WL_PROTOCOLS_VERSION 1.21)
set(WL_PROTOCOLS_FILE wayland-protocols-${WL_PROTOCOLS_VERSION}.tar.gz)
set(WL_PROTOCOLS_URI https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WL_PROTOCOLS_VERSION}/${WL_PROTOCOLS_FILE})
set(WL_PROTOCOLS_HASH af5ca07e13517cdbab33504492cef54a)
set(WL_PROTOCOLS_HASH_TYPE MD5)
if(BLENDER_PLATFORM_ARM)
# Unreleased version with macOS arm support.
set(ISPC_URI https://github.com/ispc/ispc/archive/f5949c055eb9eeb93696978a3da4bfb3a6a30b35.zip)
@@ -500,11 +494,5 @@ set(HARU_HASH 4f916aa49c3069b3a10850013c507460)
set(HARU_HASH_TYPE MD5)
set(HARU_FILE libharu-${HARU_VERSION}.tar.gz)
set(ZSTD_VERSION 1.5.0)
set(ZSTD_URI https://github.com/facebook/zstd/releases/download/v${ZSTD_VERSION}/zstd-${ZSTD_VERSION}.tar.gz)
set(ZSTD_HASH 5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94)
set(ZSTD_HASH_TYPE SHA256)
set(ZSTD_FILE zstd-${ZSTD_VERSION}.tar.gz)
set(SSE2NEON_GIT https://github.com/DLTcollab/sse2neon.git)
set(SSE2NEON_GIT_HASH fe5ff00bb8d19b327714a3c290f3e2ce81ba3525)

View File

@@ -1,27 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
ExternalProject_Add(external_wayland_protocols
URL file://${PACKAGE_DIR}/${WL_PROTOCOLS_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${WL_PROTOCOLS_HASH_TYPE}=${WL_PROTOCOLS_HASH}
PREFIX ${BUILD_DIR}/wayland-protocols
CONFIGURE_COMMAND meson --prefix ${LIBDIR}/wayland-protocols . ../external_wayland_protocols -Dtests=false
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)

View File

@@ -1,51 +0,0 @@
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENSE BLOCK *****
set(ZSTD_EXTRA_ARGS
-DZSTD_BUILD_PROGRAMS=OFF
-DZSTD_BUILD_SHARED=OFF
-DZSTD_BUILD_STATIC=ON
-DZSTD_BUILD_TESTS=OFF
-DZSTD_LEGACY_SUPPORT=OFF
-DZSTD_LZ4_SUPPORT=OFF
-DZSTD_LZMA_SUPPORT=OFF
-DZSTD_MULTITHREAD_SUPPORT=ON
-DZSTD_PROGRAMS_LINK_SHARED=OFF
-DZSTD_USE_STATIC_RUNTIME=OFF
-DZSTD_ZLIB_SUPPORT=OFF
)
ExternalProject_Add(external_zstd
URL file://${PACKAGE_DIR}/${ZSTD_FILE}
DOWNLOAD_DIR ${DOWNLOAD_DIR}
URL_HASH ${ZSTD_HASH_TYPE}=${ZSTD_HASH}
PREFIX ${BUILD_DIR}/zstd
SOURCE_SUBDIR build/cmake
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/zstd ${DEFAULT_CMAKE_FLAGS} ${ZSTD_EXTRA_ARGS}
INSTALL_DIR ${LIBDIR}/zstd
)
if(WIN32)
if(BUILD_MODE STREQUAL Release)
ExternalProject_Add_Step(external_zstd after_install
COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/zstd/lib/zstd_static${LIBEXT} ${HARVEST_TARGET}/zstd/lib/zstd_static${LIBEXT}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/zstd/include/ ${HARVEST_TARGET}/zstd/include/
DEPENDEES install
)
endif()
endif()

View File

@@ -572,7 +572,7 @@ FFMPEG_FORCE_REBUILD=false
FFMPEG_SKIP=false
_ffmpeg_list_sep=";"
XR_OPENXR_VERSION="1.0.17"
XR_OPENXR_VERSION="1.0.14"
XR_OPENXR_VERSION_SHORT="1.0"
XR_OPENXR_VERSION_MIN="1.0.8"
XR_OPENXR_VERSION_MAX="2.0"
@@ -1073,7 +1073,7 @@ OPENVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/v
#~ OPENVDB_SOURCE_REPO_BRANCH="dev"
NANOVDB_USE_REPO=false
NANOVDB_SOURCE_REPO_UID="dc37d8a631922e7bef46712947dc19b755f3e841"
NANOVDB_SOURCE_REPO_UID="e62f7a0bf1e27397223c61ddeaaf57edf111b77f"
NANOVDB_SOURCE=( "https://github.com/AcademySoftwareFoundation/openvdb/archive/${NANOVDB_SOURCE_REPO_UID}.tar.gz" )
ALEMBIC_USE_REPO=false
@@ -1108,9 +1108,9 @@ FFMPEG_SOURCE=( "http://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2" )
XR_OPENXR_USE_REPO=false
XR_OPENXR_SOURCE=("https://github.com/KhronosGroup/OpenXR-SDK/archive/release-${XR_OPENXR_VERSION}.tar.gz")
XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
XR_OPENXR_REPO_UID="bf21ccb1007bb531b45d9978919a56ea5059c245"
XR_OPENXR_REPO_BRANCH="master"
#~ XR_OPENXR_SOURCE_REPO=("https://github.com/KhronosGroup/OpenXR-SDK.git")
#~ XR_OPENXR_REPO_UID="5900c51562769b03bea699dc0352cae56acb6419d"
#~ XR_OPENXR_REPO_BRANCH="master"
# C++11 is required now
CXXFLAGS_BACK=$CXXFLAGS
@@ -1128,7 +1128,6 @@ Those libraries should be available as packages in all recent distributions (opt
* Basics of dev environment (cmake, gcc, svn , git, ...).
* libjpeg, libpng, libtiff, [openjpeg2], [libopenal].
* libx11, libxcursor, libxi, libxrandr, libxinerama (and other libx... as needed).
* libwayland-client0, libwayland-cursor0, libwayland-egl1, libxkbcommon0, libdbus-1-3, libegl1 (Wayland)
* libsqlite3, libbz2, libssl, libfftw3, libxml2, libtinyxml, yasm, libyaml-cpp.
* libsdl2, libglew, libpugixml, libpotrace, [libgmp], [libglewmx], fontconfig, [libharu/libhpdf].\""
@@ -2738,7 +2737,7 @@ _init_openvdb() {
_git=false
_inst=$INST/openvdb-$OPENVDB_VERSION_SHORT
_inst_shortcut=$INST/openvdb
_openvdb_source=$OPENVDB_SOURCE
if [ "$WITH_NANOVDB" = true ]; then
_openvdb_source=$NANOVDB_SOURCE
@@ -2843,7 +2842,7 @@ compile_OPENVDB() {
if [ -d $INST/blosc ]; then
cmake_d="$cmake_d -D Blosc_ROOT=$INST/blosc"
fi
cmake $cmake_d ..
make -j$THREADS install
@@ -3840,7 +3839,6 @@ install_DEB() {
_packages="gawk cmake cmake-curses-gui build-essential libjpeg-dev libpng-dev libtiff-dev \
git libfreetype6-dev libfontconfig-dev libx11-dev flex bison libxxf86vm-dev \
libxcursor-dev libxi-dev wget libsqlite3-dev libxrandr-dev libxinerama-dev \
libwayland-dev wayland-protocols libegl-dev libxkbcommon-dev libdbus-1-dev linux-libc-dev \
libbz2-dev libncurses5-dev libssl-dev liblzma-dev libreadline-dev \
libopenal-dev libglew-dev yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV \
libsdl2-dev libfftw3-dev patch bzip2 libxml2-dev libtinyxml-dev libjemalloc-dev \
@@ -4510,7 +4508,6 @@ install_RPM() {
_packages="gcc gcc-c++ git make cmake tar bzip2 xz findutils flex bison fontconfig-devel \
libtiff-devel libjpeg-devel libpng-devel sqlite-devel fftw-devel SDL2-devel \
libX11-devel libXi-devel libXcursor-devel libXrandr-devel libXinerama-devel \
wayland-devel wayland-protocols-devel mesa-libEGL-devel libxkbcommon-devel dbus-devel kernel-headers \
wget ncurses-devel readline-devel $OPENJPEG_DEV openal-soft-devel \
glew-devel yasm $THEORA_DEV $VORBIS_DEV $OGG_DEV patch \
libxml2-devel yaml-cpp-devel tinyxml-devel jemalloc-devel \

View File

@@ -68,32 +68,3 @@
+
return ret;
}
--- a/libavcodec/rl.c
+++ b/libavcodec/rl.c
@@ -71,7 +71,7 @@ av_cold void ff_rl_init(RLTable *rl,
av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
{
int i, q;
- VLC_TYPE table[1500][2] = {{0}};
+ VLC_TYPE (*table)[2] = av_calloc(sizeof(VLC_TYPE), 1500 * 2);
VLC vlc = { .table = table, .table_allocated = static_size };
av_assert0(static_size <= FF_ARRAY_ELEMS(table));
init_vlc(&vlc, 9, rl->n + 1, &rl->table_vlc[0][1], 4, 2, &rl->table_vlc[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC);
@@ -80,8 +80,10 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
int qmul = q * 2;
int qadd = (q - 1) | 1;
- if (!rl->rl_vlc[q])
+ if (!rl->rl_vlc[q]){
+ av_free(table);
return;
+ }
if (q == 0) {
qmul = 1;
@@ -113,4 +115,5 @@ av_cold void ff_rl_init_vlc(RLTable *rl, unsigned static_size)
rl->rl_vlc[q][i].run = run;
}
}
+ av_free(table);
}

View File

@@ -8,9 +8,6 @@ IGNORE_SOURCE = (
# specific source files
"extern/audaspace/",
# Use for `WIN32` only.
"source/creator/blender_launcher_win32.c",
# specific source files
"extern/bullet2/src/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp",
"extern/bullet2/src/BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp",

View File

@@ -29,7 +29,6 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -30,7 +30,6 @@ set(WITH_IMAGE_OPENEXR ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_OPENJPEG ON CACHE BOOL "" FORCE)
set(WITH_IMAGE_TIFF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_NDOF ON CACHE BOOL "" FORCE)
set(WITH_INPUT_IME ON CACHE BOOL "" FORCE)
set(WITH_INTERNATIONAL ON CACHE BOOL "" FORCE)
set(WITH_LIBMV ON CACHE BOOL "" FORCE)
set(WITH_LIBMV_SCHUR_SPECIALIZATIONS ON CACHE BOOL "" FORCE)

View File

@@ -1,9 +1,9 @@
echo No explicit msvc version requested, autodetecting version.
call "%~dp0\detect_msvc2019.cmd"
call "%~dp0\detect_msvc2017.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2017.cmd"
call "%~dp0\detect_msvc2019.cmd"
if %ERRORLEVEL% EQU 0 goto DetectionComplete
call "%~dp0\detect_msvc2022.cmd"

View File

@@ -12,7 +12,6 @@ such cases, lock the interface (Render → Lock Interface or
Below is an example of a mesh that is altered from a handler:
"""
def frame_change_pre(scene):
# A triangle that shifts in the z direction
zshift = scene.frame_current * 0.1

View File

@@ -16,12 +16,10 @@ execution_queue = queue.Queue()
def run_in_main_thread(function):
execution_queue.put(function)
def execute_queued_functions():
while not execution_queue.empty():
function = execution_queue.get()
function()
return 1.0
bpy.app.timers.register(execute_queued_functions)

View File

@@ -31,13 +31,11 @@ owner = object()
subscribe_to = bpy.context.object.location
def msgbus_callback(*args):
# This will print:
# Something changed! (1, 2, 3)
print("Something changed!", args)
bpy.msgbus.subscribe_rna(
key=subscribe_to,
owner=owner,

View File

@@ -44,7 +44,7 @@ class OBJECT_OT_object_to_curve(bpy.types.Operator):
# Remove temporary curve.
obj.to_curve_clear()
# Invoke to_curve() with applying modifiers.
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers=True)
curve_with_modifiers = obj.to_curve(depsgraph, apply_modifiers = True)
self.report({'INFO'}, f"{len(curve_with_modifiers.splines)} splines in new curve with modifiers.")
# Remove temporary curve.
obj.to_curve_clear()

View File

@@ -21,7 +21,6 @@ batch = batch_for_shader(
},
)
def draw():
shader.bind()
shader.uniform_sampler("image", texture)

View File

@@ -265,12 +265,6 @@ protected:
*/
void setSpecs(Specs specs);
/**
* Sets the audio output specification of the device.
* \param specs The output specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Empty default constructor. To setup the device call the function create()
* and to uninitialize call destroy().

View File

@@ -87,12 +87,6 @@ public:
*/
void setSpecs(Specs specs);
/**
* Sets the target specification for superposing.
* \param specs The target specification.
*/
void setSpecs(DeviceSpecs specs);
/**
* Mixes a buffer.
* \param buffer The buffer to superpose.

View File

@@ -78,7 +78,6 @@ void PulseAudioDevice::runMixingThread()
if(shouldStop())
{
AUD_pa_stream_cork(m_stream, 1, nullptr, nullptr);
AUD_pa_stream_flush(m_stream, nullptr, nullptr);
doStop();
return;
}
@@ -87,10 +86,7 @@ void PulseAudioDevice::runMixingThread()
if(AUD_pa_stream_is_corked(m_stream))
AUD_pa_stream_cork(m_stream, 0, nullptr, nullptr);
// similar to AUD_pa_mainloop_iterate(m_mainloop, false, nullptr); except with a longer timeout
AUD_pa_mainloop_prepare(m_mainloop, 1 << 14);
AUD_pa_mainloop_poll(m_mainloop);
AUD_pa_mainloop_dispatch(m_mainloop);
AUD_pa_mainloop_iterate(m_mainloop, true, nullptr);
}
}

View File

@@ -24,7 +24,6 @@ PULSEAUDIO_SYMBOL(pa_context_unref);
PULSEAUDIO_SYMBOL(pa_stream_begin_write);
PULSEAUDIO_SYMBOL(pa_stream_connect_playback);
PULSEAUDIO_SYMBOL(pa_stream_cork);
PULSEAUDIO_SYMBOL(pa_stream_flush);
PULSEAUDIO_SYMBOL(pa_stream_is_corked);
PULSEAUDIO_SYMBOL(pa_stream_new);
PULSEAUDIO_SYMBOL(pa_stream_set_buffer_attr);
@@ -36,6 +35,3 @@ PULSEAUDIO_SYMBOL(pa_mainloop_free);
PULSEAUDIO_SYMBOL(pa_mainloop_get_api);
PULSEAUDIO_SYMBOL(pa_mainloop_new);
PULSEAUDIO_SYMBOL(pa_mainloop_iterate);
PULSEAUDIO_SYMBOL(pa_mainloop_prepare);
PULSEAUDIO_SYMBOL(pa_mainloop_poll);
PULSEAUDIO_SYMBOL(pa_mainloop_dispatch);

View File

@@ -31,81 +31,65 @@ template <class T> void SafeRelease(T **ppT)
}
}
HRESULT WASAPIDevice::setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size)
void WASAPIDevice::runMixingThread()
{
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
UINT32 buffer_size;
UINT32 padding;
UINT32 length;
data_t* buffer;
HRESULT result;
IAudioRenderClient* render_client = nullptr;
if(FAILED(result = m_audio_client->GetBufferSize(&buffer_size)))
return result;
{
std::lock_guard<ILockable> lock(*this);
if(FAILED(result = m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
return result;
const IID IID_IAudioRenderClient = __uuidof(IAudioRenderClient);
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
return result;
if(FAILED(m_audio_client->GetBufferSize(&buffer_size)))
goto init_error;
length = buffer_size - padding;
if(FAILED(m_audio_client->GetService(IID_IAudioRenderClient, reinterpret_cast<void**>(&render_client))))
goto init_error;
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
return result;
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
goto init_error;
mix((data_t*)buffer, length);
length = buffer_size - padding;
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
return result;
if(FAILED(render_client->GetBuffer(length, &buffer)))
goto init_error;
mix((data_t*)buffer, length);
if(FAILED(render_client->ReleaseBuffer(length, 0)))
{
init_error:
SafeRelease(&render_client);
doStop();
return;
}
}
m_audio_client->Start();
return result;
}
void WASAPIDevice::runMixingThread()
{
UINT32 buffer_size;
IAudioRenderClient* render_client = nullptr;
std::chrono::milliseconds sleep_duration;
bool run_init = true;
auto sleepDuration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
for(;;)
{
HRESULT result = S_OK;
{
UINT32 padding;
UINT32 length;
data_t* buffer;
std::lock_guard<ILockable> lock(*this);
if(run_init)
{
result = setupRenderClient(render_client, buffer_size);
if(FAILED(result))
goto stop_thread;
sleep_duration = std::chrono::milliseconds(buffer_size * 1000 / int(m_specs.rate) / 2);
}
if(FAILED(result = m_audio_client->GetCurrentPadding(&padding)))
if(FAILED(m_audio_client->GetCurrentPadding(&padding)))
goto stop_thread;
length = buffer_size - padding;
if(FAILED(result = render_client->GetBuffer(length, &buffer)))
if(FAILED(render_client->GetBuffer(length, &buffer)))
goto stop_thread;
mix((data_t*)buffer, length);
if(FAILED(result = render_client->ReleaseBuffer(length, 0)))
if(FAILED(render_client->ReleaseBuffer(length, 0)))
goto stop_thread;
// stop thread
@@ -114,51 +98,53 @@ void WASAPIDevice::runMixingThread()
stop_thread:
m_audio_client->Stop();
SafeRelease(&render_client);
if(result == AUDCLNT_E_DEVICE_INVALIDATED)
{
DeviceSpecs specs = m_specs;
if(!setupDevice(specs))
result = S_FALSE;
else
{
setSpecs(specs);
run_init = true;
}
}
if(result != AUDCLNT_E_DEVICE_INVALIDATED)
{
doStop();
return;
}
doStop();
return;
}
}
std::this_thread::sleep_for(sleep_duration);
std::this_thread::sleep_for(sleepDuration);
}
}
bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
{
SafeRelease(&m_audio_client);
SafeRelease(&m_imm_device);
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
const IID IID_IAudioClient = __uuidof(IAudioClient);
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
return false;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
return false;
WAVEFORMATEXTENSIBLE wave_format_extensible_closest_match;
WAVEFORMATEXTENSIBLE* closest_match_pointer = &wave_format_extensible_closest_match;
HRESULT result;
REFERENCE_TIME minimum_time = 0;
REFERENCE_TIME buffer_duration;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(FAILED(m_imm_device_enumerator->GetDefaultAudioEndpoint(eRender, eMultimedia, &m_imm_device)))
goto error;
if(FAILED(m_imm_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, reinterpret_cast<void**>(&m_audio_client))))
goto error;
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
switch(specs.format)
{
case FORMAT_U8:
@@ -217,14 +203,12 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
m_wave_format_extensible.Format.cbSize = 22;
m_wave_format_extensible.Samples.wValidBitsPerSample = m_wave_format_extensible.Format.wBitsPerSample;
HRESULT result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
result = m_audio_client->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED, reinterpret_cast<const WAVEFORMATEX*>(&m_wave_format_extensible), reinterpret_cast<WAVEFORMATEX**>(&closest_match_pointer));
if(result == S_FALSE)
{
bool errored = false;
if(closest_match_pointer->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
goto closest_match_error;
goto error;
specs.channels = Channels(closest_match_pointer->Format.nChannels);
specs.rate = closest_match_pointer->Format.nSamplesPerSec;
@@ -236,7 +220,7 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
else if(closest_match_pointer->Format.wBitsPerSample == 64)
specs.format = FORMAT_FLOAT64;
else
goto closest_match_error;
goto error;
}
else if(closest_match_pointer->SubFormat == KSDATAFORMAT_SUBTYPE_PCM)
{
@@ -255,81 +239,44 @@ bool WASAPIDevice::setupDevice(DeviceSpecs &specs)
specs.format = FORMAT_S32;
break;
default:
goto closest_match_error;
goto error;
break;
}
}
else
goto closest_match_error;
goto error;
m_wave_format_extensible = *closest_match_pointer;
if(false)
{
closest_match_error:
errored = true;
}
if(closest_match_pointer != &wave_format_extensible_closest_match)
{
CoTaskMemFree(closest_match_pointer);
closest_match_pointer = &wave_format_extensible_closest_match;
}
if(errored)
return false;
}
else if(FAILED(result))
return false;
goto error;
if(FAILED(m_audio_client->GetDevicePeriod(nullptr, &minimum_time)))
return false;
goto error;
buffer_duration = REFERENCE_TIME(m_buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
buffer_duration = REFERENCE_TIME(buffersize) * REFERENCE_TIME(10000000) / REFERENCE_TIME(specs.rate);
if(minimum_time > buffer_duration)
buffer_duration = minimum_time;
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
return false;
return true;
}
WASAPIDevice::WASAPIDevice(DeviceSpecs specs, int buffersize) :
m_buffersize(buffersize),
m_imm_device_enumerator(nullptr),
m_imm_device(nullptr),
m_audio_client(nullptr),
m_wave_format_extensible({})
{
// initialize COM if it hasn't happened yet
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
if(specs.channels == CHANNELS_INVALID)
specs.channels = CHANNELS_STEREO;
if(specs.format == FORMAT_INVALID)
specs.format = FORMAT_FLOAT32;
if(specs.rate == RATE_INVALID)
specs.rate = RATE_48000;
if(FAILED(CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, reinterpret_cast<void**>(&m_imm_device_enumerator))))
goto error;
if(!setupDevice(specs))
goto error;
m_specs = specs;
if(FAILED(m_audio_client->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, buffer_duration, 0, reinterpret_cast<WAVEFORMATEX*>(&m_wave_format_extensible), nullptr)))
goto error;
create();
return;
error:
if(closest_match_pointer != &wave_format_extensible_closest_match)
CoTaskMemFree(closest_match_pointer);
SafeRelease(&m_imm_device);
SafeRelease(&m_imm_device_enumerator);
SafeRelease(&m_audio_client);

View File

@@ -43,21 +43,16 @@ AUD_NAMESPACE_BEGIN
class AUD_PLUGIN_API WASAPIDevice : public ThreadedDevice
{
private:
int m_buffersize;
IMMDeviceEnumerator* m_imm_device_enumerator;
IMMDevice* m_imm_device;
IAudioClient* m_audio_client;
WAVEFORMATEXTENSIBLE m_wave_format_extensible;
AUD_LOCAL HRESULT setupRenderClient(IAudioRenderClient*& render_client, UINT32& buffer_size);
/**
* Streaming thread main function.
*/
AUD_LOCAL void runMixingThread();
AUD_LOCAL bool setupDevice(DeviceSpecs& specs);
// delete copy constructor and operator=
WASAPIDevice(const WASAPIDevice&) = delete;
WASAPIDevice& operator=(const WASAPIDevice&) = delete;

View File

@@ -756,7 +756,6 @@ void SoftwareDevice::mix(data_t* buffer, int length)
// get the buffer from the source
pos = 0;
len = length;
eos = false;
// update 3D Info
sound->update();
@@ -843,27 +842,6 @@ void SoftwareDevice::setSpecs(Specs specs)
{
sound->setSpecs(specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs);
}
}
void SoftwareDevice::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
m_mixer->setSpecs(specs);
for(auto& sound : m_playingSounds)
{
sound->setSpecs(specs.specs);
}
for(auto& sound : m_pausedSounds)
{
sound->setSpecs(specs.specs);
}
}
SoftwareDevice::SoftwareDevice()

View File

@@ -21,25 +21,9 @@
AUD_NAMESPACE_BEGIN
Mixer::Mixer(DeviceSpecs specs)
Mixer::Mixer(DeviceSpecs specs) :
m_specs(specs)
{
setSpecs(specs);
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::setSpecs(DeviceSpecs specs)
{
m_specs = specs;
switch(m_specs.format)
{
case FORMAT_U8:
@@ -70,6 +54,16 @@ void Mixer::setSpecs(DeviceSpecs specs)
}
}
DeviceSpecs Mixer::getSpecs() const
{
return m_specs;
}
void Mixer::setSpecs(Specs specs)
{
m_specs.specs = specs;
}
void Mixer::clear(int length)
{
m_buffer.assureSize(length * AUD_SAMPLE_SIZE(m_specs));

View File

@@ -7,4 +7,3 @@ Local modifications:
checks for functions and so are needed.
* Added special definitions of HAVE_SNPRINTF and HAVE_LIB_GFLAGS
in Windows' specific config.h.
* Silenced syscall deprecation warnings on macOS >= 10.12.

View File

@@ -59,7 +59,7 @@
# include <unistd.h>
#endif
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && (!(defined OS_MACOSX))
#if defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)
# define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
#else
// Not so safe, but what can you do?

View File

@@ -259,13 +259,7 @@ pid_t GetTID() {
#endif
static bool lacks_gettid = false;
if (!lacks_gettid) {
#ifdef OS_MACOSX
uint64_t tid64;
const int error = pthread_threadid_np(NULL, &tid64);
pid_t tid = error ? -1 : (pid_t)tid64;
#else
pid_t tid = syscall(__NR_gettid);
#endif
if (tid != -1) {
return tid;
}

View File

@@ -49,9 +49,9 @@
#include "atomic_ops_utils.h"
#if defined(__arm__) || defined(__riscv)
/* Attempt to fix compilation error on Debian armel and RISC-V kernels.
* Both architectures do have both 32 and 64bit atomics, however
#if defined(__arm__)
/* Attempt to fix compilation error on Debian armel kernel.
* arm7 architecture does have both 32 and 64bit atomics, however
* its gcc doesn't have __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n defined.
*/
# define JE_FORCE_SYNC_COMPARE_AND_SWAP_1

View File

@@ -482,7 +482,7 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
transparent_max_bounces: IntProperty(
name="Transparent Max Bounces",
description="Maximum number of transparent bounces. This is independent of maximum number of other bounces ",
description="Maximum number of transparent bounces",
min=0, max=1024,
default=8,
)

View File

@@ -485,12 +485,10 @@ class CYCLES_RENDER_PT_light_paths_max_bounces(CyclesButtonsPanel, Panel):
col = layout.column(align=True)
col.prop(cscene, "diffuse_bounces", text="Diffuse")
col.prop(cscene, "glossy_bounces", text="Glossy")
col.prop(cscene, "transparent_max_bounces", text="Transparency")
col.prop(cscene, "transmission_bounces", text="Transmission")
col.prop(cscene, "volume_bounces", text="Volume")
col = layout.column(align=True)
col.prop(cscene, "transparent_max_bounces", text="Transparent")
class CYCLES_RENDER_PT_light_paths_clamping(CyclesButtonsPanel, Panel):
bl_label = "Clamping"

View File

@@ -137,9 +137,9 @@ bool BlenderImageLoader::load_pixels(const ImageMetaData &metadata,
/* Premultiply, byte images are always straight for Blender. */
unsigned char *cp = (unsigned char *)pixels;
for (size_t i = 0; i < num_pixels; i++, cp += channels) {
cp[0] = (cp[0] * cp[3]) / 255;
cp[1] = (cp[1] * cp[3]) / 255;
cp[2] = (cp[2] * cp[3]) / 255;
cp[0] = (cp[0] * cp[3]) >> 8;
cp[1] = (cp[1] * cp[3]) >> 8;
cp[2] = (cp[2] * cp[3]) >> 8;
}
}
}

View File

@@ -109,23 +109,23 @@ void BlenderSync::sync_object_motion_init(BL::Object &b_parent, BL::Object &b_ob
}
Geometry *geom = object->get_geometry();
geom->set_use_motion_blur(false);
geom->set_motion_steps(0);
int motion_steps = 0;
bool use_motion_blur = false;
uint motion_steps;
if (need_motion == Scene::MOTION_BLUR) {
motion_steps = object_motion_steps(b_parent, b_ob, Object::MAX_MOTION_STEPS);
geom->set_motion_steps(motion_steps);
if (motion_steps && object_use_deform_motion(b_parent, b_ob)) {
use_motion_blur = true;
geom->set_use_motion_blur(true);
}
}
else {
motion_steps = 3;
geom->set_motion_steps(motion_steps);
}
geom->set_use_motion_blur(use_motion_blur);
geom->set_motion_steps(motion_steps);
motion.resize(motion_steps, transform_empty());
if (motion_steps) {

View File

@@ -404,6 +404,8 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
Film *film = scene->film;
vector<Pass> prevpasses = scene->passes;
if (b_v3d) {
film->set_display_pass(update_viewport_display_passes(b_v3d, scene->passes));
}
@@ -433,6 +435,11 @@ void BlenderSync::sync_film(BL::SpaceView3D &b_v3d)
break;
}
}
if (!Pass::equals(prevpasses, scene->passes)) {
film->tag_passes_update(scene, prevpasses, false);
film->tag_modified();
}
}
/* Render Layer */
@@ -742,13 +749,10 @@ vector<Pass> BlenderSync::sync_render_passes(BL::Scene &b_scene,
DENOISING_CLEAN_ALL_PASSES);
scene->film->set_denoising_prefiltered_pass(denoising.store_passes &&
denoising.type == DENOISER_NLM);
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
if (!Pass::equals(passes, scene->passes)) {
scene->film->tag_passes_update(scene, passes);
scene->film->tag_modified();
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
}
scene->film->set_pass_alpha_threshold(b_view_layer.pass_alpha_threshold());
scene->film->tag_passes_update(scene, passes);
scene->integrator->tag_update(scene, Integrator::UPDATE_ALL);
return passes;
}

View File

@@ -40,8 +40,8 @@ BlenderViewportParameters::BlenderViewportParameters(BL::SpaceView3D &b_v3d)
BL::View3DShading shading = b_v3d.shading();
PointerRNA cshading = RNA_pointer_get(&shading.ptr, "cycles");
/* We only copy the shading parameters if we are in look-dev mode.
* Otherwise defaults are being used. These defaults mimic normal render settings. */
/* We only copy the shading parameters if we are in look dev mode. otherwise
* defaults are being used. These defaults mimic normal render settings */
if (shading.type() == BL::View3DShading::type_RENDERED) {
use_scene_world = shading.use_scene_world_render();
use_scene_lights = shading.use_scene_lights_render();

View File

@@ -86,7 +86,8 @@ ccl_device_inline float3 smooth_surface_offset(KernelGlobals *kg, ShaderData *sd
float3 P = V[0] * u + V[1] * v + V[2] * w; /* Local space */
float3 n = N[0] * u + N[1] * v + N[2] * w; /* We get away without normalization */
object_normal_transform(kg, sd, &n); /* Normal x scale, world space */
n = normalize(
transform_direction_transposed_auto(&sd->ob_itfm, n)); /* Normal x scale, world space */
/* Parabolic approximation */
float a = dot(N[2] - N[0], V[0] - V[2]);

View File

@@ -237,7 +237,7 @@ ccl_device bool curve_intersect_iterative(const float3 ray_dir,
return false; /* Rejects NaNs */
}
/* Back-face culling. */
/* Backface culling. */
const float3 R = normalize(Q - P);
const float3 U = dradiusdu * R + dPdu;
const float3 V = cross(dPdu, R);
@@ -458,12 +458,10 @@ ccl_device_inline bool cylinder_culling_test(const float2 p1, const float2 p2, c
return num * num <= r * r * den2;
}
/**
* Intersects a ray with a quad with back-face culling
* enabled. The quad v0,v1,v2,v3 is split into two triangles
* v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two
* triangles gets intersected.
*/
/*! Intersects a ray with a quad with backface culling
* enabled. The quad v0,v1,v2,v3 is split into two triangles
* v0,v1,v3 and v2,v3,v1. The edge v1,v2 decides which of the two
* triangles gets intersected. */
ccl_device_inline bool ribbon_intersect_quad(const float ray_tfar,
const float3 quad_v0,
const float3 quad_v1,

View File

@@ -40,7 +40,7 @@ ccl_device_noinline void compute_light_pass(
/* Evaluate surface shader. */
shader_eval_surface(kg, sd, &state, NULL, state.flag);
/* TODO: disable more closures we don't need besides transparent. */
/* TODO, disable more closures we don't need besides transparent */
shader_bsdf_disable_transparency(kg, sd);
/* Init ray. */

View File

@@ -50,29 +50,24 @@ ccl_device void svm_node_vector_rotate(ShaderData *sd,
}
else {
float3 axis;
float axis_length;
switch (type) {
case NODE_VECTOR_ROTATE_TYPE_AXIS_X:
axis = make_float3(1.0f, 0.0f, 0.0f);
axis_length = 1.0f;
break;
case NODE_VECTOR_ROTATE_TYPE_AXIS_Y:
axis = make_float3(0.0f, 1.0f, 0.0f);
axis_length = 1.0f;
break;
case NODE_VECTOR_ROTATE_TYPE_AXIS_Z:
axis = make_float3(0.0f, 0.0f, 1.0f);
axis_length = 1.0f;
break;
default:
axis = stack_load_float3(stack, axis_stack_offset);
axis_length = len(axis);
axis = normalize(stack_load_float3(stack, axis_stack_offset));
break;
}
float angle = stack_load_float(stack, angle_stack_offset);
angle = invert ? -angle : angle;
result = (axis_length != 0.0f) ?
rotate_around_axis(vector - center, axis / axis_length, angle) + center :
result = (len_squared(axis) != 0.0f) ?
rotate_around_axis(vector - center, axis, angle) + center :
vector;
}

View File

@@ -81,7 +81,7 @@ class Camera : public Node {
/* ** Rolling shutter effect. ** */
/* Defines rolling shutter effect type. */
NODE_SOCKET_API(RollingShutterType, rolling_shutter_type)
/* Specifies exposure time of scan-lines when using
/* Specifies exposure time of scanlines when using
* rolling shutter effect.
*/
NODE_SOCKET_API(float, rolling_shutter_duration)

View File

@@ -16,10 +16,8 @@
#include "render/image_vdb.h"
#include "util/util_logging.h"
#include "util/util_openvdb.h"
#ifdef WITH_OPENVDB
# include <openvdb/openvdb.h>
# include <openvdb/tools/Dense.h>
#endif
#ifdef WITH_NANOVDB
@@ -28,57 +26,6 @@
CCL_NAMESPACE_BEGIN
#ifdef WITH_OPENVDB
struct NumChannelsOp {
int num_channels = 0;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &)
{
num_channels = channels;
return true;
}
};
struct ToDenseOp {
openvdb::CoordBBox bbox;
void *pixels;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
openvdb::tools::Dense<FloatDataType, openvdb::tools::LayoutXYZ> dense(bbox,
(FloatDataType *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<GridType>(grid), dense);
return true;
}
};
# ifdef WITH_NANOVDB
struct ToNanoOp {
nanovdb::GridHandle<> nanogrid;
template<typename GridType, typename FloatGridType, typename FloatDataType, int channels>
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
if constexpr (!std::is_same_v<GridType, openvdb::MaskGrid>) {
try {
nanogrid = nanovdb::openToNanoVDB(
FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
}
catch (const std::exception &e) {
VLOG(1) << "Error converting OpenVDB to NanoVDB grid: " << e.what();
}
return true;
}
else {
return false;
}
}
};
# endif
#endif
VDBImageLoader::VDBImageLoader(const string &grid_name) : grid_name(grid_name)
{
}
@@ -94,40 +41,98 @@ bool VDBImageLoader::load_metadata(const ImageDeviceFeatures &features, ImageMet
return false;
}
/* Get number of channels from type. */
NumChannelsOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
metadata.channels = op.num_channels;
/* Set data type. */
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
/* NanoVDB expects no inactive leaf nodes. */
/*openvdb::FloatGrid &pruned_grid = *openvdb::gridPtrCast<openvdb::FloatGrid>(grid);
openvdb::tools::pruneInactive(pruned_grid.tree());
nanogrid = nanovdb::openToNanoVDB(pruned_grid);*/
ToNanoOp op;
if (!openvdb::grid_type_operation(grid, op)) {
return false;
}
nanogrid = std::move(op.nanogrid);
}
# endif
/* Set dimensions. */
bbox = grid->evalActiveVoxelBoundingBox();
if (bbox.empty()) {
return false;
}
/* Set dimensions. */
openvdb::Coord dim = bbox.dim();
metadata.width = dim.x();
metadata.height = dim.y();
metadata.depth = dim.z();
/* Set data type. */
if (grid->isType<openvdb::FloatGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid));
}
# endif
}
else if (grid->isType<openvdb::BoolGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::DoubleGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int32Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Int64Grid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::FloatGrid(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
metadata.channels = 3;
# ifdef WITH_NANOVDB
if (features.has_nanovdb) {
nanogrid = nanovdb::openToNanoVDB(
openvdb::Vec3fGrid(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid)));
}
# endif
}
else if (grid->isType<openvdb::MaskGrid>()) {
metadata.channels = 1;
# ifdef WITH_NANOVDB
return false; // Unsupported
# endif
}
else {
return false;
}
# ifdef WITH_NANOVDB
if (nanogrid) {
metadata.byte_size = nanogrid.size();
@@ -195,10 +200,45 @@ bool VDBImageLoader::load_pixels(const ImageMetaData &, void *pixels, const size
else
# endif
{
ToDenseOp op;
op.pixels = pixels;
op.bbox = bbox;
openvdb::grid_type_operation(grid, op);
if (grid->isType<openvdb::FloatGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::FloatGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3fGrid>(grid), dense);
}
else if (grid->isType<openvdb::BoolGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::BoolGrid>(grid), dense);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::DoubleGrid>(grid), dense);
}
else if (grid->isType<openvdb::Int32Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int32Grid>(grid), dense);
}
else if (grid->isType<openvdb::Int64Grid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Int64Grid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3IGrid>(grid), dense);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
openvdb::tools::Dense<openvdb::Vec3f, openvdb::tools::LayoutXYZ> dense(
bbox, (openvdb::Vec3f *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::Vec3dGrid>(grid), dense);
}
else if (grid->isType<openvdb::MaskGrid>()) {
openvdb::tools::Dense<float, openvdb::tools::LayoutXYZ> dense(bbox, (float *)pixels);
openvdb::tools::copyToDense(*openvdb::gridConstPtrCast<openvdb::MaskGrid>(grid), dense);
}
}
return true;
#else

View File

@@ -209,7 +209,7 @@ class SceneParams {
int curve_subdivisions()
{
/* Matching the tessellation rate limit in Embree. */
/* Matching the tesselation rate limit in Embree. */
return clamp(1 << hair_subdivisions, 1, 16);
}
};

View File

@@ -227,25 +227,66 @@ void Session::run_gpu()
progress.set_render_start_time();
while (!progress.get_cancel()) {
const bool no_tiles = !run_update_for_next_iteration();
/* advance to next tile */
bool no_tiles = !tile_manager.next();
DeviceKernelStatus kernel_state = DEVICE_KERNEL_UNKNOWN;
if (no_tiles) {
if (params.background) {
/* if no work left and in background mode, we can stop immediately */
kernel_state = device->get_active_kernel_switch_state();
}
if (params.background) {
/* if no work left and in background mode, we can stop immediately */
if (no_tiles) {
progress.set_status("Finished");
break;
}
}
if (run_wait_for_work(no_tiles)) {
continue;
else if (no_tiles && kernel_state == DEVICE_KERNEL_FEATURE_KERNEL_AVAILABLE) {
reset_gpu(tile_manager.params, params.samples);
}
if (progress.get_cancel()) {
break;
else {
/* if in interactive mode, and we are either paused or done for now,
* wait for pause condition notify to wake up again */
thread_scoped_lock pause_lock(pause_mutex);
if (!pause && !tile_manager.done()) {
/* reset could have happened after no_tiles was set, before this lock.
* in this case we shall not wait for pause condition
*/
}
else if (pause || no_tiles) {
update_status_time(pause, no_tiles);
while (1) {
scoped_timer pause_timer;
pause_cond.wait(pause_lock);
if (pause) {
progress.add_skip_time(pause_timer, params.background);
}
update_status_time(pause, no_tiles);
progress.set_update();
if (!pause)
break;
}
}
if (progress.get_cancel())
break;
}
if (!no_tiles) {
/* update scene */
scoped_timer update_timer;
if (update_scene()) {
profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
if (!device->error_message().empty())
progress.set_error(device->error_message());
@@ -688,27 +729,82 @@ void Session::run_cpu()
last_update_time = time_dt();
last_display_time = last_update_time;
{
/* reset once to start */
thread_scoped_lock reset_lock(delayed_reset.mutex);
thread_scoped_lock buffers_lock(buffers_mutex);
thread_scoped_lock display_lock(display_mutex);
reset_(delayed_reset.params, delayed_reset.samples);
delayed_reset.do_reset = false;
}
while (!progress.get_cancel()) {
const bool no_tiles = !run_update_for_next_iteration();
/* advance to next tile */
bool no_tiles = !tile_manager.next();
bool need_copy_to_display_buffer = false;
DeviceKernelStatus kernel_state = DEVICE_KERNEL_UNKNOWN;
if (no_tiles) {
if (params.background) {
/* if no work left and in background mode, we can stop immediately */
kernel_state = device->get_active_kernel_switch_state();
}
if (params.background) {
/* if no work left and in background mode, we can stop immediately */
if (no_tiles) {
progress.set_status("Finished");
break;
}
}
if (run_wait_for_work(no_tiles)) {
continue;
else if (no_tiles && kernel_state == DEVICE_KERNEL_FEATURE_KERNEL_AVAILABLE) {
reset_cpu(tile_manager.params, params.samples);
}
if (progress.get_cancel()) {
break;
else {
/* if in interactive mode, and we are either paused or done for now,
* wait for pause condition notify to wake up again */
thread_scoped_lock pause_lock(pause_mutex);
if (!pause && delayed_reset.do_reset) {
/* reset once to start */
thread_scoped_lock reset_lock(delayed_reset.mutex);
thread_scoped_lock buffers_lock(buffers_mutex);
thread_scoped_lock display_lock(display_mutex);
reset_(delayed_reset.params, delayed_reset.samples);
delayed_reset.do_reset = false;
}
else if (pause || no_tiles) {
update_status_time(pause, no_tiles);
while (1) {
scoped_timer pause_timer;
pause_cond.wait(pause_lock);
if (pause) {
progress.add_skip_time(pause_timer, params.background);
}
update_status_time(pause, no_tiles);
progress.set_update();
if (!pause)
break;
}
}
if (progress.get_cancel())
break;
}
if (!no_tiles) {
/* update scene */
scoped_timer update_timer;
if (update_scene()) {
profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
if (!device->error_message().empty())
progress.set_error(device->error_message());
@@ -798,63 +894,6 @@ void Session::run()
progress.set_update();
}
bool Session::run_update_for_next_iteration()
{
thread_scoped_lock scene_lock(scene->mutex);
thread_scoped_lock reset_lock(delayed_reset.mutex);
if (delayed_reset.do_reset) {
thread_scoped_lock buffers_lock(buffers_mutex);
reset_(delayed_reset.params, delayed_reset.samples);
delayed_reset.do_reset = false;
}
const bool have_tiles = tile_manager.next();
if (have_tiles) {
scoped_timer update_timer;
if (update_scene()) {
profiler.reset(scene->shaders.size(), scene->objects.size());
}
progress.add_skip_time(update_timer, params.background);
}
return have_tiles;
}
bool Session::run_wait_for_work(bool no_tiles)
{
/* In an offline rendering there is no pause, and no tiles will mean the job is fully done. */
if (params.background) {
return false;
}
thread_scoped_lock pause_lock(pause_mutex);
if (!pause && !no_tiles) {
return false;
}
update_status_time(pause, no_tiles);
while (true) {
scoped_timer pause_timer;
pause_cond.wait(pause_lock);
if (pause) {
progress.add_skip_time(pause_timer, params.background);
}
update_status_time(pause, no_tiles);
progress.set_update();
if (!pause) {
break;
}
}
return no_tiles;
}
bool Session::draw(BufferParams &buffer_params, DeviceDrawParams &draw_params)
{
if (device_use_gl)
@@ -973,6 +1012,8 @@ void Session::wait()
bool Session::update_scene()
{
thread_scoped_lock scene_lock(scene->mutex);
/* update camera if dimensions changed for progressive render. the camera
* knows nothing about progressive or cropped rendering, it just gets the
* image dimensions passed in */

View File

@@ -178,9 +178,6 @@ class Session {
void run();
bool run_update_for_next_iteration();
bool run_wait_for_work(bool no_tiles);
void update_status_time(bool show_pause = false, bool show_done = false);
void render(bool use_denoise);

View File

@@ -25,42 +25,6 @@ namespace openvdb {
using Vec4fTree = tree::Tree4<Vec4f, 5, 4, 3>::Type;
using Vec4fGrid = Grid<Vec4fTree>;
/* Apply operation to known grid types. */
template<typename OpType>
bool grid_type_operation(const openvdb::GridBase::ConstPtr &grid, OpType &&op)
{
if (grid->isType<openvdb::FloatGrid>()) {
return op.template operator()<openvdb::FloatGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3fGrid>()) {
return op.template operator()<openvdb::Vec3fGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::BoolGrid>()) {
return op.template operator()<openvdb::BoolGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::DoubleGrid>()) {
return op.template operator()<openvdb::DoubleGrid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int32Grid>()) {
return op.template operator()<openvdb::Int32Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Int64Grid>()) {
return op.template operator()<openvdb::Int64Grid, openvdb::FloatGrid, float, 1>(grid);
}
else if (grid->isType<openvdb::Vec3IGrid>()) {
return op.template operator()<openvdb::Vec3IGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::Vec3dGrid>()) {
return op.template operator()<openvdb::Vec3dGrid, openvdb::Vec3fGrid, openvdb::Vec3f, 3>(grid);
}
else if (grid->isType<openvdb::MaskGrid>()) {
return op.template operator()<openvdb::MaskGrid, openvdb::FloatGrid, float, 1>(grid);
}
else {
return false;
}
}
}; // namespace openvdb
#endif

View File

@@ -155,9 +155,6 @@ if(WITH_HEADLESS OR WITH_GHOST_SDL)
endif()
elseif(APPLE AND NOT WITH_GHOST_X11)
if(WITH_INPUT_IME)
add_definitions(-DWITH_INPUT_IME)
endif()
list(APPEND SRC
intern/GHOST_DisplayManagerCocoa.mm
intern/GHOST_SystemCocoa.mm
@@ -288,37 +285,16 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
${dbus_INCLUDE_DIRS}
)
include(CheckSymbolExists)
set(CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE)
if (HAVE_MEMFD_CREATE)
add_definitions(-DHAVE_MEMFD_CREATE)
endif()
list(APPEND SRC
intern/GHOST_SystemWayland.cpp
intern/GHOST_WindowWayland.cpp
intern/GHOST_SystemWayland.h
intern/GHOST_WaylandCursorSettings.h
intern/GHOST_WindowWayland.h
)
pkg_get_variable(WAYLAND_SCANNER wayland-scanner wayland_scanner)
pkg_check_modules(wayland-protocols wayland-protocols>=1.15)
if (${wayland-protocols_FOUND})
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
else()
find_path(WAYLAND_PROTOCOLS_DIR
NAMES unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
PATH_SUFFIXES share/wayland-protocols
)
endif()
if (NOT EXISTS ${WAYLAND_PROTOCOLS_DIR})
message(FATAL_ERROR "path to wayland-protocols not found")
endif()
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
# Generate protocols bindings.
macro(generate_protocol_bindings NAME PROT_DEF)

View File

@@ -96,7 +96,7 @@ extern GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consu
* \param systemhandle: The handle to the system.
* \return The number of milliseconds.
*/
extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
extern GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
/**
* Installs a timer.
@@ -110,8 +110,8 @@ extern uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle);
* \return A timer task (0 if timer task installation failed).
*/
extern GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
uint64_t delay,
uint64_t interval,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData);
@@ -133,7 +133,7 @@ extern GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
* \param systemhandle: The handle to the system.
* \return The number of displays.
*/
extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
extern GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
/**
* Returns the dimensions of the main display on this system.
@@ -142,8 +142,8 @@ extern uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle);
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height);
GHOST_TUns32 *width,
GHOST_TUns32 *height);
/**
* Returns the dimensions of all displays combine
@@ -154,8 +154,8 @@ extern void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
* \param height: A pointer the height gets put in.
*/
extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height);
GHOST_TUns32 *width,
GHOST_TUns32 *height);
/**
* Create a new window.
@@ -178,10 +178,10 @@ extern void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
extern GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle parent_windowhandle,
const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
bool is_dialog,
GHOST_TDrawingContextType type,
@@ -360,13 +360,13 @@ extern GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
uint8_t *bitmap,
uint8_t *mask,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor);
GHOST_TUns8 canInvertColor);
/**
* Returns the visibility state of the cursor.
@@ -391,8 +391,8 @@ extern GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
int32_t *x,
int32_t *y);
GHOST_TInt32 *x,
GHOST_TInt32 *y);
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -403,8 +403,8 @@ extern GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
int32_t x,
int32_t y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Grabs the cursor for a modal operation, to keep receiving
@@ -467,7 +467,7 @@ extern void GHOST_setNDOFDeadZone(float deadzone);
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
*/
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept);
extern void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept);
/**
* Returns the event type.
@@ -481,7 +481,7 @@ extern GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle);
* \param eventhandle: The handle to the event.
* \return The event generation time.
*/
extern uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle);
extern GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle);
/**
* Returns the window this event was generated on,
@@ -507,7 +507,7 @@ extern GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhand
/**
* Changes the timer callback.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \param timerProc: The timer callback.
*/
extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
@@ -515,14 +515,14 @@ extern void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle,
/**
* Returns the timer user data.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \return The timer user data.
*/
extern GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle);
/**
* Changes the time user data.
* \param timertaskhandle: The handle to the timer-task.
* \param timertaskhandle: The handle to the timertask.
* \param userdata: The timer user data.
*/
extern void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle,
@@ -595,7 +595,7 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle);
* \param width: The new width of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width);
extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width);
/**
* Resizes client rectangle height.
@@ -603,7 +603,7 @@ extern GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint
* \param height: The new height of the client area of the window.
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height);
extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height);
/**
* Resizes client rectangle.
@@ -613,8 +613,8 @@ extern GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uin
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
uint32_t width,
uint32_t height);
GHOST_TUns32 width,
GHOST_TUns32 height);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -624,8 +624,11 @@ extern GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
extern void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
extern void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -635,8 +638,11 @@ extern void GHOST_ScreenToClient(
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
extern void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY);
extern void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY);
/**
* Returns the state of the window (normal, minimized, maximized).
@@ -661,7 +667,7 @@ extern GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle,
* \return Indication of success.
*/
extern GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
bool isUnsavedChanges);
GHOST_TUns8 isUnsavedChanges);
/**
* Sets the order of the window (bottom, top).
@@ -752,14 +758,14 @@ extern void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI
* \param rectanglehandle: The handle to the rectangle.
* \return width of the rectangle
*/
extern int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
extern GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Access to rectangle height.
* \param rectanglehandle: The handle to the rectangle.
* \return height of the rectangle
*/
extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
extern GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
/**
* Gets all members of the rectangle.
@@ -769,8 +775,11 @@ extern int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle);
* \param r: Pointer to return right coordinate in.
* \param b: Pointer to return bottom coordinate in.
*/
extern void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b);
extern void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b);
/**
* Sets all members of the rectangle.
@@ -780,8 +789,11 @@ extern void GHOST_GetRectangle(
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
extern void GHOST_SetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b);
extern void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
@@ -806,7 +818,7 @@ extern GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehand
* \param rectanglehandle: The handle to the rectangle.
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i);
extern void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -823,7 +835,9 @@ extern void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y);
extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Returns whether the point is inside this rectangle.
@@ -834,8 +848,8 @@ extern void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int
* \return Success value (true if point is inside).
*/
extern GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
int32_t x,
int32_t y);
GHOST_TInt32 x,
GHOST_TInt32 y);
/**
* Returns whether the rectangle is inside this rectangle.
@@ -854,8 +868,8 @@ extern GHOST_TVisibility GHOST_GetRectangleVisibility(
* \param cy: Requested center y-coordinate of the rectangle.
*/
extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
int32_t cx,
int32_t cy);
GHOST_TInt32 cx,
GHOST_TInt32 cy);
/**
* Sets rectangle members.
@@ -867,8 +881,11 @@ extern void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
extern void GHOST_SetRectangleCenter(
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h);
extern void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h);
/**
* Clips a rectangle.
@@ -886,14 +903,14 @@ extern GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
* \param selection: Boolean to return the selection instead, X11 only feature.
* \return clipboard data
*/
extern char *GHOST_getClipboard(bool selection);
extern GHOST_TUns8 *GHOST_getClipboard(int selection);
/**
* Put data to the Clipboard
* \param buffer: the string buffer to set.
* \param selection: Set the selection instead, X11 only feature.
*/
extern void GHOST_putClipboard(const char *buffer, bool selection);
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
/**
* Toggles console
@@ -925,7 +942,7 @@ extern float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle);
/**
* Returns the suggested DPI for this window.
*/
extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
extern GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
/**
* Enable IME attached to the given window, i.e. allows user-input
@@ -939,8 +956,12 @@ extern uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle);
* - true: Start a new composition.
* - false: Move the IME windows to the given position without finishing it.
*/
extern void GHOST_BeginIME(
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete);
extern void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete);
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input
* events from being dispatched to the IME.
@@ -1055,7 +1076,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_context, const char *acti
*/
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionInfo *infos);
/**
@@ -1063,7 +1084,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const char *const *action_names);
/**
@@ -1071,7 +1092,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1079,7 +1100,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos);
/**
@@ -1087,7 +1108,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_context,
*/
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1095,7 +1116,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_context,
*/
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_context,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos);
/**
@@ -1117,7 +1138,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_context, const char *action_set
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_context,
const char *action_set_name,
const char *action_name,
const int64_t *duration,
const GHOST_TInt64 *duration,
const float *frequency,
const float *amplitude);

View File

@@ -58,7 +58,7 @@ class GHOST_IEvent {
* Returns the time this event was generated.
* \return The event generation time.
*/
virtual uint64_t getTime() = 0;
virtual GHOST_TUns64 getTime() = 0;
/**
* Returns the window this event was generated on,

View File

@@ -177,7 +177,7 @@ class GHOST_ISystem {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
virtual uint64_t getMilliSeconds() const = 0;
virtual GHOST_TUns64 getMilliSeconds() const = 0;
/**
* Installs a timer.
@@ -189,8 +189,8 @@ class GHOST_ISystem {
* \param userData: Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
virtual GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
virtual GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL) = 0;
@@ -209,19 +209,19 @@ class GHOST_ISystem {
* Returns the number of displays on this system.
* \return The number of displays.
*/
virtual uint8_t getNumDisplays() const = 0;
virtual GHOST_TUns8 getNumDisplays() const = 0;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
virtual void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
virtual void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
/**
* Returns the combine dimensions of all monitors.
* \return The dimension of the workspace.
*/
virtual void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const = 0;
virtual void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const = 0;
/**
* Create a new window.
@@ -242,10 +242,10 @@ class GHOST_ISystem {
* \return The new window (or 0 if creation failed).
*/
virtual GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -365,7 +365,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const = 0;
virtual GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const = 0;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -374,7 +374,7 @@ class GHOST_ISystem {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCursorPosition(int32_t x, int32_t y) = 0;
virtual GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y) = 0;
/***************************************************************************************
* Access to mouse button and keyboard states.
@@ -431,12 +431,12 @@ class GHOST_ISystem {
* \return "unsigned char" from X11 XA_CUT_BUFFER0 buffer
*
*/
virtual char *getClipboard(bool selection) const = 0;
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
/**
* Put data to the Clipboard
*/
virtual void putClipboard(const char *buffer, bool selection) const = 0;
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/***************************************************************************************
* System Message Box.

View File

@@ -68,26 +68,26 @@ class GHOST_ISystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
virtual const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
virtual const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const = 0;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
virtual const char *getBinaryDir() const = 0;
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files

View File

@@ -108,20 +108,20 @@ class GHOST_IWindow {
* Resizes client rectangle width.
* \param width: The new width of the client area of the window.
*/
virtual GHOST_TSuccess setClientWidth(uint32_t width) = 0;
virtual GHOST_TSuccess setClientWidth(GHOST_TUns32 width) = 0;
/**
* Resizes client rectangle height.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientHeight(uint32_t height) = 0;
virtual GHOST_TSuccess setClientHeight(GHOST_TUns32 height) = 0;
/**
* Resizes client rectangle.
* \param width: The new width of the client area of the window.
* \param height: The new height of the client area of the window.
*/
virtual GHOST_TSuccess setClientSize(uint32_t width, uint32_t height) = 0;
virtual GHOST_TSuccess setClientSize(GHOST_TUns32 width, GHOST_TUns32 height) = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -130,7 +130,10 @@ class GHOST_IWindow {
* \param outX: The x-coordinate in the client rectangle.
* \param outY: The y-coordinate in the client rectangle.
*/
virtual void screenToClient(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
virtual void screenToClient(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
/**
* Converts a point in screen coordinates to client rectangle coordinates
@@ -139,7 +142,10 @@ class GHOST_IWindow {
* \param outX: The x-coordinate on the screen.
* \param outY: The y-coordinate on the screen.
*/
virtual void clientToScreen(int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const = 0;
virtual void clientToScreen(GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 &outX,
GHOST_TInt32 &outY) const = 0;
/**
* Tells if the ongoing drag'n'drop object can be accepted upon mouse drop
@@ -284,8 +290,8 @@ class GHOST_IWindow {
* \param hotY: The Y coordinate of the cursor hot-spot.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCustomCursorShape(uint8_t *bitmap,
uint8_t *mask,
virtual GHOST_TSuccess setCustomCursorShape(GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
@@ -313,7 +319,7 @@ class GHOST_IWindow {
virtual GHOST_TSuccess setCursorGrab(GHOST_TGrabCursorMode /*mode*/,
GHOST_TAxisFlag /*wrap_axis*/,
GHOST_Rect * /*bounds*/,
int32_t /*mouse_ungrab_xy*/[2])
GHOST_TInt32 /*mouse_ungrab_xy*/[2])
{
return GHOST_kSuccess;
}
@@ -328,7 +334,7 @@ class GHOST_IWindow {
* Returns the recommended DPI for this window.
* \return The recommended DPI for this window.
*/
virtual uint16_t getDPIHint() = 0;
virtual GHOST_TUns16 getDPIHint() = 0;
#ifdef WITH_INPUT_IME
/**
@@ -342,7 +348,8 @@ class GHOST_IWindow {
* - true: Start a new composition
* - false: Move the IME windows to the given position without finishing it.
*/
virtual void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) = 0;
virtual void beginIME(
GHOST_TInt32 x, GHOST_TInt32 y, GHOST_TInt32 w, GHOST_TInt32 h, int completed) = 0;
/**
* Disable the IME attached to the given window, i.e. prohibits any user-input

View File

@@ -48,25 +48,25 @@ extern GHOST_TSuccess GHOST_DisposeSystemPaths(void);
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
extern const char *GHOST_getSystemDir(int version, const char *versionstr);
extern const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr);
/**
* Determine the base dir in which user configuration is stored, including versioning.
* \return Unsigned char string pointing to user dir (eg ~).
*/
extern const char *GHOST_getUserDir(int version, const char *versionstr);
extern const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr);
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
extern const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
extern const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type);
/**
* Determine the dir in which the binary file is found.
* \return Unsigned char string pointing to binary dir (eg ~/usr/local/bin/).
*/
extern const char *GHOST_getBinaryDir(void);
extern const GHOST_TUns8 *GHOST_getBinaryDir(void);
/**
* Add the file to the operating system most recently used files

View File

@@ -42,7 +42,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
GHOST_Rect(int32_t l = 0, int32_t t = 0, int32_t r = 0, int32_t b = 0)
GHOST_Rect(GHOST_TInt32 l = 0, GHOST_TInt32 t = 0, GHOST_TInt32 r = 0, GHOST_TInt32 b = 0)
: m_l(l), m_t(t), m_r(r), m_b(b)
{
}
@@ -58,13 +58,13 @@ class GHOST_Rect {
* Access to rectangle width.
* \return width of the rectangle.
*/
virtual inline int32_t getWidth() const;
virtual inline GHOST_TInt32 getWidth() const;
/**
* Access to rectangle height.
* \return height of the rectangle.
*/
virtual inline int32_t getHeight() const;
virtual inline GHOST_TInt32 getHeight() const;
/**
* Sets all members of the rectangle.
@@ -73,7 +73,7 @@ class GHOST_Rect {
* \param r: requested right coordinate of the rectangle.
* \param b: requested bottom coordinate of the rectangle.
*/
virtual inline void set(int32_t l, int32_t t, int32_t r, int32_t b);
virtual inline void set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b);
/**
* Returns whether this rectangle is empty.
@@ -95,7 +95,7 @@ class GHOST_Rect {
* The method avoids negative insets making the rectangle invalid
* \param i: The amount of offset given to each extreme (negative values shrink the rectangle).
*/
virtual void inset(int32_t i);
virtual void inset(GHOST_TInt32 i);
/**
* Does a union of the rectangle given and this rectangle.
@@ -109,14 +109,17 @@ class GHOST_Rect {
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void unionPoint(int32_t x, int32_t y);
virtual inline void unionPoint(GHOST_TInt32 x, GHOST_TInt32 y);
/**
* Grows the rectangle to included a point.
* \param x: The x-coordinate of the point.
* \param y: The y-coordinate of the point.
*/
virtual inline void wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis);
virtual inline void wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis);
/**
* Returns whether the point is inside this rectangle.
@@ -125,7 +128,7 @@ class GHOST_Rect {
* \param y: y-coordinate of point to test.
* \return boolean value (true if point is inside).
*/
virtual inline bool isInside(int32_t x, int32_t y) const;
virtual inline bool isInside(GHOST_TInt32 x, GHOST_TInt32 y) const;
/**
* Returns whether the rectangle is inside this rectangle.
@@ -140,7 +143,7 @@ class GHOST_Rect {
* \param cx: requested center x-coordinate of the rectangle.
* \param cy: requested center y-coordinate of the rectangle.
*/
virtual void setCenter(int32_t cx, int32_t cy);
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy);
/**
* Sets rectangle members.
@@ -151,7 +154,7 @@ class GHOST_Rect {
* \param w: requested width of the rectangle.
* \param h: requested height of the rectangle.
*/
virtual void setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h);
virtual void setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h);
/**
* Clips a rectangle.
@@ -163,30 +166,30 @@ class GHOST_Rect {
virtual bool clip(GHOST_Rect &r) const;
/** Left coordinate of the rectangle */
int32_t m_l;
GHOST_TInt32 m_l;
/** Top coordinate of the rectangle */
int32_t m_t;
GHOST_TInt32 m_t;
/** Right coordinate of the rectangle */
int32_t m_r;
GHOST_TInt32 m_r;
/** Bottom coordinate of the rectangle */
int32_t m_b;
GHOST_TInt32 m_b;
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("GHOST:GHOST_Rect")
#endif
};
inline int32_t GHOST_Rect::getWidth() const
inline GHOST_TInt32 GHOST_Rect::getWidth() const
{
return m_r - m_l;
}
inline int32_t GHOST_Rect::getHeight() const
inline GHOST_TInt32 GHOST_Rect::getHeight() const
{
return m_b - m_t;
}
inline void GHOST_Rect::set(int32_t l, int32_t t, int32_t r, int32_t b)
inline void GHOST_Rect::set(GHOST_TInt32 l, GHOST_TInt32 t, GHOST_TInt32 r, GHOST_TInt32 b)
{
m_l = l;
m_t = t;
@@ -216,7 +219,7 @@ inline void GHOST_Rect::unionRect(const GHOST_Rect &r)
m_b = r.m_b;
}
inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
inline void GHOST_Rect::unionPoint(GHOST_TInt32 x, GHOST_TInt32 y)
{
if (x < m_l)
m_l = x;
@@ -228,10 +231,13 @@ inline void GHOST_Rect::unionPoint(int32_t x, int32_t y)
m_b = y;
}
inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAxisFlag axis)
inline void GHOST_Rect::wrapPoint(GHOST_TInt32 &x,
GHOST_TInt32 &y,
GHOST_TInt32 ofs,
GHOST_TAxisFlag axis)
{
int32_t w = getWidth();
int32_t h = getHeight();
GHOST_TInt32 w = getWidth();
GHOST_TInt32 h = getHeight();
/* highly unlikely but avoid eternal loop */
if (w - ofs * 2 <= 0 || h - ofs * 2 <= 0) {
@@ -252,7 +258,7 @@ inline void GHOST_Rect::wrapPoint(int32_t &x, int32_t &y, int32_t ofs, GHOST_TAx
}
}
inline bool GHOST_Rect::isInside(int32_t x, int32_t y) const
inline bool GHOST_Rect::isInside(GHOST_TInt32 x, GHOST_TInt32 y) const
{
return (x >= m_l) && (x <= m_r) && (y >= m_t) && (y <= m_b);
}

View File

@@ -23,8 +23,6 @@
#pragma once
#include <stdint.h>
#ifdef WITH_CXX_GUARDEDALLOC
# include "MEM_guardedalloc.h"
#endif
@@ -58,6 +56,13 @@ GHOST_DECLARE_HANDLE(GHOST_EventConsumerHandle);
GHOST_DECLARE_HANDLE(GHOST_ContextHandle);
GHOST_DECLARE_HANDLE(GHOST_XrContextHandle);
typedef char GHOST_TInt8;
typedef unsigned char GHOST_TUns8;
typedef short GHOST_TInt16;
typedef unsigned short GHOST_TUns16;
typedef int GHOST_TInt32;
typedef unsigned int GHOST_TUns32;
typedef struct {
int flags;
} GHOST_GLSettings;
@@ -73,6 +78,14 @@ typedef enum GHOST_DialogOptions {
GHOST_DialogError = (1 << 1),
} GHOST_DialogOptions;
#ifdef _MSC_VER
typedef __int64 GHOST_TInt64;
typedef unsigned __int64 GHOST_TUns64;
#else
typedef long long GHOST_TInt64;
typedef unsigned long long GHOST_TUns64;
#endif
typedef void *GHOST_TUserDataPtr;
typedef enum { GHOST_kFailure = 0, GHOST_kSuccess } GHOST_TSuccess;
@@ -423,9 +436,9 @@ typedef void *GHOST_TEventDataPtr;
typedef struct {
/** The x-coordinate of the cursor position. */
int32_t x;
GHOST_TInt32 x;
/** The y-coordinate of the cursor position. */
int32_t y;
GHOST_TInt32 y;
/** Associated tablet data. */
GHOST_TabletData tablet;
} GHOST_TEventCursorData;
@@ -439,7 +452,7 @@ typedef struct {
typedef struct {
/** Displacement of a mouse wheel. */
int32_t z;
GHOST_TInt32 z;
} GHOST_TEventWheelData;
typedef enum {
@@ -455,13 +468,13 @@ typedef struct {
/** The event subtype */
GHOST_TTrackpadEventSubTypes subtype;
/** The x-location of the trackpad event */
int32_t x;
GHOST_TInt32 x;
/** The y-location of the trackpad event */
int32_t y;
GHOST_TInt32 y;
/** The x-delta or value of the trackpad event */
int32_t deltaX;
GHOST_TInt32 deltaX;
/** The y-delta (currently only for scroll subtype) of the trackpad event */
int32_t deltaY;
GHOST_TInt32 deltaY;
/** The delta is inverted from the device due to system preferences. */
char isDirectionInverted;
} GHOST_TEventTrackpadData;
@@ -475,9 +488,9 @@ typedef enum {
typedef struct {
/** The x-coordinate of the cursor position. */
int32_t x;
GHOST_TInt32 x;
/** The y-coordinate of the cursor position. */
int32_t y;
GHOST_TInt32 y;
/** The dropped item type */
GHOST_TDragnDropTypes dataType;
/** The "dropped content" */
@@ -502,7 +515,7 @@ typedef struct {
typedef struct {
int count;
uint8_t **strings;
GHOST_TUns8 **strings;
} GHOST_TStringArray;
typedef enum {
@@ -574,13 +587,13 @@ typedef enum {
typedef struct {
/** Number of pixels on a line. */
uint32_t xPixels;
GHOST_TUns32 xPixels;
/** Number of lines. */
uint32_t yPixels;
GHOST_TUns32 yPixels;
/** Number of bits per pixel. */
uint32_t bpp;
GHOST_TUns32 bpp;
/** Refresh rate (in Hertz). */
uint32_t frequency;
GHOST_TUns32 frequency;
} GHOST_DisplaySetting;
#ifdef _WIN32
@@ -600,10 +613,10 @@ typedef int GHOST_TEmbedderWindowID;
*/
#ifdef __cplusplus
class GHOST_ITimerTask;
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, uint64_t time);
typedef void (*GHOST_TimerProcPtr)(GHOST_ITimerTask *task, GHOST_TUns64 time);
#else
struct GHOST_TimerTaskHandle__;
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, uint64_t time);
typedef void (*GHOST_TimerProcPtr)(struct GHOST_TimerTaskHandle__ *task, GHOST_TUns64 time);
#endif
#ifdef WITH_XR_OPENXR
@@ -711,7 +724,7 @@ typedef enum GHOST_XrActionType {
typedef struct GHOST_XrActionInfo {
const char *name;
GHOST_XrActionType type;
uint32_t count_subaction_paths;
GHOST_TUns32 count_subaction_paths;
const char **subaction_paths;
/** States for each subaction path. */
void *states;
@@ -722,7 +735,7 @@ typedef struct GHOST_XrActionInfo {
typedef struct GHOST_XrActionSpaceInfo {
const char *action_name;
uint32_t count_subaction_paths;
GHOST_TUns32 count_subaction_paths;
const char **subaction_paths;
/** Poses for each subaction path. */
const GHOST_XrPose *poses;
@@ -730,14 +743,14 @@ typedef struct GHOST_XrActionSpaceInfo {
typedef struct GHOST_XrActionBindingInfo {
const char *action_name;
uint32_t count_interaction_paths;
GHOST_TUns32 count_interaction_paths;
/** Interaction path: User (sub-action) path + component path. */
const char **interaction_paths;
} GHOST_XrActionBindingInfo;
typedef struct GHOST_XrActionProfileInfo {
const char *profile_path;
uint32_t count_bindings;
GHOST_TUns32 count_bindings;
const GHOST_XrActionBindingInfo *bindings;
} GHOST_XrActionProfileInfo;

View File

@@ -57,7 +57,7 @@ struct GHOST_Buttons {
*/
void clear();
uint8_t m_ButtonLeft : 1;
uint8_t m_ButtonMiddle : 1;
uint8_t m_ButtonRight : 1;
GHOST_TUns8 m_ButtonLeft : 1;
GHOST_TUns8 m_ButtonMiddle : 1;
GHOST_TUns8 m_ButtonRight : 1;
};

View File

@@ -84,7 +84,7 @@ GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhand
return GHOST_kSuccess;
}
uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
GHOST_TUns64 GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -92,8 +92,8 @@ uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
}
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle,
uint64_t delay,
uint64_t interval,
GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerproc,
GHOST_TUserDataPtr userdata)
{
@@ -111,7 +111,7 @@ GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
return system->removeTimer(timertask);
}
uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
GHOST_TUns8 GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -119,8 +119,8 @@ uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
}
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
GHOST_TUns32 *width,
GHOST_TUns32 *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -128,8 +128,8 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
}
void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
GHOST_TUns32 *width,
GHOST_TUns32 *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -156,10 +156,10 @@ GHOST_TSuccess GHOST_DisposeOpenGLContext(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_WindowHandle parent_windowhandle,
const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
bool is_dialog,
GHOST_TDrawingContextType type,
@@ -317,13 +317,13 @@ GHOST_TSuccess GHOST_HasCursorShape(GHOST_WindowHandle windowhandle,
}
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle,
uint8_t *bitmap,
uint8_t *mask,
GHOST_TUns8 *bitmap,
GHOST_TUns8 *mask,
int sizex,
int sizey,
int hotX,
int hotY,
bool canInvertColor)
GHOST_TUns8 canInvertColor)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -344,14 +344,18 @@ GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, int vi
return window->setCursorVisibility(visible ? true : false);
}
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle, int32_t *x, int32_t *y)
GHOST_TSuccess GHOST_GetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 *x,
GHOST_TInt32 *y)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
return system->getCursorPosition(*x, *y);
}
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle, int32_t x, int32_t y)
GHOST_TSuccess GHOST_SetCursorPosition(GHOST_SystemHandle systemhandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
@@ -366,7 +370,7 @@ GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle,
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
GHOST_Rect bounds_rect;
int32_t mouse_xy[2];
GHOST_TInt32 mouse_xy[2];
if (bounds) {
bounds_rect = GHOST_Rect(bounds[0], bounds[1], bounds[2], bounds[3]);
@@ -416,7 +420,7 @@ void GHOST_setNDOFDeadZone(float deadzone)
}
#endif
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, bool canAccept)
void GHOST_setAcceptDragOperation(GHOST_WindowHandle windowhandle, GHOST_TInt8 canAccept)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -430,7 +434,7 @@ GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
return event->getType();
}
uint64_t GHOST_GetEventTime(GHOST_EventHandle eventhandle)
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
{
GHOST_IEvent *event = (GHOST_IEvent *)eventhandle;
@@ -551,14 +555,14 @@ void GHOST_DisposeRectangle(GHOST_RectangleHandle rectanglehandle)
delete (GHOST_Rect *)rectanglehandle;
}
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, uint32_t width)
GHOST_TSuccess GHOST_SetClientWidth(GHOST_WindowHandle windowhandle, GHOST_TUns32 width)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->setClientWidth(width);
}
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t height)
GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, GHOST_TUns32 height)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -566,24 +570,30 @@ GHOST_TSuccess GHOST_SetClientHeight(GHOST_WindowHandle windowhandle, uint32_t h
}
GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
uint32_t width,
uint32_t height)
GHOST_TUns32 width,
GHOST_TUns32 height)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->setClientSize(width, height);
}
void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
window->screenToClient(inX, inY, *outX, *outY);
}
void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
void GHOST_ClientToScreen(GHOST_WindowHandle windowhandle,
GHOST_TInt32 inX,
GHOST_TInt32 inY,
GHOST_TInt32 *outX,
GHOST_TInt32 *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -604,7 +614,8 @@ GHOST_TSuccess GHOST_SetWindowState(GHOST_WindowHandle windowhandle, GHOST_TWind
return window->setState(state);
}
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle, bool isUnsavedChanges)
GHOST_TSuccess GHOST_SetWindowModifiedState(GHOST_WindowHandle windowhandle,
GHOST_TUns8 isUnsavedChanges)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
@@ -692,18 +703,21 @@ void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
system->setTabletAPI(api);
}
int32_t GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect *)rectanglehandle)->getWidth();
}
int32_t GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
{
return ((GHOST_Rect *)rectanglehandle)->getHeight();
}
void GHOST_GetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t *l, int32_t *t, int32_t *r, int32_t *b)
void GHOST_GetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 *l,
GHOST_TInt32 *t,
GHOST_TInt32 *r,
GHOST_TInt32 *b)
{
GHOST_Rect *rect = (GHOST_Rect *)rectanglehandle;
@@ -713,8 +727,11 @@ void GHOST_GetRectangle(
*b = rect->m_b;
}
void GHOST_SetRectangle(
GHOST_RectangleHandle rectanglehandle, int32_t l, int32_t t, int32_t r, int32_t b)
void GHOST_SetRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 l,
GHOST_TInt32 t,
GHOST_TInt32 r,
GHOST_TInt32 b)
{
((GHOST_Rect *)rectanglehandle)->set(l, t, r, b);
}
@@ -739,7 +756,7 @@ GHOST_TSuccess GHOST_IsValidRectangle(GHOST_RectangleHandle rectanglehandle)
return result;
}
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, int32_t i)
void GHOST_InsetRectangle(GHOST_RectangleHandle rectanglehandle, GHOST_TInt32 i)
{
((GHOST_Rect *)rectanglehandle)->inset(i);
}
@@ -750,12 +767,16 @@ void GHOST_UnionRectangle(GHOST_RectangleHandle rectanglehandle,
((GHOST_Rect *)rectanglehandle)->unionRect(*(GHOST_Rect *)anotherrectanglehandle);
}
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
void GHOST_UnionPointRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
((GHOST_Rect *)rectanglehandle)->unionPoint(x, y);
}
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle, int32_t x, int32_t y)
GHOST_TSuccess GHOST_IsInsideRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 x,
GHOST_TInt32 y)
{
GHOST_TSuccess result = GHOST_kFailure;
@@ -775,13 +796,18 @@ GHOST_TVisibility GHOST_GetRectangleVisibility(GHOST_RectangleHandle rectangleha
return visible;
}
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy)
void GHOST_SetCenterRectangle(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy)
{
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy);
}
void GHOST_SetRectangleCenter(
GHOST_RectangleHandle rectanglehandle, int32_t cx, int32_t cy, int32_t w, int32_t h)
void GHOST_SetRectangleCenter(GHOST_RectangleHandle rectanglehandle,
GHOST_TInt32 cx,
GHOST_TInt32 cy,
GHOST_TInt32 w,
GHOST_TInt32 h)
{
((GHOST_Rect *)rectanglehandle)->setCenter(cx, cy, w, h);
}
@@ -797,13 +823,13 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
return result;
}
char *GHOST_getClipboard(bool selection)
GHOST_TUns8 *GHOST_getClipboard(int selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getClipboard(selection);
}
void GHOST_putClipboard(const char *buffer, bool selection)
void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
@@ -835,7 +861,7 @@ float GHOST_GetNativePixelSize(GHOST_WindowHandle windowhandle)
return 1.0f;
}
uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
GHOST_TUns16 GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
return window->getDPIHint();
@@ -843,8 +869,12 @@ uint16_t GHOST_GetDPIHint(GHOST_WindowHandle windowhandle)
#ifdef WITH_INPUT_IME
void GHOST_BeginIME(
GHOST_WindowHandle windowhandle, int32_t x, int32_t y, int32_t w, int32_t h, bool complete)
void GHOST_BeginIME(GHOST_WindowHandle windowhandle,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 w,
GHOST_TInt32 h,
int complete)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
window->beginIME(x, y, w, h, complete);
@@ -942,7 +972,7 @@ void GHOST_XrDestroyActionSet(GHOST_XrContextHandle xr_contexthandle, const char
int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -953,7 +983,7 @@ int GHOST_XrCreateActions(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const char *const *action_names)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -963,7 +993,7 @@ void GHOST_XrDestroyActions(GHOST_XrContextHandle xr_contexthandle,
int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -975,7 +1005,7 @@ int GHOST_XrCreateActionSpaces(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionSpaceInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -985,7 +1015,7 @@ void GHOST_XrDestroyActionSpaces(GHOST_XrContextHandle xr_contexthandle,
int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -997,7 +1027,7 @@ int GHOST_XrCreateActionBindings(GHOST_XrContextHandle xr_contexthandle,
void GHOST_XrDestroyActionBindings(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
uint32_t count,
GHOST_TUns32 count,
const GHOST_XrActionProfileInfo *infos)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
@@ -1024,7 +1054,7 @@ int GHOST_XrSyncActions(GHOST_XrContextHandle xr_contexthandle, const char *acti
int GHOST_XrApplyHapticAction(GHOST_XrContextHandle xr_contexthandle,
const char *action_set_name,
const char *action_name,
const int64_t *duration,
const GHOST_TInt64 *duration,
const float *frequency,
const float *amplitude)
{

View File

@@ -49,20 +49,20 @@ GHOST_TSuccess GHOST_DisplayManager::initialize(void)
return success;
}
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(uint8_t & /*numDisplays*/) const
GHOST_TSuccess GHOST_DisplayManager::getNumDisplays(GHOST_TUns8 & /*numDisplays*/) const
{
// Don't know if we have a display...
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
GHOST_TSuccess success;
GHOST_ASSERT(m_settingsInitialized,
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
if (display < numDisplays) {
@@ -75,18 +75,18 @@ GHOST_TSuccess GHOST_DisplayManager::getNumDisplaySettings(uint8_t display,
return success;
}
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
GHOST_TSuccess success;
GHOST_ASSERT(m_settingsInitialized,
"GHOST_DisplayManager::getNumDisplaySettings(): m_settingsInitialized=false");
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
if (display < numDisplays && ((uint8_t)index < m_settings[display].size())) {
if (display < numDisplays && ((GHOST_TUns8)index < m_settings[display].size())) {
setting = m_settings[display][index];
}
else {
@@ -97,18 +97,18 @@ GHOST_TSuccess GHOST_DisplayManager::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManager::getCurrentDisplaySetting(
uint8_t /*display*/, GHOST_DisplaySetting & /*setting*/) const
GHOST_TUns8 /*display*/, GHOST_DisplaySetting & /*setting*/) const
{
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::setCurrentDisplaySetting(
uint8_t /*display*/, const GHOST_DisplaySetting & /*setting*/)
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting & /*setting*/)
{
return GHOST_kFailure;
}
GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
GHOST_TSuccess GHOST_DisplayManager::findMatch(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting,
GHOST_DisplaySetting &match) const
{
@@ -157,16 +157,17 @@ GHOST_TSuccess GHOST_DisplayManager::findMatch(uint8_t display,
GHOST_TSuccess GHOST_DisplayManager::initializeSettings(void)
{
uint8_t numDisplays;
GHOST_TUns8 numDisplays;
GHOST_TSuccess success = getNumDisplays(numDisplays);
if (success == GHOST_kSuccess) {
for (uint8_t display = 0; (display < numDisplays) && (success == GHOST_kSuccess); display++) {
for (GHOST_TUns8 display = 0; (display < numDisplays) && (success == GHOST_kSuccess);
display++) {
GHOST_DisplaySettings displaySettings;
m_settings.push_back(displaySettings);
int32_t numSettings;
GHOST_TInt32 numSettings;
success = getNumDisplaySettings(display, numSettings);
if (success == GHOST_kSuccess) {
int32_t index;
GHOST_TInt32 index;
GHOST_DisplaySetting setting;
for (index = 0; (index < numSettings) && (success == GHOST_kSuccess); index++) {
success = getDisplaySetting(display, index, setting);

View File

@@ -55,7 +55,7 @@ class GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
virtual GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
virtual GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -63,7 +63,8 @@ class GHOST_DisplayManager {
* \param numSettings: The number of settings of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
virtual GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -72,8 +73,8 @@ class GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
virtual GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -82,7 +83,7 @@ class GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
virtual GHOST_TSuccess getCurrentDisplaySetting(uint8_t display,
virtual GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
@@ -93,7 +94,7 @@ class GHOST_DisplayManager {
* \param setting: The setting of the display device to be matched and activated.
* \return Indication of success.
*/
virtual GHOST_TSuccess setCurrentDisplaySetting(uint8_t display,
virtual GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
@@ -106,7 +107,7 @@ class GHOST_DisplayManager {
* \param match: The optimal display setting.
* \return Indication of success.
*/
GHOST_TSuccess findMatch(uint8_t display,
GHOST_TSuccess findMatch(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting,
GHOST_DisplaySetting &match) const;

View File

@@ -46,7 +46,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -54,7 +54,7 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -63,8 +63,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -73,7 +73,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -81,7 +82,8 @@ class GHOST_DisplayManagerCocoa : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
// Do not cache values as OS X supports screen hot plug

View File

@@ -29,26 +29,26 @@ GHOST_DisplayManagerCocoa::GHOST_DisplayManagerCocoa(void)
{
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
numDisplays = (uint8_t)[[NSScreen screens] count];
numDisplays = (GHOST_TUns8)[[NSScreen screens] count];
[pool drain];
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerCocoa::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
numSettings = (int32_t)3; // Width, Height, BitsPerPixel
numSettings = (GHOST_TInt32)3; // Width, Height, BitsPerPixel
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
NSScreen *askedDisplay;
@@ -86,7 +86,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
NSScreen *askedDisplay;
@@ -127,7 +127,7 @@ GHOST_TSuccess GHOST_DisplayManagerCocoa::getCurrentDisplaySetting(
}
GHOST_TSuccess GHOST_DisplayManagerCocoa::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
GHOST_ASSERT(
(display == kMainDisplay),

View File

@@ -31,25 +31,25 @@ class GHOST_DisplayManagerNULL : public GHOST_DisplayManager {
GHOST_DisplayManagerNULL(GHOST_SystemNULL *system) : GHOST_DisplayManager(), m_system(system)
{ /* nop */
}
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
return GHOST_kFailure;
}
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
return getDisplaySetting(display, int32_t(0), setting);
return getDisplaySetting(display, GHOST_TInt32(0), setting);
}
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
return GHOST_kSuccess;
}

View File

@@ -33,14 +33,14 @@ GHOST_DisplayManagerSDL::GHOST_DisplayManagerSDL(GHOST_SystemSDL *system)
memset(&m_mode, 0, sizeof(m_mode));
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = SDL_GetNumVideoDisplays();
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerSDL::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
@@ -66,8 +66,8 @@ static void ghost_mode_to_sdl(const GHOST_DisplaySetting &setting, SDL_DisplayMo
mode->refresh_rate = setting.frequency;
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
GHOST_ASSERT(display < 1, "Only single display systems are currently supported.\n");
@@ -81,7 +81,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(display, &mode);
@@ -98,7 +98,7 @@ GHOST_TSuccess GHOST_DisplayManagerSDL::getCurrentDisplayModeSDL(SDL_DisplayMode
}
GHOST_TSuccess GHOST_DisplayManagerSDL::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
/*
* Mode switching code ported from Quake 2 version 3.21 and bzflag version

View File

@@ -37,19 +37,21 @@ class GHOST_DisplayManagerSDL : public GHOST_DisplayManager {
public:
GHOST_DisplayManagerSDL(GHOST_SystemSDL *system);
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplayModeSDL(SDL_DisplayMode &mode) const;
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
private:
GHOST_SystemSDL *m_system;

View File

@@ -35,7 +35,7 @@ GHOST_DisplayManagerWin32::GHOST_DisplayManagerWin32(void)
{
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = ::GetSystemMetrics(SM_CMONITORS);
return numDisplays > 0 ? GHOST_kSuccess : GHOST_kFailure;
@@ -54,8 +54,8 @@ static BOOL get_dd(DWORD d, DISPLAY_DEVICE *dd)
* the information that was cached the last time the function was called with iModeNum
* set to zero.
*/
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
DISPLAY_DEVICE display_device;
if (!get_dd(display, &display_device))
@@ -69,8 +69,8 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
DISPLAY_DEVICE display_device;
@@ -111,13 +111,13 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerWin32::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
return getDisplaySetting(display, ENUM_CURRENT_SETTINGS, setting);
}
GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
uint8_t display, const GHOST_DisplaySetting &setting)
GHOST_TUns8 display, const GHOST_DisplaySetting &setting)
{
DISPLAY_DEVICE display_device;
if (!get_dd(display, &display_device))

View File

@@ -45,7 +45,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -53,7 +53,7 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -62,8 +62,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -72,7 +72,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -80,7 +81,8 @@ class GHOST_DisplayManagerWin32 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
protected:
};

View File

@@ -40,14 +40,14 @@ GHOST_DisplayManagerX11::GHOST_DisplayManagerX11(GHOST_SystemX11 *system)
/* nothing to do. */
}
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(uint8_t &numDisplays) const
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplays(GHOST_TUns8 &numDisplays) const
{
numDisplays = m_system->getNumDisplays();
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(uint8_t display,
int32_t &numSettings) const
GHOST_TSuccess GHOST_DisplayManagerX11::getNumDisplaySettings(GHOST_TUns8 display,
GHOST_TInt32 &numSettings) const
{
#ifdef WITH_X11_XF86VMODE
int majorVersion, minorVersion;
@@ -88,8 +88,8 @@ static int calculate_rate(XF86VidModeModeInfo *info)
}
#endif
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const
{
Display *dpy = m_system->getXDisplay();
@@ -140,7 +140,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getDisplaySetting(uint8_t display,
}
GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
uint8_t display, GHOST_DisplaySetting &setting) const
GHOST_TUns8 display, GHOST_DisplaySetting &setting) const
{
/* According to the xf86vidmodegetallmodelines man page,
* "The first element of the array corresponds to the current video mode."
@@ -149,7 +149,7 @@ GHOST_TSuccess GHOST_DisplayManagerX11::getCurrentDisplaySetting(
}
GHOST_TSuccess GHOST_DisplayManagerX11::setCurrentDisplaySetting(
uint8_t /*display*/, const GHOST_DisplaySetting &setting)
GHOST_TUns8 /*display*/, const GHOST_DisplaySetting &setting)
{
#ifdef WITH_X11_XF86VMODE
/* Mode switching code ported from SDL:

View File

@@ -43,7 +43,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param numDisplays: The number of displays on this system.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplays(uint8_t &numDisplays) const;
GHOST_TSuccess getNumDisplays(GHOST_TUns8 &numDisplays) const;
/**
* Returns the number of display settings for this display device.
@@ -51,7 +51,7 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param numSetting: The number of settings of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getNumDisplaySettings(uint8_t display, int32_t &numSettings) const;
GHOST_TSuccess getNumDisplaySettings(GHOST_TUns8 display, GHOST_TInt32 &numSettings) const;
/**
* Returns the current setting for this display device.
@@ -60,8 +60,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getDisplaySetting(uint8_t display,
int32_t index,
GHOST_TSuccess getDisplaySetting(GHOST_TUns8 display,
GHOST_TInt32 index,
GHOST_DisplaySetting &setting) const;
/**
@@ -70,7 +70,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess getCurrentDisplaySetting(uint8_t display, GHOST_DisplaySetting &setting) const;
GHOST_TSuccess getCurrentDisplaySetting(GHOST_TUns8 display,
GHOST_DisplaySetting &setting) const;
/**
* Changes the current setting for this display device.
@@ -78,7 +79,8 @@ class GHOST_DisplayManagerX11 : public GHOST_DisplayManager {
* \param setting: The current setting of the display device with this index.
* \return Indication of success.
*/
GHOST_TSuccess setCurrentDisplaySetting(uint8_t display, const GHOST_DisplaySetting &setting);
GHOST_TSuccess setCurrentDisplaySetting(GHOST_TUns8 display,
const GHOST_DisplaySetting &setting);
private:
GHOST_SystemX11 *m_system;

View File

@@ -242,7 +242,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
strArray = (GHOST_TStringArray *)::malloc(sizeof(GHOST_TStringArray));
strArray->count = 0;
strArray->strings = (uint8_t **)::malloc(totfiles * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)::malloc(totfiles * sizeof(GHOST_TUns8 *));
for (UINT nfile = 0; nfile < totfiles; nfile++) {
if (::DragQueryFileW(hdrop, nfile, fpath, MAX_PATH) > 0) {
@@ -251,7 +251,7 @@ void *GHOST_DropTargetWin32::getDropDataAsFilenames(IDataObject *pDataObject)
}
// Just ignore paths that could not be converted verbatim.
strArray->strings[nvalid] = (uint8_t *)temp_path;
strArray->strings[nvalid] = (GHOST_TUns8 *)temp_path;
strArray->count = nvalid + 1;
nvalid++;
}

View File

@@ -216,7 +216,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
strArray = (GHOST_TStringArray *)malloc(sizeof(GHOST_TStringArray));
strArray->count = 0;
strArray->strings = (uint8_t **)malloc(totPaths * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)malloc(totPaths * sizeof(GHOST_TUns8 *));
curLength = 0;
for (int i = 0; i <= dropBufferSize; i++) {
@@ -230,7 +230,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(unsigned char *dropBuffer, int dr
decodedPath = FileUrlDecode(curPath);
if (decodedPath) {
strArray->strings[strArray->count] = (uint8_t *)decodedPath;
strArray->strings[strArray->count] = (GHOST_TUns8 *)decodedPath;
strArray->count++;
}

View File

@@ -37,7 +37,7 @@ class GHOST_Event : public GHOST_IEvent {
* \param type: The type of this event.
* \param window: The generating window (or NULL if system event).
*/
GHOST_Event(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window)
GHOST_Event(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window)
: m_type(type), m_time(msec), m_window(window), m_data(NULL)
{
}
@@ -55,7 +55,7 @@ class GHOST_Event : public GHOST_IEvent {
* Returns the time this event was generated.
* \return The event generation time.
*/
uint64_t getTime()
GHOST_TUns64 getTime()
{
return m_time;
}
@@ -83,7 +83,7 @@ class GHOST_Event : public GHOST_IEvent {
/** Type of this event. */
GHOST_TEventType m_type;
/** The time this event was generated. */
uint64_t m_time;
GHOST_TUns64 m_time;
/** Pointer to the generating window. */
GHOST_IWindow *m_window;
/** Pointer to the event data. */

View File

@@ -40,7 +40,7 @@ class GHOST_EventButton : public GHOST_Event {
* \param button: The state of the buttons were at the time of the event.
* \param tablet: The tablet data associated with this event.
*/
GHOST_EventButton(uint64_t time,
GHOST_EventButton(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TButtonMask button,

View File

@@ -39,11 +39,11 @@ class GHOST_EventCursor : public GHOST_Event {
* \param y: The y-coordinate of the location the cursor was at the time of the event.
* \param tablet: The tablet data associated with this event.
*/
GHOST_EventCursor(uint64_t msec,
GHOST_EventCursor(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
int32_t x,
int32_t y,
GHOST_TInt32 x,
GHOST_TInt32 y,
const GHOST_TabletData &tablet)
: GHOST_Event(msec, type, window), m_cursorEventData({x, y, tablet})
{

View File

@@ -72,7 +72,7 @@ class GHOST_EventDragnDrop : public GHOST_Event {
* \param y: The y-coordinate of the location the cursor was at the time of the event.
* \param data: The "content" dropped in the window.
*/
GHOST_EventDragnDrop(uint64_t time,
GHOST_EventDragnDrop(GHOST_TUns64 time,
GHOST_TEventType type,
GHOST_TDragnDropTypes dataType,
GHOST_IWindow *window,

View File

@@ -39,8 +39,11 @@ class GHOST_EventKey : public GHOST_Event {
* \param type: The type of key event.
* \param key: The key code of the key.
*/
GHOST_EventKey(
uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, GHOST_TKey key, bool is_repeat)
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TKey key,
bool is_repeat)
: GHOST_Event(msec, type, window)
{
m_keyEventData.key = key;
@@ -57,7 +60,7 @@ class GHOST_EventKey : public GHOST_Event {
* \param key: The key code of the key.
* \param ascii: The ascii code for the key event.
*/
GHOST_EventKey(uint64_t msec,
GHOST_EventKey(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TKey key,

View File

@@ -28,6 +28,7 @@
#include "GHOST_EventManager.h"
#include "GHOST_Debug.h"
#include <algorithm>
#include <stdio.h> // [mce] temp debug
GHOST_EventManager::GHOST_EventManager()
{
@@ -45,14 +46,14 @@ GHOST_EventManager::~GHOST_EventManager()
}
}
uint32_t GHOST_EventManager::getNumEvents()
GHOST_TUns32 GHOST_EventManager::getNumEvents()
{
return (uint32_t)m_events.size();
return (GHOST_TUns32)m_events.size();
}
uint32_t GHOST_EventManager::getNumEvents(GHOST_TEventType type)
GHOST_TUns32 GHOST_EventManager::getNumEvents(GHOST_TEventType type)
{
uint32_t numEvents = 0;
GHOST_TUns32 numEvents = 0;
TEventStack::iterator p;
for (p = m_events.begin(); p != m_events.end(); ++p) {
if ((*p)->getType() == type) {

View File

@@ -53,14 +53,14 @@ class GHOST_EventManager {
* Returns the number of events currently on the stack.
* \return The number of events on the stack.
*/
uint32_t getNumEvents();
GHOST_TUns32 getNumEvents();
/**
* Returns the number of events of a certain type currently on the stack.
* \param type: The type of events to be counted.
* \return The number of events on the stack of this type.
*/
uint32_t getNumEvents(GHOST_TEventType type);
GHOST_TUns32 getNumEvents(GHOST_TEventType type);
/**
* Pushes an event on the stack.

View File

@@ -31,7 +31,7 @@ class GHOST_EventNDOFMotion : public GHOST_Event {
GHOST_TEventNDOFMotionData m_axisData;
public:
GHOST_EventNDOFMotion(uint64_t time, GHOST_IWindow *window)
GHOST_EventNDOFMotion(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFMotion, window)
{
m_data = &m_axisData;
@@ -43,7 +43,7 @@ class GHOST_EventNDOFButton : public GHOST_Event {
GHOST_TEventNDOFButtonData m_buttonData;
public:
GHOST_EventNDOFButton(uint64_t time, GHOST_IWindow *window)
GHOST_EventNDOFButton(GHOST_TUns64 time, GHOST_IWindow *window)
: GHOST_Event(time, GHOST_kEventNDOFButton, window)
{
m_data = &m_buttonData;

View File

@@ -39,7 +39,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
if (event->getType() == GHOST_kEventWindowUpdate)
return false;
std::cout << "GHOST_EventPrinter::processEvent, time: " << (int32_t)event->getTime()
std::cout << "GHOST_EventPrinter::processEvent, time: " << (GHOST_TInt32)event->getTime()
<< ", type: ";
switch (event->getType()) {
case GHOST_kEventUnknown:

View File

@@ -38,7 +38,7 @@ class GHOST_EventString : public GHOST_Event {
* \param window: The generating window (or NULL if system event).
* \param data_ptr: Pointer to the (un-formatted) data associated with the event.
*/
GHOST_EventString(uint64_t msec,
GHOST_EventString(GHOST_TUns64 msec,
GHOST_TEventType type,
GHOST_IWindow *window,
GHOST_TEventDataPtr data_ptr)

View File

@@ -39,13 +39,13 @@ class GHOST_EventTrackpad : public GHOST_Event {
* \param x: The x-delta of the pan event.
* \param y: The y-delta of the pan event.
*/
GHOST_EventTrackpad(uint64_t msec,
GHOST_EventTrackpad(GHOST_TUns64 msec,
GHOST_IWindow *window,
GHOST_TTrackpadEventSubTypes subtype,
int32_t x,
int32_t y,
int32_t deltaX,
int32_t deltaY,
GHOST_TInt32 x,
GHOST_TInt32 y,
GHOST_TInt32 deltaX,
GHOST_TInt32 deltaY,
bool isDirectionInverted)
: GHOST_Event(msec, GHOST_kEventTrackpad, window)
{

View File

@@ -39,7 +39,7 @@ class GHOST_EventWheel : public GHOST_Event {
* \param window: The window of this event.
* \param z: The displacement of the mouse wheel.
*/
GHOST_EventWheel(uint64_t msec, GHOST_IWindow *window, int32_t z)
GHOST_EventWheel(GHOST_TUns64 msec, GHOST_IWindow *window, GHOST_TInt32 z)
: GHOST_Event(msec, GHOST_kEventWheel, window)
{
m_wheelEventData.z = z;

View File

@@ -44,7 +44,7 @@ class GHOST_EventIME : public GHOST_Event {
* \param type: The type of key event.
* \param key: The key code of the key.
*/
GHOST_EventIME(uint64_t msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
GHOST_EventIME(GHOST_TUns64 msec, GHOST_TEventType type, GHOST_IWindow *window, void *customdata)
: GHOST_Event(msec, type, window)
{
this->m_data = customdata;

View File

@@ -72,17 +72,17 @@ struct GHOST_ModifierKeys {
bool equals(const GHOST_ModifierKeys &keys) const;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftShift : 1;
GHOST_TUns8 m_LeftShift : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightShift : 1;
GHOST_TUns8 m_RightShift : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftAlt : 1;
GHOST_TUns8 m_LeftAlt : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightAlt : 1;
GHOST_TUns8 m_RightAlt : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_LeftControl : 1;
GHOST_TUns8 m_LeftControl : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_RightControl : 1;
GHOST_TUns8 m_RightControl : 1;
/** Bitfield that stores the appropriate key state. */
uint8_t m_OS : 1;
GHOST_TUns8 m_OS : 1;
};

View File

@@ -279,14 +279,14 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
return m_deviceType != NDOF_UnknownDevice;
}
void GHOST_NDOFManager::updateTranslation(const int t[3], uint64_t time)
void GHOST_NDOFManager::updateTranslation(const int t[3], GHOST_TUns64 time)
{
memcpy(m_translation, t, sizeof(m_translation));
m_motionTime = time;
m_motionEventPending = true;
}
void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
void GHOST_NDOFManager::updateRotation(const int r[3], GHOST_TUns64 time)
{
memcpy(m_rotation, r, sizeof(m_rotation));
m_motionTime = time;
@@ -295,7 +295,7 @@ void GHOST_NDOFManager::updateRotation(const int r[3], uint64_t time)
void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
bool press,
uint64_t time,
GHOST_TUns64 time,
GHOST_IWindow *window)
{
GHOST_ASSERT(button > NDOF_BUTTON_NONE && button < NDOF_BUTTON_LAST,
@@ -316,7 +316,7 @@ void GHOST_NDOFManager::sendButtonEvent(NDOF_ButtonT button,
void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
bool press,
uint64_t time,
GHOST_TUns64 time,
GHOST_IWindow *window)
{
GHOST_TEventType type = press ? GHOST_kEventKeyDown : GHOST_kEventKeyUp;
@@ -329,7 +329,7 @@ void GHOST_NDOFManager::sendKeyEvent(GHOST_TKey key,
m_system.pushEvent(event);
}
void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t time)
void GHOST_NDOFManager::updateButton(int button_number, bool press, GHOST_TUns64 time)
{
GHOST_IWindow *window = m_system.getWindowManager()->getActiveWindow();
@@ -371,7 +371,7 @@ void GHOST_NDOFManager::updateButton(int button_number, bool press, uint64_t tim
}
}
void GHOST_NDOFManager::updateButtons(int button_bits, uint64_t time)
void GHOST_NDOFManager::updateButtons(int button_bits, GHOST_TUns64 time)
{
button_bits &= m_buttonMask; // discard any "garbage" bits

View File

@@ -130,13 +130,13 @@ class GHOST_NDOFManager {
// rotations are + when CCW, - when CW
// each platform is responsible for getting axis data into this form
// these values should not be scaled (just shuffled or flipped)
void updateTranslation(const int t[3], uint64_t time);
void updateRotation(const int r[3], uint64_t time);
void updateTranslation(const int t[3], GHOST_TUns64 time);
void updateRotation(const int r[3], GHOST_TUns64 time);
// the latest raw button data from the device
// use HID button encoding (not NDOF_ButtonT)
void updateButton(int button_number, bool press, uint64_t time);
void updateButtons(int button_bits, uint64_t time);
void updateButton(int button_number, bool press, GHOST_TUns64 time);
void updateButtons(int button_bits, GHOST_TUns64 time);
// NDOFButton events are sent immediately
// processes and sends most recent raw data as an NDOFMotion event
@@ -147,8 +147,8 @@ class GHOST_NDOFManager {
GHOST_System &m_system;
private:
void sendButtonEvent(NDOF_ButtonT, bool press, uint64_t time, GHOST_IWindow *);
void sendKeyEvent(GHOST_TKey, bool press, uint64_t time, GHOST_IWindow *);
void sendButtonEvent(NDOF_ButtonT, bool press, GHOST_TUns64 time, GHOST_IWindow *);
void sendKeyEvent(GHOST_TKey, bool press, GHOST_TUns64 time, GHOST_IWindow *);
NDOF_DeviceT m_deviceType;
int m_buttonCount;
@@ -159,8 +159,8 @@ class GHOST_NDOFManager {
int m_rotation[3];
int m_buttons; // bit field
uint64_t m_motionTime; // in milliseconds
uint64_t m_prevMotionTime; // time of most recent Motion event sent
GHOST_TUns64 m_motionTime; // in milliseconds
GHOST_TUns64 m_prevMotionTime; // time of most recent Motion event sent
GHOST_TProgress m_motionState;
bool m_motionEventPending;

View File

@@ -195,7 +195,7 @@ static void DeviceEvent(uint32_t unused, uint32_t msg_type, void *msg_arg)
// device state is broadcast to all clients; only react if sent to us
if (s->client == clientID) {
// TODO: is s->time compatible with GHOST timestamps? if so use that instead.
uint64_t now = ghost_system->getMilliSeconds();
GHOST_TUns64 now = ghost_system->getMilliSeconds();
switch (s->command) {
case kConnexionCmdHandleAxis: {

View File

@@ -97,7 +97,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
switch (e.type) {
case SPNAV_EVENT_MOTION: {
/* convert to blender view coords */
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
const int t[3] = {(int)e.motion.x, (int)e.motion.y, (int)-e.motion.z};
const int r[3] = {(int)-e.motion.rx, (int)-e.motion.ry, (int)e.motion.rz};
@@ -109,7 +109,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
break;
}
case SPNAV_EVENT_BUTTON:
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
updateButton(e.button.bnum, e.button.press, now);
break;
}
@@ -118,7 +118,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
#ifdef USE_FINISH_GLITCH_WORKAROUND
if (motion_test_prev == true && motion_test == false) {
uint64_t now = m_system.getMilliSeconds();
GHOST_TUns64 now = m_system.getMilliSeconds();
const int v[3] = {0, 0, 0};
updateTranslation(v, now);

View File

@@ -38,25 +38,25 @@ GHOST_TSuccess GHOST_DisposeSystemPaths(void)
return GHOST_ISystemPaths::dispose();
}
const char *GHOST_getSystemDir(int version, const char *versionstr)
const GHOST_TUns8 *GHOST_getSystemDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : NULL;
}
const char *GHOST_getUserDir(int version, const char *versionstr)
const GHOST_TUns8 *GHOST_getUserDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getUserDir(version, versionstr) : NULL; /* shouldn't be NULL */
}
const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
const GHOST_TUns8 *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getUserSpecialDir(type) : NULL; /* shouldn't be NULL */
}
const char *GHOST_getBinaryDir()
const GHOST_TUns8 *GHOST_getBinaryDir()
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getBinaryDir() : NULL; /* shouldn't be NULL */

View File

@@ -23,7 +23,7 @@
#include "GHOST_Rect.h"
void GHOST_Rect::inset(int32_t i)
void GHOST_Rect::inset(GHOST_TInt32 i)
{
if (i > 0) {
// Grow the rectangle
@@ -34,7 +34,7 @@ void GHOST_Rect::inset(int32_t i)
}
else if (i < 0) {
// Shrink the rectangle, check for insets larger than half the size
int32_t i2 = i * 2;
GHOST_TInt32 i2 = i * 2;
if (getWidth() > i2) {
m_l += i;
m_r -= i;
@@ -82,9 +82,9 @@ GHOST_TVisibility GHOST_Rect::getVisibility(GHOST_Rect &r) const
return v;
}
void GHOST_Rect::setCenter(int32_t cx, int32_t cy)
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy)
{
int32_t offset = cx - (m_l + (m_r - m_l) / 2);
GHOST_TInt32 offset = cx - (m_l + (m_r - m_l) / 2);
m_l += offset;
m_r += offset;
offset = cy - (m_t + (m_b - m_t) / 2);
@@ -92,7 +92,7 @@ void GHOST_Rect::setCenter(int32_t cx, int32_t cy)
m_b += offset;
}
void GHOST_Rect::setCenter(int32_t cx, int32_t cy, int32_t w, int32_t h)
void GHOST_Rect::setCenter(GHOST_TInt32 cx, GHOST_TInt32 cy, GHOST_TInt32 w, GHOST_TInt32 h)
{
long w_2, h_2;

View File

@@ -56,19 +56,19 @@ GHOST_System::~GHOST_System()
exit();
}
uint64_t GHOST_System::getMilliSeconds() const
GHOST_TUns64 GHOST_System::getMilliSeconds() const
{
return std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now().time_since_epoch())
.count();
}
GHOST_ITimerTask *GHOST_System::installTimer(uint64_t delay,
uint64_t interval,
GHOST_ITimerTask *GHOST_System::installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData)
{
uint64_t millis = getMilliSeconds();
GHOST_TUns64 millis = getMilliSeconds();
GHOST_TimerTask *timer = new GHOST_TimerTask(millis + delay, interval, timerProc, userData);
if (timer) {
if (m_timerManager->addTimer(timer) == GHOST_kSuccess) {

View File

@@ -75,7 +75,7 @@ class GHOST_System : public GHOST_ISystem {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
virtual uint64_t getMilliSeconds() const;
virtual GHOST_TUns64 getMilliSeconds() const;
/**
* Installs a timer.
@@ -89,8 +89,8 @@ class GHOST_System : public GHOST_ISystem {
* \param userData: Placeholder for user data.
* \return A timer task (0 if timer task installation failed).
*/
GHOST_ITimerTask *installTimer(uint64_t delay,
uint64_t interval,
GHOST_ITimerTask *installTimer(GHOST_TUns64 delay,
GHOST_TUns64 interval,
GHOST_TimerProcPtr timerProc,
GHOST_TUserDataPtr userData = NULL);
@@ -210,8 +210,8 @@ class GHOST_System : public GHOST_ISystem {
/**
* Inherited from GHOST_ISystem but left pure virtual
* <pre>
* GHOST_TSuccess getCursorPosition(int32_t& x, int32_t& y) const = 0;
* GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
* GHOST_TSuccess getCursorPosition(GHOST_TInt32& x, GHOST_TInt32& y) const = 0;
* GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
* </pre>
*/
@@ -308,14 +308,14 @@ class GHOST_System : public GHOST_ISystem {
* \return Returns the clipboard data
*
*/
virtual char *getClipboard(bool selection) const = 0;
virtual GHOST_TUns8 *getClipboard(bool selection) const = 0;
/**
* Put data to the Clipboard
* \param buffer: The buffer to copy to the clipboard.
* \param selection: The clipboard to copy too only used on X11.
*/
virtual void putClipboard(const char *buffer, bool selection) const = 0;
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
/**
* Show a system message box

View File

@@ -59,7 +59,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* Based on ANSI clock() routine.
* \return The number of milliseconds.
*/
uint64_t getMilliSeconds() const;
GHOST_TUns64 getMilliSeconds() const;
/***************************************************************************************
* Display/window management functionality
@@ -69,18 +69,18 @@ class GHOST_SystemCocoa : public GHOST_System {
* Returns the number of displays on this system.
* \return The number of displays.
*/
uint8_t getNumDisplays() const;
GHOST_TUns8 getNumDisplays() const;
/**
* Returns the dimensions of the main display on this system.
* \return The dimension of the main display.
*/
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/** Returns the combine dimensions of all monitors.
* \return The dimension of the workspace.
*/
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const;
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const;
/**
* Create a new window.
@@ -100,10 +100,10 @@ class GHOST_SystemCocoa : public GHOST_System {
* \return The new window (or 0 if creation failed).
*/
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -137,7 +137,7 @@ class GHOST_SystemCocoa : public GHOST_System {
bool processEvents(bool waitForEvent);
/**
* Handle User request to quit, from Menu bar Quit, and Command+Q
* Handle User request to quit, from Menu bar Quit, and Cmd+Q
* Display alert panel if changes performed since last save
*/
void handleQuitRequest();
@@ -175,7 +175,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const;
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const;
/**
* Updates the location of the cursor (location in screen coordinates).
@@ -183,7 +183,7 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/***************************************************************************************
* Access to mouse button and keyboard states.
@@ -208,14 +208,14 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param selection: Indicate which buffer to return.
* \return Returns the selected buffer
*/
char *getClipboard(bool selection) const;
GHOST_TUns8 *getClipboard(bool selection) const;
/**
* Puts buffer to system clipboard
* \param buffer: The buffer to be copied.
* \param selection: Indicates which buffer to copy too, only used on X11.
*/
void putClipboard(const char *buffer, bool selection) const;
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
@@ -288,10 +288,10 @@ class GHOST_SystemCocoa : public GHOST_System {
* \param y: The y-coordinate of the cursor.
* \return Indication of success.
*/
GHOST_TSuccess setMouseCursorPosition(int32_t x, int32_t y);
GHOST_TSuccess setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y);
/** Start time at initialization. */
uint64_t m_start_time;
GHOST_TUns64 m_start_time;
/** Event has been processed directly by Cocoa (or NDOF manager)
* and has sent a ghost event to be dispatched */
@@ -302,14 +302,14 @@ class GHOST_SystemCocoa : public GHOST_System {
bool m_needDelayedApplicationBecomeActiveEventProcessing;
/** State of the modifiers. */
uint32_t m_modifierMask;
GHOST_TUns32 m_modifierMask;
/** Ignores window size messages (when window is dragged). */
bool m_ignoreWindowSizedMessages;
/** Temporarily ignore momentum scroll events */
bool m_ignoreMomentumScroll;
/** Is the scroll wheel event generated by a multi-touch track-pad or mouse? */
/** Is the scroll wheel event generated by a multitouch trackpad or mouse? */
bool m_multiTouchScroll;
/** To prevent multiple warp, we store the time of the last warp event
* and ignore mouse moved events generated before that. */

View File

@@ -520,7 +520,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
sysctl(mib, 2, &boottime, &len, NULL, 0);
m_start_time = ((boottime.tv_sec * 1000) + (boottime.tv_usec / 1000));
/* Detect multi-touch track-pad. */
// Detect multitouch trackpad
mib[0] = CTL_HW;
mib[1] = HW_MODEL;
sysctl(mib, 2, NULL, &len, NULL, 0);
@@ -655,7 +655,7 @@ GHOST_TSuccess GHOST_SystemCocoa::init()
#pragma mark window management
uint64_t GHOST_SystemCocoa::getMilliSeconds() const
GHOST_TUns64 GHOST_SystemCocoa::getMilliSeconds() const
{
// Cocoa equivalent exists in 10.6 ([[NSProcessInfo processInfo] systemUptime])
struct timeval currentTime;
@@ -667,7 +667,7 @@ uint64_t GHOST_SystemCocoa::getMilliSeconds() const
return ((currentTime.tv_sec * 1000) + (currentTime.tv_usec / 1000) - m_start_time);
}
uint8_t GHOST_SystemCocoa::getNumDisplays() const
GHOST_TUns8 GHOST_SystemCocoa::getNumDisplays() const
{
// Note that OS X supports monitor hot plug
// We do not support multiple monitors at the moment
@@ -676,7 +676,7 @@ uint8_t GHOST_SystemCocoa::getNumDisplays() const
}
}
void GHOST_SystemCocoa::getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemCocoa::getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
@autoreleasepool {
// Get visible frame, that is frame excluding dock and top menu bar
@@ -693,17 +693,17 @@ void GHOST_SystemCocoa::getMainDisplayDimensions(uint32_t &width, uint32_t &heig
}
}
void GHOST_SystemCocoa::getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void GHOST_SystemCocoa::getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{
/* TODO! */
getMainDisplayDimensions(width, height);
}
GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,
@@ -721,7 +721,7 @@ GHOST_IWindow *GHOST_SystemCocoa::createWindow(const char *title,
styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
NSWindowStyleMaskMiniaturizable)];
int32_t bottom = (contentRect.size.height - 1) - height - top;
GHOST_TInt32 bottom = (contentRect.size.height - 1) - height - top;
// Ensures window top left is inside this available rect
left = left > contentRect.origin.x ? left : contentRect.origin.x;
@@ -791,20 +791,20 @@ GHOST_TSuccess GHOST_SystemCocoa::disposeContext(GHOST_IContext *context)
/**
* \note : returns coordinates in Cocoa screen coordinates
*/
GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess GHOST_SystemCocoa::getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
NSPoint mouseLoc = [NSEvent mouseLocation];
// Returns the mouse location in screen coordinates
x = (int32_t)mouseLoc.x;
y = (int32_t)mouseLoc.y;
x = (GHOST_TInt32)mouseLoc.x;
y = (GHOST_TInt32)mouseLoc.y;
return GHOST_kSuccess;
}
/**
* \note : expect Cocoa screen coordinates
*/
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
GHOST_WindowCocoa *window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
if (!window)
@@ -824,7 +824,7 @@ GHOST_TSuccess GHOST_SystemCocoa::setCursorPosition(int32_t x, int32_t y)
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess GHOST_SystemCocoa::setMouseCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
float xf = (float)x, yf = (float)y;
GHOST_WindowCocoa *window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
@@ -897,7 +897,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
GHOST_TimerManager* timerMgr = getTimerManager();
if (waitForEvent) {
uint64_t next = timerMgr->nextFireTime();
GHOST_TUns64 next = timerMgr->nextFireTime();
double timeOut;
if (next == GHOST_kFireTimeNever) {
@@ -1132,7 +1132,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
break;
case GHOST_kEventDraggingDropDone: {
uint8_t *temp_buff;
GHOST_TUns8 *temp_buff;
GHOST_TStringArray *strArray;
NSArray *droppedArray;
size_t pastedTextSize;
@@ -1157,13 +1157,13 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
return GHOST_kFailure;
}
strArray->strings = (uint8_t **)malloc(strArray->count * sizeof(uint8_t *));
strArray->strings = (GHOST_TUns8 **)malloc(strArray->count * sizeof(GHOST_TUns8 *));
for (i = 0; i < strArray->count; i++) {
droppedStr = [droppedArray objectAtIndex:i];
pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (uint8_t *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (!temp_buff) {
strArray->count = i;
@@ -1185,7 +1185,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
droppedStr = (NSString *)data;
pastedTextSize = [droppedStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (uint8_t *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (temp_buff == NULL) {
return GHOST_kFailure;
@@ -1204,9 +1204,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
NSImage *droppedImg = (NSImage *)data;
NSSize imgSize = [droppedImg size];
ImBuf *ibuf = NULL;
uint8_t *rasterRGB = NULL;
uint8_t *rasterRGBA = NULL;
uint8_t *toIBuf = NULL;
GHOST_TUns8 *rasterRGB = NULL;
GHOST_TUns8 *rasterRGBA = NULL;
GHOST_TUns8 *toIBuf = NULL;
int x, y, to_i, from_i;
NSBitmapImageRep *blBitmapFormatImageRGB, *blBitmapFormatImageRGBA, *bitmapImage = nil;
NSEnumerator *enumerator;
@@ -1232,8 +1232,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
if (([bitmapImage bitsPerPixel] == 32) && (([bitmapImage bitmapFormat] & 0x5) == 0) &&
![bitmapImage isPlanar]) {
/* Try a fast copy if the image is a meshed RGBA 32bit bitmap. */
toIBuf = (uint8_t *)ibuf->rect;
rasterRGB = (uint8_t *)[bitmapImage bitmapData];
toIBuf = (GHOST_TUns8 *)ibuf->rect;
rasterRGB = (GHOST_TUns8 *)[bitmapImage bitmapData];
for (y = 0; y < imgSize.height; y++) {
to_i = (imgSize.height - y - 1) * imgSize.width;
from_i = y * imgSize.width;
@@ -1270,7 +1270,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
[bitmapImage draw];
[NSGraphicsContext restoreGraphicsState];
rasterRGB = (uint8_t *)[blBitmapFormatImageRGB bitmapData];
rasterRGB = (GHOST_TUns8 *)[blBitmapFormatImageRGB bitmapData];
if (rasterRGB == NULL) {
[bitmapImage release];
[blBitmapFormatImageRGB release];
@@ -1299,7 +1299,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
[bitmapImage draw];
[NSGraphicsContext restoreGraphicsState];
rasterRGBA = (uint8_t *)[blBitmapFormatImageRGBA bitmapData];
rasterRGBA = (GHOST_TUns8 *)[blBitmapFormatImageRGBA bitmapData];
if (rasterRGBA == NULL) {
[bitmapImage release];
[blBitmapFormatImageRGB release];
@@ -1309,7 +1309,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleDraggingEvent(GHOST_TEventType eventType
}
/* Copy the image to ibuf, flipping it vertically. */
toIBuf = (uint8_t *)ibuf->rect;
toIBuf = (GHOST_TUns8 *)ibuf->rect;
for (y = 0; y < imgSize.height; y++) {
for (x = 0; x < imgSize.width; x++) {
to_i = (imgSize.height - y - 1) * imgSize.width + x;
@@ -1563,7 +1563,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
switch (grab_mode) {
case GHOST_kGrabHide: // Cursor hidden grab operation : no cursor move
{
int32_t x_warp, y_warp, x_accum, y_accum, x, y;
GHOST_TInt32 x_warp, y_warp, x_accum, y_accum, x, y;
window->getCursorGrabInitPos(x_warp, y_warp);
window->screenToClientIntern(x_warp, y_warp, x_warp, y_warp);
@@ -1593,8 +1593,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
NSPoint mousePos = [event locationInWindow];
int32_t x_mouse = mousePos.x;
int32_t y_mouse = mousePos.y;
GHOST_TInt32 x_mouse = mousePos.x;
GHOST_TInt32 y_mouse = mousePos.y;
GHOST_Rect bounds, windowBounds, correctedBounds;
/* fallback to window bounds */
@@ -1610,19 +1610,19 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
correctedBounds.m_t = (windowBounds.m_b - windowBounds.m_t) - correctedBounds.m_t;
// Get accumulation from previous mouse warps
int32_t x_accum, y_accum;
GHOST_TInt32 x_accum, y_accum;
window->getCursorGrabAccum(x_accum, y_accum);
// Warp mouse cursor if needed
int32_t warped_x_mouse = x_mouse;
int32_t warped_y_mouse = y_mouse;
GHOST_TInt32 warped_x_mouse = x_mouse;
GHOST_TInt32 warped_y_mouse = y_mouse;
correctedBounds.wrapPoint(
warped_x_mouse, warped_y_mouse, 4, window->getCursorGrabAxis());
// Set new cursor position
if (x_mouse != warped_x_mouse || y_mouse != warped_y_mouse) {
int32_t warped_x, warped_y;
GHOST_TInt32 warped_x, warped_y;
window->clientToScreenIntern(warped_x_mouse, warped_y_mouse, warped_x, warped_y);
setMouseCursorPosition(warped_x, warped_y); /* wrap */
window->setCursorGrabAccum(x_accum + (x_mouse - warped_x_mouse),
@@ -1633,7 +1633,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
// Generate event
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(x_mouse + x_accum, y_mouse + y_accum, x, y);
pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
GHOST_kEventCursorMove,
@@ -1646,7 +1646,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
default: {
// Normal cursor operation: send mouse position in window
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventCursor([event timestamp] * 1000,
@@ -1690,7 +1690,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
/* Standard scroll-wheel case, if no swiping happened,
* and no momentum (kinetic scroll) works. */
if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) {
int32_t delta;
GHOST_TInt32 delta;
double deltaF = [event deltaY];
@@ -1704,7 +1704,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
}
else {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
double dx;
double dy;
@@ -1734,7 +1734,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeMagnify: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000,
window,
@@ -1748,7 +1748,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeSmartMagnify: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad(
[event timestamp] * 1000, window, GHOST_kTrackpadEventSmartMagnify, x, y, 0, 0, false));
@@ -1756,7 +1756,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
case NSEventTypeRotate: {
NSPoint mousePos = [event locationInWindow];
int32_t x, y;
GHOST_TInt32 x, y;
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000,
window,
@@ -1933,9 +1933,9 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
#pragma mark Clipboard get/set
char *GHOST_SystemCocoa::getClipboard(bool selection) const
GHOST_TUns8 *GHOST_SystemCocoa::getClipboard(bool selection) const
{
char *temp_buff;
GHOST_TUns8 *temp_buff;
size_t pastedTextSize;
@autoreleasepool {
@@ -1950,13 +1950,14 @@ char *GHOST_SystemCocoa::getClipboard(bool selection) const
pastedTextSize = [textPasted lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (char *)malloc(pastedTextSize + 1);
temp_buff = (GHOST_TUns8 *)malloc(pastedTextSize + 1);
if (temp_buff == NULL) {
return NULL;
}
strncpy(temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
strncpy(
(char *)temp_buff, [textPasted cStringUsingEncoding:NSUTF8StringEncoding], pastedTextSize);
temp_buff[pastedTextSize] = '\0';
@@ -1969,7 +1970,7 @@ char *GHOST_SystemCocoa::getClipboard(bool selection) const
}
}
void GHOST_SystemCocoa::putClipboard(const char *buffer, bool selection) const
void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
{
if (selection)
return; // for copying the selection, used on X11

View File

@@ -52,33 +52,33 @@ class GHOST_SystemNULL : public GHOST_System {
{
return GHOST_kSuccess;
}
char *getClipboard(bool selection) const
GHOST_TUns8 *getClipboard(bool selection) const
{
return NULL;
}
void putClipboard(const char *buffer, bool selection) const
void putClipboard(GHOST_TInt8 *buffer, bool selection) const
{ /* nop */
}
uint64_t getMilliSeconds() const
GHOST_TUns64 getMilliSeconds() const
{
return 0;
}
uint8_t getNumDisplays() const
GHOST_TUns8 getNumDisplays() const
{
return uint8_t(1);
return GHOST_TUns8(1);
}
GHOST_TSuccess getCursorPosition(int32_t &x, int32_t &y) const
GHOST_TSuccess getCursorPosition(GHOST_TInt32 &x, GHOST_TInt32 &y) const
{
return GHOST_kFailure;
}
GHOST_TSuccess setCursorPosition(int32_t x, int32_t y)
GHOST_TSuccess setCursorPosition(GHOST_TInt32 x, GHOST_TInt32 y)
{
return GHOST_kFailure;
}
void getMainDisplayDimensions(uint32_t &width, uint32_t &height) const
void getMainDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{ /* nop */
}
void getAllDisplayDimensions(uint32_t &width, uint32_t &height) const
void getAllDisplayDimensions(GHOST_TUns32 &width, GHOST_TUns32 &height) const
{ /* nop */
}
GHOST_IContext *createOffscreenContext(GHOST_GLSettings glSettings)
@@ -106,10 +106,10 @@ class GHOST_SystemNULL : public GHOST_System {
}
GHOST_IWindow *createWindow(const char *title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TInt32 left,
GHOST_TInt32 top,
GHOST_TUns32 width,
GHOST_TUns32 height,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
GHOST_GLSettings glSettings,

View File

@@ -49,20 +49,20 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
virtual const char *getSystemDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const = 0;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
virtual const char *getUserDir(int version, const char *versionstr) const = 0;
virtual const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const = 0;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
virtual const char *getBinaryDir() const = 0;
virtual const GHOST_TUns8 *getBinaryDir() const = 0;
/**
* Add the file to the operating system most recently used files

View File

@@ -46,26 +46,26 @@ class GHOST_SystemPathsCocoa : public GHOST_SystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg /usr/share/blender/).
*/
const char *getSystemDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg ~/.blender/).
*/
const char *getUserDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
const char *getBinaryDir() const;
const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files

View File

@@ -36,7 +36,7 @@ GHOST_SystemPathsCocoa::~GHOST_SystemPathsCocoa()
#pragma mark Base directories retrieval
const char *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -60,10 +60,10 @@ const char *GHOST_SystemPathsCocoa::getSystemDir(int, const char *versionstr) co
versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -87,10 +87,10 @@ const char *GHOST_SystemPathsCocoa::getUserDir(int, const char *versionstr) cons
versionstr);
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
{
static char tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
@@ -138,12 +138,12 @@ const char *GHOST_SystemPathsCocoa::getUserSpecialDir(GHOST_TUserSpecialDirTypes
(char *)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding], sizeof(tempPath));
[pool drain];
return tempPath;
return (GHOST_TUns8 *)tempPath;
}
const char *GHOST_SystemPathsCocoa::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsCocoa::getBinaryDir() const
{
static char tempPath[512] = "";
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *basePath;

View File

@@ -55,18 +55,18 @@ GHOST_SystemPathsUnix::~GHOST_SystemPathsUnix()
{
}
const char *GHOST_SystemPathsUnix::getSystemDir(int, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getSystemDir(int, const char *versionstr) const
{
/* no prefix assumes a portable build which only uses bundled scripts */
if (static_path) {
static string system_path = string(static_path) + "/blender/" + versionstr;
return system_path.c_str();
return (GHOST_TUns8 *)system_path.c_str();
}
return NULL;
}
const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionstr) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionstr) const
{
static string user_path = "";
static int last_version = 0;
@@ -86,7 +86,7 @@ const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionst
return NULL;
}
}
return user_path.c_str();
return (GHOST_TUns8 *)user_path.c_str();
}
else {
if (user_path.empty() || last_version != version) {
@@ -107,11 +107,11 @@ const char *GHOST_SystemPathsUnix::getUserDir(int version, const char *versionst
}
}
return user_path.c_str();
return (const GHOST_TUns8 *)user_path.c_str();
}
}
const char *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
{
const char *type_str;
@@ -164,10 +164,10 @@ const char *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDirTypes
}
path = path_stream.str();
return path[0] ? path.c_str() : NULL;
return path[0] ? (const GHOST_TUns8 *)path.c_str() : NULL;
}
const char *GHOST_SystemPathsUnix::getBinaryDir() const
const GHOST_TUns8 *GHOST_SystemPathsUnix::getBinaryDir() const
{
return NULL;
}

View File

@@ -44,26 +44,26 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths {
* "unpack and run" path, then look for properly installed path, including versioning.
* \return Unsigned char string pointing to system dir (eg `/usr/share/blender/`).
*/
const char *getSystemDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getSystemDir(int version, const char *versionstr) const;
/**
* Determine the base dir in which user configuration is stored, including versioning.
* If needed, it will create the base directory.
* \return Unsigned char string pointing to user dir (eg `~/.config/.blender/`).
*/
const char *getUserDir(int version, const char *versionstr) const;
const GHOST_TUns8 *getUserDir(int version, const char *versionstr) const;
/**
* Determine a special ("well known") and easy to reach user directory.
* \return Unsigned char string pointing to user dir (eg `~/Documents/`).
*/
const char *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
const GHOST_TUns8 *getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const;
/**
* Determine the directory of the current binary
* \return Unsigned char string pointing to the binary dir
*/
const char *getBinaryDir() const;
const GHOST_TUns8 *getBinaryDir() const;
/**
* Add the file to the operating system most recently used files

Some files were not shown because too many files have changed in this diff Show More