diff options
author | falkTX <falktx@gmail.com> | 2019-01-07 01:10:57 +0100 |
---|---|---|
committer | falkTX <falktx@gmail.com> | 2019-01-07 01:10:57 +0100 |
commit | 204fbeb807d604042c4cd3fcb076df7906521739 (patch) | |
tree | 5954583a17cf73b4cff5f1f16357b19cb460070f /dgl/src/WidgetPrivateData.hpp | |
parent | a3006690997424238f4eac1c1f588cddb671909e (diff) |
Adjustments for Cairo, and general cleanup
Signed-off-by: falkTX <falktx@gmail.com>
Diffstat (limited to 'dgl/src/WidgetPrivateData.hpp')
-rw-r--r-- | dgl/src/WidgetPrivateData.hpp | 63 |
1 files changed, 3 insertions, 60 deletions
diff --git a/dgl/src/WidgetPrivateData.hpp b/dgl/src/WidgetPrivateData.hpp index 06886f6d..f48a33bc 100644 --- a/dgl/src/WidgetPrivateData.hpp +++ b/dgl/src/WidgetPrivateData.hpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com> + * Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com> * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this @@ -63,65 +63,8 @@ struct Widget::PrivateData { subWidgets.clear(); } - void display(const uint width, const uint height, const double scaling, const bool renderingSubWidget) - { - if ((skipDisplay && ! renderingSubWidget) || size.isInvalid() || ! visible) - return; - -#ifdef HAVE_DGL - bool needsDisableScissor = false; - - // reset color - glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - - if (needsFullViewport || (absolutePos.isZero() && size == Size<uint>(width, height))) - { - // full viewport size - glViewport(0, - -(height * scaling - height), - width * scaling, - height * scaling); - } - else if (needsScaling) - { - // limit viewport to widget bounds - glViewport(absolutePos.getX(), - height - self->getHeight() - absolutePos.getY(), - self->getWidth(), - self->getHeight()); - } - else - { - // only set viewport pos - glViewport(absolutePos.getX() * scaling, - -std::round((height * scaling - height) + (absolutePos.getY() * scaling)), - std::round(width * scaling), - std::round(height * scaling)); - - // then cut the outer bounds - glScissor(absolutePos.getX() * scaling, - height - std::round((self->getHeight() + absolutePos.getY()) * scaling), - std::round(self->getWidth() * scaling), - std::round(self->getHeight() * scaling)); - - glEnable(GL_SCISSOR_TEST); - needsDisableScissor = true; - } -#endif - - // display widget - self->onDisplay(); - -#ifdef HAVE_DGL - if (needsDisableScissor) - { - glDisable(GL_SCISSOR_TEST); - needsDisableScissor = false; - } -#endif - - displaySubWidgets(width, height, scaling); - } + // display function is different depending on build type + void display(const uint width, const uint height, const double scaling, const bool renderingSubWidget); void displaySubWidgets(const uint width, const uint height, const double scaling) { |