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