Changeset View
Changeset View
Standalone View
Standalone View
effects/blur/blur.cpp
Show First 20 Lines • Show All 458 Lines • ▼ Show 20 Line(s) | 458 | } else if (translated) { | |||
---|---|---|---|---|---|
459 | shape = shape.translated(data.xTranslation(), data.yTranslation()); | 459 | shape = shape.translated(data.xTranslation(), data.yTranslation()); | ||
460 | shape = shape & region; | 460 | shape = shape & region; | ||
461 | } | 461 | } | ||
462 | 462 | | |||
463 | if (!shape.isEmpty()) { | 463 | if (!shape.isEmpty()) { | ||
464 | if (w->isFullScreen() && GLRenderTarget::blitSupported() && m_simpleShader->isValid() | 464 | if (w->isFullScreen() && GLRenderTarget::blitSupported() && m_simpleShader->isValid() | ||
465 | && !GLPlatform::instance()->supports(LimitedNPOT) && shape.boundingRect() == w->geometry()) { | 465 | && !GLPlatform::instance()->supports(LimitedNPOT) && shape.boundingRect() == w->geometry()) { | ||
466 | doSimpleBlur(w, data.opacity(), data.screenProjectionMatrix()); | 466 | doSimpleBlur(w, data.opacity(), data.screenProjectionMatrix()); | ||
467 | } else if (GLRenderTarget::virtualScreenScale() > 1.0) { | ||||
468 | if (GLRenderTarget::blitSupported()) { | ||||
469 | doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix()); | ||||
470 | } | ||||
467 | } else if (m_shouldCache && !translated && !w->isDeleted()) { | 471 | } else if (m_shouldCache && !translated && !w->isDeleted()) { | ||
468 | doCachedBlur(w, region, data.opacity(), data.screenProjectionMatrix()); | 472 | doCachedBlur(w, region, data.opacity(), data.screenProjectionMatrix()); | ||
469 | } else { | 473 | } else { | ||
470 | doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix()); | 474 | doBlur(shape, screen, data.opacity(), data.screenProjectionMatrix()); | ||
471 | } | 475 | } | ||
472 | } | 476 | } | ||
473 | } | 477 | } | ||
474 | 478 | | |||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | 520 | { | |||
524 | 528 | | |||
525 | // Create a scratch texture and copy the area in the back buffer that we're | 529 | // Create a scratch texture and copy the area in the back buffer that we're | ||
526 | // going to blur into it | 530 | // going to blur into it | ||
527 | GLTexture scratch(GL_RGBA8, r.width(), r.height()); | 531 | GLTexture scratch(GL_RGBA8, r.width(), r.height()); | ||
528 | scratch.setFilter(GL_LINEAR); | 532 | scratch.setFilter(GL_LINEAR); | ||
529 | scratch.setWrapMode(GL_CLAMP_TO_EDGE); | 533 | scratch.setWrapMode(GL_CLAMP_TO_EDGE); | ||
530 | scratch.bind(); | 534 | scratch.bind(); | ||
531 | 535 | | |||
536 | //if the framebuffer is scaled, blit to downsample everything into standard resolution | ||||
537 | if (GLRenderTarget::virtualScreenScale() > 1.0) { | ||||
538 | target->attachTexture(scratch); | ||||
539 | target->blitFromFramebuffer(r, QRect(0, 0, r.width(), r.height())); | ||||
540 | } else { | ||||
532 | const QRect sg = GLRenderTarget::virtualScreenGeometry(); | 541 | const QRect sg = GLRenderTarget::virtualScreenGeometry(); | ||
533 | glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, r.x() - sg.x(), sg.height() - sg.y() - r.y() - r.height(), | 542 | glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, (r.x() - sg.x()), (sg.height() - sg.y() - r.y() - r.height()), | ||
534 | r.width(), r.height()); | 543 | scratch.width(), scratch.height()); | ||
544 | } | ||||
535 | 545 | | |||
536 | // Draw the texture on the offscreen framebuffer object, while blurring it horizontally | 546 | // Draw the texture on the offscreen framebuffer object, while blurring it horizontally | ||
537 | target->attachTexture(tex); | 547 | target->attachTexture(tex); | ||
538 | GLRenderTarget::pushRenderTarget(target); | 548 | GLRenderTarget::pushRenderTarget(target); | ||
539 | 549 | | |||
540 | shader->bind(); | 550 | shader->bind(); | ||
541 | shader->setDirection(Qt::Horizontal); | 551 | shader->setDirection(Qt::Horizontal); | ||
542 | shader->setPixelDistance(1.0 / r.width()); | 552 | shader->setPixelDistance(1.0 / r.width()); | ||
▲ Show 20 Lines • Show All 218 Lines • Show Last 20 Lines |