Mercurial > hg > dmlib
view editor/edview.cpp @ 2576:812b16ee49db
I had been living under apparent false impression that "realfft.c"
on which the FFT implementation in DMLIB was basically copied from
was released in public domain at some point, but it could very well
be that it never was. Correct license is (or seems to be) GNU GPL.
Thus I removing the code from DMLIB, and profusely apologize to the
author, Philip Van Baren.
It was never my intention to distribute code based on his original
work under a more liberal license than originally intended.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 11 Mar 2022 16:32:50 +0200 |
parents | b4992d9f72fe |
children |
line wrap: on
line source
#include "edview.h" #include <QtGui> QEDGLDemoView::QEDGLDemoView(QWidget *parent) : QGLWidget(QGLFormat(QGL::SampleBuffers|QGL::AlphaChannel), parent) { makeCurrent(); if (QGLFramebufferObject::hasOpenGLFramebufferBlit()) { QGLFramebufferObjectFormat format; format.setSamples(4); format.setAttachment(QGLFramebufferObject::CombinedDepthStencil); // render_fbo = new QGLFramebufferObject(512, 512, format); // texture_fbo = new QGLFramebufferObject(512, 512); } else { // render_fbo = new QGLFramebufferObject(1024, 1024); // texture_fbo = render_fbo; } setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } QEDGLDemoView::~QEDGLDemoView() { } QSize QEDGLDemoView::minimumSizeHint() const { return QSize(320, 240); } QSize QEDGLDemoView::sizeHint() const { return QSize(640, 480); } void QEDGLDemoView::setEngineData(DMEngineData *mengine) { engine = mengine; } void QEDGLDemoView::render(int frameTime) { if (engine != NULL) { engine->frameTime = frameTime; if (engine->demoRender != NULL) { engine->demoRender(engine); } else { dmExecuteTimeline(engine->ptl, engine, engineGetTick(engine)); } engine->frameCount++; } } void QEDGLDemoView::paintEvent(QPaintEvent *) { // save the GL state set for QPainter saveGLState(); // restore the GL state that QPainter expects restoreGLState(); } void QEDGLDemoView::saveGLState() { glPushAttrib(GL_ALL_ATTRIB_BITS); glMatrixMode(GL_PROJECTION); glPushMatrix(); glMatrixMode(GL_MODELVIEW); glPushMatrix(); } void QEDGLDemoView::restoreGLState() { glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); glPopAttrib(); } QEDSWDemoView::QEDSWDemoView(QWidget *parent) : QEDGLDemoView(parent) { img = NULL; } QEDSWDemoView::~QEDSWDemoView() { delete img; } void QEDSWDemoView::setEngineData(DMEngineData *mengine) { engine = mengine; delete img; img = new QImage((const uchar *)mengine->screen->pixels, mengine->screen->w, mengine->screen->h, mengine->screen->pitch, QImage::Format_RGB32); } void QEDSWDemoView::paintEvent(QPaintEvent *) { if (img != NULL) { QPainter painter(this); painter.drawImage(QPoint(0, 0), *img); } } void QEDSWDemoView::render(int frameTime) { if (SDL_MUSTLOCK(engine->screen) != 0 && SDL_LockSurface(engine->screen) != 0) return; QEDGLDemoView::render(frameTime); if (SDL_MUSTLOCK(engine->screen) != 0) SDL_UnlockSurface(engine->screen); update(); }