Ejemplo n.º 1
0
void View::openSettings()
{
    ViewSettings* settings = new ViewSettings(this);
    settings->open();

    connect(settings, SIGNAL(accepted()), this, SLOT(updateOverlay()));
}
Ejemplo n.º 2
0
static int 
fb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
	 unsigned long arg)
{
	struct {
    int x;
    int y;
	int w;
	int h; 
    	} param;
	
	switch (cmd) {
	case OMAPLFB_UPDATE:
		if (!copy_from_user(&param, (void __user *)arg, sizeof(param)))
			updateOverlay(param.x, param.y, param.w, param.h);
            Xoff = param.x;
            Yoff = param.y;
		break;
    case OMAPLFB_SET_POSITION:
        if (!copy_from_user(&param, (void __user *)arg, sizeof(param)))
            updateOverlayPosition(param.x-Xoff, param.y-Yoff);
        break;
	default: break;
	}
	return 0;
}
Ejemplo n.º 3
0
 void setPosition( double pos )
 {
     if ( m_pos != pos )
     {
         m_pos = pos;
         updateOverlay();
     }
 }
Ejemplo n.º 4
0
void StateView::setSelected(bool b)
{
  m_selected = b;
  setDilatation(m_selected);
  setZValue(m_selected ? ZPos::SelectedState : ZPos::State);

  updateOverlay();
}
Ejemplo n.º 5
0
void View::setMovable(bool flag)
{
    isMovable = flag;

    ui->settingsButton->setEnabled(! flag);
    ui->zoomButton->setEnabled(! flag);
    ui->removeButton->setEnabled(! flag);

    updateOverlay();
}
Ejemplo n.º 6
0
bool TutorialManager::setPreviousSlide()
{
    slideNo--;
    if (slideNo < 0)
    {
        slideNo = 0;
        return false;
    }
    updateOverlay();
    return true;
}
Ejemplo n.º 7
0
// Appends the set of slides, and if the slides do get set, set this overlay to be visible
void TutorialManager::setSlides(const std::vector<TutorialSlide> & slides)
{
    for (int i = 0; i < slides.size(); ++i)
        this->slides.push_back(slides[i]);
    slideNo = 0;
    if (slides.size() > 0)
    {
        show();
        yoffset = -0.50;
        adjust();
        updateOverlay();
    }
}
Ejemplo n.º 8
0
    virtual bool eventFilter( QObject *object, QEvent *event )
    {
        if ( object == parent() && event->type() == QEvent::Resize )
        {
            const QResizeEvent *resizeEvent = 
                static_cast<const QResizeEvent *>( event );
            resize( resizeEvent->size() );
            updateOverlay();

            return true;
        }

        return QObject::eventFilter( object, event );
    }
