commit 2795c66b1654b6fda8f5a892057ffb625508a60f
parent ff3308ea44d52261e800a618ec41c27fdb20a7b1
Author: JP Cimalando <jpcima@users.noreply.github.com>
Date: Wed, 26 Dec 2018 21:57:44 +0100
rewrite preprocessor conditionals in simplified form
Diffstat:
11 files changed, 36 insertions(+), 36 deletions(-)
diff --git a/dgl/Base.hpp b/dgl/Base.hpp
@@ -73,7 +73,7 @@
// -----------------------------------------------------------------------
// OpenGL includes
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
#ifdef DISTRHO_OS_MAC
# include <OpenGL/gl.h>
@@ -90,14 +90,14 @@
// -----------------------------------------------------------------------
// Cairo includes
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
# include <cairo/cairo.h>
#endif
// -----------------------------------------------------------------------
// Missing OpenGL defines
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
#if defined(GL_BGR_EXT) && ! defined(GL_BGR)
# define GL_BGR GL_BGR_EXT
diff --git a/dgl/Color.hpp b/dgl/Color.hpp
@@ -19,7 +19,7 @@
#include "Base.hpp"
-#if !defined(HAVE_DCAIRO)
+#ifndef HAVE_DCAIRO
struct NVGcolor;
#endif
@@ -97,7 +97,7 @@ struct Color {
*/
void fixBounds() noexcept;
-#if !defined(HAVE_DCAIRO)
+#ifndef HAVE_DCAIRO
/**
@internal
Needed for NanoVG compatibility.
diff --git a/dgl/Geometry.hpp b/dgl/Geometry.hpp
@@ -346,7 +346,7 @@ public:
*/
void moveBy(const Point<T>& pos) noexcept;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
/**
Draw this line using the current OpenGL state.
*/
@@ -462,7 +462,7 @@ public:
*/
void setNumSegments(const uint num);
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
/**
Draw this circle using the current OpenGL state.
*/
@@ -486,7 +486,7 @@ private:
// cached values
float fTheta, fCos, fSin;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
void _draw(const bool outline);
#endif
};
@@ -522,7 +522,7 @@ public:
*/
Triangle(const Triangle<T>& tri) noexcept;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
/**
Draw this triangle using the current OpenGL state.
*/
@@ -564,7 +564,7 @@ public:
private:
Point<T> fPos1, fPos2, fPos3;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
void _draw(const bool outline);
#endif
};
@@ -730,7 +730,7 @@ public:
*/
bool containsY(const T& y) const noexcept;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
/**
Draw this rectangle using the current OpenGL state.
*/
@@ -752,7 +752,7 @@ private:
Point<T> fPos;
Size<T> fSize;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
void _draw(const bool outline);
#endif
};
diff --git a/dgl/Widget.hpp b/dgl/Widget.hpp
@@ -312,7 +312,7 @@ public:
*/
Window& getParentWindow() const noexcept;
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
cairo_t* getContext() const noexcept;
#endif
diff --git a/dgl/Window.hpp b/dgl/Window.hpp
@@ -119,7 +119,7 @@ public:
Application& getApp() const noexcept;
intptr_t getWindowId() const noexcept;
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
cairo_t* getContext() const noexcept;
#endif
diff --git a/dgl/src/Color.cpp b/dgl/src/Color.cpp
@@ -16,7 +16,7 @@
#include "../Color.hpp"
-#if !defined(HAVE_DCAIRO)
+#ifndef HAVE_DCAIRO
#include "nanovg/nanovg.h"
#endif
@@ -105,7 +105,7 @@ Color::Color(const Color& color1, const Color& color2, float u) noexcept
interpolate(color2, u);
}
-#if !defined(HAVE_DGL)
+#ifndef HAVE_DGL
static float computeHue(float h, float m1, float m2)
{
if (h < 0) h += 1;
@@ -122,7 +122,7 @@ static float computeHue(float h, float m1, float m2)
Color Color::fromHSL(float hue, float saturation, float lightness, float alpha)
{
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
return nvgHSLA(hue, saturation, lightness, static_cast<uchar>(getFixedRange(alpha)*255.0f));
#else
float m1, m2;
@@ -258,7 +258,7 @@ void Color::fixBounds() noexcept
// -----------------------------------------------------------------------
-#if !defined(HAVE_DCAIRO)
+#ifndef HAVE_DCAIRO
Color::Color(const NVGcolor& c) noexcept
: red(c.r), green(c.g), blue(c.b), alpha(c.a)
{
diff --git a/dgl/src/Geometry.cpp b/dgl/src/Geometry.cpp
@@ -441,7 +441,7 @@ void Line<T>::moveBy(const Point<T>& pos) noexcept
fPosEnd.moveBy(pos);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Line<T>::draw()
{
@@ -616,7 +616,7 @@ void Circle<T>::setNumSegments(const uint num)
fSin = std::sin(fTheta);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Circle<T>::draw()
{
@@ -654,7 +654,7 @@ bool Circle<T>::operator!=(const Circle<T>& cir) const noexcept
return (fPos != cir.fPos || d_isNotEqual(fSize, cir.fSize) || fNumSegments != cir.fNumSegments);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Circle<T>::_draw(const bool outline)
{
@@ -704,7 +704,7 @@ Triangle<T>::Triangle(const Triangle<T>& tri) noexcept
fPos2(tri.fPos2),
fPos3(tri.fPos3) {}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Triangle<T>::draw()
{
@@ -763,7 +763,7 @@ bool Triangle<T>::operator!=(const Triangle<T>& tri) const noexcept
return (fPos1 != tri.fPos1 || fPos2 != tri.fPos2 || fPos3 != tri.fPos3);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Triangle<T>::_draw(const bool outline)
{
@@ -962,7 +962,7 @@ bool Rectangle<T>::containsY(const T& y) const noexcept
return (y >= fPos.fY && y <= fPos.fY + fSize.fHeight);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Rectangle<T>::draw()
{
@@ -1010,7 +1010,7 @@ bool Rectangle<T>::operator!=(const Rectangle<T>& rect) const noexcept
return (fPos != rect.fPos || fSize != rect.fSize);
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
template<typename T>
void Rectangle<T>::_draw(const bool outline)
{
diff --git a/dgl/src/Widget.cpp b/dgl/src/Widget.cpp
@@ -189,7 +189,7 @@ Window& Widget::getParentWindow() const noexcept
return pData->parent;
}
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
cairo_t* Widget::getContext() const noexcept
{
return pData->parent.getContext();
diff --git a/dgl/src/WidgetPrivateData.hpp b/dgl/src/WidgetPrivateData.hpp
@@ -68,7 +68,7 @@ struct Widget::PrivateData {
if ((skipDisplay && ! renderingSubWidget) || size.isInvalid() || ! visible)
return;
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
bool needsDisableScissor = false;
// reset color
@@ -112,7 +112,7 @@ struct Widget::PrivateData {
// display widget
self->onDisplay();
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
if (needsDisableScissor)
{
glDisable(GL_SCISSOR_TEST);
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
@@ -22,10 +22,10 @@
#undef PUGL_HAVE_CAIRO
#undef PUGL_HAVE_GL
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
#define PUGL_HAVE_GL 1
#endif
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
#define PUGL_HAVE_CAIRO 1
#endif
@@ -213,10 +213,10 @@ struct Window::PrivateData {
return;
}
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
PuglContextType contextType = PUGL_GL;
#endif
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
PuglContextType contextType = PUGL_CAIRO;
#endif
@@ -1384,7 +1384,7 @@ intptr_t Window::getWindowId() const noexcept
return puglGetNativeWindow(pData->fView);
}
-#if defined(HAVE_DCAIRO)
+#ifdef HAVE_DCAIRO
cairo_t* Window::getContext() const noexcept
{
return (cairo_t*)puglGetContext(pData->fView);
@@ -1426,7 +1426,7 @@ void Window::removeIdleCallback(IdleCallback* const callback)
void Window::onDisplayBefore()
{
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
#endif
@@ -1438,7 +1438,7 @@ void Window::onDisplayAfter()
void Window::onReshape(uint width, uint height)
{
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);
diff --git a/distrho/src/DistrhoUI.cpp b/distrho/src/DistrhoUI.cpp
@@ -152,7 +152,7 @@ void UI::uiFileBrowserSelected(const char*)
void UI::uiReshape(uint width, uint height)
{
-#if defined(HAVE_DGL)
+#ifdef HAVE_DGL
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glMatrixMode(GL_PROJECTION);