Browse Source

Skip window screenshots and glBars module if using GLES

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.07
falkTX 3 years ago
parent
commit
d5f5e57e78
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 20 additions and 2 deletions
  1. +4
    -0
      plugins/Cardinal/src/ImGuiWidget.cpp
  2. +5
    -1
      plugins/plugins.cpp
  3. +11
    -1
      src/override/Window.cpp

+ 4
- 0
plugins/Cardinal/src/ImGuiWidget.cpp View File

@@ -456,6 +456,9 @@ void ImGuiWidget::drawFramebufferCommon(const Vec& fbSize, const float scaleFact
}
}

#if defined(DGL_USE_GLES2) || defined(DGL_USE_GLES3) || defined(DGL_USE_OPENGL3)
// TODO?
#else
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
@@ -464,6 +467,7 @@ void ImGuiWidget::drawFramebufferCommon(const Vec& fbSize, const float scaleFact
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
#endif

io.DisplaySize = ImVec2(box.size.x * scaleFactor, box.size.y * scaleFactor);
io.DisplayFramebufferScale = ImVec2(fbSize.x / (box.size.x * scaleFactor), fbSize.y / (box.size.y * scaleFactor));


+ 5
- 1
plugins/plugins.cpp View File

@@ -890,7 +890,6 @@ static void initStatic__Cardinal()
p->addModel(modelCardinalBlank);
p->addModel(modelExpanderInputMIDI);
p->addModel(modelExpanderOutputMIDI);
p->addModel(modelGlBars);
p->addModel(modelHostAudio2);
p->addModel(modelHostAudio8);
p->addModel(modelHostCV);
@@ -902,6 +901,11 @@ static void initStatic__Cardinal()
p->addModel(modelHostParametersMap);
p->addModel(modelHostTime);
p->addModel(modelTextEditor);
#ifndef DGL_USE_GLES
p->addModel(modelGlBars);
#else
spl.removeModule("glBars");
#endif
#ifndef STATIC_BUILD
p->addModel(modelAudioFile);
p->addModel(modelCarla);


+ 11
- 1
src/override/Window.cpp View File

@@ -157,7 +157,9 @@ struct Window::Internal {

int frame = 0;
int frameSwapInterval = 1;
#ifndef DGL_USE_GLES
int generateScreenshotStep = kScreenshotStepNone;
#endif
double monitorRefreshRate = 60.0;
double frameTime = 0.0;
double lastFrameDuration = 0.0;
@@ -366,6 +368,7 @@ void Window::run() {
}


#ifndef DGL_USE_GLES
static void Window__flipBitmap(uint8_t* pixels, const int width, const int height, const int depth) {
for (int y = 0; y < height / 2; y++) {
const int flipY = height - y - 1;
@@ -415,6 +418,7 @@ static void Window__writeImagePNG(void* context, void* data, int size) {
ui->setState("screenshot", String::asBase64(data, size).buffer());
}
#endif
#endif


void Window::step() {
@@ -453,6 +457,7 @@ void Window::step() {
APP->event->handleDirty();
}

#ifndef DGL_USE_GLES
// Hide menu and background if generating screenshot
if (internal->generateScreenshotStep == kScreenshotStepStarted) {
#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS
@@ -462,6 +467,7 @@ void Window::step() {
internal->generateScreenshotStep = kScreenshotStepSecondPass;
#endif
}
#endif

// Get framebuffer/window ratio
int winWidth = internal->ui->getWidth();
@@ -501,6 +507,7 @@ void Window::step() {

++internal->frame;

#ifndef DGL_USE_GLES
if (internal->generateScreenshotStep != kScreenshotStepNone) {
++internal->generateScreenshotStep;

@@ -541,6 +548,7 @@ void Window::step() {

delete[] pixels;
}
#endif
}


@@ -586,7 +594,7 @@ void Window::setFullScreen(bool) {


bool Window::isFullScreen() {
#ifdef CARDINAL_TRANSPARENT_SCREENSHOTS
#if defined(CARDINAL_TRANSPARENT_SCREENSHOTS) && !defined(DGL_USE_GLES)
return internal->generateScreenshotStep != kScreenshotStepNone;
#else
return false;
@@ -668,7 +676,9 @@ int& Window::fbCount() {


void generateScreenshot() {
#ifndef DGL_USE_GLES
APP->window->internal->generateScreenshotStep = kScreenshotStepStarted;
#endif
}




Loading…
Cancel
Save