Ejemplo n.º 9
0
void CPlotter::setCenterFreq(quint64 f)
{
    if((quint64)m_CenterFreq==f)
        return;

    qint64 offset = m_CenterFreq - m_DemodCenterFreq;

    m_CenterFreq = f;
    m_DemodCenterFreq = m_CenterFreq - offset;

    updateOverlay();

    m_PeakHoldValid = false;
}
Ejemplo n.º 10
0
void VideoWidget::updateRects()
{
	if(!m_frame)
		return;
		
	m_sourceRect = m_frame->rect(); //image.rect();
	m_origSourceRect = m_sourceRect;

	m_sourceRect.adjust(m_adjustDx1,m_adjustDy1,m_adjustDx2,m_adjustDy2);

	QSize nativeSize = m_frame->size(); //.image.size();

	if (nativeSize.isEmpty())
	{
		m_targetRect = QRect();
	}
	else
	if (m_aspectRatioMode == Qt::IgnoreAspectRatio)
	{
		m_targetRect = rect();
	}
	else
	if (m_aspectRatioMode == Qt::KeepAspectRatio)
	{
		QSize size = nativeSize;
		size.scale(rect().size(), Qt::KeepAspectRatio);

		m_targetRect = QRect(0, 0, size.width(), size.height());
		m_targetRect.moveCenter(rect().center());
	}
	else
	if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding)
	{
		m_targetRect = rect();

		QSize size = rect().size();
		size.scale(nativeSize, Qt::KeepAspectRatio);

		m_sourceRect = QRect(QPoint(0,0),size);
		m_sourceRect.moveCenter(QPoint(size.width() / 2, size.height() / 2));
	}

	//qDebug() << "updateRects(): source: "<<m_sourceRect<<", target:" <<m_targetRect;
	updateOverlay();


}
Ejemplo n.º 11
0
void mainLoop()
{
        //while (mCurrentTrialTime < mTrialLength)

       
        while (true)
        {
                Ogre::Real elapsedSimTime = 0;
                Ogre::Real elapsedRealTime = 0;
                gEngine.update(elapsedSimTime, elapsedRealTime);
                handleInput(elapsedRealTime);
                if (gEngine.quitApp())
                {
                        return;
                }

                // Update sound effects at 50 Hz.
                const Ogre::Real soundUpdatePeriod = 0.02;
                static Ogre::Real soundUpdateTimer = 0;
                soundUpdateTimer -= elapsedSimTime;
                if (soundUpdateTimer <= 0)
                {
                        gRobot->updateSoundEffects(soundUpdatePeriod);
                        gCar->updateSoundEffects(soundUpdatePeriod);
                        soundUpdateTimer = soundUpdatePeriod;
                }

                gRobot->updateVisuals(elapsedSimTime);
                updateOverlay();
                gAgentDebugger->updateVisuals();
        }

        //mAvgRewardPerStep = mAvgRewardPerStep * mPhysicsStepSize /
        //      mCurrentTrialTime;
        //dataFile.storeData("trial", trial, (double)trial);
        //dataFile.storeData("avg reward per step", trial,
        //      mAvgRewardPerStep);
        //printTrialAndRunStatus(run, trial, mAvgRewardPerStep);

        //std::cout << "Agent age = " << mPendulum->getAgent()->getAgeString()
        //      << std::endl;


        //dataFile.printToFile("./results/pendulum-performance.dat");
}
Ejemplo n.º 12
0
void StateView::hoverLeaveEvent(QGraphicsSceneHoverEvent* event)
{
  m_hovered = false;
  updateOverlay();
  event->accept();
}
Ejemplo n.º 13
0
void View::showEvent(QShowEvent*)
{
    updateOverlay();
}
Ejemplo n.º 14
0
void View::resizeEvent(QResizeEvent*)
{
    updateOverlay();
}
Ejemplo n.º 15
0
void cullindirect_app::render(double currentTime)
{
    static const GLfloat farplane[] = { 1.0f };
    static float lastTime = 0.0f;
    static int frames = 0;
    float nowTime = float(currentTime);
    int i;

    // Set viewport and clear
    glViewport(0, 0, info.windowWidth, info.windowHeight);
    glClearBufferfv(GL_COLOR, 0, sb7::color::Black);
    glClearBufferfv(GL_DEPTH, 0, farplane);

    // Bind and clear atomic counter
    glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, buffers.parameters);
    glClearBufferSubData(GL_ATOMIC_COUNTER_BUFFER, GL_R32UI, 0, sizeof(GLuint), GL_RED_INTEGER, GL_UNSIGNED_INT, nullptr);

    // Bind shader storage buffers
    glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, buffers.drawCandidates);
    glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, buffers.drawCommands);

    // Bind model matrix UBO and fill with data
    glBindBufferBase(GL_UNIFORM_BUFFER, 0, buffers.modelMatrices);
    vmath::mat4* pModelMatrix = (vmath::mat4*)glMapBufferRange(GL_UNIFORM_BUFFER, 0, 1024 * sizeof(vmath::mat4), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
    
    for (i = 0; i < 1024; i++)
    {
        float f = float(i) / 127.0f + nowTime * 0.025f;
        float g = float(i) / 127.0f;
        const vmath::mat4 model_matrix = vmath::translate(70.0f * vmath::vec3(sinf(f * 3.0f), cosf(f * 5.0f), cosf(f * 9.0f))) *
                                         vmath::rotate(nowTime * 140.0f, vmath::normalize(vmath::vec3(sinf(g * 35.0f), cosf(g * 75.0f), cosf(g * 39.0f))));
        pModelMatrix[i] = model_matrix;
    }

    glUnmapBuffer(GL_UNIFORM_BUFFER);

    // Bind view + projection matrix UBO and fill
    glBindBufferBase(GL_UNIFORM_BUFFER, 1, buffers.transforms);
    TransformBuffer* pTransforms = (TransformBuffer*)glMapBufferRange(GL_UNIFORM_BUFFER, 0, sizeof(TransformBuffer), GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);

    float t = nowTime * 0.1f;

    const vmath::mat4 view_matrix = vmath::lookat(vmath::vec3(150.0f * cosf(t), 0.0f, 150.0f * sinf(t)),
                                                  vmath::vec3(0.0f, 0.0f, 0.0f),
                                                  vmath::vec3(0.0f, 1.0f, 0.0f));
    const vmath::mat4 proj_matrix = vmath::perspective(50.0f,
                                                       (float)info.windowWidth / (float)info.windowHeight,
                                                       1.0f,
                                                       2000.0f);

    pTransforms->view_matrix = view_matrix;
    pTransforms->proj_matrix = proj_matrix;
    pTransforms->view_proj_matrix = proj_matrix * view_matrix;

    glUnmapBuffer(GL_UNIFORM_BUFFER);

    // Bind the culling compute shader and dispatch it
    glUseProgram(programs.cull);
    glDispatchCompute(CANDIDATE_COUNT / 16, 1, 1);

    // Barrier
    glMemoryBarrier(GL_COMMAND_BARRIER_BIT);

    // Get ready to render
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);

    glBindVertexArray(object.get_vao());

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);

    // Bind indirect command buffer and parameter buffer
    glBindBuffer(GL_DRAW_INDIRECT_BUFFER, buffers.drawCommands);
    glBindBuffer(GL_PARAMETER_BUFFER_ARB, buffers.parameters);

    glUseProgram(programs.draw);

    // Draw
    glMultiDrawArraysIndirectCountARB(GL_TRIANGLES, 0, 0, CANDIDATE_COUNT, 0);

    // Update overlay
    if (nowTime > (lastTime + 0.25f))
    {
        fps = float(frames) / (nowTime - lastTime);
        frames = 0;
        lastTime = nowTime;
    }

    glDisable(GL_CULL_FACE);
    updateOverlay();

    frames++;
}
Ejemplo n.º 16
0
void VideoWidget::setOverlayText(const QString& text)
{
	m_overlayText = text;
	m_showOverlayText = !text.isEmpty();
	updateOverlay();
}
Ejemplo n.º 17
0
void TutorialManager::setAdditionalText(std::string text)
{
    additionalText = text;
    updateOverlay();
}
Ejemplo n.º 18
0
void TutorialManager::setNextSlide()
{
    slideNo++;
    if (slideNo >= slides.size()) slideNo = slides.size() - 1;
    updateOverlay();
}
Ejemplo n.º 19
0
void StateView::hoverEnterEvent(QGraphicsSceneHoverEvent* event)
{
  m_hovered = true;
  updateOverlay();
  event->accept();
}
Ejemplo n.º 20
0
void VideoWidget::showOverlayText(bool flag)
{
	m_showOverlayText = flag;
	updateOverlay();
}
Ejemplo n.º 21
0
void CSVRender::WorldspaceWidget::elementSelectionChanged()
{
    setVisibilityMask (getVisibilityMask());
    flagAsModified();
    updateOverlay();
}
Ejemplo n.º 22
0
void pmbstreaming_app::render(double currentTime)
{
    static float lastTime = 0.0f;
    static int frames = 0;
    float nowTime = float(currentTime);
    int isSignaled;

    static const GLfloat black[] = { 0.0f, 0.0f, 0.0f, 0.0f };
    static const GLfloat one[] = { 1.0f };

    vmath::mat4 proj_matrix = vmath::perspective(60.0f, (float)info.windowWidth / (float)info.windowHeight, 0.1f, 1800.0f);
    vmath::mat4 mv_matrix = vmath::translate(0.0f, 0.0f, -3.0f) *
                            vmath::rotate((float)currentTime * 43.75f, 0.0f, 1.0f, 0.0f) *
                            vmath::rotate((float)currentTime * 17.75f, 0.0f, 0.0f, 1.0f) *
                            vmath::rotate((float)currentTime * 35.3f, 1.0f, 0.0f, 0.0f);

    glViewport(0, 0, info.windowWidth, info.windowHeight);
    glClearBufferfv(GL_COLOR, 0, black);
    glClearBufferfv(GL_DEPTH, 0, one);

    glUseProgram(program);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LESS);
    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture);

    if (mode == ONE_SYNC)
    {
        if (fence[0] != 0)
        {
            glGetSynciv(fence[0], GL_SYNC_STATUS, sizeof(int), nullptr, &isSignaled);
            stalled = isSignaled == GL_UNSIGNALED;
            glClientWaitSync(fence[0], 0, GL_TIMEOUT_IGNORED);
            glDeleteSync(fence[0]);
        }
    }
    else if (mode == RINGED_SYNC)
    {
        if (fence[sync_index] != 0)
        {
            glGetSynciv(fence[sync_index], GL_SYNC_STATUS, sizeof(int), nullptr, &isSignaled);
            stalled = isSignaled == GL_UNSIGNALED;
            glClientWaitSync(fence[sync_index], 0, GL_TIMEOUT_IGNORED);
            glDeleteSync(fence[sync_index]);
        }
    }

    vs_uniforms[sync_index].modelview = mv_matrix;
    vs_uniforms[sync_index].projection = proj_matrix;

    if (mode == RINGED_SYNC)
    {
        object.render(1, sync_index);
    }
    else
    {
        object.render(1, 0);
    }

    if (nowTime > (lastTime + 0.25f))
    {
        fps = float(frames) / (nowTime - lastTime);
        frames = 0;
        lastTime = nowTime;
    }

    updateOverlay();

    if (mode == FINISH)
    {
        glFinish();
        stalled = true;
    }
    else if (mode == ONE_SYNC)
    {
        fence[0] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
    }
    else if (mode == RINGED_SYNC)
    {
        fence[sync_index] = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
    }

    sync_index = (sync_index + 1) % CHUNK_COUNT;

    frames++;
}
Ejemplo n.º 23
0
Drawable::Drawable(DirectDrawWriter &writer) :
	isOK(false), isOverlay(false), paused(false),
	writer(writer),
	flip(0),
	DDraw(NULL), DDClipper(NULL), DDSPrimary(NULL), DDSSecondary(NULL), DDSBackBuffer(NULL), DDrawColorCtrl(NULL),
	DwmEnableComposition(NULL)
{
	setMouseTracking(true);
	grabGesture(Qt::PinchGesture);
	if (DirectDrawCreate(NULL, &DDraw, NULL) == DD_OK && DDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL) == DD_OK)
	{
		DDSURFACEDESC ddsd_primary = { sizeof ddsd_primary };
		ddsd_primary.dwFlags = DDSD_CAPS;
		ddsd_primary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
		if (DDraw->CreateSurface(&ddsd_primary, &DDSPrimary, NULL) == DD_OK)
		{
			LPDIRECTDRAWSURFACE DDrawTestSurface;
			DDSURFACEDESC ddsd_test = { sizeof ddsd_test };
			ddsd_test.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
			ddsd_test.dwWidth  = 8;
			ddsd_test.dwHeight = 2;
			ddsd_test.ddpfPixelFormat.dwSize = sizeof ddsd_test.ddpfPixelFormat;
			ddsd_test.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
			ddsd_test.ddpfPixelFormat.dwFourCC = MAKEFOURCC('Y', 'V', '1', '2');

			/* Overlay YV12 test */
			if (QSysInfo::windowsVersion() < QSysInfo::WV_6_2) //Windows 8 and 10 can't disable DWM, so overlay won't work
			{
				DDCAPS ddCaps = { sizeof ddCaps };
				DDraw->GetCaps(&ddCaps, NULL);
				if (ddCaps.dwCaps & (DDCAPS_OVERLAY | DDCAPS_OVERLAYFOURCC | DDCAPS_OVERLAYSTRETCH))
				{
					ddsd_test.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY;
					if (DDraw->CreateSurface(&ddsd_test, &DDrawTestSurface, NULL) == DD_OK)
					{
						RECT destRect = { 0, 0, 1, 1 };
						HRESULT res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL);
						if (res == DDERR_OUTOFCAPS && QSysInfo::windowsVersion() >= QSysInfo::WV_6_0)
						{
							/* Disable DWM to use overlay */
							DwmEnableComposition = (DwmEnableCompositionProc)GetProcAddress(GetModuleHandleA("dwmapi.dll"), "DwmEnableComposition");
							if (DwmEnableComposition)
							{
								if (DwmEnableComposition(DWM_EC_DISABLECOMPOSITION) == S_OK)
									res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL);
								else
									DwmEnableComposition = NULL;
							}
						}
						if (res == DD_OK)
						{
							DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, NULL, DDOVER_HIDE, NULL);

							setAutoFillBackground(true);
							setPalette(QColor(ColorKEY));
							connect(&QMPlay2Core, SIGNAL(videoDockMoved()), this, SLOT(updateOverlay()));
							connect(&QMPlay2Core, SIGNAL(videoDockVisible(bool)), this, SLOT(overlayVisible(bool)));
							connect(&QMPlay2Core, SIGNAL(mainWidgetNotMinimized(bool)), this, SLOT(overlayVisible(bool)));
							connect(&visibleTim, SIGNAL(timeout()), this, SLOT(doOverlayVisible()));
							visibleTim.setSingleShot(true);

							isOK = isOverlay = true;
						}