Cleanup: use braces around statements
This commit is contained in:
@@ -65,8 +65,9 @@ GHOST_ContextWGL::~GHOST_ContextWGL()
|
|||||||
|
|
||||||
s_sharedCount--;
|
s_sharedCount--;
|
||||||
|
|
||||||
if (s_sharedCount == 0)
|
if (s_sharedCount == 0) {
|
||||||
s_sharedHGLRC = nullptr;
|
s_sharedHGLRC = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
WIN32_CHK(::wglDeleteContext(m_hGLRC));
|
WIN32_CHK(::wglDeleteContext(m_hGLRC));
|
||||||
}
|
}
|
||||||
@@ -88,10 +89,12 @@ GHOST_TSuccess GHOST_ContextWGL::swapBuffers()
|
|||||||
|
|
||||||
GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
|
GHOST_TSuccess GHOST_ContextWGL::setSwapInterval(int interval)
|
||||||
{
|
{
|
||||||
if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control"))
|
if (epoxy_has_wgl_extension(m_hDC, "WGL_EXT_swap_control")) {
|
||||||
return WIN32_CHK(::wglSwapIntervalEXT(interval)) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
return WIN32_CHK(::wglSwapIntervalEXT(interval)) == TRUE ? GHOST_kSuccess : GHOST_kFailure;
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
|
GHOST_TSuccess GHOST_ContextWGL::getSwapInterval(int &intervalOut)
|
||||||
@@ -149,8 +152,9 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
|
|||||||
|
|
||||||
weight += pfd.cColorBits - 8;
|
weight += pfd.cColorBits - 8;
|
||||||
|
|
||||||
if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0)
|
if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0) {
|
||||||
weight++;
|
weight++;
|
||||||
|
}
|
||||||
#ifdef WIN32_COMPOSITING
|
#ifdef WIN32_COMPOSITING
|
||||||
if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION))
|
if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION))
|
||||||
weight++;
|
weight++;
|
||||||
@@ -200,8 +204,9 @@ static int choose_pixel_format_legacy(HDC hDC, PIXELFORMATDESCRIPTOR &preferredP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* choose any available stereo format over a non-stereo format */
|
/* choose any available stereo format over a non-stereo format */
|
||||||
if (iStereoPixelFormat != 0)
|
if (iStereoPixelFormat != 0) {
|
||||||
iPixelFormat = iStereoPixelFormat;
|
iPixelFormat = iStereoPixelFormat;
|
||||||
|
}
|
||||||
|
|
||||||
if (iPixelFormat == 0) {
|
if (iPixelFormat == 0) {
|
||||||
fprintf(stderr, "Warning! Using result of ChoosePixelFormat.\n");
|
fprintf(stderr, "Warning! Using result of ChoosePixelFormat.\n");
|
||||||
@@ -372,36 +377,44 @@ struct DummyContextWGL {
|
|||||||
|
|
||||||
dummyPixelFormat = choose_pixel_format_legacy(hDC, preferredPFD);
|
dummyPixelFormat = choose_pixel_format_legacy(hDC, preferredPFD);
|
||||||
|
|
||||||
if (dummyPixelFormat == 0)
|
if (dummyPixelFormat == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PIXELFORMATDESCRIPTOR chosenPFD;
|
PIXELFORMATDESCRIPTOR chosenPFD;
|
||||||
if (!WIN32_CHK(::DescribePixelFormat(
|
if (!WIN32_CHK(::DescribePixelFormat(
|
||||||
hDC, dummyPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD)))
|
hDC, dummyPixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &chosenPFD)))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hWnd) {
|
if (hWnd) {
|
||||||
dummyHWND = clone_window(hWnd, nullptr);
|
dummyHWND = clone_window(hWnd, nullptr);
|
||||||
|
|
||||||
if (dummyHWND == nullptr)
|
if (dummyHWND == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dummyHDC = GetDC(dummyHWND);
|
dummyHDC = GetDC(dummyHWND);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WIN32_CHK(dummyHDC != nullptr))
|
if (!WIN32_CHK(dummyHDC != nullptr)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!WIN32_CHK(::SetPixelFormat(dummyHDC, dummyPixelFormat, &chosenPFD)))
|
if (!WIN32_CHK(::SetPixelFormat(dummyHDC, dummyPixelFormat, &chosenPFD))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
dummyHGLRC = ::wglCreateContext(dummyHDC);
|
dummyHGLRC = ::wglCreateContext(dummyHDC);
|
||||||
|
|
||||||
if (!WIN32_CHK(dummyHGLRC != nullptr))
|
if (!WIN32_CHK(dummyHGLRC != nullptr)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC)))
|
if (!WIN32_CHK(::wglMakeCurrent(dummyHDC, dummyHGLRC))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
has_WGL_ARB_pixel_format = epoxy_has_wgl_extension(hDC, "WGL_ARB_pixel_format");
|
has_WGL_ARB_pixel_format = epoxy_has_wgl_extension(hDC, "WGL_ARB_pixel_format");
|
||||||
has_WGL_ARB_create_context = epoxy_has_wgl_extension(hDC, "WGL_ARB_create_context");
|
has_WGL_ARB_create_context = epoxy_has_wgl_extension(hDC, "WGL_ARB_create_context");
|
||||||
@@ -523,8 +536,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
|
|||||||
if (!dummy.has_WGL_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
|
if (!dummy.has_WGL_ARB_create_context || ::GetPixelFormat(m_hDC) == 0) {
|
||||||
int iPixelFormat = 0;
|
int iPixelFormat = 0;
|
||||||
|
|
||||||
if (dummy.has_WGL_ARB_pixel_format)
|
if (dummy.has_WGL_ARB_pixel_format) {
|
||||||
iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha);
|
iPixelFormat = choose_pixel_format_arb(m_stereoVisual, needAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
if (iPixelFormat == 0)
|
if (iPixelFormat == 0)
|
||||||
iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD);
|
iPixelFormat = choose_pixel_format_legacy(m_hDC, dummy.preferredPFD);
|
||||||
@@ -541,8 +555,9 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needAlpha && chosenPFD.cAlphaBits == 0)
|
if (needAlpha && chosenPFD.cAlphaBits == 0) {
|
||||||
fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n");
|
fprintf(stderr, "Warning! Unable to find a pixel format with an alpha channel.\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) {
|
if (!WIN32_CHK(::SetPixelFormat(m_hDC, iPixelFormat, &chosenPFD))) {
|
||||||
goto error;
|
goto error;
|
||||||
@@ -553,22 +568,27 @@ GHOST_TSuccess GHOST_ContextWGL::initializeDrawingContext()
|
|||||||
int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
int profileBitCore = m_contextProfileMask & WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||||
int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
int profileBitCompat = m_contextProfileMask & WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
|
||||||
|
|
||||||
if (!dummy.has_WGL_ARB_create_context_profile && profileBitCore)
|
if (!dummy.has_WGL_ARB_create_context_profile && profileBitCore) {
|
||||||
fprintf(stderr, "Warning! OpenGL core profile not available.\n");
|
fprintf(stderr, "Warning! OpenGL core profile not available.\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (!dummy.has_WGL_ARB_create_context_profile && profileBitCompat)
|
if (!dummy.has_WGL_ARB_create_context_profile && profileBitCompat) {
|
||||||
fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n");
|
fprintf(stderr, "Warning! OpenGL compatibility profile not available.\n");
|
||||||
|
}
|
||||||
|
|
||||||
int profileMask = 0;
|
int profileMask = 0;
|
||||||
|
|
||||||
if (dummy.has_WGL_ARB_create_context_profile && profileBitCore)
|
if (dummy.has_WGL_ARB_create_context_profile && profileBitCore) {
|
||||||
profileMask |= profileBitCore;
|
profileMask |= profileBitCore;
|
||||||
|
}
|
||||||
|
|
||||||
if (dummy.has_WGL_ARB_create_context_profile && profileBitCompat)
|
if (dummy.has_WGL_ARB_create_context_profile && profileBitCompat) {
|
||||||
profileMask |= profileBitCompat;
|
profileMask |= profileBitCompat;
|
||||||
|
}
|
||||||
|
|
||||||
if (profileMask != m_contextProfileMask)
|
if (profileMask != m_contextProfileMask) {
|
||||||
fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits.");
|
fprintf(stderr, "Warning! Ignoring untested OpenGL context profile mask bits.");
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> iAttributes;
|
std::vector<int> iAttributes;
|
||||||
|
|
||||||
|
|||||||
@@ -41,8 +41,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getNumDisplaySettings(uint8_t display,
|
|||||||
* function was called with #iModeNum set to zero. */
|
* function was called with #iModeNum set to zero. */
|
||||||
|
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
if (!get_dd(display, &display_device))
|
if (!get_dd(display, &display_device)) {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
|
}
|
||||||
|
|
||||||
numSettings = 0;
|
numSettings = 0;
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
@@ -57,8 +58,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::getDisplaySetting(uint8_t display,
|
|||||||
GHOST_DisplaySetting &setting) const
|
GHOST_DisplaySetting &setting) const
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
if (!get_dd(display, &display_device))
|
if (!get_dd(display, &display_device)) {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
|
}
|
||||||
|
|
||||||
GHOST_TSuccess success;
|
GHOST_TSuccess success;
|
||||||
DEVMODE dm;
|
DEVMODE dm;
|
||||||
@@ -102,8 +104,9 @@ GHOST_TSuccess GHOST_DisplayManagerWin32::setCurrentDisplaySetting(
|
|||||||
uint8_t display, const GHOST_DisplaySetting &setting)
|
uint8_t display, const GHOST_DisplaySetting &setting)
|
||||||
{
|
{
|
||||||
DISPLAY_DEVICE display_device;
|
DISPLAY_DEVICE display_device;
|
||||||
if (!get_dd(display, &display_device))
|
if (!get_dd(display, &display_device)) {
|
||||||
return GHOST_kFailure;
|
return GHOST_kFailure;
|
||||||
|
}
|
||||||
|
|
||||||
GHOST_DisplaySetting match;
|
GHOST_DisplaySetting match;
|
||||||
findMatch(display, setting, match);
|
findMatch(display, setting, match);
|
||||||
|
|||||||
@@ -130,8 +130,9 @@ void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filepath) const
|
|||||||
IShellItem *shell_item;
|
IShellItem *shell_item;
|
||||||
|
|
||||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
|
||||||
if (!SUCCEEDED(hr))
|
if (!SUCCEEDED(hr)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hr = SHCreateItemFromParsingName(filepath_16, nullptr, IID_PPV_ARGS(&shell_item));
|
hr = SHCreateItemFromParsingName(filepath_16, nullptr, IID_PPV_ARGS(&shell_item));
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
|
|||||||
@@ -2734,8 +2734,9 @@ void GHOST_SystemX11::refreshXInputDevices()
|
|||||||
void GHOST_SystemX11::clearXInputDevices()
|
void GHOST_SystemX11::clearXInputDevices()
|
||||||
{
|
{
|
||||||
for (GHOST_TabletX11 &xtablet : m_xtablets) {
|
for (GHOST_TabletX11 &xtablet : m_xtablets) {
|
||||||
if (xtablet.Device)
|
if (xtablet.Device) {
|
||||||
XCloseDevice(m_display, xtablet.Device);
|
XCloseDevice(m_display, xtablet.Device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_xtablets.clear();
|
m_xtablets.clear();
|
||||||
|
|||||||
@@ -671,8 +671,9 @@ void GHOST_WindowWin32::updateMouseCapture(GHOST_MouseCaptureEventWin32 event)
|
|||||||
m_nPressedButtons++;
|
m_nPressedButtons++;
|
||||||
break;
|
break;
|
||||||
case MouseReleased:
|
case MouseReleased:
|
||||||
if (m_nPressedButtons)
|
if (m_nPressedButtons) {
|
||||||
m_nPressedButtons--;
|
m_nPressedButtons--;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case OperatorGrab:
|
case OperatorGrab:
|
||||||
m_hasGrabMouse = true;
|
m_hasGrabMouse = true;
|
||||||
@@ -821,12 +822,14 @@ HCURSOR GHOST_WindowWin32::getStandardCursor(GHOST_TStandardCursor shape) const
|
|||||||
void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor shape) const
|
void GHOST_WindowWin32::loadCursor(bool visible, GHOST_TStandardCursor shape) const
|
||||||
{
|
{
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
while (::ShowCursor(FALSE) >= 0)
|
while (::ShowCursor(FALSE) >= 0) {
|
||||||
;
|
/* Pass. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
while (::ShowCursor(TRUE) < 0)
|
while (::ShowCursor(TRUE) < 0) {
|
||||||
;
|
/* Pass. */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HCURSOR cursor = getStandardCursor(shape);
|
HCURSOR cursor = getStandardCursor(shape);
|
||||||
|
|||||||
@@ -402,8 +402,9 @@ bool GHOST_WindowX11::createX11_XIC()
|
|||||||
XNDestroyCallback,
|
XNDestroyCallback,
|
||||||
&destroy,
|
&destroy,
|
||||||
nullptr);
|
nullptr);
|
||||||
if (!m_xic)
|
if (!m_xic) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ulong fevent;
|
ulong fevent;
|
||||||
XGetICValues(m_xic, XNFilterEvents, &fevent, nullptr);
|
XGetICValues(m_xic, XNFilterEvents, &fevent, nullptr);
|
||||||
|
|||||||
@@ -397,8 +397,9 @@ bool processEvent(GHOST_EventHandle hEvent, GHOST_TUserDataPtr userData)
|
|||||||
break;
|
break;
|
||||||
case GHOST_kEventWindowUpdate: {
|
case GHOST_kEventWindowUpdate: {
|
||||||
GHOST_WindowHandle window2 = GHOST_GetEventWindow(hEvent);
|
GHOST_WindowHandle window2 = GHOST_GetEventWindow(hEvent);
|
||||||
if (!GHOST_ValidWindow(shSystem, window2))
|
if (!GHOST_ValidWindow(shSystem, window2)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
setViewPortGL(window2);
|
setViewPortGL(window2);
|
||||||
drawGL();
|
drawGL();
|
||||||
GHOST_SwapWindowBuffers(window2);
|
GHOST_SwapWindowBuffers(window2);
|
||||||
|
|||||||
@@ -602,8 +602,9 @@ bool Application::processEvent(GHOST_IEvent *event)
|
|||||||
|
|
||||||
case GHOST_kEventWindowUpdate: {
|
case GHOST_kEventWindowUpdate: {
|
||||||
GHOST_IWindow *window2 = event->getWindow();
|
GHOST_IWindow *window2 = event->getWindow();
|
||||||
if (!m_system->validWindow(window2))
|
if (!m_system->validWindow(window2)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
|
|||||||
@@ -78,10 +78,12 @@ void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, const float
|
|||||||
int x = (corner == 0 || corner == 1) ? (rect[0][0] + i) : (rect[1][0] - i - 1);
|
int x = (corner == 0 || corner == 1) ? (rect[0][0] + i) : (rect[1][0] - i - 1);
|
||||||
int y = (corner == 0 || corner == 3) ? (rect[0][1] + i) : (rect[1][1] - i - 1);
|
int y = (corner == 0 || corner == 3) ? (rect[0][1] + i) : (rect[1][1] - i - 1);
|
||||||
|
|
||||||
if (ltidx == corner)
|
if (ltidx == corner) {
|
||||||
glColor3f(col[0] * ltf, col[1] * ltf, col[2] * ltf);
|
glColor3f(col[0] * ltf, col[1] * ltf, col[2] * ltf);
|
||||||
if (dkidx == corner)
|
}
|
||||||
|
if (dkidx == corner) {
|
||||||
glColor3f(col[0] * dkf, col[1] * dkf, col[2] * dkf);
|
glColor3f(col[0] * dkf, col[1] * dkf, col[2] * dkf);
|
||||||
|
}
|
||||||
|
|
||||||
glVertex2i(lx, ly);
|
glVertex2i(lx, ly);
|
||||||
glVertex2i(lx = x, ly = y);
|
glVertex2i(lx = x, ly = y);
|
||||||
@@ -513,8 +515,9 @@ static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press)
|
|||||||
{
|
{
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case GHOST_kKeyQ:
|
case GHOST_kKeyQ:
|
||||||
if (press)
|
if (press) {
|
||||||
multitestapp_exit(lw->app);
|
multitestapp_exit(lw->app);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -685,8 +688,9 @@ static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press)
|
|||||||
{
|
{
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case GHOST_kKeyE:
|
case GHOST_kKeyE:
|
||||||
if (press)
|
if (press) {
|
||||||
multitestapp_toggle_extra_window(ew->app);
|
multitestapp_toggle_extra_window(ew->app);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -862,19 +866,23 @@ MultiTestApp *multitestapp_new(void)
|
|||||||
GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(multitest_event_handler, app);
|
GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(multitest_event_handler, app);
|
||||||
|
|
||||||
app->sys = GHOST_CreateSystem();
|
app->sys = GHOST_CreateSystem();
|
||||||
if (!app->sys)
|
if (!app->sys) {
|
||||||
fatal("Unable to create ghost system");
|
fatal("Unable to create ghost system");
|
||||||
|
}
|
||||||
|
|
||||||
if (!GHOST_AddEventConsumer(app->sys, consumer))
|
if (!GHOST_AddEventConsumer(app->sys, consumer)) {
|
||||||
fatal("Unable to add multitest event consumer ");
|
fatal("Unable to add multitest event consumer ");
|
||||||
|
}
|
||||||
|
|
||||||
app->main = mainwindow_new(app);
|
app->main = mainwindow_new(app);
|
||||||
if (!app->main)
|
if (!app->main) {
|
||||||
fatal("Unable to create main window");
|
fatal("Unable to create main window");
|
||||||
|
}
|
||||||
|
|
||||||
app->logger = loggerwindow_new(app);
|
app->logger = loggerwindow_new(app);
|
||||||
if (!app->logger)
|
if (!app->logger) {
|
||||||
fatal("Unable to create logger window");
|
fatal("Unable to create logger window");
|
||||||
|
}
|
||||||
|
|
||||||
app->extra = NULL;
|
app->extra = NULL;
|
||||||
app->exit = 0;
|
app->exit = 0;
|
||||||
|
|||||||
@@ -34,12 +34,14 @@ void *operator new[](size_t size)
|
|||||||
void operator delete(void *p) throw()
|
void operator delete(void *p) throw()
|
||||||
{
|
{
|
||||||
/* delete NULL is valid in c++ */
|
/* delete NULL is valid in c++ */
|
||||||
if (p)
|
if (p) {
|
||||||
MEM_freeN(p);
|
MEM_freeN(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void operator delete[](void *p) throw()
|
void operator delete[](void *p) throw()
|
||||||
{
|
{
|
||||||
/* delete NULL is valid in c++ */
|
/* delete NULL is valid in c++ */
|
||||||
if (p)
|
if (p) {
|
||||||
MEM_freeN(p);
|
MEM_freeN(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,9 @@ int main(int argc, char *argv[])
|
|||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 2:
|
case 2:
|
||||||
verbose = atoi(argv[1]);
|
verbose = atoi(argv[1]);
|
||||||
if (verbose < 0)
|
if (verbose < 0) {
|
||||||
verbose = 0;
|
verbose = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
default:
|
default:
|
||||||
@@ -59,15 +60,17 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < NUM_BLOCKS; i++) {
|
for (i = 0; i < NUM_BLOCKS; i++) {
|
||||||
int blocksize = 10000;
|
int blocksize = 10000;
|
||||||
char tagstring[1000];
|
char tagstring[1000];
|
||||||
if (verbose > 1)
|
if (verbose > 1) {
|
||||||
printf("|--* Allocating block %d\n", i);
|
printf("|--* Allocating block %d\n", i);
|
||||||
|
}
|
||||||
sprintf(tagstring, "Memblock no. %d : ", i);
|
sprintf(tagstring, "Memblock no. %d : ", i);
|
||||||
p[i] = MEM_callocN(blocksize, strdup(tagstring));
|
p[i] = MEM_callocN(blocksize, strdup(tagstring));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* report on that */
|
/* report on that */
|
||||||
if (verbose > 1)
|
if (verbose > 1) {
|
||||||
MEM_printmemlist();
|
MEM_printmemlist();
|
||||||
|
}
|
||||||
|
|
||||||
/* memory is there: test it */
|
/* memory is there: test it */
|
||||||
error_status = MEM_consistency_check();
|
error_status = MEM_consistency_check();
|
||||||
@@ -94,16 +97,18 @@ int main(int argc, char *argv[])
|
|||||||
for (i = 0; i < NUM_BLOCKS; i++) {
|
for (i = 0; i < NUM_BLOCKS; i++) {
|
||||||
int blocksize = 10000;
|
int blocksize = 10000;
|
||||||
char tagstring[1000];
|
char tagstring[1000];
|
||||||
if (verbose > 1)
|
if (verbose > 1) {
|
||||||
printf("|--* Allocating block %d\n", i);
|
printf("|--* Allocating block %d\n", i);
|
||||||
|
}
|
||||||
sprintf(tagstring, "Memblock no. %d : ", i);
|
sprintf(tagstring, "Memblock no. %d : ", i);
|
||||||
p[i] = MEM_callocN(blocksize, strdup(tagstring));
|
p[i] = MEM_callocN(blocksize, strdup(tagstring));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now corrupt a few blocks. */
|
/* Now corrupt a few blocks. */
|
||||||
ip = (int *)p[5] - 50;
|
ip = (int *)p[5] - 50;
|
||||||
for (i = 0; i < 1000; i++, ip++)
|
for (i = 0; i < 1000; i++, ip++) {
|
||||||
*ip = i + 1;
|
*ip = i + 1;
|
||||||
|
}
|
||||||
ip = (int *)p[6];
|
ip = (int *)p[6];
|
||||||
*(ip + 10005) = 0;
|
*(ip + 10005) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -227,8 +227,9 @@ static void bli_windows_system_backtrace_modules(FILE *fp)
|
|||||||
{
|
{
|
||||||
fprintf(fp, "Loaded Modules :\n");
|
fprintf(fp, "Loaded Modules :\n");
|
||||||
HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
|
HANDLE hModuleSnap = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, 0);
|
||||||
if (hModuleSnap == INVALID_HANDLE_VALUE)
|
if (hModuleSnap == INVALID_HANDLE_VALUE) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MODULEENTRY32 me32;
|
MODULEENTRY32 me32;
|
||||||
me32.dwSize = sizeof(MODULEENTRY32);
|
me32.dwSize = sizeof(MODULEENTRY32);
|
||||||
|
|||||||
@@ -573,8 +573,9 @@ void blo_readfile_invalidate(FileData *fd, Main *bmain, const char *message)
|
|||||||
/* Tag given `bmain`, and 'root 'local' main one (in case given one is a library one) as invalid.
|
/* Tag given `bmain`, and 'root 'local' main one (in case given one is a library one) as invalid.
|
||||||
*/
|
*/
|
||||||
bmain->is_read_invalid = true;
|
bmain->is_read_invalid = true;
|
||||||
for (; bmain->prev != nullptr; bmain = bmain->prev)
|
for (; bmain->prev != nullptr; bmain = bmain->prev) {
|
||||||
;
|
/* Pass. */
|
||||||
|
}
|
||||||
bmain->is_read_invalid = true;
|
bmain->is_read_invalid = true;
|
||||||
|
|
||||||
BLO_reportf_wrap(fd->reports,
|
BLO_reportf_wrap(fd->reports,
|
||||||
|
|||||||
@@ -263,8 +263,9 @@ static int strip_modifier_copy_exec(bContext *C, wmOperator *op)
|
|||||||
/* If original is sound, only copy to "sound" strips
|
/* If original is sound, only copy to "sound" strips
|
||||||
* If original is not sound, only copy to "not sound" strips
|
* If original is not sound, only copy to "not sound" strips
|
||||||
*/
|
*/
|
||||||
if (isSound != seq_iter_is_sound)
|
if (isSound != seq_iter_is_sound) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (type == SEQ_MODIFIER_COPY_REPLACE) {
|
if (type == SEQ_MODIFIER_COPY_REPLACE) {
|
||||||
if (seq_iter->modifiers.first) {
|
if (seq_iter->modifiers.first) {
|
||||||
|
|||||||
@@ -137,8 +137,9 @@ static void generate_vertex_map(const Mesh *mesh,
|
|||||||
|
|
||||||
/* Add zero UVs for any loose vertices. */
|
/* Add zero UVs for any loose vertices. */
|
||||||
for (int vertex_index = 0; vertex_index < mesh->totvert; vertex_index++) {
|
for (int vertex_index = 0; vertex_index < mesh->totvert; vertex_index++) {
|
||||||
if (r_vertex_to_ply[vertex_index] != -1)
|
if (r_vertex_to_ply[vertex_index] != -1) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
int ply_index = int(r_uvs.size());
|
int ply_index = int(r_uvs.size());
|
||||||
r_vertex_to_ply[vertex_index] = ply_index;
|
r_vertex_to_ply[vertex_index] = ply_index;
|
||||||
r_uvs.append({0, 0});
|
r_uvs.append({0, 0});
|
||||||
|
|||||||
@@ -60,8 +60,9 @@ static Span<char> parse_word(Span<char> &str)
|
|||||||
|
|
||||||
static void skip_space(Span<char> &str)
|
static void skip_space(Span<char> &str)
|
||||||
{
|
{
|
||||||
while (!str.is_empty() && str[0] <= ' ')
|
while (!str.is_empty() && str[0] <= ' ') {
|
||||||
str = str.drop_front(1);
|
str = str.drop_front(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static PlyDataTypes type_from_string(Span<char> word)
|
static PlyDataTypes type_from_string(Span<char> word)
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ bool PlyReadBuffer::read_bytes(void *dst, size_t size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int to_copy = int(size);
|
int to_copy = int(size);
|
||||||
if (to_copy > buf_used_)
|
if (to_copy > buf_used_) {
|
||||||
to_copy = buf_used_;
|
to_copy = buf_used_;
|
||||||
|
}
|
||||||
memcpy(dst, buffer_.data() + pos_, to_copy);
|
memcpy(dst, buffer_.data() + pos_, to_copy);
|
||||||
pos_ += to_copy;
|
pos_ += to_copy;
|
||||||
dst = (char *)dst + to_copy;
|
dst = (char *)dst + to_copy;
|
||||||
|
|||||||
@@ -341,8 +341,9 @@ static uint32_t read_list_count(PlyReadBuffer &file,
|
|||||||
scratch.resize(8);
|
scratch.resize(8);
|
||||||
file.read_bytes(scratch.data(), data_type_size[prop.count_type]);
|
file.read_bytes(scratch.data(), data_type_size[prop.count_type]);
|
||||||
const uint8_t *ptr = scratch.data();
|
const uint8_t *ptr = scratch.data();
|
||||||
if (big_endian)
|
if (big_endian) {
|
||||||
endian_switch((uint8_t *)ptr, data_type_size[prop.count_type]);
|
endian_switch((uint8_t *)ptr, data_type_size[prop.count_type]);
|
||||||
|
}
|
||||||
uint32_t count = get_binary_value<uint32_t>(prop.count_type, ptr);
|
uint32_t count = get_binary_value<uint32_t>(prop.count_type, ptr);
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -446,8 +447,9 @@ static const char *load_face_element(PlyReadBuffer &file,
|
|||||||
scratch.resize(count * data_type_size[prop.type]);
|
scratch.resize(count * data_type_size[prop.type]);
|
||||||
file.read_bytes(scratch.data(), scratch.size());
|
file.read_bytes(scratch.data(), scratch.size());
|
||||||
ptr = scratch.data();
|
ptr = scratch.data();
|
||||||
if (header.type == PlyFormatType::BINARY_BE)
|
if (header.type == PlyFormatType::BINARY_BE) {
|
||||||
endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count);
|
endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count);
|
||||||
|
}
|
||||||
for (int j = 0; j < count; ++j) {
|
for (int j = 0; j < count; ++j) {
|
||||||
uint32_t index = get_binary_value<uint32_t>(prop.type, ptr);
|
uint32_t index = get_binary_value<uint32_t>(prop.type, ptr);
|
||||||
data->face_vertices.append(index);
|
data->face_vertices.append(index);
|
||||||
@@ -508,8 +510,9 @@ static const char *load_tristrips_element(PlyReadBuffer &file,
|
|||||||
scratch.resize(count * data_type_size[prop.type]);
|
scratch.resize(count * data_type_size[prop.type]);
|
||||||
file.read_bytes(scratch.data(), scratch.size());
|
file.read_bytes(scratch.data(), scratch.size());
|
||||||
ptr = scratch.data();
|
ptr = scratch.data();
|
||||||
if (header.type == PlyFormatType::BINARY_BE)
|
if (header.type == PlyFormatType::BINARY_BE) {
|
||||||
endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count);
|
endian_switch_array((uint8_t *)ptr, data_type_size[prop.type], count);
|
||||||
|
}
|
||||||
for (int j = 0; j < count; ++j) {
|
for (int j = 0; j < count; ++j) {
|
||||||
int index = get_binary_value<int>(prop.type, ptr);
|
int index = get_binary_value<int>(prop.type, ptr);
|
||||||
strip[j] = index;
|
strip[j] = index;
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ static std::unique_ptr<PlyData> load_cube(PLYExportParams ¶ms)
|
|||||||
plyData->face_vertices = {0, 2, 6, 4, 3, 7, 6, 2, 7, 5, 4, 6,
|
plyData->face_vertices = {0, 2, 6, 4, 3, 7, 6, 2, 7, 5, 4, 6,
|
||||||
5, 7, 3, 1, 1, 3, 2, 0, 5, 1, 0, 4};
|
5, 7, 3, 1, 1, 3, 2, 0, 5, 1, 0, 4};
|
||||||
|
|
||||||
if (params.export_normals)
|
if (params.export_normals) {
|
||||||
plyData->vertex_normals = {
|
plyData->vertex_normals = {
|
||||||
{-0.5773503, -0.5773503, -0.5773503},
|
{-0.5773503, -0.5773503, -0.5773503},
|
||||||
{-0.5773503, -0.5773503, 0.5773503},
|
{-0.5773503, -0.5773503, 0.5773503},
|
||||||
@@ -87,6 +87,7 @@ static std::unique_ptr<PlyData> load_cube(PLYExportParams ¶ms)
|
|||||||
{0.5773503, 0.5773503, -0.5773503},
|
{0.5773503, 0.5773503, -0.5773503},
|
||||||
{0.5773503, 0.5773503, 0.5773503},
|
{0.5773503, 0.5773503, 0.5773503},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return plyData;
|
return plyData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,10 +161,12 @@ EQCurveMappingData *SEQ_sound_equalizer_add(SoundEqualizerModifierData *semd,
|
|||||||
{
|
{
|
||||||
EQCurveMappingData *eqcmd;
|
EQCurveMappingData *eqcmd;
|
||||||
|
|
||||||
if (maxX < 0)
|
if (maxX < 0) {
|
||||||
maxX = SOUND_EQUALIZER_DEFAULT_MAX_FREQ;
|
maxX = SOUND_EQUALIZER_DEFAULT_MAX_FREQ;
|
||||||
if (minX < 0)
|
}
|
||||||
|
if (minX < 0) {
|
||||||
minX = 0.0;
|
minX = 0.0;
|
||||||
|
}
|
||||||
/* It's the same as BKE_curvemapping_add , but changing the name */
|
/* It's the same as BKE_curvemapping_add , but changing the name */
|
||||||
eqcmd = MEM_cnew<EQCurveMappingData>("Equalizer");
|
eqcmd = MEM_cnew<EQCurveMappingData>("Equalizer");
|
||||||
BKE_curvemapping_set_defaults(&eqcmd->curve_mapping,
|
BKE_curvemapping_set_defaults(&eqcmd->curve_mapping,
|
||||||
@@ -212,12 +214,15 @@ EQCurveMappingData *SEQ_sound_equalizermodifier_add_graph(SoundEqualizerModifier
|
|||||||
float min_freq,
|
float min_freq,
|
||||||
float max_freq)
|
float max_freq)
|
||||||
{
|
{
|
||||||
if (min_freq < 0.0)
|
if (min_freq < 0.0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (max_freq < 0.0)
|
}
|
||||||
|
if (max_freq < 0.0) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (max_freq <= min_freq)
|
}
|
||||||
|
if (max_freq <= min_freq) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
return SEQ_sound_equalizer_add(semd, min_freq, max_freq);
|
return SEQ_sound_equalizer_add(semd, min_freq, max_freq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,8 +332,9 @@ void *SEQ_sound_equalizermodifier_recreator(Sequence *seq, SequenceModifierData
|
|||||||
const SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type)
|
const SoundModifierWorkerInfo *SEQ_sound_modifier_worker_info_get(int type)
|
||||||
{
|
{
|
||||||
for (int i = 0; workersSoundModifiers[i].type > 0; i++) {
|
for (int i = 0; workersSoundModifiers[i].type > 0; i++) {
|
||||||
if (workersSoundModifiers[i].type == type)
|
if (workersSoundModifiers[i].type == type) {
|
||||||
return &workersSoundModifiers[i];
|
return &workersSoundModifiers[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user